@scalemule/sdk 0.0.27 → 0.0.28
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 +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +149 -12
- package/dist/index.mjs +139 -12
- package/package.json +3 -6
package/dist/index.d.mts
CHANGED
|
@@ -4952,6 +4952,10 @@ interface Task {
|
|
|
4952
4952
|
metadata?: Record<string, unknown>;
|
|
4953
4953
|
created_at: string;
|
|
4954
4954
|
updated_at: string;
|
|
4955
|
+
pipeline_id?: string;
|
|
4956
|
+
pipeline_version?: number;
|
|
4957
|
+
current_phase?: string;
|
|
4958
|
+
phase_entered_at?: string;
|
|
4955
4959
|
}
|
|
4956
4960
|
interface ClaimResult {
|
|
4957
4961
|
task_id: string;
|
|
@@ -5075,6 +5079,7 @@ declare class AgentProjectsService extends ServiceModule {
|
|
|
5075
5079
|
priority?: string;
|
|
5076
5080
|
due_date?: string;
|
|
5077
5081
|
metadata?: Record<string, unknown>;
|
|
5082
|
+
pipeline_id?: string;
|
|
5078
5083
|
}, applicationId?: string, options?: RequestOptions): Promise<ApiResponse<Task>>;
|
|
5079
5084
|
listTasks(projectId: string, params?: PaginationParams & {
|
|
5080
5085
|
application_id?: string;
|
|
@@ -5098,6 +5103,10 @@ declare class AgentProjectsService extends ServiceModule {
|
|
|
5098
5103
|
heartbeat(taskId: string, agentId: string, applicationId?: string, options?: RequestOptions): Promise<ApiResponse<{
|
|
5099
5104
|
lease_expires_at: string;
|
|
5100
5105
|
}>>;
|
|
5106
|
+
startTask(taskId: string, agentId: string, applicationId?: string, options?: RequestOptions): Promise<ApiResponse<{
|
|
5107
|
+
task_id: string;
|
|
5108
|
+
status: string;
|
|
5109
|
+
}>>;
|
|
5101
5110
|
submit(taskId: string, data: {
|
|
5102
5111
|
agent_id: string;
|
|
5103
5112
|
idempotency_key: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -4952,6 +4952,10 @@ interface Task {
|
|
|
4952
4952
|
metadata?: Record<string, unknown>;
|
|
4953
4953
|
created_at: string;
|
|
4954
4954
|
updated_at: string;
|
|
4955
|
+
pipeline_id?: string;
|
|
4956
|
+
pipeline_version?: number;
|
|
4957
|
+
current_phase?: string;
|
|
4958
|
+
phase_entered_at?: string;
|
|
4955
4959
|
}
|
|
4956
4960
|
interface ClaimResult {
|
|
4957
4961
|
task_id: string;
|
|
@@ -5075,6 +5079,7 @@ declare class AgentProjectsService extends ServiceModule {
|
|
|
5075
5079
|
priority?: string;
|
|
5076
5080
|
due_date?: string;
|
|
5077
5081
|
metadata?: Record<string, unknown>;
|
|
5082
|
+
pipeline_id?: string;
|
|
5078
5083
|
}, applicationId?: string, options?: RequestOptions): Promise<ApiResponse<Task>>;
|
|
5079
5084
|
listTasks(projectId: string, params?: PaginationParams & {
|
|
5080
5085
|
application_id?: string;
|
|
@@ -5098,6 +5103,10 @@ declare class AgentProjectsService extends ServiceModule {
|
|
|
5098
5103
|
heartbeat(taskId: string, agentId: string, applicationId?: string, options?: RequestOptions): Promise<ApiResponse<{
|
|
5099
5104
|
lease_expires_at: string;
|
|
5100
5105
|
}>>;
|
|
5106
|
+
startTask(taskId: string, agentId: string, applicationId?: string, options?: RequestOptions): Promise<ApiResponse<{
|
|
5107
|
+
task_id: string;
|
|
5108
|
+
status: string;
|
|
5109
|
+
}>>;
|
|
5101
5110
|
submit(taskId: string, data: {
|
|
5102
5111
|
agent_id: string;
|
|
5103
5112
|
idempotency_key: string;
|
package/dist/index.js
CHANGED
|
@@ -321,7 +321,7 @@ __export(index_exports, {
|
|
|
321
321
|
LoggerService: () => LoggerService,
|
|
322
322
|
NotificationsService: () => NotificationsService,
|
|
323
323
|
OrchestratorService: () => OrchestratorService,
|
|
324
|
-
PHONE_COUNTRIES: () =>
|
|
324
|
+
PHONE_COUNTRIES: () => PHONE_COUNTRIES,
|
|
325
325
|
PHOTO_BREAKPOINTS: () => PHOTO_BREAKPOINTS,
|
|
326
326
|
PermissionsService: () => PermissionsService,
|
|
327
327
|
PhotoService: () => PhotoService,
|
|
@@ -346,22 +346,22 @@ __export(index_exports, {
|
|
|
346
346
|
buildClientContextHeaders: () => buildClientContextHeaders,
|
|
347
347
|
calculateTotalParts: () => calculateTotalParts,
|
|
348
348
|
canPerform: () => canPerform,
|
|
349
|
-
composePhoneNumber: () =>
|
|
350
|
-
countryFlag: () =>
|
|
349
|
+
composePhoneNumber: () => composePhoneNumber,
|
|
350
|
+
countryFlag: () => countryFlag,
|
|
351
351
|
createUploadPlan: () => createUploadPlan,
|
|
352
352
|
default: () => index_default,
|
|
353
|
-
detectCountryFromE164: () =>
|
|
353
|
+
detectCountryFromE164: () => detectCountryFromE164,
|
|
354
354
|
detectNetworkClass: () => detectNetworkClass,
|
|
355
355
|
extractClientContext: () => extractClientContext,
|
|
356
|
-
findPhoneCountryByCode: () =>
|
|
357
|
-
findPhoneCountryByDialCode: () =>
|
|
356
|
+
findPhoneCountryByCode: () => findPhoneCountryByCode,
|
|
357
|
+
findPhoneCountryByDialCode: () => findPhoneCountryByDialCode,
|
|
358
358
|
generateUploadSessionId: () => generateUploadSessionId,
|
|
359
359
|
getMeasuredBandwidthMbps: () => getMeasuredBandwidthMbps,
|
|
360
360
|
getPartRange: () => getPartRange,
|
|
361
361
|
hasMinRoleLevel: () => hasMinRoleLevel,
|
|
362
|
-
isValidE164Phone: () =>
|
|
363
|
-
normalizeAndValidatePhone: () =>
|
|
364
|
-
normalizePhoneNumber: () =>
|
|
362
|
+
isValidE164Phone: () => isValidE164Phone,
|
|
363
|
+
normalizeAndValidatePhone: () => normalizeAndValidatePhone,
|
|
364
|
+
normalizePhoneNumber: () => normalizePhoneNumber,
|
|
365
365
|
resolveStrategy: () => resolveStrategy,
|
|
366
366
|
uploadMultipartToS3: () => uploadMultipartToS3,
|
|
367
367
|
uploadSingleToS3: () => uploadSingleToS3,
|
|
@@ -1352,8 +1352,138 @@ function asString(parent, key) {
|
|
|
1352
1352
|
return typeof value === "string" ? value : void 0;
|
|
1353
1353
|
}
|
|
1354
1354
|
|
|
1355
|
-
//
|
|
1356
|
-
var
|
|
1355
|
+
// node_modules/@scalemule/ui/dist/phone/index.mjs
|
|
1356
|
+
var PHONE_COUNTRIES = [
|
|
1357
|
+
{ code: "US", name: "United States", dialCode: "+1" },
|
|
1358
|
+
{ code: "CA", name: "Canada", dialCode: "+1" },
|
|
1359
|
+
{ code: "GB", name: "United Kingdom", dialCode: "+44" },
|
|
1360
|
+
{ code: "AU", name: "Australia", dialCode: "+61" },
|
|
1361
|
+
{ code: "DE", name: "Germany", dialCode: "+49" },
|
|
1362
|
+
{ code: "FR", name: "France", dialCode: "+33" },
|
|
1363
|
+
{ code: "IT", name: "Italy", dialCode: "+39" },
|
|
1364
|
+
{ code: "ES", name: "Spain", dialCode: "+34" },
|
|
1365
|
+
{ code: "NL", name: "Netherlands", dialCode: "+31" },
|
|
1366
|
+
{ code: "BE", name: "Belgium", dialCode: "+32" },
|
|
1367
|
+
{ code: "CH", name: "Switzerland", dialCode: "+41" },
|
|
1368
|
+
{ code: "AT", name: "Austria", dialCode: "+43" },
|
|
1369
|
+
{ code: "SE", name: "Sweden", dialCode: "+46" },
|
|
1370
|
+
{ code: "NO", name: "Norway", dialCode: "+47" },
|
|
1371
|
+
{ code: "DK", name: "Denmark", dialCode: "+45" },
|
|
1372
|
+
{ code: "FI", name: "Finland", dialCode: "+358" },
|
|
1373
|
+
{ code: "IE", name: "Ireland", dialCode: "+353" },
|
|
1374
|
+
{ code: "PT", name: "Portugal", dialCode: "+351" },
|
|
1375
|
+
{ code: "PL", name: "Poland", dialCode: "+48" },
|
|
1376
|
+
{ code: "CZ", name: "Czech Republic", dialCode: "+420" },
|
|
1377
|
+
{ code: "GR", name: "Greece", dialCode: "+30" },
|
|
1378
|
+
{ code: "RU", name: "Russia", dialCode: "+7" },
|
|
1379
|
+
{ code: "JP", name: "Japan", dialCode: "+81" },
|
|
1380
|
+
{ code: "KR", name: "South Korea", dialCode: "+82" },
|
|
1381
|
+
{ code: "CN", name: "China", dialCode: "+86" },
|
|
1382
|
+
{ code: "HK", name: "Hong Kong", dialCode: "+852" },
|
|
1383
|
+
{ code: "TW", name: "Taiwan", dialCode: "+886" },
|
|
1384
|
+
{ code: "SG", name: "Singapore", dialCode: "+65" },
|
|
1385
|
+
{ code: "MY", name: "Malaysia", dialCode: "+60" },
|
|
1386
|
+
{ code: "TH", name: "Thailand", dialCode: "+66" },
|
|
1387
|
+
{ code: "VN", name: "Vietnam", dialCode: "+84" },
|
|
1388
|
+
{ code: "PH", name: "Philippines", dialCode: "+63" },
|
|
1389
|
+
{ code: "ID", name: "Indonesia", dialCode: "+62" },
|
|
1390
|
+
{ code: "IN", name: "India", dialCode: "+91" },
|
|
1391
|
+
{ code: "PK", name: "Pakistan", dialCode: "+92" },
|
|
1392
|
+
{ code: "BD", name: "Bangladesh", dialCode: "+880" },
|
|
1393
|
+
{ code: "AE", name: "UAE", dialCode: "+971" },
|
|
1394
|
+
{ code: "SA", name: "Saudi Arabia", dialCode: "+966" },
|
|
1395
|
+
{ code: "IL", name: "Israel", dialCode: "+972" },
|
|
1396
|
+
{ code: "TR", name: "Turkey", dialCode: "+90" },
|
|
1397
|
+
{ code: "EG", name: "Egypt", dialCode: "+20" },
|
|
1398
|
+
{ code: "ZA", name: "South Africa", dialCode: "+27" },
|
|
1399
|
+
{ code: "NG", name: "Nigeria", dialCode: "+234" },
|
|
1400
|
+
{ code: "KE", name: "Kenya", dialCode: "+254" },
|
|
1401
|
+
{ code: "BR", name: "Brazil", dialCode: "+55" },
|
|
1402
|
+
{ code: "MX", name: "Mexico", dialCode: "+52" },
|
|
1403
|
+
{ code: "AR", name: "Argentina", dialCode: "+54" },
|
|
1404
|
+
{ code: "CL", name: "Chile", dialCode: "+56" },
|
|
1405
|
+
{ code: "CO", name: "Colombia", dialCode: "+57" },
|
|
1406
|
+
{ code: "PE", name: "Peru", dialCode: "+51" },
|
|
1407
|
+
{ code: "NZ", name: "New Zealand", dialCode: "+64" }
|
|
1408
|
+
];
|
|
1409
|
+
var E164_REGEX = /^\+[1-9]\d{6,14}$/;
|
|
1410
|
+
function isValidE164Phone(input) {
|
|
1411
|
+
return E164_REGEX.test(input);
|
|
1412
|
+
}
|
|
1413
|
+
function normalizePhoneNumber(input) {
|
|
1414
|
+
if (typeof input !== "string") return "";
|
|
1415
|
+
const trimmed = input.trim();
|
|
1416
|
+
if (!trimmed) return "";
|
|
1417
|
+
const digitsOnly = trimmed.replace(/\D/g, "");
|
|
1418
|
+
if (!digitsOnly) return "";
|
|
1419
|
+
if (trimmed.startsWith("+")) {
|
|
1420
|
+
return `+${digitsOnly}`;
|
|
1421
|
+
}
|
|
1422
|
+
if (trimmed.startsWith("00") && digitsOnly.length > 2) {
|
|
1423
|
+
return `+${digitsOnly.slice(2)}`;
|
|
1424
|
+
}
|
|
1425
|
+
return `+${digitsOnly}`;
|
|
1426
|
+
}
|
|
1427
|
+
function normalizeAndValidatePhone(input) {
|
|
1428
|
+
const normalized = normalizePhoneNumber(input);
|
|
1429
|
+
if (!normalized) {
|
|
1430
|
+
return {
|
|
1431
|
+
input,
|
|
1432
|
+
normalized: null,
|
|
1433
|
+
valid: false,
|
|
1434
|
+
error: "Phone number is required"
|
|
1435
|
+
};
|
|
1436
|
+
}
|
|
1437
|
+
if (!E164_REGEX.test(normalized)) {
|
|
1438
|
+
return {
|
|
1439
|
+
input,
|
|
1440
|
+
normalized,
|
|
1441
|
+
valid: false,
|
|
1442
|
+
error: "Phone number must be in E.164 format (+[country code][number])"
|
|
1443
|
+
};
|
|
1444
|
+
}
|
|
1445
|
+
return {
|
|
1446
|
+
input,
|
|
1447
|
+
normalized,
|
|
1448
|
+
valid: true,
|
|
1449
|
+
error: null
|
|
1450
|
+
};
|
|
1451
|
+
}
|
|
1452
|
+
function composePhoneNumber(countryDialCode, localNumber) {
|
|
1453
|
+
const normalizedDial = normalizePhoneNumber(countryDialCode);
|
|
1454
|
+
if (!normalizedDial) return "";
|
|
1455
|
+
const localDigits = typeof localNumber === "string" ? localNumber.replace(/\D/g, "") : "";
|
|
1456
|
+
if (!localDigits) return "";
|
|
1457
|
+
return `${normalizedDial}${localDigits}`;
|
|
1458
|
+
}
|
|
1459
|
+
function findPhoneCountryByCode(code) {
|
|
1460
|
+
if (!code) return void 0;
|
|
1461
|
+
const upperCode = code.toUpperCase();
|
|
1462
|
+
return PHONE_COUNTRIES.find((country) => country.code === upperCode);
|
|
1463
|
+
}
|
|
1464
|
+
function findPhoneCountryByDialCode(dialCode) {
|
|
1465
|
+
if (!dialCode) return void 0;
|
|
1466
|
+
const normalized = dialCode.startsWith("+") ? dialCode : `+${dialCode}`;
|
|
1467
|
+
return PHONE_COUNTRIES.find((country) => country.dialCode === normalized);
|
|
1468
|
+
}
|
|
1469
|
+
var DIAL_CODES_DESC = [...PHONE_COUNTRIES].sort((a, b) => b.dialCode.length - a.dialCode.length);
|
|
1470
|
+
function detectCountryFromE164(e164) {
|
|
1471
|
+
if (!e164 || !e164.startsWith("+")) return null;
|
|
1472
|
+
const normalized = "+" + e164.slice(1).replace(/\D/g, "");
|
|
1473
|
+
for (const country of DIAL_CODES_DESC) {
|
|
1474
|
+
const prefix = country.dialCode;
|
|
1475
|
+
if (normalized.startsWith(prefix)) {
|
|
1476
|
+
const local = normalized.slice(prefix.length);
|
|
1477
|
+
if (local.length > 0) {
|
|
1478
|
+
return { country, local };
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
return null;
|
|
1483
|
+
}
|
|
1484
|
+
function countryFlag(code) {
|
|
1485
|
+
return [...code.toUpperCase()].map((c) => String.fromCodePoint(127462 + c.charCodeAt(0) - 65)).join("");
|
|
1486
|
+
}
|
|
1357
1487
|
|
|
1358
1488
|
// src/services/auth.ts
|
|
1359
1489
|
function collectDeviceFingerprint() {
|
|
@@ -1460,7 +1590,7 @@ var AuthService = class extends ServiceModule {
|
|
|
1460
1590
|
}
|
|
1461
1591
|
sanitizePhoneField(value) {
|
|
1462
1592
|
if (typeof value !== "string") return value;
|
|
1463
|
-
const normalized =
|
|
1593
|
+
const normalized = normalizePhoneNumber(value);
|
|
1464
1594
|
return normalized || void 0;
|
|
1465
1595
|
}
|
|
1466
1596
|
// --------------------------------------------------------------------------
|
|
@@ -6094,6 +6224,13 @@ var AgentProjectsService = class extends ServiceModule {
|
|
|
6094
6224
|
options
|
|
6095
6225
|
);
|
|
6096
6226
|
}
|
|
6227
|
+
async startTask(taskId, agentId, applicationId, options) {
|
|
6228
|
+
return this.post(
|
|
6229
|
+
this.withAppId(`/tasks/${taskId}/start`, applicationId),
|
|
6230
|
+
{ agent_id: agentId },
|
|
6231
|
+
options
|
|
6232
|
+
);
|
|
6233
|
+
}
|
|
6097
6234
|
async submit(taskId, data, applicationId, options) {
|
|
6098
6235
|
return this.post(this.withAppId(`/tasks/${taskId}/submit`, applicationId), data, options);
|
|
6099
6236
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -985,18 +985,138 @@ function asString(parent, key) {
|
|
|
985
985
|
return typeof value === "string" ? value : void 0;
|
|
986
986
|
}
|
|
987
987
|
|
|
988
|
-
//
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
988
|
+
// node_modules/@scalemule/ui/dist/phone/index.mjs
|
|
989
|
+
var PHONE_COUNTRIES = [
|
|
990
|
+
{ code: "US", name: "United States", dialCode: "+1" },
|
|
991
|
+
{ code: "CA", name: "Canada", dialCode: "+1" },
|
|
992
|
+
{ code: "GB", name: "United Kingdom", dialCode: "+44" },
|
|
993
|
+
{ code: "AU", name: "Australia", dialCode: "+61" },
|
|
994
|
+
{ code: "DE", name: "Germany", dialCode: "+49" },
|
|
995
|
+
{ code: "FR", name: "France", dialCode: "+33" },
|
|
996
|
+
{ code: "IT", name: "Italy", dialCode: "+39" },
|
|
997
|
+
{ code: "ES", name: "Spain", dialCode: "+34" },
|
|
998
|
+
{ code: "NL", name: "Netherlands", dialCode: "+31" },
|
|
999
|
+
{ code: "BE", name: "Belgium", dialCode: "+32" },
|
|
1000
|
+
{ code: "CH", name: "Switzerland", dialCode: "+41" },
|
|
1001
|
+
{ code: "AT", name: "Austria", dialCode: "+43" },
|
|
1002
|
+
{ code: "SE", name: "Sweden", dialCode: "+46" },
|
|
1003
|
+
{ code: "NO", name: "Norway", dialCode: "+47" },
|
|
1004
|
+
{ code: "DK", name: "Denmark", dialCode: "+45" },
|
|
1005
|
+
{ code: "FI", name: "Finland", dialCode: "+358" },
|
|
1006
|
+
{ code: "IE", name: "Ireland", dialCode: "+353" },
|
|
1007
|
+
{ code: "PT", name: "Portugal", dialCode: "+351" },
|
|
1008
|
+
{ code: "PL", name: "Poland", dialCode: "+48" },
|
|
1009
|
+
{ code: "CZ", name: "Czech Republic", dialCode: "+420" },
|
|
1010
|
+
{ code: "GR", name: "Greece", dialCode: "+30" },
|
|
1011
|
+
{ code: "RU", name: "Russia", dialCode: "+7" },
|
|
1012
|
+
{ code: "JP", name: "Japan", dialCode: "+81" },
|
|
1013
|
+
{ code: "KR", name: "South Korea", dialCode: "+82" },
|
|
1014
|
+
{ code: "CN", name: "China", dialCode: "+86" },
|
|
1015
|
+
{ code: "HK", name: "Hong Kong", dialCode: "+852" },
|
|
1016
|
+
{ code: "TW", name: "Taiwan", dialCode: "+886" },
|
|
1017
|
+
{ code: "SG", name: "Singapore", dialCode: "+65" },
|
|
1018
|
+
{ code: "MY", name: "Malaysia", dialCode: "+60" },
|
|
1019
|
+
{ code: "TH", name: "Thailand", dialCode: "+66" },
|
|
1020
|
+
{ code: "VN", name: "Vietnam", dialCode: "+84" },
|
|
1021
|
+
{ code: "PH", name: "Philippines", dialCode: "+63" },
|
|
1022
|
+
{ code: "ID", name: "Indonesia", dialCode: "+62" },
|
|
1023
|
+
{ code: "IN", name: "India", dialCode: "+91" },
|
|
1024
|
+
{ code: "PK", name: "Pakistan", dialCode: "+92" },
|
|
1025
|
+
{ code: "BD", name: "Bangladesh", dialCode: "+880" },
|
|
1026
|
+
{ code: "AE", name: "UAE", dialCode: "+971" },
|
|
1027
|
+
{ code: "SA", name: "Saudi Arabia", dialCode: "+966" },
|
|
1028
|
+
{ code: "IL", name: "Israel", dialCode: "+972" },
|
|
1029
|
+
{ code: "TR", name: "Turkey", dialCode: "+90" },
|
|
1030
|
+
{ code: "EG", name: "Egypt", dialCode: "+20" },
|
|
1031
|
+
{ code: "ZA", name: "South Africa", dialCode: "+27" },
|
|
1032
|
+
{ code: "NG", name: "Nigeria", dialCode: "+234" },
|
|
1033
|
+
{ code: "KE", name: "Kenya", dialCode: "+254" },
|
|
1034
|
+
{ code: "BR", name: "Brazil", dialCode: "+55" },
|
|
1035
|
+
{ code: "MX", name: "Mexico", dialCode: "+52" },
|
|
1036
|
+
{ code: "AR", name: "Argentina", dialCode: "+54" },
|
|
1037
|
+
{ code: "CL", name: "Chile", dialCode: "+56" },
|
|
1038
|
+
{ code: "CO", name: "Colombia", dialCode: "+57" },
|
|
1039
|
+
{ code: "PE", name: "Peru", dialCode: "+51" },
|
|
1040
|
+
{ code: "NZ", name: "New Zealand", dialCode: "+64" }
|
|
1041
|
+
];
|
|
1042
|
+
var E164_REGEX = /^\+[1-9]\d{6,14}$/;
|
|
1043
|
+
function isValidE164Phone(input) {
|
|
1044
|
+
return E164_REGEX.test(input);
|
|
1045
|
+
}
|
|
1046
|
+
function normalizePhoneNumber(input) {
|
|
1047
|
+
if (typeof input !== "string") return "";
|
|
1048
|
+
const trimmed = input.trim();
|
|
1049
|
+
if (!trimmed) return "";
|
|
1050
|
+
const digitsOnly = trimmed.replace(/\D/g, "");
|
|
1051
|
+
if (!digitsOnly) return "";
|
|
1052
|
+
if (trimmed.startsWith("+")) {
|
|
1053
|
+
return `+${digitsOnly}`;
|
|
1054
|
+
}
|
|
1055
|
+
if (trimmed.startsWith("00") && digitsOnly.length > 2) {
|
|
1056
|
+
return `+${digitsOnly.slice(2)}`;
|
|
1057
|
+
}
|
|
1058
|
+
return `+${digitsOnly}`;
|
|
1059
|
+
}
|
|
1060
|
+
function normalizeAndValidatePhone(input) {
|
|
1061
|
+
const normalized = normalizePhoneNumber(input);
|
|
1062
|
+
if (!normalized) {
|
|
1063
|
+
return {
|
|
1064
|
+
input,
|
|
1065
|
+
normalized: null,
|
|
1066
|
+
valid: false,
|
|
1067
|
+
error: "Phone number is required"
|
|
1068
|
+
};
|
|
1069
|
+
}
|
|
1070
|
+
if (!E164_REGEX.test(normalized)) {
|
|
1071
|
+
return {
|
|
1072
|
+
input,
|
|
1073
|
+
normalized,
|
|
1074
|
+
valid: false,
|
|
1075
|
+
error: "Phone number must be in E.164 format (+[country code][number])"
|
|
1076
|
+
};
|
|
1077
|
+
}
|
|
1078
|
+
return {
|
|
1079
|
+
input,
|
|
1080
|
+
normalized,
|
|
1081
|
+
valid: true,
|
|
1082
|
+
error: null
|
|
1083
|
+
};
|
|
1084
|
+
}
|
|
1085
|
+
function composePhoneNumber(countryDialCode, localNumber) {
|
|
1086
|
+
const normalizedDial = normalizePhoneNumber(countryDialCode);
|
|
1087
|
+
if (!normalizedDial) return "";
|
|
1088
|
+
const localDigits = typeof localNumber === "string" ? localNumber.replace(/\D/g, "") : "";
|
|
1089
|
+
if (!localDigits) return "";
|
|
1090
|
+
return `${normalizedDial}${localDigits}`;
|
|
1091
|
+
}
|
|
1092
|
+
function findPhoneCountryByCode(code) {
|
|
1093
|
+
if (!code) return void 0;
|
|
1094
|
+
const upperCode = code.toUpperCase();
|
|
1095
|
+
return PHONE_COUNTRIES.find((country) => country.code === upperCode);
|
|
1096
|
+
}
|
|
1097
|
+
function findPhoneCountryByDialCode(dialCode) {
|
|
1098
|
+
if (!dialCode) return void 0;
|
|
1099
|
+
const normalized = dialCode.startsWith("+") ? dialCode : `+${dialCode}`;
|
|
1100
|
+
return PHONE_COUNTRIES.find((country) => country.dialCode === normalized);
|
|
1101
|
+
}
|
|
1102
|
+
var DIAL_CODES_DESC = [...PHONE_COUNTRIES].sort((a, b) => b.dialCode.length - a.dialCode.length);
|
|
1103
|
+
function detectCountryFromE164(e164) {
|
|
1104
|
+
if (!e164 || !e164.startsWith("+")) return null;
|
|
1105
|
+
const normalized = "+" + e164.slice(1).replace(/\D/g, "");
|
|
1106
|
+
for (const country of DIAL_CODES_DESC) {
|
|
1107
|
+
const prefix = country.dialCode;
|
|
1108
|
+
if (normalized.startsWith(prefix)) {
|
|
1109
|
+
const local = normalized.slice(prefix.length);
|
|
1110
|
+
if (local.length > 0) {
|
|
1111
|
+
return { country, local };
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
return null;
|
|
1116
|
+
}
|
|
1117
|
+
function countryFlag(code) {
|
|
1118
|
+
return [...code.toUpperCase()].map((c) => String.fromCodePoint(127462 + c.charCodeAt(0) - 65)).join("");
|
|
1119
|
+
}
|
|
1000
1120
|
|
|
1001
1121
|
// src/services/auth.ts
|
|
1002
1122
|
function collectDeviceFingerprint() {
|
|
@@ -5734,6 +5854,13 @@ var AgentProjectsService = class extends ServiceModule {
|
|
|
5734
5854
|
options
|
|
5735
5855
|
);
|
|
5736
5856
|
}
|
|
5857
|
+
async startTask(taskId, agentId, applicationId, options) {
|
|
5858
|
+
return this.post(
|
|
5859
|
+
this.withAppId(`/tasks/${taskId}/start`, applicationId),
|
|
5860
|
+
{ agent_id: agentId },
|
|
5861
|
+
options
|
|
5862
|
+
);
|
|
5863
|
+
}
|
|
5737
5864
|
async submit(taskId, data, applicationId, options) {
|
|
5738
5865
|
return this.post(this.withAppId(`/tasks/${taskId}/submit`, applicationId), data, options);
|
|
5739
5866
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scalemule/sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.28",
|
|
4
4
|
"description": "Official TypeScript/JavaScript SDK for ScaleMule Backend-as-a-Service",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"LICENSE"
|
|
24
24
|
],
|
|
25
25
|
"scripts": {
|
|
26
|
-
"build": "tsup
|
|
26
|
+
"build": "tsup",
|
|
27
27
|
"dev": "tsup src/index.ts --format cjs,esm --dts --watch",
|
|
28
28
|
"test": "vitest run",
|
|
29
29
|
"test:watch": "vitest",
|
|
@@ -62,16 +62,13 @@
|
|
|
62
62
|
"node": ">=18.0.0"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
+
"@scalemule/ui": ">=0.0.1",
|
|
65
66
|
"semver": "^7.7.4"
|
|
66
67
|
},
|
|
67
68
|
"peerDependencies": {
|
|
68
|
-
"@scalemule/ui": ">=0.0.1",
|
|
69
69
|
"browser-image-compression": ">=2.0.0"
|
|
70
70
|
},
|
|
71
71
|
"peerDependenciesMeta": {
|
|
72
|
-
"@scalemule/ui": {
|
|
73
|
-
"optional": false
|
|
74
|
-
},
|
|
75
72
|
"browser-image-compression": {
|
|
76
73
|
"optional": true
|
|
77
74
|
}
|