@eide/foir-cli 0.8.0 → 0.10.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/cli.js +746 -229
- package/dist/lib/config-helpers.d.ts +44 -1
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -469,6 +469,7 @@ import { HooksService as HooksService2 } from "@eide/foir-proto-ts/hooks/v1/hook
|
|
|
469
469
|
import { NotificationsService as NotificationsService2 } from "@eide/foir-proto-ts/notifications/v1/notifications_pb";
|
|
470
470
|
import { SchedulesService as SchedulesService2 } from "@eide/foir-proto-ts/schedules/v1/schedules_pb";
|
|
471
471
|
import { IntegrationsService as IntegrationsService2 } from "@eide/foir-proto-ts/integrations/v1/integrations_pb";
|
|
472
|
+
import { AppsService as AppsService2 } from "@eide/foir-proto-ts/apps/v1/apps_service_pb";
|
|
472
473
|
|
|
473
474
|
// src/lib/rpc/identity.ts
|
|
474
475
|
import { create } from "@bufbuild/protobuf";
|
|
@@ -1266,8 +1267,115 @@ function extensionConfigToInput(cfg) {
|
|
|
1266
1267
|
return out;
|
|
1267
1268
|
}
|
|
1268
1269
|
|
|
1270
|
+
// src/lib/rpc/apps.ts
|
|
1271
|
+
import { create as create3 } from "@bufbuild/protobuf";
|
|
1272
|
+
import {
|
|
1273
|
+
ListAppsRequestSchema,
|
|
1274
|
+
GetAppRequestSchema,
|
|
1275
|
+
InstallAppRequestSchema,
|
|
1276
|
+
ConfirmInstallAppRequestSchema,
|
|
1277
|
+
UpdateAppRequestSchema,
|
|
1278
|
+
ConfirmUpdateAppRequestSchema,
|
|
1279
|
+
UninstallAppRequestSchema,
|
|
1280
|
+
SetAppMappingRequestSchema,
|
|
1281
|
+
ValidateManifestRequestSchema,
|
|
1282
|
+
TriggerOperationRequestSchema
|
|
1283
|
+
} from "@eide/foir-proto-ts/apps/v1/apps_service_pb";
|
|
1284
|
+
function createAppsMethods(client) {
|
|
1285
|
+
return {
|
|
1286
|
+
async listApps(tenantId, projectId) {
|
|
1287
|
+
const resp = await client.listApps(
|
|
1288
|
+
create3(ListAppsRequestSchema, { tenantId, projectId })
|
|
1289
|
+
);
|
|
1290
|
+
return resp.apps;
|
|
1291
|
+
},
|
|
1292
|
+
async getApp(tenantId, projectId, name) {
|
|
1293
|
+
const resp = await client.getApp(
|
|
1294
|
+
create3(GetAppRequestSchema, { tenantId, projectId, name })
|
|
1295
|
+
);
|
|
1296
|
+
return resp.app ?? null;
|
|
1297
|
+
},
|
|
1298
|
+
async installApp(tenantId, projectId, manifestUrl) {
|
|
1299
|
+
return client.installApp(
|
|
1300
|
+
create3(InstallAppRequestSchema, { tenantId, projectId, manifestUrl })
|
|
1301
|
+
);
|
|
1302
|
+
},
|
|
1303
|
+
async confirmInstallApp(params) {
|
|
1304
|
+
const resp = await client.confirmInstallApp(
|
|
1305
|
+
create3(ConfirmInstallAppRequestSchema, {
|
|
1306
|
+
installTicket: params.installTicket,
|
|
1307
|
+
sourceMappings: params.sourceMappings ?? {},
|
|
1308
|
+
sinkMappings: params.sinkMappings ?? {},
|
|
1309
|
+
settings: params.settings,
|
|
1310
|
+
placementFieldChoices: params.placementFieldChoices ?? {}
|
|
1311
|
+
})
|
|
1312
|
+
);
|
|
1313
|
+
return resp.app;
|
|
1314
|
+
},
|
|
1315
|
+
async updateApp(tenantId, projectId, name) {
|
|
1316
|
+
return client.updateApp(
|
|
1317
|
+
create3(UpdateAppRequestSchema, { tenantId, projectId, name })
|
|
1318
|
+
);
|
|
1319
|
+
},
|
|
1320
|
+
async confirmUpdateApp(tenantId, projectId, name, newManifestHash) {
|
|
1321
|
+
const resp = await client.confirmUpdateApp(
|
|
1322
|
+
create3(ConfirmUpdateAppRequestSchema, {
|
|
1323
|
+
tenantId,
|
|
1324
|
+
projectId,
|
|
1325
|
+
name,
|
|
1326
|
+
newManifestHash
|
|
1327
|
+
})
|
|
1328
|
+
);
|
|
1329
|
+
return resp.app;
|
|
1330
|
+
},
|
|
1331
|
+
async uninstallApp(tenantId, projectId, name, force = false) {
|
|
1332
|
+
return client.uninstallApp(
|
|
1333
|
+
create3(UninstallAppRequestSchema, { tenantId, projectId, name, force })
|
|
1334
|
+
);
|
|
1335
|
+
},
|
|
1336
|
+
async setAppMapping(params) {
|
|
1337
|
+
const resp = await client.setAppMapping(
|
|
1338
|
+
create3(SetAppMappingRequestSchema, {
|
|
1339
|
+
tenantId: params.tenantId,
|
|
1340
|
+
projectId: params.projectId,
|
|
1341
|
+
name: params.name,
|
|
1342
|
+
sourceMappings: params.sourceMappings ?? {},
|
|
1343
|
+
sinkMappings: params.sinkMappings ?? {},
|
|
1344
|
+
placementFieldChoices: params.placementFieldChoices ?? {}
|
|
1345
|
+
})
|
|
1346
|
+
);
|
|
1347
|
+
return resp.app;
|
|
1348
|
+
},
|
|
1349
|
+
async validateManifestUrl(manifestUrl) {
|
|
1350
|
+
return client.validateManifest(
|
|
1351
|
+
create3(ValidateManifestRequestSchema, {
|
|
1352
|
+
source: { case: "manifestUrl", value: manifestUrl }
|
|
1353
|
+
})
|
|
1354
|
+
);
|
|
1355
|
+
},
|
|
1356
|
+
async validateManifestJson(manifestJson) {
|
|
1357
|
+
return client.validateManifest(
|
|
1358
|
+
create3(ValidateManifestRequestSchema, {
|
|
1359
|
+
source: { case: "manifestJson", value: manifestJson }
|
|
1360
|
+
})
|
|
1361
|
+
);
|
|
1362
|
+
},
|
|
1363
|
+
async triggerOperation(tenantId, projectId, operationKey, input) {
|
|
1364
|
+
const resp = await client.triggerOperation(
|
|
1365
|
+
create3(TriggerOperationRequestSchema, {
|
|
1366
|
+
tenantId,
|
|
1367
|
+
projectId,
|
|
1368
|
+
operationKey,
|
|
1369
|
+
input
|
|
1370
|
+
})
|
|
1371
|
+
);
|
|
1372
|
+
return resp.executionId;
|
|
1373
|
+
}
|
|
1374
|
+
};
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1269
1377
|
// src/lib/rpc/models.ts
|
|
1270
|
-
import { create as
|
|
1378
|
+
import { create as create4, fromJson } from "@bufbuild/protobuf";
|
|
1271
1379
|
import { ValueSchema } from "@bufbuild/protobuf/wkt";
|
|
1272
1380
|
import {
|
|
1273
1381
|
FieldSchema as ProtoFieldSchema,
|
|
@@ -1284,7 +1392,7 @@ import {
|
|
|
1284
1392
|
RestoreModelVersionRequestSchema
|
|
1285
1393
|
} from "@eide/foir-proto-ts/models/v1/models_pb";
|
|
1286
1394
|
function jsFieldToProto(f) {
|
|
1287
|
-
return
|
|
1395
|
+
return create4(ProtoFieldSchema, {
|
|
1288
1396
|
id: f.id,
|
|
1289
1397
|
key: f.key,
|
|
1290
1398
|
label: f.label,
|
|
@@ -1301,13 +1409,13 @@ function jsFieldToProto(f) {
|
|
|
1301
1409
|
});
|
|
1302
1410
|
}
|
|
1303
1411
|
function jsConfigToProto(c) {
|
|
1304
|
-
return
|
|
1412
|
+
return create4(ProtoModelConfigSchema, {
|
|
1305
1413
|
versioning: c.versioning ?? false,
|
|
1306
1414
|
publishing: c.publishing ?? false,
|
|
1307
1415
|
variants: c.variants ?? false,
|
|
1308
1416
|
inline: c.inline ?? false,
|
|
1309
1417
|
customerScoped: c.customerScoped ?? false,
|
|
1310
|
-
sharing: c.sharing ?
|
|
1418
|
+
sharing: c.sharing ? create4(ProtoSharingConfigSchema, {
|
|
1311
1419
|
enabled: c.sharing.enabled,
|
|
1312
1420
|
requireAcceptance: c.sharing.requireAcceptance
|
|
1313
1421
|
}) : void 0,
|
|
@@ -1326,18 +1434,18 @@ function createModelsMethods(client) {
|
|
|
1326
1434
|
return {
|
|
1327
1435
|
// ── Queries ──────────────────────────────────────────────
|
|
1328
1436
|
async getModel(id) {
|
|
1329
|
-
const resp = await client.getModel(
|
|
1437
|
+
const resp = await client.getModel(create4(GetModelRequestSchema, { id }));
|
|
1330
1438
|
return resp.model ?? null;
|
|
1331
1439
|
},
|
|
1332
1440
|
async getModelByKey(key) {
|
|
1333
1441
|
const resp = await client.getModelByKey(
|
|
1334
|
-
|
|
1442
|
+
create4(GetModelByKeyRequestSchema, { key })
|
|
1335
1443
|
);
|
|
1336
1444
|
return resp.model ?? null;
|
|
1337
1445
|
},
|
|
1338
1446
|
async listModels(params = {}) {
|
|
1339
1447
|
const resp = await client.listModels(
|
|
1340
|
-
|
|
1448
|
+
create4(ListModelsRequestSchema, {
|
|
1341
1449
|
search: params.search,
|
|
1342
1450
|
category: params.category,
|
|
1343
1451
|
configId: params.configId,
|
|
@@ -1353,7 +1461,7 @@ function createModelsMethods(client) {
|
|
|
1353
1461
|
// ── Mutations ────────────────────────────────────────────
|
|
1354
1462
|
async createModel(params) {
|
|
1355
1463
|
const resp = await client.createModel(
|
|
1356
|
-
|
|
1464
|
+
create4(CreateModelRequestSchema, {
|
|
1357
1465
|
key: params.key,
|
|
1358
1466
|
name: params.name,
|
|
1359
1467
|
fields: params.fields.map(jsFieldToProto),
|
|
@@ -1365,7 +1473,7 @@ function createModelsMethods(client) {
|
|
|
1365
1473
|
},
|
|
1366
1474
|
async updateModel(params) {
|
|
1367
1475
|
const resp = await client.updateModel(
|
|
1368
|
-
|
|
1476
|
+
create4(UpdateModelRequestSchema, {
|
|
1369
1477
|
id: params.id,
|
|
1370
1478
|
name: params.name,
|
|
1371
1479
|
updateFields: params.fields != null,
|
|
@@ -1378,20 +1486,20 @@ function createModelsMethods(client) {
|
|
|
1378
1486
|
},
|
|
1379
1487
|
async deleteModel(id) {
|
|
1380
1488
|
const resp = await client.deleteModel(
|
|
1381
|
-
|
|
1489
|
+
create4(DeleteModelRequestSchema, { id })
|
|
1382
1490
|
);
|
|
1383
1491
|
return resp.success;
|
|
1384
1492
|
},
|
|
1385
1493
|
async duplicateModel(params) {
|
|
1386
1494
|
const resp = await client.duplicateModel(
|
|
1387
|
-
|
|
1495
|
+
create4(DuplicateModelRequestSchema, params)
|
|
1388
1496
|
);
|
|
1389
1497
|
return resp.model ?? null;
|
|
1390
1498
|
},
|
|
1391
1499
|
// ── Versioning ───────────────────────────────────────────
|
|
1392
1500
|
async listModelVersions(modelId, params = {}) {
|
|
1393
1501
|
const resp = await client.listModelVersions(
|
|
1394
|
-
|
|
1502
|
+
create4(ListModelVersionsRequestSchema, {
|
|
1395
1503
|
modelId,
|
|
1396
1504
|
limit: params.limit ?? 50,
|
|
1397
1505
|
offset: params.offset ?? 0
|
|
@@ -1404,7 +1512,7 @@ function createModelsMethods(client) {
|
|
|
1404
1512
|
},
|
|
1405
1513
|
async restoreModelVersion(modelId, versionId) {
|
|
1406
1514
|
const resp = await client.restoreModelVersion(
|
|
1407
|
-
|
|
1515
|
+
create4(RestoreModelVersionRequestSchema, { modelId, versionId })
|
|
1408
1516
|
);
|
|
1409
1517
|
return resp.model ?? null;
|
|
1410
1518
|
}
|
|
@@ -1412,7 +1520,7 @@ function createModelsMethods(client) {
|
|
|
1412
1520
|
}
|
|
1413
1521
|
|
|
1414
1522
|
// src/lib/rpc/records.ts
|
|
1415
|
-
import { create as
|
|
1523
|
+
import { create as create5 } from "@bufbuild/protobuf";
|
|
1416
1524
|
import {
|
|
1417
1525
|
CreateRecordRequestSchema,
|
|
1418
1526
|
GetRecordRequestSchema,
|
|
@@ -1483,7 +1591,7 @@ function createRecordsMethods(client) {
|
|
|
1483
1591
|
// ── CRUD ──────────────────────────────────────────────────
|
|
1484
1592
|
async createRecord(params) {
|
|
1485
1593
|
const resp = await client.createRecord(
|
|
1486
|
-
|
|
1594
|
+
create5(CreateRecordRequestSchema, {
|
|
1487
1595
|
modelKey: params.modelKey,
|
|
1488
1596
|
naturalKey: params.naturalKey,
|
|
1489
1597
|
data: params.data ? sanitizeData(params.data) : void 0,
|
|
@@ -1500,32 +1608,32 @@ function createRecordsMethods(client) {
|
|
|
1500
1608
|
},
|
|
1501
1609
|
async getRecord(id) {
|
|
1502
1610
|
const resp = await client.getRecord(
|
|
1503
|
-
|
|
1611
|
+
create5(GetRecordRequestSchema, { id })
|
|
1504
1612
|
);
|
|
1505
1613
|
return resp.record ?? null;
|
|
1506
1614
|
},
|
|
1507
1615
|
async getRecordByKey(modelKey, naturalKey) {
|
|
1508
1616
|
const resp = await client.getRecordByKey(
|
|
1509
|
-
|
|
1617
|
+
create5(GetRecordByKeyRequestSchema, { modelKey, naturalKey })
|
|
1510
1618
|
);
|
|
1511
1619
|
return resp.record ?? null;
|
|
1512
1620
|
},
|
|
1513
1621
|
async getRecordByKeyOrId(modelKey, identifier) {
|
|
1514
1622
|
const resp = await client.getRecordByKeyOrId(
|
|
1515
|
-
|
|
1623
|
+
create5(GetRecordByKeyOrIdRequestSchema, { modelKey, identifier })
|
|
1516
1624
|
);
|
|
1517
1625
|
return resp.record ?? null;
|
|
1518
1626
|
},
|
|
1519
1627
|
async listRecords(params) {
|
|
1520
1628
|
const resp = await client.listRecords(
|
|
1521
|
-
|
|
1629
|
+
create5(ListRecordsRequestSchema, {
|
|
1522
1630
|
modelKey: params.modelKey,
|
|
1523
1631
|
limit: params.limit ?? 50,
|
|
1524
1632
|
offset: params.offset ?? 0,
|
|
1525
1633
|
customerId: params.customerId,
|
|
1526
1634
|
search: params.search,
|
|
1527
1635
|
filters: params.filters?.map(
|
|
1528
|
-
(f) =>
|
|
1636
|
+
(f) => create5(RecordFilterSchema, {
|
|
1529
1637
|
field: f.field,
|
|
1530
1638
|
operator: f.operator
|
|
1531
1639
|
})
|
|
@@ -1539,7 +1647,7 @@ function createRecordsMethods(client) {
|
|
|
1539
1647
|
},
|
|
1540
1648
|
async updateRecord(params) {
|
|
1541
1649
|
const resp = await client.updateRecord(
|
|
1542
|
-
|
|
1650
|
+
create5(UpdateRecordRequestSchema, {
|
|
1543
1651
|
id: params.id,
|
|
1544
1652
|
data: sanitizeData(params.data),
|
|
1545
1653
|
naturalKey: params.naturalKey
|
|
@@ -1549,28 +1657,28 @@ function createRecordsMethods(client) {
|
|
|
1549
1657
|
},
|
|
1550
1658
|
async deleteRecord(id) {
|
|
1551
1659
|
const resp = await client.deleteRecord(
|
|
1552
|
-
|
|
1660
|
+
create5(DeleteRecordRequestSchema, { id })
|
|
1553
1661
|
);
|
|
1554
1662
|
return resp.success;
|
|
1555
1663
|
},
|
|
1556
1664
|
async duplicateRecord(id, newNaturalKey) {
|
|
1557
1665
|
const resp = await client.duplicateRecord(
|
|
1558
|
-
|
|
1666
|
+
create5(DuplicateRecordRequestSchema, { id, newNaturalKey })
|
|
1559
1667
|
);
|
|
1560
1668
|
return resp.record ?? null;
|
|
1561
1669
|
},
|
|
1562
1670
|
async duplicateRecordsBulk(ids, modelKey) {
|
|
1563
1671
|
const resp = await client.duplicateRecordsBulk(
|
|
1564
|
-
|
|
1672
|
+
create5(DuplicateRecordsBulkRequestSchema, { ids, modelKey })
|
|
1565
1673
|
);
|
|
1566
1674
|
return resp.records ?? [];
|
|
1567
1675
|
},
|
|
1568
1676
|
async batchRecordOperations(operations) {
|
|
1569
1677
|
const typeMap = { create: 1, update: 2, delete: 3 };
|
|
1570
1678
|
const resp = await client.batchRecordOperations(
|
|
1571
|
-
|
|
1679
|
+
create5(BatchRecordOperationsRequestSchema, {
|
|
1572
1680
|
operations: operations.map(
|
|
1573
|
-
(op) =>
|
|
1681
|
+
(op) => create5(BatchOperationSchema, {
|
|
1574
1682
|
type: typeMap[op.type],
|
|
1575
1683
|
id: op.id,
|
|
1576
1684
|
modelKey: op.modelKey,
|
|
@@ -1587,7 +1695,7 @@ function createRecordsMethods(client) {
|
|
|
1587
1695
|
},
|
|
1588
1696
|
async bulkUpdateRecords(params) {
|
|
1589
1697
|
const resp = await client.bulkUpdateRecords(
|
|
1590
|
-
|
|
1698
|
+
create5(BulkUpdateRecordsRequestSchema, {
|
|
1591
1699
|
modelKey: params.modelKey,
|
|
1592
1700
|
data: sanitizeData(params.data)
|
|
1593
1701
|
})
|
|
@@ -1597,7 +1705,7 @@ function createRecordsMethods(client) {
|
|
|
1597
1705
|
// ── Versioning ────────────────────────────────────────────
|
|
1598
1706
|
async createVersion(parentId, data, changeDescription) {
|
|
1599
1707
|
const resp = await client.createVersion(
|
|
1600
|
-
|
|
1708
|
+
create5(CreateVersionRequestSchema, {
|
|
1601
1709
|
parentId,
|
|
1602
1710
|
data: data ? sanitizeData(data) : void 0,
|
|
1603
1711
|
changeDescription
|
|
@@ -1607,25 +1715,25 @@ function createRecordsMethods(client) {
|
|
|
1607
1715
|
},
|
|
1608
1716
|
async publishVersion(versionId) {
|
|
1609
1717
|
const resp = await client.publishVersion(
|
|
1610
|
-
|
|
1718
|
+
create5(PublishVersionRequestSchema, { versionId })
|
|
1611
1719
|
);
|
|
1612
1720
|
return resp.record ?? null;
|
|
1613
1721
|
},
|
|
1614
1722
|
async unpublishRecord(recordId) {
|
|
1615
1723
|
const resp = await client.unpublishRecord(
|
|
1616
|
-
|
|
1724
|
+
create5(UnpublishRecordRequestSchema, { recordId })
|
|
1617
1725
|
);
|
|
1618
1726
|
return resp.success;
|
|
1619
1727
|
},
|
|
1620
1728
|
async revertToVersion(versionId) {
|
|
1621
1729
|
const resp = await client.revertToVersion(
|
|
1622
|
-
|
|
1730
|
+
create5(RevertToVersionRequestSchema, { versionId })
|
|
1623
1731
|
);
|
|
1624
1732
|
return resp.record ?? null;
|
|
1625
1733
|
},
|
|
1626
1734
|
async listRecordVersions(parentId, params) {
|
|
1627
1735
|
const resp = await client.listRecordVersions(
|
|
1628
|
-
|
|
1736
|
+
create5(ListRecordVersionsRequestSchema, {
|
|
1629
1737
|
parentId,
|
|
1630
1738
|
limit: params?.limit ?? 50,
|
|
1631
1739
|
offset: params?.offset ?? 0
|
|
@@ -1638,7 +1746,7 @@ function createRecordsMethods(client) {
|
|
|
1638
1746
|
},
|
|
1639
1747
|
async saveContent(params) {
|
|
1640
1748
|
const resp = await client.saveContent(
|
|
1641
|
-
|
|
1749
|
+
create5(SaveContentRequestSchema, {
|
|
1642
1750
|
recordId: params.recordId,
|
|
1643
1751
|
data: sanitizeData(params.data),
|
|
1644
1752
|
variantKey: params.variantKey,
|
|
@@ -1653,7 +1761,7 @@ function createRecordsMethods(client) {
|
|
|
1653
1761
|
// ── Variants ──────────────────────────────────────────────
|
|
1654
1762
|
async createVariant(recordId, variantKey, data) {
|
|
1655
1763
|
const resp = await client.createVariant(
|
|
1656
|
-
|
|
1764
|
+
create5(CreateVariantRequestSchema, {
|
|
1657
1765
|
recordId,
|
|
1658
1766
|
variantKey,
|
|
1659
1767
|
data: data ? sanitizeData(data) : void 0
|
|
@@ -1663,7 +1771,7 @@ function createRecordsMethods(client) {
|
|
|
1663
1771
|
},
|
|
1664
1772
|
async updateVariant(variantId, data) {
|
|
1665
1773
|
const resp = await client.updateVariant(
|
|
1666
|
-
|
|
1774
|
+
create5(UpdateVariantRequestSchema, {
|
|
1667
1775
|
variantId,
|
|
1668
1776
|
data: sanitizeData(data)
|
|
1669
1777
|
})
|
|
@@ -1672,19 +1780,19 @@ function createRecordsMethods(client) {
|
|
|
1672
1780
|
},
|
|
1673
1781
|
async deleteVariant(variantId) {
|
|
1674
1782
|
const resp = await client.deleteVariant(
|
|
1675
|
-
|
|
1783
|
+
create5(DeleteVariantRequestSchema, { variantId })
|
|
1676
1784
|
);
|
|
1677
1785
|
return resp.success;
|
|
1678
1786
|
},
|
|
1679
1787
|
async setDefaultVariant(recordId, variantId) {
|
|
1680
1788
|
const resp = await client.setDefaultVariant(
|
|
1681
|
-
|
|
1789
|
+
create5(SetDefaultVariantRequestSchema, { recordId, variantId })
|
|
1682
1790
|
);
|
|
1683
1791
|
return resp.record ?? null;
|
|
1684
1792
|
},
|
|
1685
1793
|
async listRecordVariants(recordId, params) {
|
|
1686
1794
|
const resp = await client.listRecordVariants(
|
|
1687
|
-
|
|
1795
|
+
create5(ListRecordVariantsRequestSchema, {
|
|
1688
1796
|
recordId,
|
|
1689
1797
|
limit: params?.limit ?? 50,
|
|
1690
1798
|
offset: params?.offset ?? 0
|
|
@@ -1698,7 +1806,7 @@ function createRecordsMethods(client) {
|
|
|
1698
1806
|
// ── Scheduling ────────────────────────────────────────────
|
|
1699
1807
|
async scheduleRecordPublish(versionId, publishAt, unpublishAt) {
|
|
1700
1808
|
const resp = await client.scheduleRecordPublish(
|
|
1701
|
-
|
|
1809
|
+
create5(ScheduleRecordPublishRequestSchema, {
|
|
1702
1810
|
versionId,
|
|
1703
1811
|
publishAt: {
|
|
1704
1812
|
seconds: BigInt(Math.floor(publishAt.getTime() / 1e3)),
|
|
@@ -1714,13 +1822,13 @@ function createRecordsMethods(client) {
|
|
|
1714
1822
|
},
|
|
1715
1823
|
async cancelScheduledRecordPublish(versionId) {
|
|
1716
1824
|
const resp = await client.cancelScheduledRecordPublish(
|
|
1717
|
-
|
|
1825
|
+
create5(CancelScheduledRecordPublishRequestSchema, { versionId })
|
|
1718
1826
|
);
|
|
1719
1827
|
return resp.version ?? null;
|
|
1720
1828
|
},
|
|
1721
1829
|
async listScheduledPublishes(params) {
|
|
1722
1830
|
const resp = await client.listScheduledPublishes(
|
|
1723
|
-
|
|
1831
|
+
create5(ListScheduledPublishesRequestSchema, {
|
|
1724
1832
|
from: params?.from ? {
|
|
1725
1833
|
seconds: BigInt(Math.floor(params.from.getTime() / 1e3)),
|
|
1726
1834
|
nanos: 0
|
|
@@ -1741,7 +1849,7 @@ function createRecordsMethods(client) {
|
|
|
1741
1849
|
},
|
|
1742
1850
|
async listDraftVersions(params) {
|
|
1743
1851
|
const resp = await client.listDraftVersions(
|
|
1744
|
-
|
|
1852
|
+
create5(ListDraftVersionsRequestSchema, {
|
|
1745
1853
|
modelKey: params?.modelKey,
|
|
1746
1854
|
search: params?.search,
|
|
1747
1855
|
limit: params?.limit ?? 50,
|
|
@@ -1756,7 +1864,7 @@ function createRecordsMethods(client) {
|
|
|
1756
1864
|
// ── Batch Publishing ──────────────────────────────────────
|
|
1757
1865
|
async batchPublishVersions(versionIds) {
|
|
1758
1866
|
const resp = await client.batchPublishVersions(
|
|
1759
|
-
|
|
1867
|
+
create5(BatchPublishVersionsRequestSchema, { versionIds })
|
|
1760
1868
|
);
|
|
1761
1869
|
return {
|
|
1762
1870
|
records: resp.records ?? [],
|
|
@@ -1766,7 +1874,7 @@ function createRecordsMethods(client) {
|
|
|
1766
1874
|
// ── Publish Batches ───────────────────────────────────────
|
|
1767
1875
|
async createPublishBatch(params) {
|
|
1768
1876
|
const resp = await client.createPublishBatch(
|
|
1769
|
-
|
|
1877
|
+
create5(CreatePublishBatchRequestSchema, {
|
|
1770
1878
|
name: params.name,
|
|
1771
1879
|
versionIds: params.versionIds,
|
|
1772
1880
|
scheduledAt: params.scheduledAt ? {
|
|
@@ -1781,7 +1889,7 @@ function createRecordsMethods(client) {
|
|
|
1781
1889
|
},
|
|
1782
1890
|
async updatePublishBatch(params) {
|
|
1783
1891
|
const resp = await client.updatePublishBatch(
|
|
1784
|
-
|
|
1892
|
+
create5(UpdatePublishBatchRequestSchema, {
|
|
1785
1893
|
batchId: params.batchId,
|
|
1786
1894
|
name: params.name,
|
|
1787
1895
|
scheduledAt: params.scheduledAt ? {
|
|
@@ -1796,19 +1904,19 @@ function createRecordsMethods(client) {
|
|
|
1796
1904
|
},
|
|
1797
1905
|
async cancelPublishBatch(batchId) {
|
|
1798
1906
|
const resp = await client.cancelPublishBatch(
|
|
1799
|
-
|
|
1907
|
+
create5(CancelPublishBatchRequestSchema, { batchId })
|
|
1800
1908
|
);
|
|
1801
1909
|
return resp.batch ?? null;
|
|
1802
1910
|
},
|
|
1803
1911
|
async rollbackPublishBatch(batchId) {
|
|
1804
1912
|
const resp = await client.rollbackPublishBatch(
|
|
1805
|
-
|
|
1913
|
+
create5(RollbackPublishBatchRequestSchema, { batchId })
|
|
1806
1914
|
);
|
|
1807
1915
|
return resp.batch ?? null;
|
|
1808
1916
|
},
|
|
1809
1917
|
async retryFailedBatchItems(batchId) {
|
|
1810
1918
|
const resp = await client.retryFailedBatchItems(
|
|
1811
|
-
|
|
1919
|
+
create5(RetryFailedBatchItemsRequestSchema, { batchId })
|
|
1812
1920
|
);
|
|
1813
1921
|
return {
|
|
1814
1922
|
batch: resp.batch ?? null,
|
|
@@ -1817,13 +1925,13 @@ function createRecordsMethods(client) {
|
|
|
1817
1925
|
},
|
|
1818
1926
|
async addItemsToPublishBatch(batchId, versionIds) {
|
|
1819
1927
|
const resp = await client.addItemsToPublishBatch(
|
|
1820
|
-
|
|
1928
|
+
create5(AddItemsToPublishBatchRequestSchema, { batchId, versionIds })
|
|
1821
1929
|
);
|
|
1822
1930
|
return resp.batch ?? null;
|
|
1823
1931
|
},
|
|
1824
1932
|
async removeItemsFromPublishBatch(batchId, versionIds) {
|
|
1825
1933
|
const resp = await client.removeItemsFromPublishBatch(
|
|
1826
|
-
|
|
1934
|
+
create5(RemoveItemsFromPublishBatchRequestSchema, {
|
|
1827
1935
|
batchId,
|
|
1828
1936
|
versionIds
|
|
1829
1937
|
})
|
|
@@ -1832,7 +1940,7 @@ function createRecordsMethods(client) {
|
|
|
1832
1940
|
},
|
|
1833
1941
|
async listPublishBatches(params) {
|
|
1834
1942
|
const resp = await client.listPublishBatches(
|
|
1835
|
-
|
|
1943
|
+
create5(ListPublishBatchesRequestSchema, {
|
|
1836
1944
|
status: params?.status,
|
|
1837
1945
|
from: params?.from ? {
|
|
1838
1946
|
seconds: BigInt(Math.floor(params.from.getTime() / 1e3)),
|
|
@@ -1853,7 +1961,7 @@ function createRecordsMethods(client) {
|
|
|
1853
1961
|
},
|
|
1854
1962
|
async getPublishBatch(batchId) {
|
|
1855
1963
|
const resp = await client.getPublishBatch(
|
|
1856
|
-
|
|
1964
|
+
create5(GetPublishBatchRequestSchema, { batchId })
|
|
1857
1965
|
);
|
|
1858
1966
|
return {
|
|
1859
1967
|
batch: resp.batch ?? null,
|
|
@@ -1863,7 +1971,7 @@ function createRecordsMethods(client) {
|
|
|
1863
1971
|
// ── Search & Embeddings ──────────────────────────────────
|
|
1864
1972
|
async globalSearch(params) {
|
|
1865
1973
|
const resp = await client.globalSearch(
|
|
1866
|
-
|
|
1974
|
+
create5(GlobalSearchRequestSchema, {
|
|
1867
1975
|
query: params.query,
|
|
1868
1976
|
modelKeys: params.modelKeys ?? [],
|
|
1869
1977
|
limit: params.limit ?? 20
|
|
@@ -1876,7 +1984,7 @@ function createRecordsMethods(client) {
|
|
|
1876
1984
|
},
|
|
1877
1985
|
async getEmbeddingStats(modelKey) {
|
|
1878
1986
|
const resp = await client.getEmbeddingStats(
|
|
1879
|
-
|
|
1987
|
+
create5(GetEmbeddingStatsRequestSchema, {
|
|
1880
1988
|
modelKey
|
|
1881
1989
|
})
|
|
1882
1990
|
);
|
|
@@ -1884,13 +1992,13 @@ function createRecordsMethods(client) {
|
|
|
1884
1992
|
},
|
|
1885
1993
|
async getRecordEmbeddings(recordId) {
|
|
1886
1994
|
const resp = await client.getRecordEmbeddings(
|
|
1887
|
-
|
|
1995
|
+
create5(GetRecordEmbeddingsRequestSchema, { recordId })
|
|
1888
1996
|
);
|
|
1889
1997
|
return resp.embeddings ?? [];
|
|
1890
1998
|
},
|
|
1891
1999
|
async findSimilarRecords(params) {
|
|
1892
2000
|
const resp = await client.findSimilarRecords(
|
|
1893
|
-
|
|
2001
|
+
create5(FindSimilarRecordsRequestSchema, {
|
|
1894
2002
|
recordId: params.recordId,
|
|
1895
2003
|
modelKey: params.modelKey,
|
|
1896
2004
|
limit: params.limit ?? 10
|
|
@@ -1902,7 +2010,7 @@ function createRecordsMethods(client) {
|
|
|
1902
2010
|
}
|
|
1903
2011
|
|
|
1904
2012
|
// src/lib/rpc/configs.ts
|
|
1905
|
-
import { create as
|
|
2013
|
+
import { create as create6 } from "@bufbuild/protobuf";
|
|
1906
2014
|
import {
|
|
1907
2015
|
CreateConfigRequestSchema,
|
|
1908
2016
|
GetConfigRequestSchema,
|
|
@@ -1927,7 +2035,7 @@ function createConfigsMethods(client) {
|
|
|
1927
2035
|
// ── Operations ────────────────────────────────────────────
|
|
1928
2036
|
async listOperations(params = {}) {
|
|
1929
2037
|
return client.listOperations(
|
|
1930
|
-
|
|
2038
|
+
create6(ListOperationsRequestSchema, {
|
|
1931
2039
|
category: params.category,
|
|
1932
2040
|
isActive: params.isActive,
|
|
1933
2041
|
search: params.search,
|
|
@@ -1939,19 +2047,19 @@ function createConfigsMethods(client) {
|
|
|
1939
2047
|
// ── Queries ──────────────────────────────────────────────
|
|
1940
2048
|
async getConfig(id) {
|
|
1941
2049
|
const resp = await client.getConfig(
|
|
1942
|
-
|
|
2050
|
+
create6(GetConfigRequestSchema, { id })
|
|
1943
2051
|
);
|
|
1944
2052
|
return resp.config ?? null;
|
|
1945
2053
|
},
|
|
1946
2054
|
async getConfigByKey(key) {
|
|
1947
2055
|
const resp = await client.getConfigByKey(
|
|
1948
|
-
|
|
2056
|
+
create6(GetConfigByKeyRequestSchema, { key })
|
|
1949
2057
|
);
|
|
1950
2058
|
return resp.config ?? null;
|
|
1951
2059
|
},
|
|
1952
2060
|
async listConfigs(params = {}) {
|
|
1953
2061
|
return client.listConfigs(
|
|
1954
|
-
|
|
2062
|
+
create6(ListConfigsRequestSchema, {
|
|
1955
2063
|
configType: params.configType,
|
|
1956
2064
|
enabled: params.enabled,
|
|
1957
2065
|
limit: params.limit ?? 50,
|
|
@@ -1962,7 +2070,7 @@ function createConfigsMethods(client) {
|
|
|
1962
2070
|
// ── Mutations ────────────────────────────────────────────
|
|
1963
2071
|
async createConfig(params) {
|
|
1964
2072
|
const resp = await client.createConfig(
|
|
1965
|
-
|
|
2073
|
+
create6(CreateConfigRequestSchema, {
|
|
1966
2074
|
key: params.key,
|
|
1967
2075
|
configType: params.configType,
|
|
1968
2076
|
direction: DIRECTION_TO_PROTO[params.direction ?? "read"] ?? ConfigDirection.READ,
|
|
@@ -1976,7 +2084,7 @@ function createConfigsMethods(client) {
|
|
|
1976
2084
|
},
|
|
1977
2085
|
async updateConfig(params) {
|
|
1978
2086
|
const resp = await client.updateConfig(
|
|
1979
|
-
|
|
2087
|
+
create6(UpdateConfigRequestSchema, {
|
|
1980
2088
|
id: params.id,
|
|
1981
2089
|
name: params.name,
|
|
1982
2090
|
description: params.description,
|
|
@@ -1990,7 +2098,7 @@ function createConfigsMethods(client) {
|
|
|
1990
2098
|
},
|
|
1991
2099
|
async applyConfig(configKey, configData) {
|
|
1992
2100
|
const resp = await client.applyConfig(
|
|
1993
|
-
|
|
2101
|
+
create6(ApplyConfigRequestSchema, {
|
|
1994
2102
|
configKey,
|
|
1995
2103
|
configData
|
|
1996
2104
|
})
|
|
@@ -2006,7 +2114,7 @@ function createConfigsMethods(client) {
|
|
|
2006
2114
|
},
|
|
2007
2115
|
async writeConfigCredential(params) {
|
|
2008
2116
|
const resp = await client.writeConfigCredential(
|
|
2009
|
-
|
|
2117
|
+
create6(WriteConfigCredentialRequestSchema, {
|
|
2010
2118
|
configKey: params.configKey,
|
|
2011
2119
|
value: params.value
|
|
2012
2120
|
})
|
|
@@ -2018,13 +2126,13 @@ function createConfigsMethods(client) {
|
|
|
2018
2126
|
},
|
|
2019
2127
|
async triggerConfigSync(configId) {
|
|
2020
2128
|
const resp = await client.triggerConfigSync(
|
|
2021
|
-
|
|
2129
|
+
create6(TriggerConfigSyncRequestSchema, { configId })
|
|
2022
2130
|
);
|
|
2023
2131
|
return resp.success;
|
|
2024
2132
|
},
|
|
2025
2133
|
async deleteConfig(id) {
|
|
2026
2134
|
const resp = await client.deleteConfig(
|
|
2027
|
-
|
|
2135
|
+
create6(DeleteConfigRequestSchema, { id })
|
|
2028
2136
|
);
|
|
2029
2137
|
return resp.success;
|
|
2030
2138
|
}
|
|
@@ -2032,7 +2140,7 @@ function createConfigsMethods(client) {
|
|
|
2032
2140
|
}
|
|
2033
2141
|
|
|
2034
2142
|
// src/lib/rpc/segments.ts
|
|
2035
|
-
import { create as
|
|
2143
|
+
import { create as create7, fromJson as fromJson2 } from "@bufbuild/protobuf";
|
|
2036
2144
|
import { ValueSchema as ValueSchema2 } from "@bufbuild/protobuf/wkt";
|
|
2037
2145
|
import {
|
|
2038
2146
|
RuleExpressionSchema,
|
|
@@ -2053,7 +2161,7 @@ import {
|
|
|
2053
2161
|
OptBackIntoSegmentRequestSchema
|
|
2054
2162
|
} from "@eide/foir-proto-ts/segments/v1/segments_pb";
|
|
2055
2163
|
function rawOperandToProto(raw) {
|
|
2056
|
-
return
|
|
2164
|
+
return create7(RuleOperandSchema, {
|
|
2057
2165
|
type: raw.type,
|
|
2058
2166
|
path: raw.path,
|
|
2059
2167
|
value: raw.value !== void 0 ? fromJson2(ValueSchema2, raw.value) : void 0,
|
|
@@ -2062,7 +2170,7 @@ function rawOperandToProto(raw) {
|
|
|
2062
2170
|
});
|
|
2063
2171
|
}
|
|
2064
2172
|
function rawRulesToProto(raw) {
|
|
2065
|
-
return
|
|
2173
|
+
return create7(RuleExpressionSchema, {
|
|
2066
2174
|
type: raw.type,
|
|
2067
2175
|
id: raw.id,
|
|
2068
2176
|
left: raw.left ? rawOperandToProto(raw.left) : void 0,
|
|
@@ -2078,19 +2186,19 @@ function createSegmentsMethods(client) {
|
|
|
2078
2186
|
// ── Queries ──────────────────────────────────────────────
|
|
2079
2187
|
async getSegment(id) {
|
|
2080
2188
|
const resp = await client.getSegment(
|
|
2081
|
-
|
|
2189
|
+
create7(GetSegmentRequestSchema, { id })
|
|
2082
2190
|
);
|
|
2083
2191
|
return resp.segment ?? null;
|
|
2084
2192
|
},
|
|
2085
2193
|
async getSegmentByKey(key) {
|
|
2086
2194
|
const resp = await client.getSegmentByKey(
|
|
2087
|
-
|
|
2195
|
+
create7(GetSegmentByKeyRequestSchema, { key })
|
|
2088
2196
|
);
|
|
2089
2197
|
return resp.segment ?? null;
|
|
2090
2198
|
},
|
|
2091
2199
|
async listSegments(params = {}) {
|
|
2092
2200
|
return client.listSegments(
|
|
2093
|
-
|
|
2201
|
+
create7(ListSegmentsRequestSchema, {
|
|
2094
2202
|
isActive: params.isActive,
|
|
2095
2203
|
configId: params.configId,
|
|
2096
2204
|
limit: params.limit ?? 50,
|
|
@@ -2102,7 +2210,7 @@ function createSegmentsMethods(client) {
|
|
|
2102
2210
|
async createSegment(params) {
|
|
2103
2211
|
const rules = params.rules && !("$typeName" in params.rules) ? rawRulesToProto(params.rules) : params.rules;
|
|
2104
2212
|
const resp = await client.createSegment(
|
|
2105
|
-
|
|
2213
|
+
create7(CreateSegmentRequestSchema, {
|
|
2106
2214
|
key: params.key,
|
|
2107
2215
|
name: params.name,
|
|
2108
2216
|
description: params.description,
|
|
@@ -2119,7 +2227,7 @@ function createSegmentsMethods(client) {
|
|
|
2119
2227
|
async updateSegment(params) {
|
|
2120
2228
|
const rules = params.rules && !("$typeName" in params.rules) ? rawRulesToProto(params.rules) : params.rules;
|
|
2121
2229
|
const resp = await client.updateSegment(
|
|
2122
|
-
|
|
2230
|
+
create7(UpdateSegmentRequestSchema, {
|
|
2123
2231
|
id: params.id,
|
|
2124
2232
|
name: params.name,
|
|
2125
2233
|
description: params.description,
|
|
@@ -2132,19 +2240,19 @@ function createSegmentsMethods(client) {
|
|
|
2132
2240
|
},
|
|
2133
2241
|
async deleteSegment(id) {
|
|
2134
2242
|
const resp = await client.deleteSegment(
|
|
2135
|
-
|
|
2243
|
+
create7(DeleteSegmentRequestSchema, { id })
|
|
2136
2244
|
);
|
|
2137
2245
|
return resp.success;
|
|
2138
2246
|
},
|
|
2139
2247
|
// ── Customer Operations ──────────────────────────────────
|
|
2140
2248
|
async getCustomerMemberships(customerId) {
|
|
2141
2249
|
return client.getCustomerMemberships(
|
|
2142
|
-
|
|
2250
|
+
create7(GetCustomerMembershipsRequestSchema, { customerId })
|
|
2143
2251
|
);
|
|
2144
2252
|
},
|
|
2145
2253
|
async previewSegmentRules(rules, sampleSize) {
|
|
2146
2254
|
const resp = await client.previewSegmentRules(
|
|
2147
|
-
|
|
2255
|
+
create7(PreviewSegmentRulesRequestSchema, {
|
|
2148
2256
|
rules,
|
|
2149
2257
|
sampleSize: sampleSize ?? 10
|
|
2150
2258
|
})
|
|
@@ -2153,26 +2261,26 @@ function createSegmentsMethods(client) {
|
|
|
2153
2261
|
},
|
|
2154
2262
|
async testSegmentEvaluation(segmentId, customerId) {
|
|
2155
2263
|
const resp = await client.testSegmentEvaluation(
|
|
2156
|
-
|
|
2264
|
+
create7(TestSegmentEvaluationRequestSchema, { segmentId, customerId })
|
|
2157
2265
|
);
|
|
2158
2266
|
return resp.result ?? null;
|
|
2159
2267
|
},
|
|
2160
2268
|
// ── Opt-out Management ───────────────────────────────────
|
|
2161
2269
|
async setGlobalOptOut(customerId, optedOut) {
|
|
2162
2270
|
const resp = await client.setGlobalOptOut(
|
|
2163
|
-
|
|
2271
|
+
create7(SetGlobalOptOutRequestSchema, { customerId, optedOut })
|
|
2164
2272
|
);
|
|
2165
2273
|
return resp.success;
|
|
2166
2274
|
},
|
|
2167
2275
|
async optOutOfSegment(customerId, segmentId) {
|
|
2168
2276
|
const resp = await client.optOutOfSegment(
|
|
2169
|
-
|
|
2277
|
+
create7(OptOutOfSegmentRequestSchema, { customerId, segmentId })
|
|
2170
2278
|
);
|
|
2171
2279
|
return resp.success;
|
|
2172
2280
|
},
|
|
2173
2281
|
async optBackIntoSegment(customerId, segmentId) {
|
|
2174
2282
|
const resp = await client.optBackIntoSegment(
|
|
2175
|
-
|
|
2283
|
+
create7(OptBackIntoSegmentRequestSchema, { customerId, segmentId })
|
|
2176
2284
|
);
|
|
2177
2285
|
return resp.success;
|
|
2178
2286
|
}
|
|
@@ -2180,7 +2288,7 @@ function createSegmentsMethods(client) {
|
|
|
2180
2288
|
}
|
|
2181
2289
|
|
|
2182
2290
|
// src/lib/rpc/experiments.ts
|
|
2183
|
-
import { create as
|
|
2291
|
+
import { create as create8 } from "@bufbuild/protobuf";
|
|
2184
2292
|
import {
|
|
2185
2293
|
ExperimentStatus,
|
|
2186
2294
|
CreateExperimentRequestSchema,
|
|
@@ -2213,19 +2321,19 @@ function createExperimentsMethods(client) {
|
|
|
2213
2321
|
// ── Queries ──────────────────────────────────────────────
|
|
2214
2322
|
async getExperiment(id) {
|
|
2215
2323
|
const resp = await client.getExperiment(
|
|
2216
|
-
|
|
2324
|
+
create8(GetExperimentRequestSchema, { id })
|
|
2217
2325
|
);
|
|
2218
2326
|
return resp.experiment ?? null;
|
|
2219
2327
|
},
|
|
2220
2328
|
async getExperimentByKey(key) {
|
|
2221
2329
|
const resp = await client.getExperimentByKey(
|
|
2222
|
-
|
|
2330
|
+
create8(GetExperimentByKeyRequestSchema, { key })
|
|
2223
2331
|
);
|
|
2224
2332
|
return resp.experiment ?? null;
|
|
2225
2333
|
},
|
|
2226
2334
|
async listExperiments(params = {}) {
|
|
2227
2335
|
return client.listExperiments(
|
|
2228
|
-
|
|
2336
|
+
create8(ListExperimentsRequestSchema, {
|
|
2229
2337
|
status: params.status ? STATUS_TO_PROTO[params.status] : void 0,
|
|
2230
2338
|
isActive: params.isActive,
|
|
2231
2339
|
limit: params.limit ?? 50,
|
|
@@ -2235,21 +2343,21 @@ function createExperimentsMethods(client) {
|
|
|
2235
2343
|
},
|
|
2236
2344
|
async getExperimentStats(experimentId) {
|
|
2237
2345
|
const resp = await client.getExperimentStats(
|
|
2238
|
-
|
|
2346
|
+
create8(GetExperimentStatsRequestSchema, { experimentId })
|
|
2239
2347
|
);
|
|
2240
2348
|
return resp.stats ?? null;
|
|
2241
2349
|
},
|
|
2242
2350
|
// ── Mutations ────────────────────────────────────────────
|
|
2243
2351
|
async createExperiment(params) {
|
|
2244
2352
|
const resp = await client.createExperiment(
|
|
2245
|
-
|
|
2353
|
+
create8(CreateExperimentRequestSchema, {
|
|
2246
2354
|
key: params.key,
|
|
2247
2355
|
name: params.name,
|
|
2248
2356
|
description: params.description,
|
|
2249
2357
|
targeting: params.targeting,
|
|
2250
2358
|
controlPercent: params.controlPercent,
|
|
2251
2359
|
variants: params.variants?.map(
|
|
2252
|
-
(v) =>
|
|
2360
|
+
(v) => create8(ExperimentVariantSchema, {
|
|
2253
2361
|
key: v.key,
|
|
2254
2362
|
name: v.name,
|
|
2255
2363
|
percent: v.percent
|
|
@@ -2261,14 +2369,14 @@ function createExperimentsMethods(client) {
|
|
|
2261
2369
|
},
|
|
2262
2370
|
async updateExperiment(params) {
|
|
2263
2371
|
const resp = await client.updateExperiment(
|
|
2264
|
-
|
|
2372
|
+
create8(UpdateExperimentRequestSchema, {
|
|
2265
2373
|
id: params.id,
|
|
2266
2374
|
name: params.name,
|
|
2267
2375
|
description: params.description,
|
|
2268
2376
|
targeting: params.targeting,
|
|
2269
2377
|
controlPercent: params.controlPercent,
|
|
2270
2378
|
variants: params.variants?.map(
|
|
2271
|
-
(v) =>
|
|
2379
|
+
(v) => create8(ExperimentVariantSchema, {
|
|
2272
2380
|
key: v.key,
|
|
2273
2381
|
name: v.name,
|
|
2274
2382
|
percent: v.percent
|
|
@@ -2280,38 +2388,38 @@ function createExperimentsMethods(client) {
|
|
|
2280
2388
|
},
|
|
2281
2389
|
async deleteExperiment(id) {
|
|
2282
2390
|
const resp = await client.deleteExperiment(
|
|
2283
|
-
|
|
2391
|
+
create8(DeleteExperimentRequestSchema, { id })
|
|
2284
2392
|
);
|
|
2285
2393
|
return resp.success;
|
|
2286
2394
|
},
|
|
2287
2395
|
// ── Lifecycle ────────────────────────────────────────────
|
|
2288
2396
|
async startExperiment(experimentId) {
|
|
2289
2397
|
const resp = await client.startExperiment(
|
|
2290
|
-
|
|
2398
|
+
create8(StartExperimentRequestSchema, { experimentId })
|
|
2291
2399
|
);
|
|
2292
2400
|
return resp.experiment ?? null;
|
|
2293
2401
|
},
|
|
2294
2402
|
async pauseExperiment(experimentId) {
|
|
2295
2403
|
const resp = await client.pauseExperiment(
|
|
2296
|
-
|
|
2404
|
+
create8(PauseExperimentRequestSchema, { experimentId })
|
|
2297
2405
|
);
|
|
2298
2406
|
return resp.experiment ?? null;
|
|
2299
2407
|
},
|
|
2300
2408
|
async resumeExperiment(experimentId) {
|
|
2301
2409
|
const resp = await client.resumeExperiment(
|
|
2302
|
-
|
|
2410
|
+
create8(ResumeExperimentRequestSchema, { experimentId })
|
|
2303
2411
|
);
|
|
2304
2412
|
return resp.experiment ?? null;
|
|
2305
2413
|
},
|
|
2306
2414
|
async endExperiment(experimentId) {
|
|
2307
2415
|
const resp = await client.endExperiment(
|
|
2308
|
-
|
|
2416
|
+
create8(EndExperimentRequestSchema, { experimentId })
|
|
2309
2417
|
);
|
|
2310
2418
|
return resp.experiment ?? null;
|
|
2311
2419
|
},
|
|
2312
2420
|
async applyExperimentWinner(experimentId, winnerVariantKey) {
|
|
2313
2421
|
const resp = await client.applyExperimentWinner(
|
|
2314
|
-
|
|
2422
|
+
create8(ApplyExperimentWinnerRequestSchema, {
|
|
2315
2423
|
experimentId,
|
|
2316
2424
|
winnerVariantKey
|
|
2317
2425
|
})
|
|
@@ -2321,7 +2429,7 @@ function createExperimentsMethods(client) {
|
|
|
2321
2429
|
// ── Assignments ──────────────────────────────────────────
|
|
2322
2430
|
async forceAssignExperiment(customerId, experimentId, variantKey) {
|
|
2323
2431
|
const resp = await client.forceAssignExperiment(
|
|
2324
|
-
|
|
2432
|
+
create8(ForceAssignExperimentRequestSchema, {
|
|
2325
2433
|
customerId,
|
|
2326
2434
|
experimentId,
|
|
2327
2435
|
variantKey
|
|
@@ -2331,7 +2439,7 @@ function createExperimentsMethods(client) {
|
|
|
2331
2439
|
},
|
|
2332
2440
|
async removeExperimentAssignment(customerId, experimentId) {
|
|
2333
2441
|
const resp = await client.removeExperimentAssignment(
|
|
2334
|
-
|
|
2442
|
+
create8(RemoveExperimentAssignmentRequestSchema, {
|
|
2335
2443
|
customerId,
|
|
2336
2444
|
experimentId
|
|
2337
2445
|
})
|
|
@@ -2340,7 +2448,7 @@ function createExperimentsMethods(client) {
|
|
|
2340
2448
|
},
|
|
2341
2449
|
async getCustomerAssignments(customerId) {
|
|
2342
2450
|
const resp = await client.getCustomerAssignments(
|
|
2343
|
-
|
|
2451
|
+
create8(GetCustomerAssignmentsRequestSchema, { customerId })
|
|
2344
2452
|
);
|
|
2345
2453
|
return resp.assignments ?? [];
|
|
2346
2454
|
}
|
|
@@ -2348,7 +2456,7 @@ function createExperimentsMethods(client) {
|
|
|
2348
2456
|
}
|
|
2349
2457
|
|
|
2350
2458
|
// src/lib/rpc/settings.ts
|
|
2351
|
-
import { create as
|
|
2459
|
+
import { create as create9 } from "@bufbuild/protobuf";
|
|
2352
2460
|
import {
|
|
2353
2461
|
GetSettingsRequestSchema,
|
|
2354
2462
|
UpdateSettingRequestSchema,
|
|
@@ -2399,7 +2507,7 @@ function createSettingsMethods(client) {
|
|
|
2399
2507
|
// ── Settings ─────────────────────────────────────────────
|
|
2400
2508
|
async getSettings(params = {}) {
|
|
2401
2509
|
const resp = await client.getSettings(
|
|
2402
|
-
|
|
2510
|
+
create9(GetSettingsRequestSchema, {
|
|
2403
2511
|
category: params.category,
|
|
2404
2512
|
key: params.key
|
|
2405
2513
|
})
|
|
@@ -2408,7 +2516,7 @@ function createSettingsMethods(client) {
|
|
|
2408
2516
|
},
|
|
2409
2517
|
async updateSetting(params) {
|
|
2410
2518
|
const resp = await client.updateSetting(
|
|
2411
|
-
|
|
2519
|
+
create9(UpdateSettingRequestSchema, {
|
|
2412
2520
|
key: params.key,
|
|
2413
2521
|
value: params.value
|
|
2414
2522
|
})
|
|
@@ -2417,14 +2525,14 @@ function createSettingsMethods(client) {
|
|
|
2417
2525
|
},
|
|
2418
2526
|
async deleteSetting(key) {
|
|
2419
2527
|
const resp = await client.deleteSetting(
|
|
2420
|
-
|
|
2528
|
+
create9(DeleteSettingRequestSchema, { key })
|
|
2421
2529
|
);
|
|
2422
2530
|
return resp.success;
|
|
2423
2531
|
},
|
|
2424
2532
|
// ── Mentions ─────────────────────────────────────────────
|
|
2425
2533
|
async listMyMentions(params = {}) {
|
|
2426
2534
|
return client.listMyMentions(
|
|
2427
|
-
|
|
2535
|
+
create9(ListMyMentionsRequestSchema, {
|
|
2428
2536
|
status: params.status ?? [],
|
|
2429
2537
|
entityType: params.entityType,
|
|
2430
2538
|
limit: params.limit ?? 50,
|
|
@@ -2434,7 +2542,7 @@ function createSettingsMethods(client) {
|
|
|
2434
2542
|
},
|
|
2435
2543
|
async updateMentionStatus(params) {
|
|
2436
2544
|
const resp = await client.updateMentionStatus(
|
|
2437
|
-
|
|
2545
|
+
create9(UpdateMentionStatusRequestSchema, {
|
|
2438
2546
|
mentionId: params.mentionId,
|
|
2439
2547
|
status: params.status,
|
|
2440
2548
|
completedNote: params.completedNote,
|
|
@@ -2446,7 +2554,7 @@ function createSettingsMethods(client) {
|
|
|
2446
2554
|
// ── Notes ────────────────────────────────────────────────
|
|
2447
2555
|
async createNote(params) {
|
|
2448
2556
|
const resp = await client.createNote(
|
|
2449
|
-
|
|
2557
|
+
create9(CreateNoteRequestSchema, {
|
|
2450
2558
|
...params,
|
|
2451
2559
|
content: params.content
|
|
2452
2560
|
})
|
|
@@ -2454,12 +2562,12 @@ function createSettingsMethods(client) {
|
|
|
2454
2562
|
return resp.note ?? null;
|
|
2455
2563
|
},
|
|
2456
2564
|
async getNote(id) {
|
|
2457
|
-
const resp = await client.getNote(
|
|
2565
|
+
const resp = await client.getNote(create9(GetNoteRequestSchema, { id }));
|
|
2458
2566
|
return resp.note ?? null;
|
|
2459
2567
|
},
|
|
2460
2568
|
async listNotes(params) {
|
|
2461
2569
|
return client.listNotes(
|
|
2462
|
-
|
|
2570
|
+
create9(ListNotesRequestSchema, {
|
|
2463
2571
|
entityType: params.entityType,
|
|
2464
2572
|
entityId: params.entityId,
|
|
2465
2573
|
limit: params.limit ?? 50,
|
|
@@ -2469,7 +2577,7 @@ function createSettingsMethods(client) {
|
|
|
2469
2577
|
},
|
|
2470
2578
|
async updateNote(params) {
|
|
2471
2579
|
const resp = await client.updateNote(
|
|
2472
|
-
|
|
2580
|
+
create9(UpdateNoteRequestSchema, {
|
|
2473
2581
|
id: params.id,
|
|
2474
2582
|
content: params.content,
|
|
2475
2583
|
isResolved: params.isResolved
|
|
@@ -2479,14 +2587,14 @@ function createSettingsMethods(client) {
|
|
|
2479
2587
|
},
|
|
2480
2588
|
async deleteNote(id) {
|
|
2481
2589
|
const resp = await client.deleteNote(
|
|
2482
|
-
|
|
2590
|
+
create9(DeleteNoteRequestSchema, { id })
|
|
2483
2591
|
);
|
|
2484
2592
|
return resp.success;
|
|
2485
2593
|
},
|
|
2486
2594
|
// ── Context Dimensions ───────────────────────────────────
|
|
2487
2595
|
async listContextDimensions(params = {}) {
|
|
2488
2596
|
return client.listContextDimensions(
|
|
2489
|
-
|
|
2597
|
+
create9(ListContextDimensionsRequestSchema, {
|
|
2490
2598
|
search: params.search,
|
|
2491
2599
|
limit: params.limit ?? 50,
|
|
2492
2600
|
offset: params.offset ?? 0
|
|
@@ -2495,31 +2603,31 @@ function createSettingsMethods(client) {
|
|
|
2495
2603
|
},
|
|
2496
2604
|
async getContextDimension(id) {
|
|
2497
2605
|
const resp = await client.getContextDimension(
|
|
2498
|
-
|
|
2606
|
+
create9(GetContextDimensionRequestSchema, { id })
|
|
2499
2607
|
);
|
|
2500
2608
|
return resp.dimension ?? null;
|
|
2501
2609
|
},
|
|
2502
2610
|
async createContextDimension(params) {
|
|
2503
2611
|
const resp = await client.createContextDimension(
|
|
2504
|
-
|
|
2612
|
+
create9(CreateContextDimensionRequestSchema, params)
|
|
2505
2613
|
);
|
|
2506
2614
|
return resp.dimension ?? null;
|
|
2507
2615
|
},
|
|
2508
2616
|
async updateContextDimension(params) {
|
|
2509
2617
|
const resp = await client.updateContextDimension(
|
|
2510
|
-
|
|
2618
|
+
create9(UpdateContextDimensionRequestSchema, params)
|
|
2511
2619
|
);
|
|
2512
2620
|
return resp.dimension ?? null;
|
|
2513
2621
|
},
|
|
2514
2622
|
async deleteContextDimension(id) {
|
|
2515
2623
|
const resp = await client.deleteContextDimension(
|
|
2516
|
-
|
|
2624
|
+
create9(DeleteContextDimensionRequestSchema, { id })
|
|
2517
2625
|
);
|
|
2518
2626
|
return resp.success;
|
|
2519
2627
|
},
|
|
2520
2628
|
async getContextDimensionValues(dimensionKey, params = {}) {
|
|
2521
2629
|
return client.getContextDimensionValues(
|
|
2522
|
-
|
|
2630
|
+
create9(GetContextDimensionValuesRequestSchema, {
|
|
2523
2631
|
dimensionKey,
|
|
2524
2632
|
search: params.search,
|
|
2525
2633
|
limit: params.limit ?? 50,
|
|
@@ -2530,19 +2638,19 @@ function createSettingsMethods(client) {
|
|
|
2530
2638
|
// ── Customer Profile Schema ──────────────────────────────
|
|
2531
2639
|
async getCustomerProfileSchema() {
|
|
2532
2640
|
const resp = await client.getCustomerProfileSchema(
|
|
2533
|
-
|
|
2641
|
+
create9(GetCustomerProfileSchemaRequestSchema, {})
|
|
2534
2642
|
);
|
|
2535
2643
|
return resp.schema ?? null;
|
|
2536
2644
|
},
|
|
2537
2645
|
async getCustomerProfile(customerId) {
|
|
2538
2646
|
const resp = await client.getCustomerProfile(
|
|
2539
|
-
|
|
2647
|
+
create9(GetCustomerProfileRequestSchema, { customerId })
|
|
2540
2648
|
);
|
|
2541
2649
|
return resp.data ?? null;
|
|
2542
2650
|
},
|
|
2543
2651
|
async setCustomerProfile(params) {
|
|
2544
2652
|
const resp = await client.setCustomerProfile(
|
|
2545
|
-
|
|
2653
|
+
create9(SetCustomerProfileRequestSchema, {
|
|
2546
2654
|
customerId: params.customerId,
|
|
2547
2655
|
data: params.data
|
|
2548
2656
|
})
|
|
@@ -2551,7 +2659,7 @@ function createSettingsMethods(client) {
|
|
|
2551
2659
|
},
|
|
2552
2660
|
async updateCustomerProfileSchema(params) {
|
|
2553
2661
|
const resp = await client.updateCustomerProfileSchema(
|
|
2554
|
-
|
|
2662
|
+
create9(UpdateCustomerProfileSchemaRequestSchema, {
|
|
2555
2663
|
fields: params.fields.map((f) => ({
|
|
2556
2664
|
id: f.id,
|
|
2557
2665
|
key: f.key,
|
|
@@ -2569,19 +2677,19 @@ function createSettingsMethods(client) {
|
|
|
2569
2677
|
},
|
|
2570
2678
|
async getCustomerResolutionAttributes(customerId) {
|
|
2571
2679
|
return client.getCustomerResolutionAttributes(
|
|
2572
|
-
|
|
2680
|
+
create9(GetCustomerResolutionAttributesRequestSchema, { customerId })
|
|
2573
2681
|
);
|
|
2574
2682
|
},
|
|
2575
2683
|
async getEditorConfigs(modelKey) {
|
|
2576
2684
|
const resp = await client.getEditorConfigs(
|
|
2577
|
-
|
|
2685
|
+
create9(GetEditorConfigsRequestSchema, { modelKey })
|
|
2578
2686
|
);
|
|
2579
2687
|
return resp.placements ?? [];
|
|
2580
2688
|
},
|
|
2581
2689
|
// ── Variant Catalog ──────────────────────────────────────
|
|
2582
2690
|
async listVariantCatalog(params = {}) {
|
|
2583
2691
|
return client.listVariantCatalog(
|
|
2584
|
-
|
|
2692
|
+
create9(ListVariantCatalogRequestSchema, {
|
|
2585
2693
|
isActive: params.isActive,
|
|
2586
2694
|
limit: params.limit ?? 50,
|
|
2587
2695
|
offset: params.offset ?? 0
|
|
@@ -2590,13 +2698,13 @@ function createSettingsMethods(client) {
|
|
|
2590
2698
|
},
|
|
2591
2699
|
async getVariantCatalogEntry(id) {
|
|
2592
2700
|
const resp = await client.getVariantCatalogEntry(
|
|
2593
|
-
|
|
2701
|
+
create9(GetVariantCatalogEntryRequestSchema, { id })
|
|
2594
2702
|
);
|
|
2595
2703
|
return resp.entry ?? null;
|
|
2596
2704
|
},
|
|
2597
2705
|
async createVariantCatalogEntry(params) {
|
|
2598
2706
|
const resp = await client.createVariantCatalogEntry(
|
|
2599
|
-
|
|
2707
|
+
create9(CreateVariantCatalogEntryRequestSchema, {
|
|
2600
2708
|
key: params.key,
|
|
2601
2709
|
name: params.name,
|
|
2602
2710
|
description: params.description,
|
|
@@ -2610,7 +2718,7 @@ function createSettingsMethods(client) {
|
|
|
2610
2718
|
},
|
|
2611
2719
|
async updateVariantCatalogEntry(params) {
|
|
2612
2720
|
const resp = await client.updateVariantCatalogEntry(
|
|
2613
|
-
|
|
2721
|
+
create9(UpdateVariantCatalogEntryRequestSchema, {
|
|
2614
2722
|
id: params.id,
|
|
2615
2723
|
name: params.name,
|
|
2616
2724
|
description: params.description,
|
|
@@ -2624,14 +2732,14 @@ function createSettingsMethods(client) {
|
|
|
2624
2732
|
},
|
|
2625
2733
|
async deleteVariantCatalogEntry(id) {
|
|
2626
2734
|
const resp = await client.deleteVariantCatalogEntry(
|
|
2627
|
-
|
|
2735
|
+
create9(DeleteVariantCatalogEntryRequestSchema, { id })
|
|
2628
2736
|
);
|
|
2629
2737
|
return resp.success;
|
|
2630
2738
|
},
|
|
2631
2739
|
// ── Locales ──────────────────────────────────────────────
|
|
2632
2740
|
async listLocales(params = {}) {
|
|
2633
2741
|
return client.listLocales(
|
|
2634
|
-
|
|
2742
|
+
create9(ListLocalesRequestSchema, {
|
|
2635
2743
|
includeInactive: params.includeInactive,
|
|
2636
2744
|
limit: params.limit ?? 50,
|
|
2637
2745
|
offset: params.offset ?? 0
|
|
@@ -2640,25 +2748,25 @@ function createSettingsMethods(client) {
|
|
|
2640
2748
|
},
|
|
2641
2749
|
async getLocale(id) {
|
|
2642
2750
|
const resp = await client.getLocale(
|
|
2643
|
-
|
|
2751
|
+
create9(GetLocaleRequestSchema, { id })
|
|
2644
2752
|
);
|
|
2645
2753
|
return resp.locale ?? null;
|
|
2646
2754
|
},
|
|
2647
2755
|
async getLocaleByCode(code) {
|
|
2648
2756
|
const resp = await client.getLocaleByCode(
|
|
2649
|
-
|
|
2757
|
+
create9(GetLocaleByCodeRequestSchema, { code })
|
|
2650
2758
|
);
|
|
2651
2759
|
return resp.locale ?? null;
|
|
2652
2760
|
},
|
|
2653
2761
|
async getDefaultLocale() {
|
|
2654
2762
|
const resp = await client.getDefaultLocale(
|
|
2655
|
-
|
|
2763
|
+
create9(GetDefaultLocaleRequestSchema, {})
|
|
2656
2764
|
);
|
|
2657
2765
|
return resp.locale ?? null;
|
|
2658
2766
|
},
|
|
2659
2767
|
async createLocale(params) {
|
|
2660
2768
|
const resp = await client.createLocale(
|
|
2661
|
-
|
|
2769
|
+
create9(CreateLocaleRequestSchema, {
|
|
2662
2770
|
locale: params.locale,
|
|
2663
2771
|
displayName: params.displayName,
|
|
2664
2772
|
nativeName: params.nativeName,
|
|
@@ -2671,7 +2779,7 @@ function createSettingsMethods(client) {
|
|
|
2671
2779
|
},
|
|
2672
2780
|
async updateLocale(params) {
|
|
2673
2781
|
const resp = await client.updateLocale(
|
|
2674
|
-
|
|
2782
|
+
create9(UpdateLocaleRequestSchema, {
|
|
2675
2783
|
id: params.id,
|
|
2676
2784
|
displayName: params.displayName,
|
|
2677
2785
|
nativeName: params.nativeName,
|
|
@@ -2685,20 +2793,20 @@ function createSettingsMethods(client) {
|
|
|
2685
2793
|
},
|
|
2686
2794
|
async deleteLocale(id) {
|
|
2687
2795
|
const resp = await client.deleteLocale(
|
|
2688
|
-
|
|
2796
|
+
create9(DeleteLocaleRequestSchema, { id })
|
|
2689
2797
|
);
|
|
2690
2798
|
return resp.success;
|
|
2691
2799
|
},
|
|
2692
2800
|
// ── Nav Preferences ─────────────────────────────────────
|
|
2693
2801
|
async getNavPreferences() {
|
|
2694
2802
|
const resp = await client.getNavPreferences(
|
|
2695
|
-
|
|
2803
|
+
create9(GetNavPreferencesRequestSchema, {})
|
|
2696
2804
|
);
|
|
2697
2805
|
return resp.preferences ?? null;
|
|
2698
2806
|
},
|
|
2699
2807
|
async updateNavPreferences(params) {
|
|
2700
2808
|
const resp = await client.updateNavPreferences(
|
|
2701
|
-
|
|
2809
|
+
create9(UpdateNavPreferencesRequestSchema, {
|
|
2702
2810
|
preferences: params.preferences ? {
|
|
2703
2811
|
favoriteProjects: params.preferences.favoriteProjects,
|
|
2704
2812
|
favoriteNavItems: params.preferences.favoriteNavItems,
|
|
@@ -2715,7 +2823,7 @@ function createSettingsMethods(client) {
|
|
|
2715
2823
|
// ── Recently Opened ─────────────────────────────────────
|
|
2716
2824
|
async listRecentlyOpened(limit) {
|
|
2717
2825
|
const resp = await client.listRecentlyOpened(
|
|
2718
|
-
|
|
2826
|
+
create9(ListRecentlyOpenedRequestSchema, {
|
|
2719
2827
|
limit: limit ?? 20
|
|
2720
2828
|
})
|
|
2721
2829
|
);
|
|
@@ -2723,7 +2831,7 @@ function createSettingsMethods(client) {
|
|
|
2723
2831
|
},
|
|
2724
2832
|
async trackRecentlyOpened(params) {
|
|
2725
2833
|
const resp = await client.trackRecentlyOpened(
|
|
2726
|
-
|
|
2834
|
+
create9(TrackRecentlyOpenedRequestSchema, {
|
|
2727
2835
|
type: params.type,
|
|
2728
2836
|
id: params.id,
|
|
2729
2837
|
label: params.label,
|
|
@@ -2734,7 +2842,7 @@ function createSettingsMethods(client) {
|
|
|
2734
2842
|
},
|
|
2735
2843
|
async removeRecentlyOpened(params) {
|
|
2736
2844
|
const resp = await client.removeRecentlyOpened(
|
|
2737
|
-
|
|
2845
|
+
create9(RemoveRecentlyOpenedRequestSchema, {
|
|
2738
2846
|
type: params.type,
|
|
2739
2847
|
id: params.id
|
|
2740
2848
|
})
|
|
@@ -2743,14 +2851,14 @@ function createSettingsMethods(client) {
|
|
|
2743
2851
|
},
|
|
2744
2852
|
async clearRecentlyOpened() {
|
|
2745
2853
|
const resp = await client.clearRecentlyOpened(
|
|
2746
|
-
|
|
2854
|
+
create9(ClearRecentlyOpenedRequestSchema, {})
|
|
2747
2855
|
);
|
|
2748
2856
|
return resp.success;
|
|
2749
2857
|
},
|
|
2750
2858
|
// ── Email Actions ──────────────────────────────────────────
|
|
2751
2859
|
async listEmailActions(params = {}) {
|
|
2752
2860
|
return client.listEmailActions(
|
|
2753
|
-
|
|
2861
|
+
create9(ListEmailActionsRequestSchema, {
|
|
2754
2862
|
limit: params.limit ?? 50,
|
|
2755
2863
|
offset: params.offset ?? 0
|
|
2756
2864
|
})
|
|
@@ -2758,7 +2866,7 @@ function createSettingsMethods(client) {
|
|
|
2758
2866
|
},
|
|
2759
2867
|
async updateEmailAction(params) {
|
|
2760
2868
|
const resp = await client.updateEmailAction(
|
|
2761
|
-
|
|
2869
|
+
create9(UpdateEmailActionRequestSchema, {
|
|
2762
2870
|
key: params.key,
|
|
2763
2871
|
resendTemplateId: params.resendTemplateId,
|
|
2764
2872
|
defaultFrom: params.defaultFrom,
|
|
@@ -2771,7 +2879,7 @@ function createSettingsMethods(client) {
|
|
|
2771
2879
|
},
|
|
2772
2880
|
async listResendTemplates() {
|
|
2773
2881
|
const resp = await client.listResendTemplates(
|
|
2774
|
-
|
|
2882
|
+
create9(ListResendTemplatesRequestSchema, {})
|
|
2775
2883
|
);
|
|
2776
2884
|
return resp.templates ?? [];
|
|
2777
2885
|
}
|
|
@@ -2779,7 +2887,7 @@ function createSettingsMethods(client) {
|
|
|
2779
2887
|
}
|
|
2780
2888
|
|
|
2781
2889
|
// src/lib/rpc/storage.ts
|
|
2782
|
-
import { create as
|
|
2890
|
+
import { create as create10 } from "@bufbuild/protobuf";
|
|
2783
2891
|
import {
|
|
2784
2892
|
CreateFileUploadRequestSchema,
|
|
2785
2893
|
ConfirmFileUploadRequestSchema,
|
|
@@ -2799,7 +2907,7 @@ function createStorageMethods(client) {
|
|
|
2799
2907
|
return {
|
|
2800
2908
|
async createFileUpload(params) {
|
|
2801
2909
|
return client.createFileUpload(
|
|
2802
|
-
|
|
2910
|
+
create10(CreateFileUploadRequestSchema, {
|
|
2803
2911
|
filename: params.filename,
|
|
2804
2912
|
mimeType: params.mimeType,
|
|
2805
2913
|
size: BigInt(params.size),
|
|
@@ -2809,17 +2917,17 @@ function createStorageMethods(client) {
|
|
|
2809
2917
|
},
|
|
2810
2918
|
async confirmFileUpload(uploadId) {
|
|
2811
2919
|
const resp = await client.confirmFileUpload(
|
|
2812
|
-
|
|
2920
|
+
create10(ConfirmFileUploadRequestSchema, { uploadId })
|
|
2813
2921
|
);
|
|
2814
2922
|
return resp.file ?? null;
|
|
2815
2923
|
},
|
|
2816
2924
|
async getFile(id) {
|
|
2817
|
-
const resp = await client.getFile(
|
|
2925
|
+
const resp = await client.getFile(create10(GetFileRequestSchema, { id }));
|
|
2818
2926
|
return resp.file ?? null;
|
|
2819
2927
|
},
|
|
2820
2928
|
async listFiles(params) {
|
|
2821
2929
|
return client.listFiles(
|
|
2822
|
-
|
|
2930
|
+
create10(ListFilesRequestSchema, {
|
|
2823
2931
|
folder: params.folder,
|
|
2824
2932
|
mimeType: params.mimeType,
|
|
2825
2933
|
search: params.search,
|
|
@@ -2831,13 +2939,13 @@ function createStorageMethods(client) {
|
|
|
2831
2939
|
},
|
|
2832
2940
|
async getStorageUsage() {
|
|
2833
2941
|
const resp = await client.getStorageUsage(
|
|
2834
|
-
|
|
2942
|
+
create10(GetStorageUsageRequestSchema, {})
|
|
2835
2943
|
);
|
|
2836
2944
|
return resp.usage ?? null;
|
|
2837
2945
|
},
|
|
2838
2946
|
async updateFile(params) {
|
|
2839
2947
|
const resp = await client.updateFile(
|
|
2840
|
-
|
|
2948
|
+
create10(UpdateFileRequestSchema, {
|
|
2841
2949
|
id: params.id,
|
|
2842
2950
|
filename: params.filename,
|
|
2843
2951
|
folder: params.folder,
|
|
@@ -2848,7 +2956,7 @@ function createStorageMethods(client) {
|
|
|
2848
2956
|
},
|
|
2849
2957
|
async updateFileMetadata(params) {
|
|
2850
2958
|
const resp = await client.updateFileMetadata(
|
|
2851
|
-
|
|
2959
|
+
create10(UpdateFileMetadataRequestSchema, {
|
|
2852
2960
|
id: params.id,
|
|
2853
2961
|
altText: params.altText,
|
|
2854
2962
|
caption: params.caption,
|
|
@@ -2859,37 +2967,37 @@ function createStorageMethods(client) {
|
|
|
2859
2967
|
},
|
|
2860
2968
|
async deleteFile(id) {
|
|
2861
2969
|
const resp = await client.deleteFile(
|
|
2862
|
-
|
|
2970
|
+
create10(DeleteFileRequestSchema, { id })
|
|
2863
2971
|
);
|
|
2864
2972
|
return resp.success;
|
|
2865
2973
|
},
|
|
2866
2974
|
async permanentlyDeleteFile(id) {
|
|
2867
2975
|
const resp = await client.permanentlyDeleteFile(
|
|
2868
|
-
|
|
2976
|
+
create10(PermanentlyDeleteFileRequestSchema, { id })
|
|
2869
2977
|
);
|
|
2870
2978
|
return resp.success;
|
|
2871
2979
|
},
|
|
2872
2980
|
async restoreFile(id) {
|
|
2873
2981
|
const resp = await client.restoreFile(
|
|
2874
|
-
|
|
2982
|
+
create10(RestoreFileRequestSchema, { id })
|
|
2875
2983
|
);
|
|
2876
2984
|
return resp.file ?? null;
|
|
2877
2985
|
},
|
|
2878
2986
|
async trackFileUsage(fileId, entityType) {
|
|
2879
2987
|
const resp = await client.trackFileUsage(
|
|
2880
|
-
|
|
2988
|
+
create10(TrackFileUsageRequestSchema, { fileId, entityType })
|
|
2881
2989
|
);
|
|
2882
2990
|
return resp.file ?? null;
|
|
2883
2991
|
},
|
|
2884
2992
|
async removeFileUsage(fileId, entityType) {
|
|
2885
2993
|
const resp = await client.removeFileUsage(
|
|
2886
|
-
|
|
2994
|
+
create10(RemoveFileUsageRequestSchema, { fileId, entityType })
|
|
2887
2995
|
);
|
|
2888
2996
|
return resp.success;
|
|
2889
2997
|
},
|
|
2890
2998
|
async cleanupOrphanedFiles(params) {
|
|
2891
2999
|
return client.cleanupOrphanedFiles(
|
|
2892
|
-
|
|
3000
|
+
create10(CleanupOrphanedFilesRequestSchema, {
|
|
2893
3001
|
orphanThresholdDays: params?.orphanThresholdDays ?? 30,
|
|
2894
3002
|
dryRun: params?.dryRun ?? false,
|
|
2895
3003
|
limit: params?.limit ?? 100
|
|
@@ -2900,7 +3008,7 @@ function createStorageMethods(client) {
|
|
|
2900
3008
|
}
|
|
2901
3009
|
|
|
2902
3010
|
// src/lib/rpc/operations.ts
|
|
2903
|
-
import { create as
|
|
3011
|
+
import { create as create11 } from "@bufbuild/protobuf";
|
|
2904
3012
|
import {
|
|
2905
3013
|
ListOperationsRequestSchema as ListOperationsRequestSchema2,
|
|
2906
3014
|
GetOperationRequestSchema,
|
|
@@ -2918,7 +3026,7 @@ function createOperationsMethods(client) {
|
|
|
2918
3026
|
// ── CRUD ──────────────────────────────────────────────────
|
|
2919
3027
|
async listOperations(params = {}) {
|
|
2920
3028
|
return client.listOperations(
|
|
2921
|
-
|
|
3029
|
+
create11(ListOperationsRequestSchema2, {
|
|
2922
3030
|
configId: params.configId,
|
|
2923
3031
|
category: params.category,
|
|
2924
3032
|
isActive: params.isActive,
|
|
@@ -2930,7 +3038,7 @@ function createOperationsMethods(client) {
|
|
|
2930
3038
|
},
|
|
2931
3039
|
async getOperation(params) {
|
|
2932
3040
|
const resp = await client.getOperation(
|
|
2933
|
-
|
|
3041
|
+
create11(GetOperationRequestSchema, {
|
|
2934
3042
|
id: params.id ?? "",
|
|
2935
3043
|
key: params.key
|
|
2936
3044
|
})
|
|
@@ -2939,7 +3047,7 @@ function createOperationsMethods(client) {
|
|
|
2939
3047
|
},
|
|
2940
3048
|
async createOperation(params) {
|
|
2941
3049
|
const resp = await client.createOperation(
|
|
2942
|
-
|
|
3050
|
+
create11(CreateOperationRequestSchema, {
|
|
2943
3051
|
key: params.key,
|
|
2944
3052
|
name: params.name,
|
|
2945
3053
|
endpoint: params.endpoint,
|
|
@@ -2963,7 +3071,7 @@ function createOperationsMethods(client) {
|
|
|
2963
3071
|
},
|
|
2964
3072
|
async updateOperation(params) {
|
|
2965
3073
|
const resp = await client.updateOperation(
|
|
2966
|
-
|
|
3074
|
+
create11(UpdateOperationRequestSchema, {
|
|
2967
3075
|
id: params.id,
|
|
2968
3076
|
name: params.name,
|
|
2969
3077
|
description: params.description,
|
|
@@ -2984,20 +3092,20 @@ function createOperationsMethods(client) {
|
|
|
2984
3092
|
},
|
|
2985
3093
|
async deleteOperation(id) {
|
|
2986
3094
|
const resp = await client.deleteOperation(
|
|
2987
|
-
|
|
3095
|
+
create11(DeleteOperationRequestSchema, { id })
|
|
2988
3096
|
);
|
|
2989
3097
|
return resp.success;
|
|
2990
3098
|
},
|
|
2991
3099
|
async getSigningSecret() {
|
|
2992
3100
|
const resp = await client.getSigningSecret(
|
|
2993
|
-
|
|
3101
|
+
create11(GetSigningSecretRequestSchema, {})
|
|
2994
3102
|
);
|
|
2995
3103
|
return { secret: resp.secret, prefix: resp.prefix };
|
|
2996
3104
|
},
|
|
2997
3105
|
// ── Execution ─────────────────────────────────────────────
|
|
2998
3106
|
async executeOperation(params) {
|
|
2999
3107
|
return client.executeOperation(
|
|
3000
|
-
|
|
3108
|
+
create11(ExecuteOperationRequestSchema, {
|
|
3001
3109
|
operationKey: params.operationKey,
|
|
3002
3110
|
input: params.input,
|
|
3003
3111
|
triggerType: params.triggerType,
|
|
@@ -3008,7 +3116,7 @@ function createOperationsMethods(client) {
|
|
|
3008
3116
|
// ── Dead Letter Queue ─────────────────────────────────────
|
|
3009
3117
|
async listDeadLetterEntries(params = {}) {
|
|
3010
3118
|
return client.listDeadLetterEntries(
|
|
3011
|
-
|
|
3119
|
+
create11(ListDeadLetterEntriesRequestSchema, {
|
|
3012
3120
|
operationKey: params.operationKey,
|
|
3013
3121
|
limit: params.limit ?? 50,
|
|
3014
3122
|
offset: params.offset ?? 0
|
|
@@ -3017,13 +3125,13 @@ function createOperationsMethods(client) {
|
|
|
3017
3125
|
},
|
|
3018
3126
|
async retryDeadLetterEntry(id) {
|
|
3019
3127
|
const resp = await client.retryDeadLetterEntry(
|
|
3020
|
-
|
|
3128
|
+
create11(RetryDeadLetterEntryRequestSchema, { id })
|
|
3021
3129
|
);
|
|
3022
3130
|
return resp.success;
|
|
3023
3131
|
},
|
|
3024
3132
|
async dismissDeadLetterEntry(id) {
|
|
3025
3133
|
const resp = await client.dismissDeadLetterEntry(
|
|
3026
|
-
|
|
3134
|
+
create11(DismissDeadLetterEntryRequestSchema, { id })
|
|
3027
3135
|
);
|
|
3028
3136
|
return resp.success;
|
|
3029
3137
|
}
|
|
@@ -3031,7 +3139,7 @@ function createOperationsMethods(client) {
|
|
|
3031
3139
|
}
|
|
3032
3140
|
|
|
3033
3141
|
// src/lib/rpc/hooks.ts
|
|
3034
|
-
import { create as
|
|
3142
|
+
import { create as create12 } from "@bufbuild/protobuf";
|
|
3035
3143
|
import {
|
|
3036
3144
|
ListHooksRequestSchema,
|
|
3037
3145
|
GetHookRequestSchema,
|
|
@@ -3048,7 +3156,7 @@ function createHooksMethods(client) {
|
|
|
3048
3156
|
// ── Queries ──────────────────────────────────────────────
|
|
3049
3157
|
async listHooks(params = {}) {
|
|
3050
3158
|
return client.listHooks(
|
|
3051
|
-
|
|
3159
|
+
create12(ListHooksRequestSchema, {
|
|
3052
3160
|
event: params.event,
|
|
3053
3161
|
isActive: params.isActive,
|
|
3054
3162
|
configId: params.configId,
|
|
@@ -3058,13 +3166,13 @@ function createHooksMethods(client) {
|
|
|
3058
3166
|
);
|
|
3059
3167
|
},
|
|
3060
3168
|
async getHook(id) {
|
|
3061
|
-
const resp = await client.getHook(
|
|
3169
|
+
const resp = await client.getHook(create12(GetHookRequestSchema, { id }));
|
|
3062
3170
|
return resp.hook ?? null;
|
|
3063
3171
|
},
|
|
3064
3172
|
// ── Mutations ────────────────────────────────────────────
|
|
3065
3173
|
async createHook(params) {
|
|
3066
3174
|
const resp = await client.createHook(
|
|
3067
|
-
|
|
3175
|
+
create12(CreateHookRequestSchema, {
|
|
3068
3176
|
key: params.key,
|
|
3069
3177
|
name: params.name,
|
|
3070
3178
|
event: params.event,
|
|
@@ -3080,7 +3188,7 @@ function createHooksMethods(client) {
|
|
|
3080
3188
|
},
|
|
3081
3189
|
async updateHook(params) {
|
|
3082
3190
|
const resp = await client.updateHook(
|
|
3083
|
-
|
|
3191
|
+
create12(UpdateHookRequestSchema, {
|
|
3084
3192
|
id: params.id,
|
|
3085
3193
|
name: params.name,
|
|
3086
3194
|
description: params.description,
|
|
@@ -3094,21 +3202,21 @@ function createHooksMethods(client) {
|
|
|
3094
3202
|
},
|
|
3095
3203
|
async deleteHook(id) {
|
|
3096
3204
|
const resp = await client.deleteHook(
|
|
3097
|
-
|
|
3205
|
+
create12(DeleteHookRequestSchema, { id })
|
|
3098
3206
|
);
|
|
3099
3207
|
return resp.success;
|
|
3100
3208
|
},
|
|
3101
3209
|
// ── Get by Key ──────────────────────────────────────────
|
|
3102
3210
|
async getHookByKey(key) {
|
|
3103
3211
|
const resp = await client.getHookByKey(
|
|
3104
|
-
|
|
3212
|
+
create12(GetHookByKeyRequestSchema, { key })
|
|
3105
3213
|
);
|
|
3106
3214
|
return resp.hook ?? null;
|
|
3107
3215
|
},
|
|
3108
3216
|
// ── Deliveries ──────────────────────────────────────────
|
|
3109
3217
|
async listHookDeliveries(params) {
|
|
3110
3218
|
return client.listHookDeliveries(
|
|
3111
|
-
|
|
3219
|
+
create12(ListHookDeliveriesRequestSchema, {
|
|
3112
3220
|
hookId: params.hookId,
|
|
3113
3221
|
status: params.status,
|
|
3114
3222
|
limit: params.limit ?? 50,
|
|
@@ -3118,14 +3226,14 @@ function createHooksMethods(client) {
|
|
|
3118
3226
|
},
|
|
3119
3227
|
async retryHookDelivery(deliveryId) {
|
|
3120
3228
|
const resp = await client.retryHookDelivery(
|
|
3121
|
-
|
|
3229
|
+
create12(RetryHookDeliveryRequestSchema, { deliveryId })
|
|
3122
3230
|
);
|
|
3123
3231
|
return resp.success;
|
|
3124
3232
|
},
|
|
3125
3233
|
// ── Testing ─────────────────────────────────────────────
|
|
3126
3234
|
async testHook(params) {
|
|
3127
3235
|
const resp = await client.testHook(
|
|
3128
|
-
|
|
3236
|
+
create12(TestHookRequestSchema, {
|
|
3129
3237
|
hookId: params.hookId,
|
|
3130
3238
|
testPayload: params.testPayload
|
|
3131
3239
|
})
|
|
@@ -3139,7 +3247,7 @@ function createHooksMethods(client) {
|
|
|
3139
3247
|
}
|
|
3140
3248
|
|
|
3141
3249
|
// src/lib/rpc/notifications.ts
|
|
3142
|
-
import { create as
|
|
3250
|
+
import { create as create13 } from "@bufbuild/protobuf";
|
|
3143
3251
|
import {
|
|
3144
3252
|
ListNotificationsRequestSchema,
|
|
3145
3253
|
MarkNotificationReadRequestSchema,
|
|
@@ -3149,7 +3257,7 @@ function createNotificationsMethods(client) {
|
|
|
3149
3257
|
return {
|
|
3150
3258
|
async listNotifications(params = {}) {
|
|
3151
3259
|
return client.listNotifications(
|
|
3152
|
-
|
|
3260
|
+
create13(ListNotificationsRequestSchema, {
|
|
3153
3261
|
isRead: params.unreadOnly ? false : void 0,
|
|
3154
3262
|
limit: params.limit ?? 20,
|
|
3155
3263
|
offset: params.offset ?? 0
|
|
@@ -3158,13 +3266,13 @@ function createNotificationsMethods(client) {
|
|
|
3158
3266
|
},
|
|
3159
3267
|
async markNotificationRead(id) {
|
|
3160
3268
|
const resp = await client.markNotificationRead(
|
|
3161
|
-
|
|
3269
|
+
create13(MarkNotificationReadRequestSchema, { id })
|
|
3162
3270
|
);
|
|
3163
3271
|
return resp.success;
|
|
3164
3272
|
},
|
|
3165
3273
|
async markAllNotificationsRead() {
|
|
3166
3274
|
const resp = await client.markAllNotificationsRead(
|
|
3167
|
-
|
|
3275
|
+
create13(MarkAllNotificationsReadRequestSchema, {})
|
|
3168
3276
|
);
|
|
3169
3277
|
return resp.count;
|
|
3170
3278
|
}
|
|
@@ -3172,7 +3280,7 @@ function createNotificationsMethods(client) {
|
|
|
3172
3280
|
}
|
|
3173
3281
|
|
|
3174
3282
|
// src/lib/rpc/cron-schedules.ts
|
|
3175
|
-
import { create as
|
|
3283
|
+
import { create as create14 } from "@bufbuild/protobuf";
|
|
3176
3284
|
import {
|
|
3177
3285
|
ListCronSchedulesRequestSchema,
|
|
3178
3286
|
GetCronScheduleRequestSchema,
|
|
@@ -3189,7 +3297,7 @@ function createCronSchedulesMethods(client) {
|
|
|
3189
3297
|
// ── Queries ──────────────────────────────────────────────
|
|
3190
3298
|
async listCronSchedules(params = {}) {
|
|
3191
3299
|
return client.listCronSchedules(
|
|
3192
|
-
|
|
3300
|
+
create14(ListCronSchedulesRequestSchema, {
|
|
3193
3301
|
configId: params.configId,
|
|
3194
3302
|
isActive: params.isActive,
|
|
3195
3303
|
limit: params.limit ?? 50,
|
|
@@ -3199,36 +3307,34 @@ function createCronSchedulesMethods(client) {
|
|
|
3199
3307
|
},
|
|
3200
3308
|
async getCronSchedule(id) {
|
|
3201
3309
|
const resp = await client.getCronSchedule(
|
|
3202
|
-
|
|
3310
|
+
create14(GetCronScheduleRequestSchema, { id })
|
|
3203
3311
|
);
|
|
3204
3312
|
return resp.schedule ?? null;
|
|
3205
3313
|
},
|
|
3206
3314
|
async getCronScheduleByKey(key) {
|
|
3207
3315
|
const resp = await client.getCronScheduleByKey(
|
|
3208
|
-
|
|
3316
|
+
create14(GetCronScheduleByKeyRequestSchema, { key })
|
|
3209
3317
|
);
|
|
3210
3318
|
return resp.schedule ?? null;
|
|
3211
3319
|
},
|
|
3212
3320
|
// ── Mutations ────────────────────────────────────────────
|
|
3213
3321
|
async createCronSchedule(params) {
|
|
3214
3322
|
const resp = await client.createCronSchedule(
|
|
3215
|
-
|
|
3323
|
+
create14(CreateCronScheduleRequestSchema, {
|
|
3216
3324
|
key: params.key,
|
|
3217
3325
|
name: params.name,
|
|
3218
3326
|
description: params.description,
|
|
3219
3327
|
cron: params.cron,
|
|
3220
3328
|
timezone: params.timezone,
|
|
3221
3329
|
operationKey: params.operationKey,
|
|
3222
|
-
configId: params.configId
|
|
3223
|
-
targetType: params.targetType,
|
|
3224
|
-
targetConfig: params.targetConfig
|
|
3330
|
+
configId: params.configId
|
|
3225
3331
|
})
|
|
3226
3332
|
);
|
|
3227
3333
|
return resp.schedule ?? null;
|
|
3228
3334
|
},
|
|
3229
3335
|
async updateCronSchedule(params) {
|
|
3230
3336
|
const resp = await client.updateCronSchedule(
|
|
3231
|
-
|
|
3337
|
+
create14(UpdateCronScheduleRequestSchema, {
|
|
3232
3338
|
id: params.id,
|
|
3233
3339
|
name: params.name,
|
|
3234
3340
|
description: params.description,
|
|
@@ -3242,25 +3348,25 @@ function createCronSchedulesMethods(client) {
|
|
|
3242
3348
|
},
|
|
3243
3349
|
async deleteCronSchedule(id) {
|
|
3244
3350
|
const resp = await client.deleteCronSchedule(
|
|
3245
|
-
|
|
3351
|
+
create14(DeleteCronScheduleRequestSchema, { id })
|
|
3246
3352
|
);
|
|
3247
3353
|
return resp.success;
|
|
3248
3354
|
},
|
|
3249
3355
|
async pauseCronSchedule(params) {
|
|
3250
3356
|
const resp = await client.pauseCronSchedule(
|
|
3251
|
-
|
|
3357
|
+
create14(PauseCronScheduleRequestSchema, { id: params.id })
|
|
3252
3358
|
);
|
|
3253
3359
|
return resp.schedule ?? null;
|
|
3254
3360
|
},
|
|
3255
3361
|
async resumeCronSchedule(params) {
|
|
3256
3362
|
const resp = await client.resumeCronSchedule(
|
|
3257
|
-
|
|
3363
|
+
create14(ResumeCronScheduleRequestSchema, { id: params.id })
|
|
3258
3364
|
);
|
|
3259
3365
|
return resp.schedule ?? null;
|
|
3260
3366
|
},
|
|
3261
3367
|
async triggerCronSchedule(params) {
|
|
3262
3368
|
const resp = await client.triggerCronSchedule(
|
|
3263
|
-
|
|
3369
|
+
create14(TriggerCronScheduleRequestSchema, { id: params.id })
|
|
3264
3370
|
);
|
|
3265
3371
|
return resp.schedule ?? null;
|
|
3266
3372
|
}
|
|
@@ -3328,7 +3434,8 @@ async function createPlatformClient(options) {
|
|
|
3328
3434
|
),
|
|
3329
3435
|
integrations: createIntegrationsMethods(
|
|
3330
3436
|
createRpcClient(IntegrationsService2, transport)
|
|
3331
|
-
)
|
|
3437
|
+
),
|
|
3438
|
+
apps: createAppsMethods(createRpcClient(AppsService2, transport))
|
|
3332
3439
|
};
|
|
3333
3440
|
}
|
|
3334
3441
|
function createPlatformClientWithHeaders(apiUrl, headers) {
|
|
@@ -3366,7 +3473,8 @@ function createPlatformClientWithHeaders(apiUrl, headers) {
|
|
|
3366
3473
|
),
|
|
3367
3474
|
integrations: createIntegrationsMethods(
|
|
3368
3475
|
createRpcClient(IntegrationsService2, transport)
|
|
3369
|
-
)
|
|
3476
|
+
),
|
|
3477
|
+
apps: createAppsMethods(createRpcClient(AppsService2, transport))
|
|
3370
3478
|
};
|
|
3371
3479
|
}
|
|
3372
3480
|
async function getStorageAuth(options) {
|
|
@@ -3648,6 +3756,9 @@ function success(message, data) {
|
|
|
3648
3756
|
}
|
|
3649
3757
|
console.log(chalk2.green(`\u2713 ${interpolated}`));
|
|
3650
3758
|
}
|
|
3759
|
+
function warn(message) {
|
|
3760
|
+
console.log(chalk2.yellow(`\u26A0 ${message}`));
|
|
3761
|
+
}
|
|
3651
3762
|
|
|
3652
3763
|
// src/commands/whoami.ts
|
|
3653
3764
|
function registerWhoamiCommand(program2, globalOpts) {
|
|
@@ -4880,7 +4991,7 @@ import { resolve as resolve4 } from "path";
|
|
|
4880
4991
|
function zeroCounts() {
|
|
4881
4992
|
return { created: 0, updated: 0, deleted: 0 };
|
|
4882
4993
|
}
|
|
4883
|
-
async function reconcileConfig(client, configId, manifest) {
|
|
4994
|
+
async function reconcileConfig(client, configId, manifest, options = {}) {
|
|
4884
4995
|
const summary = {
|
|
4885
4996
|
models: zeroCounts(),
|
|
4886
4997
|
operations: zeroCounts(),
|
|
@@ -4890,7 +5001,8 @@ async function reconcileConfig(client, configId, manifest) {
|
|
|
4890
5001
|
authProviders: zeroCounts(),
|
|
4891
5002
|
placementsUpdated: false,
|
|
4892
5003
|
profileSchemaUpdated: false,
|
|
4893
|
-
apiKeys: []
|
|
5004
|
+
apiKeys: [],
|
|
5005
|
+
apps: zeroCounts()
|
|
4894
5006
|
};
|
|
4895
5007
|
const operationBaseUrl = manifest.operationBaseUrl ?? "";
|
|
4896
5008
|
await reconcileModels(client, configId, manifest.models ?? [], summary);
|
|
@@ -4901,7 +5013,20 @@ async function reconcileConfig(client, configId, manifest) {
|
|
|
4901
5013
|
await reconcileAuthProviders(client, manifest.authProviders ?? [], summary);
|
|
4902
5014
|
await reconcilePlacements(client, configId, manifest.placements ?? [], summary);
|
|
4903
5015
|
await reconcileProfileSchema(client, manifest, summary);
|
|
4904
|
-
await reconcileApiKeys(
|
|
5016
|
+
await reconcileApiKeys(
|
|
5017
|
+
client,
|
|
5018
|
+
manifest.key,
|
|
5019
|
+
manifest.apiKeys ?? [],
|
|
5020
|
+
summary,
|
|
5021
|
+
options.rotateKeys ?? false
|
|
5022
|
+
);
|
|
5023
|
+
await reconcileApps(
|
|
5024
|
+
client,
|
|
5025
|
+
options.tenantId,
|
|
5026
|
+
options.projectId,
|
|
5027
|
+
manifest.apps ?? {},
|
|
5028
|
+
summary
|
|
5029
|
+
);
|
|
4905
5030
|
return summary;
|
|
4906
5031
|
}
|
|
4907
5032
|
async function reconcileModels(client, configId, models, summary) {
|
|
@@ -5242,7 +5367,7 @@ async function reconcileProfileSchema(client, manifest, summary) {
|
|
|
5242
5367
|
});
|
|
5243
5368
|
summary.profileSchemaUpdated = true;
|
|
5244
5369
|
}
|
|
5245
|
-
async function reconcileApiKeys(client, configKey, apiKeys, summary) {
|
|
5370
|
+
async function reconcileApiKeys(client, configKey, apiKeys, summary, rotateKeys) {
|
|
5246
5371
|
if (apiKeys.length === 0) return;
|
|
5247
5372
|
const existing = await client.identity.listApiKeys({ limit: 200 });
|
|
5248
5373
|
const existingByName = new Map(
|
|
@@ -5264,8 +5389,10 @@ async function reconcileApiKeys(client, configKey, apiKeys, summary) {
|
|
|
5264
5389
|
updateScopes: true
|
|
5265
5390
|
});
|
|
5266
5391
|
}
|
|
5267
|
-
|
|
5268
|
-
|
|
5392
|
+
if (rotateKeys) {
|
|
5393
|
+
const rotated = await client.identity.rotateApiKey(existingKey.id);
|
|
5394
|
+
rawKey = rotated?.apiKey?.rawKey;
|
|
5395
|
+
}
|
|
5269
5396
|
} else {
|
|
5270
5397
|
const result = await client.identity.createApiKey({
|
|
5271
5398
|
name: key.name,
|
|
@@ -5301,6 +5428,111 @@ async function reconcileApiKeys(client, configKey, apiKeys, summary) {
|
|
|
5301
5428
|
}
|
|
5302
5429
|
}
|
|
5303
5430
|
}
|
|
5431
|
+
async function reconcileApps(client, tenantId, projectId, apps, summary) {
|
|
5432
|
+
const entries = Object.entries(apps);
|
|
5433
|
+
if (entries.length === 0) return;
|
|
5434
|
+
if (!tenantId || !projectId) {
|
|
5435
|
+
console.warn(
|
|
5436
|
+
"Warning: apps declared in foir.config.ts but tenant/project context not supplied; skipping apps reconcile."
|
|
5437
|
+
);
|
|
5438
|
+
return;
|
|
5439
|
+
}
|
|
5440
|
+
const existingList = await client.apps.listApps(tenantId, projectId);
|
|
5441
|
+
const existingByName = new Map(existingList.map((a) => [a.name, a]));
|
|
5442
|
+
for (const [name, input] of entries) {
|
|
5443
|
+
const existing = existingByName.get(name);
|
|
5444
|
+
if (!existing) {
|
|
5445
|
+
await installApp(client, tenantId, projectId, name, input);
|
|
5446
|
+
summary.apps.created += 1;
|
|
5447
|
+
continue;
|
|
5448
|
+
}
|
|
5449
|
+
if (existing.manifestUrl !== input.source) {
|
|
5450
|
+
console.warn(
|
|
5451
|
+
`Warning: app "${name}" installed from ${existing.manifestUrl} but config declares ${input.source}; skipping. Uninstall explicitly (\`foir apps uninstall ${name}\`) and re-push to change sources.`
|
|
5452
|
+
);
|
|
5453
|
+
continue;
|
|
5454
|
+
}
|
|
5455
|
+
await client.apps.setAppMapping({
|
|
5456
|
+
tenantId,
|
|
5457
|
+
projectId,
|
|
5458
|
+
name,
|
|
5459
|
+
sourceMappings: toSourceMappings(input.mappings?.sources ?? {}),
|
|
5460
|
+
sinkMappings: toSinkMappings(input.mappings?.sinks ?? {}),
|
|
5461
|
+
placementFieldChoices: toPlacementFieldChoices(
|
|
5462
|
+
input.mappings?.placementFields ?? {}
|
|
5463
|
+
)
|
|
5464
|
+
});
|
|
5465
|
+
summary.apps.updated += 1;
|
|
5466
|
+
}
|
|
5467
|
+
}
|
|
5468
|
+
async function installApp(client, tenantId, projectId, name, input) {
|
|
5469
|
+
const installResp = await client.apps.installApp(
|
|
5470
|
+
tenantId,
|
|
5471
|
+
projectId,
|
|
5472
|
+
input.source
|
|
5473
|
+
);
|
|
5474
|
+
const previewName = installResp.preview?.manifest?.name ?? name;
|
|
5475
|
+
if (previewName !== name) {
|
|
5476
|
+
throw new Error(
|
|
5477
|
+
`apps.${name}: manifest declares name "${previewName}"; config key must match the manifest name.`
|
|
5478
|
+
);
|
|
5479
|
+
}
|
|
5480
|
+
const missing = [];
|
|
5481
|
+
for (const needed of installResp.preview?.sourceTypesToMap ?? []) {
|
|
5482
|
+
if (!(input.mappings?.sources ?? {})[needed]) missing.push(`source ${needed}`);
|
|
5483
|
+
}
|
|
5484
|
+
for (const needed of installResp.preview?.sinkContractsToMap ?? []) {
|
|
5485
|
+
if (!(input.mappings?.sinks ?? {})[needed]) missing.push(`sink ${needed}`);
|
|
5486
|
+
}
|
|
5487
|
+
for (const needed of installResp.preview?.placementsRequiringFieldChoice ?? []) {
|
|
5488
|
+
if (!(input.mappings?.placementFields ?? {})[needed]) {
|
|
5489
|
+
missing.push(`placement-field ${needed}`);
|
|
5490
|
+
}
|
|
5491
|
+
}
|
|
5492
|
+
if (missing.length > 0) {
|
|
5493
|
+
throw new Error(
|
|
5494
|
+
`apps.${name}: missing mappings in foir.config.ts: ${missing.join(", ")}`
|
|
5495
|
+
);
|
|
5496
|
+
}
|
|
5497
|
+
await client.apps.confirmInstallApp({
|
|
5498
|
+
installTicket: installResp.installTicket,
|
|
5499
|
+
sourceMappings: toSourceMappings(input.mappings?.sources ?? {}),
|
|
5500
|
+
sinkMappings: toSinkMappings(input.mappings?.sinks ?? {}),
|
|
5501
|
+
settings: input.settings,
|
|
5502
|
+
placementFieldChoices: toPlacementFieldChoices(
|
|
5503
|
+
input.mappings?.placementFields ?? {}
|
|
5504
|
+
)
|
|
5505
|
+
});
|
|
5506
|
+
}
|
|
5507
|
+
function toSourceMappings(input) {
|
|
5508
|
+
const out = {};
|
|
5509
|
+
for (const [k, v] of Object.entries(input)) {
|
|
5510
|
+
out[k] = {
|
|
5511
|
+
toModel: v.toModel,
|
|
5512
|
+
naturalKey: v.naturalKey,
|
|
5513
|
+
fields: v.fields
|
|
5514
|
+
};
|
|
5515
|
+
}
|
|
5516
|
+
return out;
|
|
5517
|
+
}
|
|
5518
|
+
function toSinkMappings(input) {
|
|
5519
|
+
const out = {};
|
|
5520
|
+
for (const [k, v] of Object.entries(input)) {
|
|
5521
|
+
out[k] = {
|
|
5522
|
+
toModel: v.toModel,
|
|
5523
|
+
naturalKey: v.naturalKey,
|
|
5524
|
+
fields: v.fields
|
|
5525
|
+
};
|
|
5526
|
+
}
|
|
5527
|
+
return out;
|
|
5528
|
+
}
|
|
5529
|
+
function toPlacementFieldChoices(input) {
|
|
5530
|
+
const out = {};
|
|
5531
|
+
for (const [k, v] of Object.entries(input)) {
|
|
5532
|
+
out[k] = { model: v.model, field: v.field };
|
|
5533
|
+
}
|
|
5534
|
+
return out;
|
|
5535
|
+
}
|
|
5304
5536
|
|
|
5305
5537
|
// src/lib/validate-integrations.ts
|
|
5306
5538
|
import { fromJson as fromJson3 } from "@bufbuild/protobuf";
|
|
@@ -5603,23 +5835,6 @@ function syncEnvVar(envPath, key, value) {
|
|
|
5603
5835
|
`, "utf-8");
|
|
5604
5836
|
return "written";
|
|
5605
5837
|
}
|
|
5606
|
-
function writeEnvVar(envPath, key, value) {
|
|
5607
|
-
let content = "";
|
|
5608
|
-
if (existsSync4(envPath)) {
|
|
5609
|
-
content = readFileSync(envPath, "utf-8");
|
|
5610
|
-
const regex = new RegExp(`^${key}=`, "m");
|
|
5611
|
-
if (regex.test(content)) {
|
|
5612
|
-
return false;
|
|
5613
|
-
}
|
|
5614
|
-
}
|
|
5615
|
-
if (content && !content.endsWith("\n")) {
|
|
5616
|
-
content += "\n";
|
|
5617
|
-
}
|
|
5618
|
-
content += `${key}=${value}
|
|
5619
|
-
`;
|
|
5620
|
-
writeFileSync2(envPath, content, "utf-8");
|
|
5621
|
-
return true;
|
|
5622
|
-
}
|
|
5623
5838
|
function printSummary(summary) {
|
|
5624
5839
|
const lines = [];
|
|
5625
5840
|
const fmt = (label, c) => {
|
|
@@ -5645,7 +5860,11 @@ function printSummary(summary) {
|
|
|
5645
5860
|
}
|
|
5646
5861
|
}
|
|
5647
5862
|
function registerPushCommand(program2, globalOpts) {
|
|
5648
|
-
program2.command("push").description("Push foir.config.ts to the platform").option("--config <path>", "Path to config file (default: auto-discover)").option("--force", "Force reinstall (delete and recreate)", false).option(
|
|
5863
|
+
program2.command("push").description("Push foir.config.ts to the platform").option("--config <path>", "Path to config file (default: auto-discover)").option("--force", "Force reinstall (delete and recreate)", false).option(
|
|
5864
|
+
"--rotate-keys",
|
|
5865
|
+
"Rotate existing API keys and rewrite their values in .env",
|
|
5866
|
+
false
|
|
5867
|
+
).option("--env <path>", "Path to .env file (default: .env)").action(
|
|
5649
5868
|
withErrorHandler(
|
|
5650
5869
|
globalOpts,
|
|
5651
5870
|
async (opts) => {
|
|
@@ -5670,7 +5889,9 @@ function registerPushCommand(program2, globalOpts) {
|
|
|
5670
5889
|
console.log(chalk6.yellow(`\u26A0 ${warning}`));
|
|
5671
5890
|
}
|
|
5672
5891
|
assertValid(validation);
|
|
5673
|
-
const
|
|
5892
|
+
const gOpts = globalOpts();
|
|
5893
|
+
const client = await createPlatformClient(gOpts);
|
|
5894
|
+
const resolved = await resolveProjectContext(gOpts);
|
|
5674
5895
|
console.log(
|
|
5675
5896
|
chalk6.dim(`Pushing config "${config2.key}" to platform...`)
|
|
5676
5897
|
);
|
|
@@ -5685,7 +5906,11 @@ function registerPushCommand(program2, globalOpts) {
|
|
|
5685
5906
|
}
|
|
5686
5907
|
const configId = applyResult.id;
|
|
5687
5908
|
console.log(chalk6.dim("Reconciling resources..."));
|
|
5688
|
-
const summary = await reconcileConfig(client, configId, config2
|
|
5909
|
+
const summary = await reconcileConfig(client, configId, config2, {
|
|
5910
|
+
rotateKeys: opts.rotateKeys ?? false,
|
|
5911
|
+
tenantId: resolved?.project.tenantId,
|
|
5912
|
+
projectId: resolved?.project.id
|
|
5913
|
+
});
|
|
5689
5914
|
console.log();
|
|
5690
5915
|
console.log(chalk6.green("\u2713 Config applied successfully"));
|
|
5691
5916
|
console.log(` Config ID: ${chalk6.cyan(configId)}`);
|
|
@@ -5724,14 +5949,18 @@ function registerPushCommand(program2, globalOpts) {
|
|
|
5724
5949
|
if (envWrites.length > 0) {
|
|
5725
5950
|
console.log();
|
|
5726
5951
|
for (const { key, value, label } of envWrites) {
|
|
5727
|
-
const
|
|
5728
|
-
if (
|
|
5952
|
+
const result = syncEnvVar(envPath, key, value);
|
|
5953
|
+
if (result === "unchanged") {
|
|
5729
5954
|
console.log(
|
|
5730
|
-
chalk6.
|
|
5955
|
+
chalk6.dim(` ${label}: ${key} already up to date in ${envPath}, skipped`)
|
|
5956
|
+
);
|
|
5957
|
+
} else if (result === "replaced") {
|
|
5958
|
+
console.log(
|
|
5959
|
+
chalk6.yellow(`\u27F3 ${label}`) + chalk6.dim(` \u2192 ${key} updated in ${envPath}`)
|
|
5731
5960
|
);
|
|
5732
5961
|
} else {
|
|
5733
5962
|
console.log(
|
|
5734
|
-
chalk6.
|
|
5963
|
+
chalk6.green(`\u2713 ${label}`) + chalk6.dim(` \u2192 ${key} written to ${envPath}`)
|
|
5735
5964
|
);
|
|
5736
5965
|
}
|
|
5737
5966
|
}
|
|
@@ -5788,8 +6017,10 @@ function registerPullCommand(program2, globalOpts) {
|
|
|
5788
6017
|
const resolved = await resolveProjectContext(globalOpts());
|
|
5789
6018
|
let integrations;
|
|
5790
6019
|
let extensions;
|
|
6020
|
+
let apps;
|
|
5791
6021
|
if (resolved) {
|
|
5792
6022
|
const projectId = resolved.project.id;
|
|
6023
|
+
const tenantId = resolved.project.tenantId;
|
|
5793
6024
|
const protoIntegrations = await client.integrations.listIntegrations(projectId);
|
|
5794
6025
|
if (protoIntegrations.length > 0) {
|
|
5795
6026
|
integrations = {};
|
|
@@ -5804,10 +6035,18 @@ function registerPullCommand(program2, globalOpts) {
|
|
|
5804
6035
|
extensions[cfg.name] = extensionConfigToInput(cfg);
|
|
5805
6036
|
}
|
|
5806
6037
|
}
|
|
6038
|
+
const installedApps = await client.apps.listApps(tenantId, projectId);
|
|
6039
|
+
if (installedApps.length > 0) {
|
|
6040
|
+
apps = {};
|
|
6041
|
+
for (const a of installedApps) {
|
|
6042
|
+
apps[a.name] = appToInput(a);
|
|
6043
|
+
}
|
|
6044
|
+
}
|
|
5807
6045
|
}
|
|
5808
6046
|
const configDataNoInteg = { ...configData };
|
|
5809
6047
|
delete configDataNoInteg.integrations;
|
|
5810
6048
|
delete configDataNoInteg.extensions;
|
|
6049
|
+
delete configDataNoInteg.apps;
|
|
5811
6050
|
const manifest = {
|
|
5812
6051
|
key: config2.key,
|
|
5813
6052
|
name: config2.name,
|
|
@@ -5817,7 +6056,8 @@ function registerPullCommand(program2, globalOpts) {
|
|
|
5817
6056
|
...config2.connectionDomain ? { operationBaseUrl: config2.connectionDomain } : {},
|
|
5818
6057
|
...configDataNoInteg,
|
|
5819
6058
|
...integrations ? { integrations } : {},
|
|
5820
|
-
...extensions ? { extensions } : {}
|
|
6059
|
+
...extensions ? { extensions } : {},
|
|
6060
|
+
...apps ? { apps } : {}
|
|
5821
6061
|
};
|
|
5822
6062
|
delete manifest.force;
|
|
5823
6063
|
const jsonContent = JSON.stringify(manifest, null, 2);
|
|
@@ -5870,6 +6110,9 @@ export default defineConfig(${jsonContent});
|
|
|
5870
6110
|
if (extensions && Object.keys(extensions).length > 0) {
|
|
5871
6111
|
parts.push(`${Object.keys(extensions).length} extension(s)`);
|
|
5872
6112
|
}
|
|
6113
|
+
if (apps) {
|
|
6114
|
+
parts.push(`${Object.keys(apps).length} app(s)`);
|
|
6115
|
+
}
|
|
5873
6116
|
if (parts.length > 0) {
|
|
5874
6117
|
console.log(chalk7.dim(` Contains: ${parts.join(", ")}`));
|
|
5875
6118
|
}
|
|
@@ -5877,6 +6120,25 @@ export default defineConfig(${jsonContent});
|
|
|
5877
6120
|
)
|
|
5878
6121
|
);
|
|
5879
6122
|
}
|
|
6123
|
+
function appToInput(a) {
|
|
6124
|
+
const mappingsBlob = a.mappings ?? {};
|
|
6125
|
+
const out = { source: a.manifestUrl };
|
|
6126
|
+
const settingsObj = a.settings;
|
|
6127
|
+
if (settingsObj && Object.keys(settingsObj).length > 0) {
|
|
6128
|
+
out.settings = settingsObj;
|
|
6129
|
+
}
|
|
6130
|
+
const sources = mappingsBlob.sources;
|
|
6131
|
+
const sinks = mappingsBlob.sinks;
|
|
6132
|
+
const placementFields = mappingsBlob.placement_fields;
|
|
6133
|
+
if (sources && Object.keys(sources).length > 0 || sinks && Object.keys(sinks).length > 0 || placementFields && Object.keys(placementFields).length > 0) {
|
|
6134
|
+
out.mappings = {
|
|
6135
|
+
...sources ? { sources } : {},
|
|
6136
|
+
...sinks ? { sinks } : {},
|
|
6137
|
+
...placementFields ? { placementFields } : {}
|
|
6138
|
+
};
|
|
6139
|
+
}
|
|
6140
|
+
return out;
|
|
6141
|
+
}
|
|
5880
6142
|
|
|
5881
6143
|
// src/commands/remove.ts
|
|
5882
6144
|
import chalk8 from "chalk";
|
|
@@ -8252,6 +8514,260 @@ function registerConfigsCommands(program2, globalOpts) {
|
|
|
8252
8514
|
);
|
|
8253
8515
|
}
|
|
8254
8516
|
|
|
8517
|
+
// src/commands/apps.ts
|
|
8518
|
+
function registerAppsCommands(program2, globalOpts) {
|
|
8519
|
+
const apps = program2.command("apps").description("Install and manage apps");
|
|
8520
|
+
apps.command("list").description("List installed apps").action(
|
|
8521
|
+
withErrorHandler(globalOpts, async () => {
|
|
8522
|
+
const opts = globalOpts();
|
|
8523
|
+
const resolved = await requireProject(opts);
|
|
8524
|
+
const client = await createPlatformClient(opts);
|
|
8525
|
+
const apps2 = await client.apps.listApps(
|
|
8526
|
+
resolved.project.tenantId,
|
|
8527
|
+
resolved.project.id
|
|
8528
|
+
);
|
|
8529
|
+
formatList(apps2, opts, {
|
|
8530
|
+
columns: [
|
|
8531
|
+
{ key: "name", header: "Name", width: 24 },
|
|
8532
|
+
{
|
|
8533
|
+
key: "manifest",
|
|
8534
|
+
header: "Version",
|
|
8535
|
+
width: 10,
|
|
8536
|
+
format: (v) => v?.version ?? ""
|
|
8537
|
+
},
|
|
8538
|
+
{ key: "manifestUrl", header: "Manifest URL", width: 40 },
|
|
8539
|
+
{
|
|
8540
|
+
key: "installedAt",
|
|
8541
|
+
header: "Installed",
|
|
8542
|
+
width: 12,
|
|
8543
|
+
format: (v) => {
|
|
8544
|
+
const ts = v;
|
|
8545
|
+
if (!ts?.seconds) return "";
|
|
8546
|
+
return new Date(Number(ts.seconds) * 1e3).toLocaleDateString();
|
|
8547
|
+
}
|
|
8548
|
+
}
|
|
8549
|
+
]
|
|
8550
|
+
});
|
|
8551
|
+
})
|
|
8552
|
+
);
|
|
8553
|
+
apps.command("get <name>").description("Get an installed app by name").action(
|
|
8554
|
+
withErrorHandler(globalOpts, async (name) => {
|
|
8555
|
+
const opts = globalOpts();
|
|
8556
|
+
const resolved = await requireProject(opts);
|
|
8557
|
+
const client = await createPlatformClient(opts);
|
|
8558
|
+
const app = await client.apps.getApp(
|
|
8559
|
+
resolved.project.tenantId,
|
|
8560
|
+
resolved.project.id,
|
|
8561
|
+
name
|
|
8562
|
+
);
|
|
8563
|
+
if (!app) throw new Error(`App "${name}" not installed.`);
|
|
8564
|
+
formatOutput(app, opts);
|
|
8565
|
+
})
|
|
8566
|
+
);
|
|
8567
|
+
apps.command("install <manifestUrl>").description("Install an app from a manifest URL").option(
|
|
8568
|
+
"--source-map <json>",
|
|
8569
|
+
`Inline source-type mappings as JSON, e.g. '{"product":{"toModel":"product","naturalKey":"handle","fields":{"title":"title"}}}'`
|
|
8570
|
+
).option(
|
|
8571
|
+
"--sink-map <json>",
|
|
8572
|
+
"Inline sink-contract mappings as JSON"
|
|
8573
|
+
).option(
|
|
8574
|
+
"--field-map <json>",
|
|
8575
|
+
"Inline placement field choices as JSON, keyed by placement key"
|
|
8576
|
+
).action(
|
|
8577
|
+
withErrorHandler(
|
|
8578
|
+
globalOpts,
|
|
8579
|
+
async (manifestUrl, cmdOpts) => {
|
|
8580
|
+
const opts = globalOpts();
|
|
8581
|
+
const resolved = await requireProject(opts);
|
|
8582
|
+
const client = await createPlatformClient(opts);
|
|
8583
|
+
const installResp = await client.apps.installApp(
|
|
8584
|
+
resolved.project.tenantId,
|
|
8585
|
+
resolved.project.id,
|
|
8586
|
+
manifestUrl
|
|
8587
|
+
);
|
|
8588
|
+
if (!opts.json && !opts.quiet) {
|
|
8589
|
+
const preview = installResp.preview;
|
|
8590
|
+
console.error(
|
|
8591
|
+
`preview: ${preview?.operationsToCreate.length ?? 0} ops, ${preview?.hooksToCreate.length ?? 0} hooks, ${preview?.placementsToCreate.length ?? 0} placements`
|
|
8592
|
+
);
|
|
8593
|
+
const sourcesNeeded = preview?.sourceTypesToMap ?? [];
|
|
8594
|
+
const sinksNeeded = preview?.sinkContractsToMap ?? [];
|
|
8595
|
+
const fieldsNeeded = preview?.placementsRequiringFieldChoice ?? [];
|
|
8596
|
+
if (sourcesNeeded.length) {
|
|
8597
|
+
console.error(
|
|
8598
|
+
`source mappings required for: ${sourcesNeeded.join(", ")}`
|
|
8599
|
+
);
|
|
8600
|
+
}
|
|
8601
|
+
if (sinksNeeded.length) {
|
|
8602
|
+
console.error(
|
|
8603
|
+
`sink mappings required for: ${sinksNeeded.join(", ")}`
|
|
8604
|
+
);
|
|
8605
|
+
}
|
|
8606
|
+
if (fieldsNeeded.length) {
|
|
8607
|
+
console.error(
|
|
8608
|
+
`placement field choices required for: ${fieldsNeeded.join(", ")}`
|
|
8609
|
+
);
|
|
8610
|
+
}
|
|
8611
|
+
}
|
|
8612
|
+
const sourceMappings = parseJsonOpt(cmdOpts.sourceMap, "source-map");
|
|
8613
|
+
const sinkMappings = parseJsonOpt(cmdOpts.sinkMap, "sink-map");
|
|
8614
|
+
const placementFieldChoices = parseJsonOpt(
|
|
8615
|
+
cmdOpts.fieldMap,
|
|
8616
|
+
"field-map"
|
|
8617
|
+
);
|
|
8618
|
+
const app = await client.apps.confirmInstallApp({
|
|
8619
|
+
installTicket: installResp.installTicket,
|
|
8620
|
+
sourceMappings,
|
|
8621
|
+
sinkMappings,
|
|
8622
|
+
placementFieldChoices
|
|
8623
|
+
});
|
|
8624
|
+
if (opts.json) {
|
|
8625
|
+
formatOutput(app, opts);
|
|
8626
|
+
} else {
|
|
8627
|
+
success(`Installed ${app?.name ?? ""}`);
|
|
8628
|
+
}
|
|
8629
|
+
}
|
|
8630
|
+
)
|
|
8631
|
+
);
|
|
8632
|
+
apps.command("update <name>").description("Check for updates and apply if no rejected changes").option("--dry-run", "Show the diff without applying").action(
|
|
8633
|
+
withErrorHandler(
|
|
8634
|
+
globalOpts,
|
|
8635
|
+
async (name, cmdOpts) => {
|
|
8636
|
+
const opts = globalOpts();
|
|
8637
|
+
const resolved = await requireProject(opts);
|
|
8638
|
+
const client = await createPlatformClient(opts);
|
|
8639
|
+
const updateResp = await client.apps.updateApp(
|
|
8640
|
+
resolved.project.tenantId,
|
|
8641
|
+
resolved.project.id,
|
|
8642
|
+
name
|
|
8643
|
+
);
|
|
8644
|
+
if (updateResp.noChanges) {
|
|
8645
|
+
if (!opts.quiet) success("no changes");
|
|
8646
|
+
return;
|
|
8647
|
+
}
|
|
8648
|
+
if (!opts.json && !opts.quiet) {
|
|
8649
|
+
for (const change of updateResp.changes) {
|
|
8650
|
+
const classLabel = classToLabel(change.class);
|
|
8651
|
+
console.error(`[${classLabel}] ${change.path}: ${change.description}`);
|
|
8652
|
+
}
|
|
8653
|
+
}
|
|
8654
|
+
const hasRejected = updateResp.changes.some((c) => c.class === 3);
|
|
8655
|
+
if (hasRejected) {
|
|
8656
|
+
throw new Error(
|
|
8657
|
+
"update rejected: one or more changes require admin resolution; see diff above"
|
|
8658
|
+
);
|
|
8659
|
+
}
|
|
8660
|
+
if (cmdOpts.dryRun) return;
|
|
8661
|
+
const app = await client.apps.confirmUpdateApp(
|
|
8662
|
+
resolved.project.tenantId,
|
|
8663
|
+
resolved.project.id,
|
|
8664
|
+
name,
|
|
8665
|
+
updateResp.newManifestHash
|
|
8666
|
+
);
|
|
8667
|
+
if (opts.json) {
|
|
8668
|
+
formatOutput(app, opts);
|
|
8669
|
+
} else {
|
|
8670
|
+
success(`Updated ${name}`);
|
|
8671
|
+
}
|
|
8672
|
+
}
|
|
8673
|
+
)
|
|
8674
|
+
);
|
|
8675
|
+
apps.command("uninstall <name>").description("Uninstall an app (runs __uninstall if declared)").option("--force", "Skip middleware __uninstall call; remove platform state regardless").action(
|
|
8676
|
+
withErrorHandler(
|
|
8677
|
+
globalOpts,
|
|
8678
|
+
async (name, cmdOpts) => {
|
|
8679
|
+
const opts = globalOpts();
|
|
8680
|
+
const resolved = await requireProject(opts);
|
|
8681
|
+
const client = await createPlatformClient(opts);
|
|
8682
|
+
const resp = await client.apps.uninstallApp(
|
|
8683
|
+
resolved.project.tenantId,
|
|
8684
|
+
resolved.project.id,
|
|
8685
|
+
name,
|
|
8686
|
+
!!cmdOpts.force
|
|
8687
|
+
);
|
|
8688
|
+
if (!opts.quiet) {
|
|
8689
|
+
if (resp.forced) warn(`force-uninstalled ${name} (external resources may be orphaned)`);
|
|
8690
|
+
else success(`uninstalled ${name}`);
|
|
8691
|
+
}
|
|
8692
|
+
}
|
|
8693
|
+
)
|
|
8694
|
+
);
|
|
8695
|
+
apps.command("trigger <appName> <operationKey>").description(
|
|
8696
|
+
"Trigger an operation on an installed app. operationKey is the bare manifest key (the namespaced form is built for you)."
|
|
8697
|
+
).option("-d, --data <json>", "Input data as JSON").action(
|
|
8698
|
+
withErrorHandler(
|
|
8699
|
+
globalOpts,
|
|
8700
|
+
async (appName, operationKey, cmdOpts) => {
|
|
8701
|
+
const opts = globalOpts();
|
|
8702
|
+
const resolved = await requireProject(opts);
|
|
8703
|
+
const client = await createPlatformClient(opts);
|
|
8704
|
+
const stored = operationKey.includes("/") ? operationKey : `${appName}/${operationKey}`;
|
|
8705
|
+
const input = cmdOpts.data ? JSON.parse(String(cmdOpts.data)) : void 0;
|
|
8706
|
+
const executionId = await client.apps.triggerOperation(
|
|
8707
|
+
resolved.project.tenantId,
|
|
8708
|
+
resolved.project.id,
|
|
8709
|
+
stored,
|
|
8710
|
+
input
|
|
8711
|
+
);
|
|
8712
|
+
if (opts.json) {
|
|
8713
|
+
formatOutput({ executionId }, opts);
|
|
8714
|
+
} else {
|
|
8715
|
+
success(`triggered ${stored}`, { executionId });
|
|
8716
|
+
}
|
|
8717
|
+
}
|
|
8718
|
+
)
|
|
8719
|
+
);
|
|
8720
|
+
apps.command("validate <manifestUrl>").description("Dry-run a manifest URL against the validator; prints any issues").action(
|
|
8721
|
+
withErrorHandler(globalOpts, async (manifestUrl) => {
|
|
8722
|
+
const opts = globalOpts();
|
|
8723
|
+
const client = await createPlatformClient(opts);
|
|
8724
|
+
const resp = await client.apps.validateManifestUrl(manifestUrl);
|
|
8725
|
+
if (opts.json) {
|
|
8726
|
+
formatOutput(resp, opts);
|
|
8727
|
+
return;
|
|
8728
|
+
}
|
|
8729
|
+
if (resp.ok) {
|
|
8730
|
+
success("manifest validates cleanly");
|
|
8731
|
+
return;
|
|
8732
|
+
}
|
|
8733
|
+
for (const iss of resp.issues) {
|
|
8734
|
+
const sev = iss.severity === 1 ? "error" : "warning";
|
|
8735
|
+
console.error(`[${sev}] ${iss.path}: ${iss.message}`);
|
|
8736
|
+
}
|
|
8737
|
+
throw new Error(`manifest has ${resp.issues.length} issue(s)`);
|
|
8738
|
+
})
|
|
8739
|
+
);
|
|
8740
|
+
}
|
|
8741
|
+
async function requireProject(opts) {
|
|
8742
|
+
const resolved = await resolveProjectContext(opts);
|
|
8743
|
+
if (!resolved) {
|
|
8744
|
+
throw new Error(
|
|
8745
|
+
"No project selected. Run `foir select-project` or set FOIR_PROJECT."
|
|
8746
|
+
);
|
|
8747
|
+
}
|
|
8748
|
+
return resolved;
|
|
8749
|
+
}
|
|
8750
|
+
function parseJsonOpt(value, flag) {
|
|
8751
|
+
if (!value) return void 0;
|
|
8752
|
+
try {
|
|
8753
|
+
return JSON.parse(String(value));
|
|
8754
|
+
} catch (err) {
|
|
8755
|
+
throw new Error(`--${flag} is not valid JSON: ${err.message}`);
|
|
8756
|
+
}
|
|
8757
|
+
}
|
|
8758
|
+
function classToLabel(n) {
|
|
8759
|
+
switch (n) {
|
|
8760
|
+
case 1:
|
|
8761
|
+
return "safe";
|
|
8762
|
+
case 2:
|
|
8763
|
+
return "confirm";
|
|
8764
|
+
case 3:
|
|
8765
|
+
return "REJECTED";
|
|
8766
|
+
default:
|
|
8767
|
+
return "?";
|
|
8768
|
+
}
|
|
8769
|
+
}
|
|
8770
|
+
|
|
8255
8771
|
// src/cli.ts
|
|
8256
8772
|
var __filename = fileURLToPath(import.meta.url);
|
|
8257
8773
|
var __dirname = dirname4(__filename);
|
|
@@ -8300,4 +8816,5 @@ registerFilesCommands(program, getGlobalOpts);
|
|
|
8300
8816
|
registerNotesCommands(program, getGlobalOpts);
|
|
8301
8817
|
registerNotificationsCommands(program, getGlobalOpts);
|
|
8302
8818
|
registerConfigsCommands(program, getGlobalOpts);
|
|
8819
|
+
registerAppsCommands(program, getGlobalOpts);
|
|
8303
8820
|
program.parse();
|