@topolo/sdk 0.9.8 → 0.9.10
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 +200 -23
- package/dist/index.d.cts +129 -20
- package/dist/index.d.ts +129 -20
- package/dist/index.js +199 -23
- package/dist/node/credential-store.cjs +2 -0
- package/dist/node/credential-store.js +2 -0
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -37,6 +37,7 @@ __export(index_exports, {
|
|
|
37
37
|
TopoloOAuth: () => TopoloOAuth,
|
|
38
38
|
TopoloPermissionError: () => TopoloPermissionError,
|
|
39
39
|
TopoloSdkError: () => TopoloSdkError,
|
|
40
|
+
WorkspacesModule: () => WorkspacesModule,
|
|
40
41
|
actionContractCompleteness: () => actionContractCompleteness,
|
|
41
42
|
applicationRequirementScopes: () => applicationRequirementScopes,
|
|
42
43
|
auditAllApplicationRequirements: () => auditAllApplicationRequirements,
|
|
@@ -170,6 +171,7 @@ var APP_API_URLS = {
|
|
|
170
171
|
agent: "https://agent.topolo.app",
|
|
171
172
|
auth: "https://auth.topolo.app",
|
|
172
173
|
backup: "https://backup.topolo.app",
|
|
174
|
+
blog: "https://blog.topolo.app",
|
|
173
175
|
books: "https://books.topolo.app",
|
|
174
176
|
brand: "https://brand.topolo.app",
|
|
175
177
|
bugfix: "https://bugfix.topolo.app",
|
|
@@ -182,6 +184,7 @@ var APP_API_URLS = {
|
|
|
182
184
|
compose: "https://compose.topolo.app",
|
|
183
185
|
consent: "https://consent.topolo.app",
|
|
184
186
|
crm: "https://crm.topolo.app",
|
|
187
|
+
design: "https://design.topolo.app",
|
|
185
188
|
developers: "https://developers.topolo.app",
|
|
186
189
|
director: "https://director.topolo.app",
|
|
187
190
|
feed: "https://feed.topolo.app",
|
|
@@ -267,7 +270,9 @@ var APPLICATIONS = {
|
|
|
267
270
|
"domains": [
|
|
268
271
|
"agent.topolo.app"
|
|
269
272
|
],
|
|
270
|
-
"routes": [
|
|
273
|
+
"routes": [
|
|
274
|
+
"agent.topolo.app"
|
|
275
|
+
],
|
|
271
276
|
"appId": "agent"
|
|
272
277
|
},
|
|
273
278
|
{
|
|
@@ -328,6 +333,38 @@ var APPLICATIONS = {
|
|
|
328
333
|
}
|
|
329
334
|
]
|
|
330
335
|
},
|
|
336
|
+
"blog": {
|
|
337
|
+
"id": "blog",
|
|
338
|
+
"appDir": "TopoloBlog",
|
|
339
|
+
"name": "topolo-blog",
|
|
340
|
+
"packageName": "topolo-blog",
|
|
341
|
+
"productionUrl": "https://blog.topolo.app",
|
|
342
|
+
"services": [
|
|
343
|
+
"blog"
|
|
344
|
+
],
|
|
345
|
+
"deployTargets": [
|
|
346
|
+
{
|
|
347
|
+
"name": "topolo-blog",
|
|
348
|
+
"kind": "worker",
|
|
349
|
+
"apiUrl": "https://blog.topolo.app",
|
|
350
|
+
"domains": [
|
|
351
|
+
"blog.topolo.app"
|
|
352
|
+
],
|
|
353
|
+
"routes": [
|
|
354
|
+
"blog.topolo.app"
|
|
355
|
+
],
|
|
356
|
+
"appId": "blog"
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
"name": "topolo-blog-api",
|
|
360
|
+
"kind": "worker",
|
|
361
|
+
"apiUrl": null,
|
|
362
|
+
"domains": [],
|
|
363
|
+
"routes": [],
|
|
364
|
+
"appId": null
|
|
365
|
+
}
|
|
366
|
+
]
|
|
367
|
+
},
|
|
331
368
|
"books": {
|
|
332
369
|
"id": "books",
|
|
333
370
|
"appDir": "TopoloBooks",
|
|
@@ -345,7 +382,9 @@ var APPLICATIONS = {
|
|
|
345
382
|
"domains": [
|
|
346
383
|
"books.topolo.app"
|
|
347
384
|
],
|
|
348
|
-
"routes": [
|
|
385
|
+
"routes": [
|
|
386
|
+
"books.topolo.app"
|
|
387
|
+
],
|
|
349
388
|
"appId": "books"
|
|
350
389
|
},
|
|
351
390
|
{
|
|
@@ -495,7 +534,9 @@ var APPLICATIONS = {
|
|
|
495
534
|
"domains": [
|
|
496
535
|
"campaigns.topolo.app"
|
|
497
536
|
],
|
|
498
|
-
"routes": [
|
|
537
|
+
"routes": [
|
|
538
|
+
"campaigns.topolo.app"
|
|
539
|
+
],
|
|
499
540
|
"appId": "campaigns"
|
|
500
541
|
},
|
|
501
542
|
{
|
|
@@ -637,7 +678,9 @@ var APPLICATIONS = {
|
|
|
637
678
|
"domains": [
|
|
638
679
|
"compose.topolo.app"
|
|
639
680
|
],
|
|
640
|
-
"routes": [
|
|
681
|
+
"routes": [
|
|
682
|
+
"compose.topolo.app"
|
|
683
|
+
],
|
|
641
684
|
"appId": "compose"
|
|
642
685
|
},
|
|
643
686
|
{
|
|
@@ -667,7 +710,9 @@ var APPLICATIONS = {
|
|
|
667
710
|
"domains": [
|
|
668
711
|
"consent.topolo.app"
|
|
669
712
|
],
|
|
670
|
-
"routes": [
|
|
713
|
+
"routes": [
|
|
714
|
+
"consent.topolo.app"
|
|
715
|
+
],
|
|
671
716
|
"appId": "consent"
|
|
672
717
|
},
|
|
673
718
|
{
|
|
@@ -705,11 +750,45 @@ var APPLICATIONS = {
|
|
|
705
750
|
"domains": [
|
|
706
751
|
"crm.topolo.app"
|
|
707
752
|
],
|
|
708
|
-
"routes": [
|
|
753
|
+
"routes": [
|
|
754
|
+
"crm.topolo.app"
|
|
755
|
+
],
|
|
709
756
|
"appId": "crm"
|
|
710
757
|
}
|
|
711
758
|
]
|
|
712
759
|
},
|
|
760
|
+
"design": {
|
|
761
|
+
"id": "design",
|
|
762
|
+
"appDir": "TopoloDesign",
|
|
763
|
+
"name": "topolo-design",
|
|
764
|
+
"packageName": "@topolo-io/design",
|
|
765
|
+
"productionUrl": "https://design.topolo.app",
|
|
766
|
+
"services": [
|
|
767
|
+
"design"
|
|
768
|
+
],
|
|
769
|
+
"deployTargets": [
|
|
770
|
+
{
|
|
771
|
+
"name": "topolo-design",
|
|
772
|
+
"kind": "worker",
|
|
773
|
+
"apiUrl": "https://design.topolo.app",
|
|
774
|
+
"domains": [
|
|
775
|
+
"design.topolo.app"
|
|
776
|
+
],
|
|
777
|
+
"routes": [
|
|
778
|
+
"design.topolo.app"
|
|
779
|
+
],
|
|
780
|
+
"appId": "design"
|
|
781
|
+
},
|
|
782
|
+
{
|
|
783
|
+
"name": "topolo-design-api",
|
|
784
|
+
"kind": "worker",
|
|
785
|
+
"apiUrl": null,
|
|
786
|
+
"domains": [],
|
|
787
|
+
"routes": [],
|
|
788
|
+
"appId": null
|
|
789
|
+
}
|
|
790
|
+
]
|
|
791
|
+
},
|
|
713
792
|
"developers": {
|
|
714
793
|
"id": "developers",
|
|
715
794
|
"appDir": "TopoloDevelopers",
|
|
@@ -735,7 +814,9 @@ var APPLICATIONS = {
|
|
|
735
814
|
"domains": [
|
|
736
815
|
"developers.topolo.app"
|
|
737
816
|
],
|
|
738
|
-
"routes": [
|
|
817
|
+
"routes": [
|
|
818
|
+
"developers.topolo.app"
|
|
819
|
+
],
|
|
739
820
|
"appId": "developers"
|
|
740
821
|
},
|
|
741
822
|
{
|
|
@@ -765,7 +846,9 @@ var APPLICATIONS = {
|
|
|
765
846
|
"domains": [
|
|
766
847
|
"director.topolo.app"
|
|
767
848
|
],
|
|
768
|
-
"routes": [
|
|
849
|
+
"routes": [
|
|
850
|
+
"director.topolo.app"
|
|
851
|
+
],
|
|
769
852
|
"appId": "director"
|
|
770
853
|
},
|
|
771
854
|
{
|
|
@@ -873,7 +956,9 @@ var APPLICATIONS = {
|
|
|
873
956
|
"domains": [
|
|
874
957
|
"flow.topolo.app"
|
|
875
958
|
],
|
|
876
|
-
"routes": [
|
|
959
|
+
"routes": [
|
|
960
|
+
"flow.topolo.app"
|
|
961
|
+
],
|
|
877
962
|
"appId": "flow"
|
|
878
963
|
},
|
|
879
964
|
{
|
|
@@ -903,7 +988,9 @@ var APPLICATIONS = {
|
|
|
903
988
|
"domains": [
|
|
904
989
|
"forecast.topolo.app"
|
|
905
990
|
],
|
|
906
|
-
"routes": [
|
|
991
|
+
"routes": [
|
|
992
|
+
"forecast.topolo.app"
|
|
993
|
+
],
|
|
907
994
|
"appId": "forecast"
|
|
908
995
|
},
|
|
909
996
|
{
|
|
@@ -933,7 +1020,9 @@ var APPLICATIONS = {
|
|
|
933
1020
|
"domains": [
|
|
934
1021
|
"forms.topolo.app"
|
|
935
1022
|
],
|
|
936
|
-
"routes": [
|
|
1023
|
+
"routes": [
|
|
1024
|
+
"forms.topolo.app"
|
|
1025
|
+
],
|
|
937
1026
|
"appId": "forms"
|
|
938
1027
|
},
|
|
939
1028
|
{
|
|
@@ -995,7 +1084,9 @@ var APPLICATIONS = {
|
|
|
995
1084
|
"domains": [
|
|
996
1085
|
"insights.topolo.app"
|
|
997
1086
|
],
|
|
998
|
-
"routes": [
|
|
1087
|
+
"routes": [
|
|
1088
|
+
"insights.topolo.app"
|
|
1089
|
+
],
|
|
999
1090
|
"appId": "insights"
|
|
1000
1091
|
},
|
|
1001
1092
|
{
|
|
@@ -1025,7 +1116,9 @@ var APPLICATIONS = {
|
|
|
1025
1116
|
"domains": [
|
|
1026
1117
|
"inventory.topolo.app"
|
|
1027
1118
|
],
|
|
1028
|
-
"routes": [
|
|
1119
|
+
"routes": [
|
|
1120
|
+
"inventory.topolo.app"
|
|
1121
|
+
],
|
|
1029
1122
|
"appId": "inventory"
|
|
1030
1123
|
},
|
|
1031
1124
|
{
|
|
@@ -1379,7 +1472,9 @@ var APPLICATIONS = {
|
|
|
1379
1472
|
"domains": [
|
|
1380
1473
|
"pay.topolo.app"
|
|
1381
1474
|
],
|
|
1382
|
-
"routes": [
|
|
1475
|
+
"routes": [
|
|
1476
|
+
"pay.topolo.app"
|
|
1477
|
+
],
|
|
1383
1478
|
"appId": "pay"
|
|
1384
1479
|
},
|
|
1385
1480
|
{
|
|
@@ -1409,7 +1504,9 @@ var APPLICATIONS = {
|
|
|
1409
1504
|
"domains": [
|
|
1410
1505
|
"people.topolo.app"
|
|
1411
1506
|
],
|
|
1412
|
-
"routes": [
|
|
1507
|
+
"routes": [
|
|
1508
|
+
"people.topolo.app"
|
|
1509
|
+
],
|
|
1413
1510
|
"appId": "people"
|
|
1414
1511
|
},
|
|
1415
1512
|
{
|
|
@@ -1488,7 +1585,9 @@ var APPLICATIONS = {
|
|
|
1488
1585
|
"domains": [
|
|
1489
1586
|
"roadmapper.topolo.app"
|
|
1490
1587
|
],
|
|
1491
|
-
"routes": [
|
|
1588
|
+
"routes": [
|
|
1589
|
+
"roadmapper.topolo.app"
|
|
1590
|
+
],
|
|
1492
1591
|
"appId": "roadmapper"
|
|
1493
1592
|
},
|
|
1494
1593
|
{
|
|
@@ -1518,7 +1617,9 @@ var APPLICATIONS = {
|
|
|
1518
1617
|
"domains": [
|
|
1519
1618
|
"sign.topolo.app"
|
|
1520
1619
|
],
|
|
1521
|
-
"routes": [
|
|
1620
|
+
"routes": [
|
|
1621
|
+
"sign.topolo.app"
|
|
1622
|
+
],
|
|
1522
1623
|
"appId": "sign"
|
|
1523
1624
|
},
|
|
1524
1625
|
{
|
|
@@ -1632,7 +1733,9 @@ var APPLICATIONS = {
|
|
|
1632
1733
|
"domains": [
|
|
1633
1734
|
"spaces.topolo.app"
|
|
1634
1735
|
],
|
|
1635
|
-
"routes": [
|
|
1736
|
+
"routes": [
|
|
1737
|
+
"spaces.topolo.app"
|
|
1738
|
+
],
|
|
1636
1739
|
"appId": "spaces"
|
|
1637
1740
|
},
|
|
1638
1741
|
{
|
|
@@ -1750,7 +1853,9 @@ var APPLICATIONS = {
|
|
|
1750
1853
|
"domains": [
|
|
1751
1854
|
"survey.topolo.app"
|
|
1752
1855
|
],
|
|
1753
|
-
"routes": [
|
|
1856
|
+
"routes": [
|
|
1857
|
+
"survey.topolo.app"
|
|
1858
|
+
],
|
|
1754
1859
|
"appId": "survey"
|
|
1755
1860
|
},
|
|
1756
1861
|
{
|
|
@@ -3700,10 +3805,19 @@ function mapActionInput(action, input) {
|
|
|
3700
3805
|
delete remaining[key];
|
|
3701
3806
|
return encodeURIComponent(String(value));
|
|
3702
3807
|
});
|
|
3703
|
-
const
|
|
3704
|
-
|
|
3705
|
-
const
|
|
3706
|
-
|
|
3808
|
+
const schemaProperties = plainObject(plainObject(action.inputSchema).properties);
|
|
3809
|
+
const schemaOwnsQuery = Object.prototype.hasOwnProperty.call(schemaProperties, "query");
|
|
3810
|
+
const schemaOwnsBody = Object.prototype.hasOwnProperty.call(schemaProperties, "body");
|
|
3811
|
+
let explicitQuery = {};
|
|
3812
|
+
if (!schemaOwnsQuery) {
|
|
3813
|
+
explicitQuery = plainObject(remaining.query);
|
|
3814
|
+
delete remaining.query;
|
|
3815
|
+
}
|
|
3816
|
+
let explicitBody;
|
|
3817
|
+
if (!schemaOwnsBody) {
|
|
3818
|
+
explicitBody = Object.prototype.hasOwnProperty.call(remaining, "body") ? remaining.body : void 0;
|
|
3819
|
+
delete remaining.body;
|
|
3820
|
+
}
|
|
3707
3821
|
if (action.method === "GET") {
|
|
3708
3822
|
return {
|
|
3709
3823
|
path,
|
|
@@ -4174,6 +4288,67 @@ var IdentityModule = class {
|
|
|
4174
4288
|
}
|
|
4175
4289
|
};
|
|
4176
4290
|
|
|
4291
|
+
// src/modules/workspaces.ts
|
|
4292
|
+
var ACTIONS = {
|
|
4293
|
+
list: "app_topolo_auth.workspaces.list",
|
|
4294
|
+
create: "app_topolo_auth.workspaces.create",
|
|
4295
|
+
rename: "app_topolo_auth.workspaces.rename",
|
|
4296
|
+
setDefault: "app_topolo_auth.workspaces.default.set"
|
|
4297
|
+
};
|
|
4298
|
+
var WorkspacesModule = class {
|
|
4299
|
+
constructor(client) {
|
|
4300
|
+
this.client = client;
|
|
4301
|
+
}
|
|
4302
|
+
client;
|
|
4303
|
+
async list(application) {
|
|
4304
|
+
const context = await this.resolveContext(application);
|
|
4305
|
+
return this.client.callAction(ACTIONS.list, {
|
|
4306
|
+
org_id: context.organizationId,
|
|
4307
|
+
app_id: context.appId
|
|
4308
|
+
});
|
|
4309
|
+
}
|
|
4310
|
+
async create(application, input) {
|
|
4311
|
+
const current = await this.list(application);
|
|
4312
|
+
if (!current.data.policy.canCreate) {
|
|
4313
|
+
throw new TopoloSdkError(
|
|
4314
|
+
"workspace_creation_not_allowed",
|
|
4315
|
+
`Workspace creation is not allowed for ${current.data.appId}: ${current.data.policy.reason}`
|
|
4316
|
+
);
|
|
4317
|
+
}
|
|
4318
|
+
return this.client.callAction(ACTIONS.create, {
|
|
4319
|
+
organizationId: current.data.organizationId,
|
|
4320
|
+
appId: current.data.appId,
|
|
4321
|
+
name: input.name,
|
|
4322
|
+
...input.isDefault === void 0 ? {} : { isDefault: input.isDefault }
|
|
4323
|
+
}, { confirm: input.confirm === true });
|
|
4324
|
+
}
|
|
4325
|
+
async rename(application, workspaceId, name, confirm = false) {
|
|
4326
|
+
const context = await this.resolveContext(application);
|
|
4327
|
+
return this.client.callAction(ACTIONS.rename, {
|
|
4328
|
+
workspaceId,
|
|
4329
|
+
organizationId: context.organizationId,
|
|
4330
|
+
appId: context.appId,
|
|
4331
|
+
name
|
|
4332
|
+
}, { confirm });
|
|
4333
|
+
}
|
|
4334
|
+
async setDefault(application, workspaceId, confirm = false) {
|
|
4335
|
+
const context = await this.resolveContext(application);
|
|
4336
|
+
return this.client.callAction(ACTIONS.setDefault, {
|
|
4337
|
+
workspaceId,
|
|
4338
|
+
organizationId: context.organizationId,
|
|
4339
|
+
appId: context.appId
|
|
4340
|
+
}, { confirm });
|
|
4341
|
+
}
|
|
4342
|
+
async resolveContext(application) {
|
|
4343
|
+
const identity = await this.client.introspect();
|
|
4344
|
+
if (!identity.organization?.id) {
|
|
4345
|
+
throw new TopoloSdkError("organization_required", "Workspace lifecycle requires an organization-scoped credential.");
|
|
4346
|
+
}
|
|
4347
|
+
const service = await this.client.getService(application);
|
|
4348
|
+
return { organizationId: identity.organization.id, appId: service.appId };
|
|
4349
|
+
}
|
|
4350
|
+
};
|
|
4351
|
+
|
|
4177
4352
|
// src/modules/p2p.ts
|
|
4178
4353
|
var P2PModule = class {
|
|
4179
4354
|
constructor(client) {
|
|
@@ -4632,6 +4807,7 @@ function createTopolo(options) {
|
|
|
4632
4807
|
return {
|
|
4633
4808
|
client,
|
|
4634
4809
|
identity: new IdentityModule(client),
|
|
4810
|
+
workspaces: new WorkspacesModule(client),
|
|
4635
4811
|
crm: new CrmModule(client)
|
|
4636
4812
|
};
|
|
4637
4813
|
}
|
|
@@ -4654,6 +4830,7 @@ function createTopolo(options) {
|
|
|
4654
4830
|
TopoloOAuth,
|
|
4655
4831
|
TopoloPermissionError,
|
|
4656
4832
|
TopoloSdkError,
|
|
4833
|
+
WorkspacesModule,
|
|
4657
4834
|
actionContractCompleteness,
|
|
4658
4835
|
applicationRequirementScopes,
|
|
4659
4836
|
auditAllApplicationRequirements,
|