@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.cjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -103,14 +104,20 @@ var TopoloHttpError = class extends TopoloSdkError {
|
|
|
103
104
|
var SERVICES = {
|
|
104
105
|
agent: "https://topolo-agent-worker.topolo.workers.dev",
|
|
105
106
|
auth: "https://auth.topolo.app",
|
|
107
|
+
books: "https://books.topolo.app",
|
|
106
108
|
bugfix: "https://bugfix.topolo.app",
|
|
107
109
|
bytes: "https://r2-media-manager-worker.topolo.workers.dev",
|
|
108
110
|
calendar: "https://calendar.topolo.app",
|
|
109
111
|
chat: "https://chat.topolo.app",
|
|
110
112
|
commerce: "https://topolo-commerce-api.topolo.workers.dev",
|
|
111
113
|
crm: "https://crm-api.topolo.app",
|
|
114
|
+
customer_success: "https://customer-success.topolo.app",
|
|
112
115
|
feed: "https://topolo-feed-api.topolo.app",
|
|
116
|
+
flow: "https://flow.topolo.app",
|
|
113
117
|
forecast: "https://forecast-worker-production.topolo.workers.dev",
|
|
118
|
+
forms: "https://forms.topolo.app",
|
|
119
|
+
insights: "https://insights.topolo.app",
|
|
120
|
+
inventory: "https://inventory.topolo.app",
|
|
114
121
|
learn: "https://topololearn-api.topolo.workers.dev",
|
|
115
122
|
mail: "https://mail.topolo.app",
|
|
116
123
|
mdm: "https://topolo-mdm-api.topolo.app",
|
|
@@ -118,16 +125,30 @@ var SERVICES = {
|
|
|
118
125
|
nexus: "https://topolo-nexus-gateway.topolo.workers.dev",
|
|
119
126
|
one: "https://one.topolo.app",
|
|
120
127
|
pay: "https://topolo-pay.topolo.workers.dev",
|
|
128
|
+
people: "https://people.topolo.app",
|
|
121
129
|
"quro.api": "https://api.ol0.me",
|
|
122
130
|
"quro.redirect": "https://ol0.me",
|
|
123
131
|
roadmapper: "https://roadmapper-api.topolo.app",
|
|
132
|
+
sign: "https://sign.topolo.app",
|
|
124
133
|
social_studio: "https://topolo-social-studio-api.topolo.workers.dev",
|
|
125
134
|
socialize: "https://socialize-prod-api.topolo.workers.dev",
|
|
126
135
|
support: "https://support.topolo.app",
|
|
136
|
+
survey: "https://survey.topolo.app",
|
|
137
|
+
voice: "https://voice.topolo.app",
|
|
127
138
|
web: "https://web-api.topolo.app"
|
|
128
139
|
};
|
|
129
140
|
var PLATFORM_SERVICE_IDS = {
|
|
130
|
-
|
|
141
|
+
books: "srv_topolo_books",
|
|
142
|
+
crm: "srv_iCwM4jGXcwlj",
|
|
143
|
+
customer_success: "srv_topolo_customer_success",
|
|
144
|
+
flow: "srv_topolo_flow",
|
|
145
|
+
forms: "srv_topolo_forms",
|
|
146
|
+
insights: "srv_topolo_insights",
|
|
147
|
+
inventory: "srv_topolo_inventory",
|
|
148
|
+
people: "srv_topolo_people",
|
|
149
|
+
sign: "srv_topolo_sign",
|
|
150
|
+
survey: "srv_topolo_survey",
|
|
151
|
+
voice: "srv_topolo_voice"
|
|
131
152
|
};
|
|
132
153
|
|
|
133
154
|
// src/applications.generated.ts
|
|
@@ -202,6 +223,30 @@ var APPLICATIONS = {
|
|
|
202
223
|
}
|
|
203
224
|
]
|
|
204
225
|
},
|
|
226
|
+
"books": {
|
|
227
|
+
"id": "books",
|
|
228
|
+
"appDir": "TopoloBooks",
|
|
229
|
+
"name": "topolo-books",
|
|
230
|
+
"packageName": "topolo-books",
|
|
231
|
+
"productionUrl": "https://books.topolo.app",
|
|
232
|
+
"services": [
|
|
233
|
+
"books"
|
|
234
|
+
],
|
|
235
|
+
"deployTargets": [
|
|
236
|
+
{
|
|
237
|
+
"name": "topolo-books",
|
|
238
|
+
"kind": "worker",
|
|
239
|
+
"apiUrl": "https://books.topolo.app",
|
|
240
|
+
"domains": [
|
|
241
|
+
"books.topolo.app"
|
|
242
|
+
],
|
|
243
|
+
"routes": [
|
|
244
|
+
"books.topolo.app"
|
|
245
|
+
],
|
|
246
|
+
"serviceId": "books"
|
|
247
|
+
}
|
|
248
|
+
]
|
|
249
|
+
},
|
|
205
250
|
"bugfix": {
|
|
206
251
|
"id": "bugfix",
|
|
207
252
|
"appDir": "TopoloBugFix",
|
|
@@ -403,6 +448,30 @@ var APPLICATIONS = {
|
|
|
403
448
|
}
|
|
404
449
|
]
|
|
405
450
|
},
|
|
451
|
+
"customer_success": {
|
|
452
|
+
"id": "customer_success",
|
|
453
|
+
"appDir": "TopoloCustomerSuccess",
|
|
454
|
+
"name": "topolo-customer-success",
|
|
455
|
+
"packageName": "topolo-customer-success",
|
|
456
|
+
"productionUrl": "https://customer-success.topolo.app",
|
|
457
|
+
"services": [
|
|
458
|
+
"customer_success"
|
|
459
|
+
],
|
|
460
|
+
"deployTargets": [
|
|
461
|
+
{
|
|
462
|
+
"name": "topolo-customer-success",
|
|
463
|
+
"kind": "worker",
|
|
464
|
+
"apiUrl": "https://customer-success.topolo.app",
|
|
465
|
+
"domains": [
|
|
466
|
+
"customer-success.topolo.app"
|
|
467
|
+
],
|
|
468
|
+
"routes": [
|
|
469
|
+
"customer-success.topolo.app"
|
|
470
|
+
],
|
|
471
|
+
"serviceId": "customer_success"
|
|
472
|
+
}
|
|
473
|
+
]
|
|
474
|
+
},
|
|
406
475
|
"developers": {
|
|
407
476
|
"id": "developers",
|
|
408
477
|
"appDir": "TopoloDevelopers",
|
|
@@ -479,6 +548,30 @@ var APPLICATIONS = {
|
|
|
479
548
|
}
|
|
480
549
|
]
|
|
481
550
|
},
|
|
551
|
+
"flow": {
|
|
552
|
+
"id": "flow",
|
|
553
|
+
"appDir": "TopoloFlow",
|
|
554
|
+
"name": "topolo-flow",
|
|
555
|
+
"packageName": "topolo-flow",
|
|
556
|
+
"productionUrl": "https://flow.topolo.app",
|
|
557
|
+
"services": [
|
|
558
|
+
"flow"
|
|
559
|
+
],
|
|
560
|
+
"deployTargets": [
|
|
561
|
+
{
|
|
562
|
+
"name": "topolo-flow",
|
|
563
|
+
"kind": "worker",
|
|
564
|
+
"apiUrl": "https://flow.topolo.app",
|
|
565
|
+
"domains": [
|
|
566
|
+
"flow.topolo.app"
|
|
567
|
+
],
|
|
568
|
+
"routes": [
|
|
569
|
+
"flow.topolo.app"
|
|
570
|
+
],
|
|
571
|
+
"serviceId": "flow"
|
|
572
|
+
}
|
|
573
|
+
]
|
|
574
|
+
},
|
|
482
575
|
"forecast": {
|
|
483
576
|
"id": "forecast",
|
|
484
577
|
"appDir": "TopoloForecast",
|
|
@@ -507,6 +600,78 @@ var APPLICATIONS = {
|
|
|
507
600
|
}
|
|
508
601
|
]
|
|
509
602
|
},
|
|
603
|
+
"forms": {
|
|
604
|
+
"id": "forms",
|
|
605
|
+
"appDir": "TopoloForms",
|
|
606
|
+
"name": "topolo-forms",
|
|
607
|
+
"packageName": "topolo-forms",
|
|
608
|
+
"productionUrl": "https://forms.topolo.app",
|
|
609
|
+
"services": [
|
|
610
|
+
"forms"
|
|
611
|
+
],
|
|
612
|
+
"deployTargets": [
|
|
613
|
+
{
|
|
614
|
+
"name": "topolo-forms",
|
|
615
|
+
"kind": "worker",
|
|
616
|
+
"apiUrl": "https://forms.topolo.app",
|
|
617
|
+
"domains": [
|
|
618
|
+
"forms.topolo.app"
|
|
619
|
+
],
|
|
620
|
+
"routes": [
|
|
621
|
+
"forms.topolo.app"
|
|
622
|
+
],
|
|
623
|
+
"serviceId": "forms"
|
|
624
|
+
}
|
|
625
|
+
]
|
|
626
|
+
},
|
|
627
|
+
"insights": {
|
|
628
|
+
"id": "insights",
|
|
629
|
+
"appDir": "TopoloInsights",
|
|
630
|
+
"name": "topolo-insights",
|
|
631
|
+
"packageName": "topolo-insights",
|
|
632
|
+
"productionUrl": "https://insights.topolo.app",
|
|
633
|
+
"services": [
|
|
634
|
+
"insights"
|
|
635
|
+
],
|
|
636
|
+
"deployTargets": [
|
|
637
|
+
{
|
|
638
|
+
"name": "topolo-insights",
|
|
639
|
+
"kind": "worker",
|
|
640
|
+
"apiUrl": "https://insights.topolo.app",
|
|
641
|
+
"domains": [
|
|
642
|
+
"insights.topolo.app"
|
|
643
|
+
],
|
|
644
|
+
"routes": [
|
|
645
|
+
"insights.topolo.app"
|
|
646
|
+
],
|
|
647
|
+
"serviceId": "insights"
|
|
648
|
+
}
|
|
649
|
+
]
|
|
650
|
+
},
|
|
651
|
+
"inventory": {
|
|
652
|
+
"id": "inventory",
|
|
653
|
+
"appDir": "TopoloInventory",
|
|
654
|
+
"name": "topolo-inventory",
|
|
655
|
+
"packageName": "topolo-inventory",
|
|
656
|
+
"productionUrl": "https://inventory.topolo.app",
|
|
657
|
+
"services": [
|
|
658
|
+
"inventory"
|
|
659
|
+
],
|
|
660
|
+
"deployTargets": [
|
|
661
|
+
{
|
|
662
|
+
"name": "topolo-inventory",
|
|
663
|
+
"kind": "worker",
|
|
664
|
+
"apiUrl": "https://inventory.topolo.app",
|
|
665
|
+
"domains": [
|
|
666
|
+
"inventory.topolo.app"
|
|
667
|
+
],
|
|
668
|
+
"routes": [
|
|
669
|
+
"inventory.topolo.app"
|
|
670
|
+
],
|
|
671
|
+
"serviceId": "inventory"
|
|
672
|
+
}
|
|
673
|
+
]
|
|
674
|
+
},
|
|
510
675
|
"learn": {
|
|
511
676
|
"id": "learn",
|
|
512
677
|
"appDir": "TopoloLearn",
|
|
@@ -707,7 +872,9 @@ var APPLICATIONS = {
|
|
|
707
872
|
"kind": "worker",
|
|
708
873
|
"apiUrl": null,
|
|
709
874
|
"domains": [
|
|
710
|
-
"one.topolo.io"
|
|
875
|
+
"one.topolo.io",
|
|
876
|
+
"topolo.io",
|
|
877
|
+
"www.topolo.io"
|
|
711
878
|
],
|
|
712
879
|
"routes": [],
|
|
713
880
|
"serviceId": null
|
|
@@ -744,6 +911,30 @@ var APPLICATIONS = {
|
|
|
744
911
|
}
|
|
745
912
|
]
|
|
746
913
|
},
|
|
914
|
+
"people": {
|
|
915
|
+
"id": "people",
|
|
916
|
+
"appDir": "TopoloPeople",
|
|
917
|
+
"name": "topolo-people",
|
|
918
|
+
"packageName": "topolo-people",
|
|
919
|
+
"productionUrl": "https://people.topolo.app",
|
|
920
|
+
"services": [
|
|
921
|
+
"people"
|
|
922
|
+
],
|
|
923
|
+
"deployTargets": [
|
|
924
|
+
{
|
|
925
|
+
"name": "topolo-people",
|
|
926
|
+
"kind": "worker",
|
|
927
|
+
"apiUrl": "https://people.topolo.app",
|
|
928
|
+
"domains": [
|
|
929
|
+
"people.topolo.app"
|
|
930
|
+
],
|
|
931
|
+
"routes": [
|
|
932
|
+
"people.topolo.app"
|
|
933
|
+
],
|
|
934
|
+
"serviceId": "people"
|
|
935
|
+
}
|
|
936
|
+
]
|
|
937
|
+
},
|
|
747
938
|
"quro": {
|
|
748
939
|
"id": "quro",
|
|
749
940
|
"appDir": "TopoloQuro",
|
|
@@ -815,6 +1006,30 @@ var APPLICATIONS = {
|
|
|
815
1006
|
}
|
|
816
1007
|
]
|
|
817
1008
|
},
|
|
1009
|
+
"sign": {
|
|
1010
|
+
"id": "sign",
|
|
1011
|
+
"appDir": "TopoloSign",
|
|
1012
|
+
"name": "topolo-sign",
|
|
1013
|
+
"packageName": "topolo-sign",
|
|
1014
|
+
"productionUrl": "https://sign.topolo.app",
|
|
1015
|
+
"services": [
|
|
1016
|
+
"sign"
|
|
1017
|
+
],
|
|
1018
|
+
"deployTargets": [
|
|
1019
|
+
{
|
|
1020
|
+
"name": "topolo-sign",
|
|
1021
|
+
"kind": "worker",
|
|
1022
|
+
"apiUrl": "https://sign.topolo.app",
|
|
1023
|
+
"domains": [
|
|
1024
|
+
"sign.topolo.app"
|
|
1025
|
+
],
|
|
1026
|
+
"routes": [
|
|
1027
|
+
"sign.topolo.app"
|
|
1028
|
+
],
|
|
1029
|
+
"serviceId": "sign"
|
|
1030
|
+
}
|
|
1031
|
+
]
|
|
1032
|
+
},
|
|
818
1033
|
"social_studio": {
|
|
819
1034
|
"id": "social_studio",
|
|
820
1035
|
"appDir": "TopoloSocialStudio",
|
|
@@ -911,6 +1126,54 @@ var APPLICATIONS = {
|
|
|
911
1126
|
}
|
|
912
1127
|
]
|
|
913
1128
|
},
|
|
1129
|
+
"survey": {
|
|
1130
|
+
"id": "survey",
|
|
1131
|
+
"appDir": "TopoloSurvey",
|
|
1132
|
+
"name": "topolo-survey",
|
|
1133
|
+
"packageName": "topolo-survey",
|
|
1134
|
+
"productionUrl": "https://survey.topolo.app",
|
|
1135
|
+
"services": [
|
|
1136
|
+
"survey"
|
|
1137
|
+
],
|
|
1138
|
+
"deployTargets": [
|
|
1139
|
+
{
|
|
1140
|
+
"name": "topolo-survey",
|
|
1141
|
+
"kind": "worker",
|
|
1142
|
+
"apiUrl": "https://survey.topolo.app",
|
|
1143
|
+
"domains": [
|
|
1144
|
+
"survey.topolo.app"
|
|
1145
|
+
],
|
|
1146
|
+
"routes": [
|
|
1147
|
+
"survey.topolo.app"
|
|
1148
|
+
],
|
|
1149
|
+
"serviceId": "survey"
|
|
1150
|
+
}
|
|
1151
|
+
]
|
|
1152
|
+
},
|
|
1153
|
+
"voice": {
|
|
1154
|
+
"id": "voice",
|
|
1155
|
+
"appDir": "TopoloVoice",
|
|
1156
|
+
"name": "topolo-voice",
|
|
1157
|
+
"packageName": "topolo-voice",
|
|
1158
|
+
"productionUrl": "https://voice.topolo.app",
|
|
1159
|
+
"services": [
|
|
1160
|
+
"voice"
|
|
1161
|
+
],
|
|
1162
|
+
"deployTargets": [
|
|
1163
|
+
{
|
|
1164
|
+
"name": "topolo-voice",
|
|
1165
|
+
"kind": "worker",
|
|
1166
|
+
"apiUrl": "https://voice.topolo.app",
|
|
1167
|
+
"domains": [
|
|
1168
|
+
"voice.topolo.app"
|
|
1169
|
+
],
|
|
1170
|
+
"routes": [
|
|
1171
|
+
"voice.topolo.app"
|
|
1172
|
+
],
|
|
1173
|
+
"serviceId": "voice"
|
|
1174
|
+
}
|
|
1175
|
+
]
|
|
1176
|
+
},
|
|
914
1177
|
"web": {
|
|
915
1178
|
"id": "web",
|
|
916
1179
|
"appDir": "TopoloWeb",
|
|
@@ -1123,9 +1386,8 @@ var APPLICATION_REQUIREMENTS = [
|
|
|
1123
1386
|
];
|
|
1124
1387
|
function applicationRequirementScopes(application) {
|
|
1125
1388
|
const scopes = /* @__PURE__ */ new Set(["all"]);
|
|
1126
|
-
const
|
|
1127
|
-
const
|
|
1128
|
-
const hasApiSurface = application.services.length > 0 || deployTargets.some((target) => Boolean(target.apiUrl));
|
|
1389
|
+
const hasBrowserSurface = Boolean(application.productionUrl) || application.deployTargets.some((target) => target.kind === "pages");
|
|
1390
|
+
const hasApiSurface = application.services.length > 0 || application.deployTargets.some((target) => Boolean(target.apiUrl));
|
|
1129
1391
|
if (hasBrowserSurface) scopes.add("browser");
|
|
1130
1392
|
if (hasApiSurface) scopes.add("api");
|
|
1131
1393
|
if (application.id === "cli" || application.id === "mcp" || application.id === "cloudcontrol") {
|
|
@@ -1313,11 +1575,10 @@ function statusRank(status) {
|
|
|
1313
1575
|
// src/services.ts
|
|
1314
1576
|
var DEFAULT_SERVICE_URLS = SERVICES;
|
|
1315
1577
|
function resolveServiceUrl(service, overrides) {
|
|
1316
|
-
|
|
1317
|
-
const override = overrides == null ? void 0 : overrides[service];
|
|
1578
|
+
const override = overrides?.[service];
|
|
1318
1579
|
if (override) return override;
|
|
1319
1580
|
const envKey = `TOPOLO_SERVICE_URL_${service.replace(/\./g, "_").toUpperCase()}`;
|
|
1320
|
-
const envValue = typeof process !== "undefined" ?
|
|
1581
|
+
const envValue = typeof process !== "undefined" ? process.env?.[envKey] : void 0;
|
|
1321
1582
|
if (envValue) return envValue;
|
|
1322
1583
|
return DEFAULT_SERVICE_URLS[service];
|
|
1323
1584
|
}
|
|
@@ -1333,9 +1594,8 @@ var TopoloClient = class {
|
|
|
1333
1594
|
fetchImpl;
|
|
1334
1595
|
debug;
|
|
1335
1596
|
constructor(options) {
|
|
1336
|
-
var _a;
|
|
1337
1597
|
if (!options.credential) throw new TopoloAuthError("credential is required");
|
|
1338
|
-
if (!
|
|
1598
|
+
if (!options.agent?.clientName) throw new TopoloAuthError("agent.clientName is required");
|
|
1339
1599
|
this.credential = options.credential;
|
|
1340
1600
|
this.agent = options.agent;
|
|
1341
1601
|
this.serviceUrls = options.serviceUrls;
|
|
@@ -1525,7 +1785,6 @@ var CrmModule = class {
|
|
|
1525
1785
|
}
|
|
1526
1786
|
client;
|
|
1527
1787
|
async listContacts(options = {}) {
|
|
1528
|
-
var _a, _b, _c;
|
|
1529
1788
|
const res = await this.client.request({
|
|
1530
1789
|
service: "crm",
|
|
1531
1790
|
path: "/api/contacts",
|
|
@@ -1535,12 +1794,12 @@ var CrmModule = class {
|
|
|
1535
1794
|
pageSize: options.pageSize
|
|
1536
1795
|
}
|
|
1537
1796
|
});
|
|
1538
|
-
const rows = Array.isArray(res
|
|
1797
|
+
const rows = Array.isArray(res?.contacts) ? res.contacts : Array.isArray(res?.data) ? res.data : [];
|
|
1539
1798
|
return {
|
|
1540
1799
|
contacts: rows.map(toSummary),
|
|
1541
|
-
total:
|
|
1542
|
-
page:
|
|
1543
|
-
pageSize:
|
|
1800
|
+
total: res?.total ?? res?.pagination?.total ?? rows.length,
|
|
1801
|
+
page: res?.page ?? res?.pagination?.page ?? options.page ?? 1,
|
|
1802
|
+
pageSize: res?.pageSize ?? res?.pagination?.pageSize ?? options.pageSize ?? rows.length
|
|
1544
1803
|
};
|
|
1545
1804
|
}
|
|
1546
1805
|
async getContact(contactId) {
|