@topolo/sdk 0.2.4 → 0.2.5
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.cjs +274 -15
- package/dist/index.d.cts +227 -57
- package/dist/index.d.ts +227 -57
- package/dist/index.js +273 -15
- package/package.json +1 -1
- package/src/application-requirements.ts +2 -4
- package/src/applications.generated.ts +243 -1
- package/src/services.generated.ts +20 -0
- package/src/services.test.ts +23 -0
package/dist/index.js
CHANGED
|
@@ -60,14 +60,20 @@ var TopoloHttpError = class extends TopoloSdkError {
|
|
|
60
60
|
var SERVICES = {
|
|
61
61
|
agent: "https://topolo-agent-worker.topolo.workers.dev",
|
|
62
62
|
auth: "https://auth.topolo.app",
|
|
63
|
+
books: "https://books.topolo.app",
|
|
63
64
|
bugfix: "https://bugfix.topolo.app",
|
|
64
65
|
bytes: "https://r2-media-manager-worker.topolo.workers.dev",
|
|
65
66
|
calendar: "https://calendar.topolo.app",
|
|
66
67
|
chat: "https://chat.topolo.app",
|
|
67
68
|
commerce: "https://topolo-commerce-api.topolo.workers.dev",
|
|
68
69
|
crm: "https://crm-api.topolo.app",
|
|
70
|
+
customer_success: "https://customer-success.topolo.app",
|
|
69
71
|
feed: "https://topolo-feed-api.topolo.app",
|
|
72
|
+
flow: "https://flow.topolo.app",
|
|
70
73
|
forecast: "https://forecast-worker-production.topolo.workers.dev",
|
|
74
|
+
forms: "https://forms.topolo.app",
|
|
75
|
+
insights: "https://insights.topolo.app",
|
|
76
|
+
inventory: "https://inventory.topolo.app",
|
|
71
77
|
learn: "https://topololearn-api.topolo.workers.dev",
|
|
72
78
|
mail: "https://mail.topolo.app",
|
|
73
79
|
mdm: "https://topolo-mdm-api.topolo.app",
|
|
@@ -75,16 +81,30 @@ var SERVICES = {
|
|
|
75
81
|
nexus: "https://topolo-nexus-gateway.topolo.workers.dev",
|
|
76
82
|
one: "https://one.topolo.app",
|
|
77
83
|
pay: "https://topolo-pay.topolo.workers.dev",
|
|
84
|
+
people: "https://people.topolo.app",
|
|
78
85
|
"quro.api": "https://api.ol0.me",
|
|
79
86
|
"quro.redirect": "https://ol0.me",
|
|
80
87
|
roadmapper: "https://roadmapper-api.topolo.app",
|
|
88
|
+
sign: "https://sign.topolo.app",
|
|
81
89
|
social_studio: "https://topolo-social-studio-api.topolo.workers.dev",
|
|
82
90
|
socialize: "https://socialize-prod-api.topolo.workers.dev",
|
|
83
91
|
support: "https://support.topolo.app",
|
|
92
|
+
survey: "https://survey.topolo.app",
|
|
93
|
+
voice: "https://voice.topolo.app",
|
|
84
94
|
web: "https://web-api.topolo.app"
|
|
85
95
|
};
|
|
86
96
|
var PLATFORM_SERVICE_IDS = {
|
|
87
|
-
|
|
97
|
+
books: "srv_topolo_books",
|
|
98
|
+
crm: "srv_iCwM4jGXcwlj",
|
|
99
|
+
customer_success: "srv_topolo_customer_success",
|
|
100
|
+
flow: "srv_topolo_flow",
|
|
101
|
+
forms: "srv_topolo_forms",
|
|
102
|
+
insights: "srv_topolo_insights",
|
|
103
|
+
inventory: "srv_topolo_inventory",
|
|
104
|
+
people: "srv_topolo_people",
|
|
105
|
+
sign: "srv_topolo_sign",
|
|
106
|
+
survey: "srv_topolo_survey",
|
|
107
|
+
voice: "srv_topolo_voice"
|
|
88
108
|
};
|
|
89
109
|
|
|
90
110
|
// src/applications.generated.ts
|
|
@@ -159,6 +179,30 @@ var APPLICATIONS = {
|
|
|
159
179
|
}
|
|
160
180
|
]
|
|
161
181
|
},
|
|
182
|
+
"books": {
|
|
183
|
+
"id": "books",
|
|
184
|
+
"appDir": "TopoloBooks",
|
|
185
|
+
"name": "topolo-books",
|
|
186
|
+
"packageName": "topolo-books",
|
|
187
|
+
"productionUrl": "https://books.topolo.app",
|
|
188
|
+
"services": [
|
|
189
|
+
"books"
|
|
190
|
+
],
|
|
191
|
+
"deployTargets": [
|
|
192
|
+
{
|
|
193
|
+
"name": "topolo-books",
|
|
194
|
+
"kind": "worker",
|
|
195
|
+
"apiUrl": "https://books.topolo.app",
|
|
196
|
+
"domains": [
|
|
197
|
+
"books.topolo.app"
|
|
198
|
+
],
|
|
199
|
+
"routes": [
|
|
200
|
+
"books.topolo.app"
|
|
201
|
+
],
|
|
202
|
+
"serviceId": "books"
|
|
203
|
+
}
|
|
204
|
+
]
|
|
205
|
+
},
|
|
162
206
|
"bugfix": {
|
|
163
207
|
"id": "bugfix",
|
|
164
208
|
"appDir": "TopoloBugFix",
|
|
@@ -360,6 +404,30 @@ var APPLICATIONS = {
|
|
|
360
404
|
}
|
|
361
405
|
]
|
|
362
406
|
},
|
|
407
|
+
"customer_success": {
|
|
408
|
+
"id": "customer_success",
|
|
409
|
+
"appDir": "TopoloCustomerSuccess",
|
|
410
|
+
"name": "topolo-customer-success",
|
|
411
|
+
"packageName": "topolo-customer-success",
|
|
412
|
+
"productionUrl": "https://customer-success.topolo.app",
|
|
413
|
+
"services": [
|
|
414
|
+
"customer_success"
|
|
415
|
+
],
|
|
416
|
+
"deployTargets": [
|
|
417
|
+
{
|
|
418
|
+
"name": "topolo-customer-success",
|
|
419
|
+
"kind": "worker",
|
|
420
|
+
"apiUrl": "https://customer-success.topolo.app",
|
|
421
|
+
"domains": [
|
|
422
|
+
"customer-success.topolo.app"
|
|
423
|
+
],
|
|
424
|
+
"routes": [
|
|
425
|
+
"customer-success.topolo.app"
|
|
426
|
+
],
|
|
427
|
+
"serviceId": "customer_success"
|
|
428
|
+
}
|
|
429
|
+
]
|
|
430
|
+
},
|
|
363
431
|
"developers": {
|
|
364
432
|
"id": "developers",
|
|
365
433
|
"appDir": "TopoloDevelopers",
|
|
@@ -436,6 +504,30 @@ var APPLICATIONS = {
|
|
|
436
504
|
}
|
|
437
505
|
]
|
|
438
506
|
},
|
|
507
|
+
"flow": {
|
|
508
|
+
"id": "flow",
|
|
509
|
+
"appDir": "TopoloFlow",
|
|
510
|
+
"name": "topolo-flow",
|
|
511
|
+
"packageName": "topolo-flow",
|
|
512
|
+
"productionUrl": "https://flow.topolo.app",
|
|
513
|
+
"services": [
|
|
514
|
+
"flow"
|
|
515
|
+
],
|
|
516
|
+
"deployTargets": [
|
|
517
|
+
{
|
|
518
|
+
"name": "topolo-flow",
|
|
519
|
+
"kind": "worker",
|
|
520
|
+
"apiUrl": "https://flow.topolo.app",
|
|
521
|
+
"domains": [
|
|
522
|
+
"flow.topolo.app"
|
|
523
|
+
],
|
|
524
|
+
"routes": [
|
|
525
|
+
"flow.topolo.app"
|
|
526
|
+
],
|
|
527
|
+
"serviceId": "flow"
|
|
528
|
+
}
|
|
529
|
+
]
|
|
530
|
+
},
|
|
439
531
|
"forecast": {
|
|
440
532
|
"id": "forecast",
|
|
441
533
|
"appDir": "TopoloForecast",
|
|
@@ -464,6 +556,78 @@ var APPLICATIONS = {
|
|
|
464
556
|
}
|
|
465
557
|
]
|
|
466
558
|
},
|
|
559
|
+
"forms": {
|
|
560
|
+
"id": "forms",
|
|
561
|
+
"appDir": "TopoloForms",
|
|
562
|
+
"name": "topolo-forms",
|
|
563
|
+
"packageName": "topolo-forms",
|
|
564
|
+
"productionUrl": "https://forms.topolo.app",
|
|
565
|
+
"services": [
|
|
566
|
+
"forms"
|
|
567
|
+
],
|
|
568
|
+
"deployTargets": [
|
|
569
|
+
{
|
|
570
|
+
"name": "topolo-forms",
|
|
571
|
+
"kind": "worker",
|
|
572
|
+
"apiUrl": "https://forms.topolo.app",
|
|
573
|
+
"domains": [
|
|
574
|
+
"forms.topolo.app"
|
|
575
|
+
],
|
|
576
|
+
"routes": [
|
|
577
|
+
"forms.topolo.app"
|
|
578
|
+
],
|
|
579
|
+
"serviceId": "forms"
|
|
580
|
+
}
|
|
581
|
+
]
|
|
582
|
+
},
|
|
583
|
+
"insights": {
|
|
584
|
+
"id": "insights",
|
|
585
|
+
"appDir": "TopoloInsights",
|
|
586
|
+
"name": "topolo-insights",
|
|
587
|
+
"packageName": "topolo-insights",
|
|
588
|
+
"productionUrl": "https://insights.topolo.app",
|
|
589
|
+
"services": [
|
|
590
|
+
"insights"
|
|
591
|
+
],
|
|
592
|
+
"deployTargets": [
|
|
593
|
+
{
|
|
594
|
+
"name": "topolo-insights",
|
|
595
|
+
"kind": "worker",
|
|
596
|
+
"apiUrl": "https://insights.topolo.app",
|
|
597
|
+
"domains": [
|
|
598
|
+
"insights.topolo.app"
|
|
599
|
+
],
|
|
600
|
+
"routes": [
|
|
601
|
+
"insights.topolo.app"
|
|
602
|
+
],
|
|
603
|
+
"serviceId": "insights"
|
|
604
|
+
}
|
|
605
|
+
]
|
|
606
|
+
},
|
|
607
|
+
"inventory": {
|
|
608
|
+
"id": "inventory",
|
|
609
|
+
"appDir": "TopoloInventory",
|
|
610
|
+
"name": "topolo-inventory",
|
|
611
|
+
"packageName": "topolo-inventory",
|
|
612
|
+
"productionUrl": "https://inventory.topolo.app",
|
|
613
|
+
"services": [
|
|
614
|
+
"inventory"
|
|
615
|
+
],
|
|
616
|
+
"deployTargets": [
|
|
617
|
+
{
|
|
618
|
+
"name": "topolo-inventory",
|
|
619
|
+
"kind": "worker",
|
|
620
|
+
"apiUrl": "https://inventory.topolo.app",
|
|
621
|
+
"domains": [
|
|
622
|
+
"inventory.topolo.app"
|
|
623
|
+
],
|
|
624
|
+
"routes": [
|
|
625
|
+
"inventory.topolo.app"
|
|
626
|
+
],
|
|
627
|
+
"serviceId": "inventory"
|
|
628
|
+
}
|
|
629
|
+
]
|
|
630
|
+
},
|
|
467
631
|
"learn": {
|
|
468
632
|
"id": "learn",
|
|
469
633
|
"appDir": "TopoloLearn",
|
|
@@ -664,7 +828,9 @@ var APPLICATIONS = {
|
|
|
664
828
|
"kind": "worker",
|
|
665
829
|
"apiUrl": null,
|
|
666
830
|
"domains": [
|
|
667
|
-
"one.topolo.io"
|
|
831
|
+
"one.topolo.io",
|
|
832
|
+
"topolo.io",
|
|
833
|
+
"www.topolo.io"
|
|
668
834
|
],
|
|
669
835
|
"routes": [],
|
|
670
836
|
"serviceId": null
|
|
@@ -701,6 +867,30 @@ var APPLICATIONS = {
|
|
|
701
867
|
}
|
|
702
868
|
]
|
|
703
869
|
},
|
|
870
|
+
"people": {
|
|
871
|
+
"id": "people",
|
|
872
|
+
"appDir": "TopoloPeople",
|
|
873
|
+
"name": "topolo-people",
|
|
874
|
+
"packageName": "topolo-people",
|
|
875
|
+
"productionUrl": "https://people.topolo.app",
|
|
876
|
+
"services": [
|
|
877
|
+
"people"
|
|
878
|
+
],
|
|
879
|
+
"deployTargets": [
|
|
880
|
+
{
|
|
881
|
+
"name": "topolo-people",
|
|
882
|
+
"kind": "worker",
|
|
883
|
+
"apiUrl": "https://people.topolo.app",
|
|
884
|
+
"domains": [
|
|
885
|
+
"people.topolo.app"
|
|
886
|
+
],
|
|
887
|
+
"routes": [
|
|
888
|
+
"people.topolo.app"
|
|
889
|
+
],
|
|
890
|
+
"serviceId": "people"
|
|
891
|
+
}
|
|
892
|
+
]
|
|
893
|
+
},
|
|
704
894
|
"quro": {
|
|
705
895
|
"id": "quro",
|
|
706
896
|
"appDir": "TopoloQuro",
|
|
@@ -772,6 +962,30 @@ var APPLICATIONS = {
|
|
|
772
962
|
}
|
|
773
963
|
]
|
|
774
964
|
},
|
|
965
|
+
"sign": {
|
|
966
|
+
"id": "sign",
|
|
967
|
+
"appDir": "TopoloSign",
|
|
968
|
+
"name": "topolo-sign",
|
|
969
|
+
"packageName": "topolo-sign",
|
|
970
|
+
"productionUrl": "https://sign.topolo.app",
|
|
971
|
+
"services": [
|
|
972
|
+
"sign"
|
|
973
|
+
],
|
|
974
|
+
"deployTargets": [
|
|
975
|
+
{
|
|
976
|
+
"name": "topolo-sign",
|
|
977
|
+
"kind": "worker",
|
|
978
|
+
"apiUrl": "https://sign.topolo.app",
|
|
979
|
+
"domains": [
|
|
980
|
+
"sign.topolo.app"
|
|
981
|
+
],
|
|
982
|
+
"routes": [
|
|
983
|
+
"sign.topolo.app"
|
|
984
|
+
],
|
|
985
|
+
"serviceId": "sign"
|
|
986
|
+
}
|
|
987
|
+
]
|
|
988
|
+
},
|
|
775
989
|
"social_studio": {
|
|
776
990
|
"id": "social_studio",
|
|
777
991
|
"appDir": "TopoloSocialStudio",
|
|
@@ -868,6 +1082,54 @@ var APPLICATIONS = {
|
|
|
868
1082
|
}
|
|
869
1083
|
]
|
|
870
1084
|
},
|
|
1085
|
+
"survey": {
|
|
1086
|
+
"id": "survey",
|
|
1087
|
+
"appDir": "TopoloSurvey",
|
|
1088
|
+
"name": "topolo-survey",
|
|
1089
|
+
"packageName": "topolo-survey",
|
|
1090
|
+
"productionUrl": "https://survey.topolo.app",
|
|
1091
|
+
"services": [
|
|
1092
|
+
"survey"
|
|
1093
|
+
],
|
|
1094
|
+
"deployTargets": [
|
|
1095
|
+
{
|
|
1096
|
+
"name": "topolo-survey",
|
|
1097
|
+
"kind": "worker",
|
|
1098
|
+
"apiUrl": "https://survey.topolo.app",
|
|
1099
|
+
"domains": [
|
|
1100
|
+
"survey.topolo.app"
|
|
1101
|
+
],
|
|
1102
|
+
"routes": [
|
|
1103
|
+
"survey.topolo.app"
|
|
1104
|
+
],
|
|
1105
|
+
"serviceId": "survey"
|
|
1106
|
+
}
|
|
1107
|
+
]
|
|
1108
|
+
},
|
|
1109
|
+
"voice": {
|
|
1110
|
+
"id": "voice",
|
|
1111
|
+
"appDir": "TopoloVoice",
|
|
1112
|
+
"name": "topolo-voice",
|
|
1113
|
+
"packageName": "topolo-voice",
|
|
1114
|
+
"productionUrl": "https://voice.topolo.app",
|
|
1115
|
+
"services": [
|
|
1116
|
+
"voice"
|
|
1117
|
+
],
|
|
1118
|
+
"deployTargets": [
|
|
1119
|
+
{
|
|
1120
|
+
"name": "topolo-voice",
|
|
1121
|
+
"kind": "worker",
|
|
1122
|
+
"apiUrl": "https://voice.topolo.app",
|
|
1123
|
+
"domains": [
|
|
1124
|
+
"voice.topolo.app"
|
|
1125
|
+
],
|
|
1126
|
+
"routes": [
|
|
1127
|
+
"voice.topolo.app"
|
|
1128
|
+
],
|
|
1129
|
+
"serviceId": "voice"
|
|
1130
|
+
}
|
|
1131
|
+
]
|
|
1132
|
+
},
|
|
871
1133
|
"web": {
|
|
872
1134
|
"id": "web",
|
|
873
1135
|
"appDir": "TopoloWeb",
|
|
@@ -1080,9 +1342,8 @@ var APPLICATION_REQUIREMENTS = [
|
|
|
1080
1342
|
];
|
|
1081
1343
|
function applicationRequirementScopes(application) {
|
|
1082
1344
|
const scopes = /* @__PURE__ */ new Set(["all"]);
|
|
1083
|
-
const
|
|
1084
|
-
const
|
|
1085
|
-
const hasApiSurface = application.services.length > 0 || deployTargets.some((target) => Boolean(target.apiUrl));
|
|
1345
|
+
const hasBrowserSurface = Boolean(application.productionUrl) || application.deployTargets.some((target) => target.kind === "pages");
|
|
1346
|
+
const hasApiSurface = application.services.length > 0 || application.deployTargets.some((target) => Boolean(target.apiUrl));
|
|
1086
1347
|
if (hasBrowserSurface) scopes.add("browser");
|
|
1087
1348
|
if (hasApiSurface) scopes.add("api");
|
|
1088
1349
|
if (application.id === "cli" || application.id === "mcp" || application.id === "cloudcontrol") {
|
|
@@ -1270,11 +1531,10 @@ function statusRank(status) {
|
|
|
1270
1531
|
// src/services.ts
|
|
1271
1532
|
var DEFAULT_SERVICE_URLS = SERVICES;
|
|
1272
1533
|
function resolveServiceUrl(service, overrides) {
|
|
1273
|
-
|
|
1274
|
-
const override = overrides == null ? void 0 : overrides[service];
|
|
1534
|
+
const override = overrides?.[service];
|
|
1275
1535
|
if (override) return override;
|
|
1276
1536
|
const envKey = `TOPOLO_SERVICE_URL_${service.replace(/\./g, "_").toUpperCase()}`;
|
|
1277
|
-
const envValue = typeof process !== "undefined" ?
|
|
1537
|
+
const envValue = typeof process !== "undefined" ? process.env?.[envKey] : void 0;
|
|
1278
1538
|
if (envValue) return envValue;
|
|
1279
1539
|
return DEFAULT_SERVICE_URLS[service];
|
|
1280
1540
|
}
|
|
@@ -1290,9 +1550,8 @@ var TopoloClient = class {
|
|
|
1290
1550
|
fetchImpl;
|
|
1291
1551
|
debug;
|
|
1292
1552
|
constructor(options) {
|
|
1293
|
-
var _a;
|
|
1294
1553
|
if (!options.credential) throw new TopoloAuthError("credential is required");
|
|
1295
|
-
if (!
|
|
1554
|
+
if (!options.agent?.clientName) throw new TopoloAuthError("agent.clientName is required");
|
|
1296
1555
|
this.credential = options.credential;
|
|
1297
1556
|
this.agent = options.agent;
|
|
1298
1557
|
this.serviceUrls = options.serviceUrls;
|
|
@@ -1482,7 +1741,6 @@ var CrmModule = class {
|
|
|
1482
1741
|
}
|
|
1483
1742
|
client;
|
|
1484
1743
|
async listContacts(options = {}) {
|
|
1485
|
-
var _a, _b, _c;
|
|
1486
1744
|
const res = await this.client.request({
|
|
1487
1745
|
service: "crm",
|
|
1488
1746
|
path: "/api/contacts",
|
|
@@ -1492,12 +1750,12 @@ var CrmModule = class {
|
|
|
1492
1750
|
pageSize: options.pageSize
|
|
1493
1751
|
}
|
|
1494
1752
|
});
|
|
1495
|
-
const rows = Array.isArray(res
|
|
1753
|
+
const rows = Array.isArray(res?.contacts) ? res.contacts : Array.isArray(res?.data) ? res.data : [];
|
|
1496
1754
|
return {
|
|
1497
1755
|
contacts: rows.map(toSummary),
|
|
1498
|
-
total:
|
|
1499
|
-
page:
|
|
1500
|
-
pageSize:
|
|
1756
|
+
total: res?.total ?? res?.pagination?.total ?? rows.length,
|
|
1757
|
+
page: res?.page ?? res?.pagination?.page ?? options.page ?? 1,
|
|
1758
|
+
pageSize: res?.pageSize ?? res?.pagination?.pageSize ?? options.pageSize ?? rows.length
|
|
1501
1759
|
};
|
|
1502
1760
|
}
|
|
1503
1761
|
async getContact(contactId) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
APPLICATIONS,
|
|
3
3
|
type ApplicationCatalogEntry,
|
|
4
|
-
type ApplicationDeployTarget,
|
|
5
4
|
type ApplicationId,
|
|
6
5
|
} from './applications.generated.js';
|
|
7
6
|
|
|
@@ -246,12 +245,11 @@ export function applicationRequirementScopes(
|
|
|
246
245
|
application: ApplicationCatalogEntry,
|
|
247
246
|
): ApplicationRequirementScope[] {
|
|
248
247
|
const scopes = new Set<ApplicationRequirementScope>(['all']);
|
|
249
|
-
const deployTargets = application.deployTargets as readonly ApplicationDeployTarget[];
|
|
250
248
|
const hasBrowserSurface =
|
|
251
|
-
Boolean(application.productionUrl) || deployTargets.some((target) => target.kind === 'pages');
|
|
249
|
+
Boolean(application.productionUrl) || application.deployTargets.some((target) => target.kind === 'pages');
|
|
252
250
|
const hasApiSurface =
|
|
253
251
|
application.services.length > 0 ||
|
|
254
|
-
deployTargets.some((target) => Boolean(target.apiUrl));
|
|
252
|
+
application.deployTargets.some((target) => Boolean(target.apiUrl));
|
|
255
253
|
|
|
256
254
|
if (hasBrowserSurface) scopes.add('browser');
|
|
257
255
|
if (hasApiSurface) scopes.add('api');
|