@appconda/sdk 1.0.680 → 1.0.683
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/modules/emploid/schema.d.ts +1149 -21
- package/dist/modules/emploid/schema.js +740 -53
- package/dist/modules/emploid/service.d.ts +117 -15
- package/dist/modules/emploid/service.js +163 -1
- package/dist/modules/emploid/types.d.ts +818 -6
- package/dist/modules/emploid/types.js +1 -1
- package/package.json +1 -1
- package/src/modules/emploid/schema.ts +826 -60
- package/src/modules/emploid/service.ts +476 -15
- package/src/modules/emploid/types.ts +892 -7
|
@@ -1017,6 +1017,12 @@ export const UpdateCollectionSchema = z.object({
|
|
|
1017
1017
|
collectionId: z.string(),
|
|
1018
1018
|
displayName: z.string().optional(),
|
|
1019
1019
|
description: z.string().optional(),
|
|
1020
|
+
// Legacy callers used the same fields under a `data` envelope. The
|
|
1021
|
+
// backend accepts both shapes while direct fields remain canonical.
|
|
1022
|
+
data: z.object({
|
|
1023
|
+
displayName: z.string().optional(),
|
|
1024
|
+
description: z.string().optional(),
|
|
1025
|
+
}).optional(),
|
|
1020
1026
|
});
|
|
1021
1027
|
|
|
1022
1028
|
export const DeleteCollectionSchema = z.object({
|
|
@@ -1024,6 +1030,20 @@ export const DeleteCollectionSchema = z.object({
|
|
|
1024
1030
|
collectionId: z.string(),
|
|
1025
1031
|
});
|
|
1026
1032
|
|
|
1033
|
+
export const ArchiveCollectionSchema = z.object({
|
|
1034
|
+
tenantId: z.string(),
|
|
1035
|
+
collectionId: z.string(),
|
|
1036
|
+
reason: z.string(),
|
|
1037
|
+
actor: z.string(),
|
|
1038
|
+
});
|
|
1039
|
+
|
|
1040
|
+
export const PurgeCollectionSchema = z.object({
|
|
1041
|
+
tenantId: z.string(),
|
|
1042
|
+
collectionId: z.string(),
|
|
1043
|
+
actor: z.string(),
|
|
1044
|
+
confirm: z.literal("PURGE"),
|
|
1045
|
+
});
|
|
1046
|
+
|
|
1027
1047
|
|
|
1028
1048
|
|
|
1029
1049
|
export const ListCollectionsSchema = z.object({
|
|
@@ -1238,6 +1258,34 @@ export const EnsureGithubImportCredentialSchema = z.object({
|
|
|
1238
1258
|
tenantId: z.string(),
|
|
1239
1259
|
});
|
|
1240
1260
|
|
|
1261
|
+
const CsvImportInvalidRowPolicySchema = z.enum(["reject", "skip-row", "set-null"]);
|
|
1262
|
+
|
|
1263
|
+
const CsvImportRowRepairSchema = z.object({
|
|
1264
|
+
rowIndex: z.number().int().nonnegative(),
|
|
1265
|
+
fieldId: z.string().min(1),
|
|
1266
|
+
value: z.any(),
|
|
1267
|
+
});
|
|
1268
|
+
|
|
1269
|
+
const CsvImportFieldMappingSchema = z.object({
|
|
1270
|
+
fieldId: z.string().min(1),
|
|
1271
|
+
type: z.string(),
|
|
1272
|
+
displayName: z.string(),
|
|
1273
|
+
name: z.string(),
|
|
1274
|
+
required: z.boolean().optional(),
|
|
1275
|
+
config: z.object({}).catchall(z.any()).optional(),
|
|
1276
|
+
fallbackReason: z.string().optional(),
|
|
1277
|
+
mode: z.enum(["field", "skip", "relation"]).optional(),
|
|
1278
|
+
relation: z.object({
|
|
1279
|
+
targetCollectionId: z.string().min(1),
|
|
1280
|
+
matchFieldName: z.string().min(1),
|
|
1281
|
+
unmatchedPolicy: z.enum(["reject", "ignore", "create"]),
|
|
1282
|
+
cardinality: z.enum(["one", "many"]).optional(),
|
|
1283
|
+
inverseCardinality: z.enum(["one", "many"]).optional(),
|
|
1284
|
+
inverseDisplayName: z.string().optional(),
|
|
1285
|
+
separator: z.string().max(8).optional(),
|
|
1286
|
+
}).optional(),
|
|
1287
|
+
});
|
|
1288
|
+
|
|
1241
1289
|
export const PreviewCsvImportSchema = z.object({
|
|
1242
1290
|
tenantId: z.string(),
|
|
1243
1291
|
fileName: z.string(),
|
|
@@ -1250,7 +1298,10 @@ export const PreviewCsvImportSchema = z.object({
|
|
|
1250
1298
|
index: z.number().int(),
|
|
1251
1299
|
})
|
|
1252
1300
|
).min(1),
|
|
1253
|
-
rows: z.array(z.object({}).catchall(z.any())).optional(),
|
|
1301
|
+
rows: z.array(z.object({}).catchall(z.any())).max(1_000).optional(),
|
|
1302
|
+
fields: z.array(CsvImportFieldMappingSchema).min(1).optional(),
|
|
1303
|
+
rowRepairs: z.array(CsvImportRowRepairSchema).max(10_000).optional(),
|
|
1304
|
+
invalidRowPolicy: CsvImportInvalidRowPolicySchema.optional(),
|
|
1254
1305
|
});
|
|
1255
1306
|
|
|
1256
1307
|
export const ListGmailImportSourcesSchema = z.object({
|
|
@@ -1288,22 +1339,14 @@ export const RunCsvImportSchema = z.object({
|
|
|
1288
1339
|
index: z.number().int(),
|
|
1289
1340
|
})
|
|
1290
1341
|
).min(1),
|
|
1291
|
-
rows: z.array(z.object({}).catchall(z.any())),
|
|
1342
|
+
rows: z.array(z.object({}).catchall(z.any())).max(1_000),
|
|
1292
1343
|
collection: z.object({
|
|
1293
1344
|
collectionKey: z.literal("rows"),
|
|
1294
1345
|
collectionName: z.string(),
|
|
1295
1346
|
collectionDisplayName: z.string(),
|
|
1296
|
-
fields: z.array(
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
type: z.string(),
|
|
1300
|
-
displayName: z.string(),
|
|
1301
|
-
name: z.string(),
|
|
1302
|
-
required: z.boolean().optional(),
|
|
1303
|
-
config: z.object({}).catchall(z.any()).optional(),
|
|
1304
|
-
fallbackReason: z.string().optional(),
|
|
1305
|
-
})
|
|
1306
|
-
).min(1),
|
|
1347
|
+
fields: z.array(CsvImportFieldMappingSchema).min(1),
|
|
1348
|
+
invalidRowPolicy: CsvImportInvalidRowPolicySchema.optional(),
|
|
1349
|
+
rowRepairs: z.array(CsvImportRowRepairSchema).max(10_000).optional(),
|
|
1307
1350
|
}),
|
|
1308
1351
|
});
|
|
1309
1352
|
|
|
@@ -1483,18 +1526,36 @@ export const RunTrelloImportSchema = z.object({
|
|
|
1483
1526
|
).min(1),
|
|
1484
1527
|
});
|
|
1485
1528
|
|
|
1486
|
-
|
|
1529
|
+
const BulkUpdateRecordSchema = z.object({
|
|
1530
|
+
recordId: z.string(),
|
|
1531
|
+
data: z.object({}).catchall(z.any()),
|
|
1532
|
+
});
|
|
1533
|
+
|
|
1534
|
+
const LegacyBulkUpdateRecordSchema = z.object({
|
|
1535
|
+
id: z.string().optional(),
|
|
1536
|
+
recordId: z.string().optional(),
|
|
1537
|
+
data: z.object({}).catchall(z.any()),
|
|
1538
|
+
}).refine((item) => Boolean(item.id || item.recordId), {
|
|
1539
|
+
message: "Each bulk update item must include id or recordId",
|
|
1540
|
+
});
|
|
1541
|
+
|
|
1542
|
+
const BulkUpdateRecordsBaseSchema = z.object({
|
|
1487
1543
|
tenantId: z.string(),
|
|
1488
1544
|
collectionId: z.string(),
|
|
1489
|
-
|
|
1490
|
-
records: z.array(
|
|
1491
|
-
z.object({
|
|
1492
|
-
recordId: z.string(),
|
|
1493
|
-
data: z.object({}).catchall(z.any()),
|
|
1494
|
-
})
|
|
1495
|
-
),
|
|
1545
|
+
actor: z.string().optional(),
|
|
1496
1546
|
});
|
|
1497
1547
|
|
|
1548
|
+
export const BulkUpdateRecordsSchema = z.union([
|
|
1549
|
+
BulkUpdateRecordsBaseSchema.extend({
|
|
1550
|
+
records: z.array(BulkUpdateRecordSchema).min(1),
|
|
1551
|
+
items: z.array(LegacyBulkUpdateRecordSchema).optional(),
|
|
1552
|
+
}),
|
|
1553
|
+
BulkUpdateRecordsBaseSchema.extend({
|
|
1554
|
+
records: z.array(BulkUpdateRecordSchema).optional(),
|
|
1555
|
+
items: z.array(LegacyBulkUpdateRecordSchema).min(1),
|
|
1556
|
+
}),
|
|
1557
|
+
]);
|
|
1558
|
+
|
|
1498
1559
|
export const BulkDeleteRecordsSchema = z.object({
|
|
1499
1560
|
tenantId: z.string(),
|
|
1500
1561
|
collectionId: z.string(),
|
|
@@ -1520,7 +1581,10 @@ export const QueryRecordsSchema = z.object({
|
|
|
1520
1581
|
filter: z.object({}).catchall(z.any()).optional(),
|
|
1521
1582
|
|
|
1522
1583
|
// projection (hangi alanlar gelsin)
|
|
1523
|
-
fields: z.
|
|
1584
|
+
fields: z.union([
|
|
1585
|
+
z.array(z.string()),
|
|
1586
|
+
z.object({}).catchall(z.any()),
|
|
1587
|
+
]).optional(),
|
|
1524
1588
|
|
|
1525
1589
|
// sorting
|
|
1526
1590
|
sort: z.object({}).catchall(z.string()).optional(),
|
|
@@ -1528,15 +1592,26 @@ export const QueryRecordsSchema = z.object({
|
|
|
1528
1592
|
// pagination
|
|
1529
1593
|
limit: z.number().optional(),
|
|
1530
1594
|
offset: z.number().optional(),
|
|
1595
|
+
|
|
1596
|
+
// Compatibility with the original backend action, which expected the
|
|
1597
|
+
// complete query DSL in one parameter.
|
|
1598
|
+
query: z.object({
|
|
1599
|
+
where: z.object({}).catchall(z.any()).optional(),
|
|
1600
|
+
filter: z.object({}).catchall(z.any()).optional(),
|
|
1601
|
+
fields: z.union([
|
|
1602
|
+
z.array(z.string()),
|
|
1603
|
+
z.object({}).catchall(z.any()),
|
|
1604
|
+
]).optional(),
|
|
1605
|
+
sort: z.object({}).catchall(z.string()).optional(),
|
|
1606
|
+
limit: z.number().optional(),
|
|
1607
|
+
offset: z.number().optional(),
|
|
1608
|
+
}).optional(),
|
|
1531
1609
|
});
|
|
1532
1610
|
|
|
1533
|
-
|
|
1611
|
+
const SearchRecordsBaseSchema = z.object({
|
|
1534
1612
|
tenantId: z.string(),
|
|
1535
1613
|
collectionId: z.string(),
|
|
1536
1614
|
|
|
1537
|
-
// arama metni
|
|
1538
|
-
query: z.string(),
|
|
1539
|
-
|
|
1540
1615
|
// opsiyonel: hangi alanlarda aransın
|
|
1541
1616
|
fields: z.array(z.string()).optional(),
|
|
1542
1617
|
|
|
@@ -1551,6 +1626,19 @@ export const SearchRecordsSchema = z.object({
|
|
|
1551
1626
|
offset: z.number().optional(),
|
|
1552
1627
|
});
|
|
1553
1628
|
|
|
1629
|
+
export const SearchRecordsSchema = z.union([
|
|
1630
|
+
SearchRecordsBaseSchema.extend({
|
|
1631
|
+
// Canonical public name.
|
|
1632
|
+
query: z.string().min(1),
|
|
1633
|
+
q: z.string().optional(),
|
|
1634
|
+
}),
|
|
1635
|
+
SearchRecordsBaseSchema.extend({
|
|
1636
|
+
// Compatibility with the original backend action and Agent Flow node.
|
|
1637
|
+
query: z.string().optional(),
|
|
1638
|
+
q: z.string().min(1),
|
|
1639
|
+
}),
|
|
1640
|
+
]);
|
|
1641
|
+
|
|
1554
1642
|
export const CountRecordsSchema = z.object({
|
|
1555
1643
|
tenantId: z.string(),
|
|
1556
1644
|
collectionId: z.string(),
|
|
@@ -1611,6 +1699,56 @@ export const DistinctFieldValuesSchema = z.object({
|
|
|
1611
1699
|
limit: z.number().optional(),
|
|
1612
1700
|
});
|
|
1613
1701
|
|
|
1702
|
+
export const CollectionDerivedConditionSchema = z.object({
|
|
1703
|
+
fieldId: z.string(),
|
|
1704
|
+
fieldName: z.string().optional(),
|
|
1705
|
+
operator: z.enum([
|
|
1706
|
+
"eq", "neq", "contains", "not-contains", "gt", "gte", "lt", "lte",
|
|
1707
|
+
"is-empty", "is-not-empty",
|
|
1708
|
+
]),
|
|
1709
|
+
value: z.unknown().optional(),
|
|
1710
|
+
});
|
|
1711
|
+
|
|
1712
|
+
export const CollectionFieldConfigSchema = z.object({
|
|
1713
|
+
relationFieldId: z.string().optional(),
|
|
1714
|
+
relationFieldName: z.string().optional(),
|
|
1715
|
+
relationId: z.string().optional(),
|
|
1716
|
+
targetCollectionId: z.string().optional(),
|
|
1717
|
+
targetFieldId: z.string().optional(),
|
|
1718
|
+
targetFieldName: z.string().optional(),
|
|
1719
|
+
resultMode: z.enum(["first", "list"]).optional(),
|
|
1720
|
+
operation: z.enum([
|
|
1721
|
+
"count", "count-values", "count-unique", "sum", "average", "min", "max",
|
|
1722
|
+
]).optional(),
|
|
1723
|
+
condition: CollectionDerivedConditionSchema.optional(),
|
|
1724
|
+
maxItems: z.number().int().min(1).max(500).optional(),
|
|
1725
|
+
min: z.number().optional(),
|
|
1726
|
+
max: z.number().optional(),
|
|
1727
|
+
precision: z.number().int().min(0).max(4).optional(),
|
|
1728
|
+
mode: z.enum(["typed", "drawn", "both"]).optional(),
|
|
1729
|
+
source: z.enum(["organization", "users", "employees", "both"]).optional(),
|
|
1730
|
+
includeInactive: z.boolean().optional(),
|
|
1731
|
+
}).catchall(z.any());
|
|
1732
|
+
|
|
1733
|
+
export const CollectionChecklistItemSchema = z.object({
|
|
1734
|
+
id: z.string().min(1).max(128),
|
|
1735
|
+
text: z.string().min(1).max(1000),
|
|
1736
|
+
checked: z.boolean(),
|
|
1737
|
+
});
|
|
1738
|
+
|
|
1739
|
+
export const CollectionSignatureValueSchema = z.object({
|
|
1740
|
+
kind: z.enum(["typed", "drawn"]),
|
|
1741
|
+
value: z.string().min(1),
|
|
1742
|
+
signedAt: z.string().datetime(),
|
|
1743
|
+
signedBy: z.string().min(1),
|
|
1744
|
+
});
|
|
1745
|
+
|
|
1746
|
+
/** Browser/import input. signedAt and signedBy are server-managed output fields. */
|
|
1747
|
+
export const CollectionSignatureInputSchema = CollectionSignatureValueSchema.pick({
|
|
1748
|
+
kind: true,
|
|
1749
|
+
value: true,
|
|
1750
|
+
});
|
|
1751
|
+
|
|
1614
1752
|
export const CreateCollectionFieldSchema = z.object({
|
|
1615
1753
|
tenantId: z.string(),
|
|
1616
1754
|
dataModelId: z.string(),
|
|
@@ -1622,7 +1760,7 @@ export const CreateCollectionFieldSchema = z.object({
|
|
|
1622
1760
|
required: z.boolean().optional(),
|
|
1623
1761
|
|
|
1624
1762
|
// field-specific config (min, max, enum, format, relation, etc.)
|
|
1625
|
-
config:
|
|
1763
|
+
config: CollectionFieldConfigSchema.optional(),
|
|
1626
1764
|
|
|
1627
1765
|
// opsiyonel sıralama
|
|
1628
1766
|
order: z.number().optional(),
|
|
@@ -1639,7 +1777,7 @@ export const UpdateCollectionFieldSchema = z.object({
|
|
|
1639
1777
|
required: z.boolean().optional(),
|
|
1640
1778
|
|
|
1641
1779
|
// field-specific config (min, max, enum, relation vb.)
|
|
1642
|
-
config:
|
|
1780
|
+
config: CollectionFieldConfigSchema.optional(),
|
|
1643
1781
|
|
|
1644
1782
|
// opsiyonel sıralama
|
|
1645
1783
|
order: z.number().optional(),
|
|
@@ -1659,6 +1797,9 @@ export const ListCollectionAutomationRulesSchema = z.object({
|
|
|
1659
1797
|
|
|
1660
1798
|
const CollectionAutomationRuleTriggerConfigSchema = z.object({
|
|
1661
1799
|
updatedFieldId: z.string().nullable().optional(),
|
|
1800
|
+
cron: z.string().max(191).nullable().optional(),
|
|
1801
|
+
timezone: z.string().max(64).nullable().optional(),
|
|
1802
|
+
maxRecords: z.number().int().min(1).max(100).optional(),
|
|
1662
1803
|
});
|
|
1663
1804
|
|
|
1664
1805
|
const CollectionAutomationRuleConditionSchema = z.object({
|
|
@@ -1668,6 +1809,40 @@ const CollectionAutomationRuleConditionSchema = z.object({
|
|
|
1668
1809
|
value: z.union([z.string(), z.array(z.string()), z.boolean(), z.null()]).optional(),
|
|
1669
1810
|
});
|
|
1670
1811
|
|
|
1812
|
+
const CollectionAutomationRuleActionSchema: z.ZodType<Record<string, unknown>> = z.lazy(() => z.object({
|
|
1813
|
+
id: z.string().min(1),
|
|
1814
|
+
type: z.enum([
|
|
1815
|
+
"create", "update", "delete", "append-description", "script",
|
|
1816
|
+
"conditional-branch", "find-records", "for-each", "copy-record",
|
|
1817
|
+
"move-record", "webhook", "approval",
|
|
1818
|
+
]).nullable(),
|
|
1819
|
+
fieldId: z.string().nullable().optional(),
|
|
1820
|
+
value: z.string().optional(),
|
|
1821
|
+
valueMode: z.enum(["literal", "formula"]).optional(),
|
|
1822
|
+
formula: z.string().optional(),
|
|
1823
|
+
template: z.string().optional(),
|
|
1824
|
+
script: z.string().optional(),
|
|
1825
|
+
condition: CollectionAutomationRuleConditionSchema.nullable().optional(),
|
|
1826
|
+
thenActions: z.array(CollectionAutomationRuleActionSchema).max(100).optional(),
|
|
1827
|
+
elseActions: z.array(CollectionAutomationRuleActionSchema).max(100).optional(),
|
|
1828
|
+
collectionId: z.string().nullable().optional(),
|
|
1829
|
+
filters: z.array(CollectionAutomationRuleConditionSchema).max(25).optional(),
|
|
1830
|
+
limit: z.number().int().min(1).max(100).optional(),
|
|
1831
|
+
resultKey: z.string().max(80).optional(),
|
|
1832
|
+
sourceKey: z.string().max(80).optional(),
|
|
1833
|
+
maxIterations: z.number().int().min(1).max(50).optional(),
|
|
1834
|
+
actions: z.array(CollectionAutomationRuleActionSchema).max(100).optional(),
|
|
1835
|
+
targetCollectionId: z.string().nullable().optional(),
|
|
1836
|
+
fieldMap: z.record(z.string(), z.string()).optional(),
|
|
1837
|
+
url: z.string().max(2048).optional(),
|
|
1838
|
+
method: z.enum(["GET", "POST", "PUT", "PATCH", "DELETE"]).optional(),
|
|
1839
|
+
headers: z.record(z.string(), z.string()).optional(),
|
|
1840
|
+
body: z.unknown().optional(),
|
|
1841
|
+
timeoutMs: z.number().int().min(1).max(10_000).optional(),
|
|
1842
|
+
approverIds: z.array(z.string()).max(25).optional(),
|
|
1843
|
+
approvalMessage: z.string().max(2_000).optional(),
|
|
1844
|
+
}));
|
|
1845
|
+
|
|
1671
1846
|
export const CreateCollectionAutomationRuleSchema = z.object({
|
|
1672
1847
|
tenantId: z.string(),
|
|
1673
1848
|
dataModelId: z.string(),
|
|
@@ -1678,7 +1853,7 @@ export const CreateCollectionAutomationRuleSchema = z.object({
|
|
|
1678
1853
|
trigger: z.enum(["created", "updated", "linked", "unlinked", "schedule"]),
|
|
1679
1854
|
triggerConfig: CollectionAutomationRuleTriggerConfigSchema.nullable().optional(),
|
|
1680
1855
|
conditions: z.array(CollectionAutomationRuleConditionSchema).optional(),
|
|
1681
|
-
actions: z.array(
|
|
1856
|
+
actions: z.array(CollectionAutomationRuleActionSchema).min(1).max(100),
|
|
1682
1857
|
});
|
|
1683
1858
|
|
|
1684
1859
|
export const UpdateCollectionAutomationRuleSchema = z.object({
|
|
@@ -1691,7 +1866,7 @@ export const UpdateCollectionAutomationRuleSchema = z.object({
|
|
|
1691
1866
|
trigger: z.enum(["created", "updated", "linked", "unlinked", "schedule"]).optional(),
|
|
1692
1867
|
triggerConfig: CollectionAutomationRuleTriggerConfigSchema.nullable().optional(),
|
|
1693
1868
|
conditions: z.array(CollectionAutomationRuleConditionSchema).optional(),
|
|
1694
|
-
actions: z.array(
|
|
1869
|
+
actions: z.array(CollectionAutomationRuleActionSchema).min(1).max(100).optional(),
|
|
1695
1870
|
});
|
|
1696
1871
|
|
|
1697
1872
|
export const DeleteCollectionAutomationRuleSchema = z.object({
|
|
@@ -1700,6 +1875,22 @@ export const DeleteCollectionAutomationRuleSchema = z.object({
|
|
|
1700
1875
|
ruleId: z.string(),
|
|
1701
1876
|
});
|
|
1702
1877
|
|
|
1878
|
+
export const ListCollectionAutomationExecutionsSchema = z.object({
|
|
1879
|
+
tenantId: z.string(),
|
|
1880
|
+
collectionId: z.string().optional(),
|
|
1881
|
+
ruleId: z.string().optional(),
|
|
1882
|
+
status: z.enum(["queued", "running", "waiting_approval", "succeeded", "failed", "skipped", "cancelled"]).optional(),
|
|
1883
|
+
cursor: z.string().optional(),
|
|
1884
|
+
limit: z.number().int().min(1).max(100).optional(),
|
|
1885
|
+
});
|
|
1886
|
+
|
|
1887
|
+
export const DecideCollectionAutomationApprovalSchema = z.object({
|
|
1888
|
+
tenantId: z.string(),
|
|
1889
|
+
approvalId: z.string(),
|
|
1890
|
+
decision: z.enum(["approved", "rejected"]),
|
|
1891
|
+
note: z.string().max(2_000).optional(),
|
|
1892
|
+
});
|
|
1893
|
+
|
|
1703
1894
|
export const ListCollectionViewsSchema = z.object({
|
|
1704
1895
|
tenantId: z.string(),
|
|
1705
1896
|
collectionId: z.string(),
|
|
@@ -1709,18 +1900,20 @@ export const CreateCollectionViewSchema = z.object({
|
|
|
1709
1900
|
tenantId: z.string(),
|
|
1710
1901
|
dataModelId: z.string(),
|
|
1711
1902
|
collectionId: z.string(),
|
|
1712
|
-
name: z.string(),
|
|
1713
|
-
type: z.
|
|
1903
|
+
name: z.string().trim().min(1).max(191),
|
|
1904
|
+
type: z.enum(["grid", "board", "calendar", "timeline", "tree", "gallery", "map", "document"]),
|
|
1714
1905
|
config: z.object({}).catchall(z.any()),
|
|
1906
|
+
visibility: z.enum(["shared", "personal"]).optional(),
|
|
1715
1907
|
});
|
|
1716
1908
|
|
|
1717
1909
|
export const UpdateCollectionViewSchema = z.object({
|
|
1718
1910
|
tenantId: z.string(),
|
|
1719
1911
|
collectionId: z.string(),
|
|
1720
1912
|
viewId: z.string(),
|
|
1721
|
-
name: z.string().optional(),
|
|
1722
|
-
type: z.
|
|
1913
|
+
name: z.string().trim().min(1).max(191).optional(),
|
|
1914
|
+
type: z.enum(["grid", "board", "calendar", "timeline", "tree", "gallery", "map", "document"]).optional(),
|
|
1723
1915
|
config: z.object({}).catchall(z.any()).optional(),
|
|
1916
|
+
visibility: z.enum(["shared", "personal"]).optional(),
|
|
1724
1917
|
});
|
|
1725
1918
|
|
|
1726
1919
|
export const DeleteCollectionViewSchema = z.object({
|
|
@@ -1729,6 +1922,23 @@ export const DeleteCollectionViewSchema = z.object({
|
|
|
1729
1922
|
viewId: z.string(),
|
|
1730
1923
|
});
|
|
1731
1924
|
|
|
1925
|
+
export const UpsertCollectionViewPreferenceSchema = z.object({
|
|
1926
|
+
tenantId: z.string(),
|
|
1927
|
+
collectionId: z.string(),
|
|
1928
|
+
viewId: z.string(),
|
|
1929
|
+
columns: z.array(z.object({
|
|
1930
|
+
fieldName: z.string().trim().min(1).max(191),
|
|
1931
|
+
visible: z.boolean(),
|
|
1932
|
+
width: z.number().positive().max(2_000).optional(),
|
|
1933
|
+
})).max(500),
|
|
1934
|
+
});
|
|
1935
|
+
|
|
1936
|
+
export const DeleteCollectionViewPreferenceSchema = z.object({
|
|
1937
|
+
tenantId: z.string(),
|
|
1938
|
+
collectionId: z.string(),
|
|
1939
|
+
viewId: z.string(),
|
|
1940
|
+
});
|
|
1941
|
+
|
|
1732
1942
|
export const ListCollectionButtonsSchema = z.object({
|
|
1733
1943
|
tenantId: z.string(),
|
|
1734
1944
|
collectionId: z.string().optional(),
|
|
@@ -1824,18 +2034,33 @@ export const GetRecordRelationsSchema = z.object({
|
|
|
1824
2034
|
recordId: z.string(),
|
|
1825
2035
|
});
|
|
1826
2036
|
|
|
1827
|
-
|
|
2037
|
+
const ReorderCollectionFieldsBaseSchema = z.object({
|
|
1828
2038
|
tenantId: z.string(),
|
|
1829
2039
|
collectionId: z.string(),
|
|
2040
|
+
});
|
|
1830
2041
|
|
|
1831
|
-
|
|
1832
|
-
|
|
2042
|
+
export const ReorderCollectionFieldsSchema = z.union([
|
|
2043
|
+
ReorderCollectionFieldsBaseSchema.extend({
|
|
2044
|
+
// Canonical shape: explicit field/order pairs.
|
|
2045
|
+
fields: z.array(
|
|
1833
2046
|
z.object({
|
|
1834
2047
|
fieldId: z.string(),
|
|
1835
2048
|
order: z.number(),
|
|
1836
2049
|
})
|
|
1837
|
-
|
|
1838
|
-
|
|
2050
|
+
).min(1),
|
|
2051
|
+
fieldIds: z.array(z.string()).optional(),
|
|
2052
|
+
}),
|
|
2053
|
+
ReorderCollectionFieldsBaseSchema.extend({
|
|
2054
|
+
fields: z.array(
|
|
2055
|
+
z.object({
|
|
2056
|
+
fieldId: z.string(),
|
|
2057
|
+
order: z.number(),
|
|
2058
|
+
})
|
|
2059
|
+
).optional(),
|
|
2060
|
+
// Compatibility with the original backend action.
|
|
2061
|
+
fieldIds: z.array(z.string()).min(1),
|
|
2062
|
+
}),
|
|
2063
|
+
]);
|
|
1839
2064
|
|
|
1840
2065
|
export const GetCollectionSchemaSchema = z.object({
|
|
1841
2066
|
tenantId: z.string(),
|
|
@@ -1875,39 +2100,243 @@ export const CheckRecordPermissionSchema = z.object({
|
|
|
1875
2100
|
action: z.string(), // read | update | delete | restore | duplicate | custom
|
|
1876
2101
|
});
|
|
1877
2102
|
|
|
1878
|
-
export const
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
2103
|
+
export const CollectionAccessPolicyScopeTypeSchema = z.enum(["app", "list", "field"]);
|
|
2104
|
+
export const CollectionAccessPolicySubjectTypeSchema = z.enum(["user", "role", "team", "service"]);
|
|
2105
|
+
export const CollectionAccessPolicyEffectSchema = z.enum(["allow", "deny"]);
|
|
2106
|
+
export const CollectionAccessPolicyActionSchema = z.enum(["read", "create", "update", "delete", "comment", "assign"]);
|
|
2107
|
+
export const CollectionAccessPolicyRowOperatorSchema = z.enum(["me", "user", "team", "linked-record"]);
|
|
2108
|
+
|
|
2109
|
+
export const CollectionAccessPolicyRowFilterSchema = z.object({
|
|
2110
|
+
match: z.enum(["all", "any"]),
|
|
2111
|
+
conditions: z.array(z.object({
|
|
2112
|
+
fieldId: z.string().min(1),
|
|
2113
|
+
operator: CollectionAccessPolicyRowOperatorSchema,
|
|
2114
|
+
value: z.string().optional(),
|
|
2115
|
+
})).min(1).max(20),
|
|
2116
|
+
}).superRefine((filter, context) => {
|
|
2117
|
+
filter.conditions.forEach((condition, index) => {
|
|
2118
|
+
if (
|
|
2119
|
+
(condition.operator === "user"
|
|
2120
|
+
|| condition.operator === "team"
|
|
2121
|
+
|| condition.operator === "linked-record")
|
|
2122
|
+
&& !condition.value?.trim()
|
|
2123
|
+
) {
|
|
2124
|
+
context.addIssue({
|
|
2125
|
+
code: z.ZodIssueCode.custom,
|
|
2126
|
+
path: ["conditions", index, "value"],
|
|
2127
|
+
message: `${condition.operator} filters require a value`,
|
|
2128
|
+
});
|
|
2129
|
+
}
|
|
2130
|
+
});
|
|
2131
|
+
});
|
|
2132
|
+
|
|
2133
|
+
export const ListCollectionAccessPoliciesSchema = z.object({
|
|
2134
|
+
tenantId: z.string().min(1),
|
|
2135
|
+
dataModelId: z.string().optional(),
|
|
2136
|
+
collectionId: z.string().optional(),
|
|
1882
2137
|
});
|
|
1883
2138
|
|
|
1884
|
-
|
|
1885
|
-
tenantId: z.string(),
|
|
1886
|
-
|
|
1887
|
-
|
|
2139
|
+
const CollectionAccessPolicyWriteSchema = z.object({
|
|
2140
|
+
tenantId: z.string().min(1),
|
|
2141
|
+
dataModelId: z.string().min(1),
|
|
2142
|
+
policyId: z.string().optional(),
|
|
2143
|
+
name: z.string().trim().min(1).max(160),
|
|
2144
|
+
scopeType: CollectionAccessPolicyScopeTypeSchema,
|
|
2145
|
+
collectionId: z.string().optional(),
|
|
2146
|
+
fieldId: z.string().optional(),
|
|
2147
|
+
subjectType: CollectionAccessPolicySubjectTypeSchema,
|
|
2148
|
+
subjectId: z.string().trim().min(1).max(255),
|
|
2149
|
+
effect: CollectionAccessPolicyEffectSchema,
|
|
2150
|
+
actions: z.array(CollectionAccessPolicyActionSchema).min(1).max(6),
|
|
2151
|
+
rowFilter: CollectionAccessPolicyRowFilterSchema.nullable().optional(),
|
|
2152
|
+
enabled: z.boolean().optional(),
|
|
2153
|
+
});
|
|
2154
|
+
|
|
2155
|
+
function validateCollectionAccessPolicyShape(
|
|
2156
|
+
policy: {
|
|
2157
|
+
scopeType: z.infer<typeof CollectionAccessPolicyScopeTypeSchema>;
|
|
2158
|
+
collectionId?: string | undefined;
|
|
2159
|
+
fieldId?: string | undefined;
|
|
2160
|
+
actions: Array<z.infer<typeof CollectionAccessPolicyActionSchema>>;
|
|
2161
|
+
rowFilter?: z.infer<typeof CollectionAccessPolicyRowFilterSchema> | null | undefined;
|
|
2162
|
+
},
|
|
2163
|
+
context: z.RefinementCtx
|
|
2164
|
+
) {
|
|
2165
|
+
if (policy.scopeType === "app") {
|
|
2166
|
+
if (policy.collectionId) {
|
|
2167
|
+
context.addIssue({ code: z.ZodIssueCode.custom, path: ["collectionId"], message: "App policies cannot target a collection" });
|
|
2168
|
+
}
|
|
2169
|
+
if (policy.fieldId) {
|
|
2170
|
+
context.addIssue({ code: z.ZodIssueCode.custom, path: ["fieldId"], message: "App policies cannot target a field" });
|
|
2171
|
+
}
|
|
2172
|
+
} else if (!policy.collectionId) {
|
|
2173
|
+
context.addIssue({ code: z.ZodIssueCode.custom, path: ["collectionId"], message: "List and field policies require a collection" });
|
|
2174
|
+
}
|
|
2175
|
+
|
|
2176
|
+
if (policy.scopeType === "field") {
|
|
2177
|
+
if (!policy.fieldId) {
|
|
2178
|
+
context.addIssue({ code: z.ZodIssueCode.custom, path: ["fieldId"], message: "Field policies require a field" });
|
|
2179
|
+
}
|
|
2180
|
+
if (policy.actions.some((action) => action !== "read" && action !== "update")) {
|
|
2181
|
+
context.addIssue({ code: z.ZodIssueCode.custom, path: ["actions"], message: "Field policies only support read and update" });
|
|
2182
|
+
}
|
|
2183
|
+
} else if (policy.fieldId) {
|
|
2184
|
+
context.addIssue({ code: z.ZodIssueCode.custom, path: ["fieldId"], message: "Only field policies can target a field" });
|
|
2185
|
+
}
|
|
2186
|
+
|
|
2187
|
+
if (policy.scopeType !== "list" && policy.rowFilter) {
|
|
2188
|
+
context.addIssue({ code: z.ZodIssueCode.custom, path: ["rowFilter"], message: "Data limits can only be attached to list policies" });
|
|
2189
|
+
}
|
|
2190
|
+
}
|
|
2191
|
+
|
|
2192
|
+
export const UpsertCollectionAccessPolicySchema = CollectionAccessPolicyWriteSchema
|
|
2193
|
+
.superRefine(validateCollectionAccessPolicyShape);
|
|
2194
|
+
|
|
2195
|
+
export const DeleteCollectionAccessPolicySchema = z.object({
|
|
2196
|
+
tenantId: z.string().min(1),
|
|
2197
|
+
policyId: z.string().min(1),
|
|
2198
|
+
});
|
|
2199
|
+
|
|
2200
|
+
export const ListCollectionAccessTeamMembersSchema = z.object({
|
|
2201
|
+
tenantId: z.string().min(1),
|
|
2202
|
+
teamId: z.string().min(1),
|
|
2203
|
+
});
|
|
2204
|
+
|
|
2205
|
+
export const SetCollectionAccessTeamMembersSchema = z.object({
|
|
2206
|
+
tenantId: z.string().min(1),
|
|
2207
|
+
teamId: z.string().min(1),
|
|
2208
|
+
userIds: z.array(z.string().min(1)).max(1_000),
|
|
2209
|
+
});
|
|
2210
|
+
|
|
2211
|
+
export const PreviewCollectionAccessPolicySchema = z.object({
|
|
2212
|
+
tenantId: z.string().min(1),
|
|
2213
|
+
dataModelId: z.string().min(1),
|
|
2214
|
+
collectionId: z.string().optional(),
|
|
2215
|
+
policy: CollectionAccessPolicyWriteSchema.omit({
|
|
2216
|
+
tenantId: true,
|
|
2217
|
+
dataModelId: true,
|
|
2218
|
+
policyId: true,
|
|
2219
|
+
}).extend({
|
|
2220
|
+
dataModelId: z.string().optional(),
|
|
2221
|
+
collectionId: z.string().optional(),
|
|
2222
|
+
}).superRefine(validateCollectionAccessPolicyShape),
|
|
2223
|
+
record: z.record(z.string(), z.unknown()).optional(),
|
|
2224
|
+
});
|
|
2225
|
+
|
|
2226
|
+
const CollectionCollaborationRecordScopeSchema = z.object({
|
|
2227
|
+
tenantId: z.string().min(1),
|
|
2228
|
+
collectionId: z.string().min(1),
|
|
2229
|
+
recordId: z.string().min(1),
|
|
2230
|
+
});
|
|
2231
|
+
|
|
2232
|
+
const CollectionCollaborationRequestIdSchema = z.string().max(191).optional();
|
|
2233
|
+
|
|
2234
|
+
export const CreateCollectionCommentSchema = CollectionCollaborationRecordScopeSchema.extend({
|
|
2235
|
+
body: z.string().trim().min(1).max(10_000),
|
|
2236
|
+
parentId: z.string().min(1).optional(),
|
|
2237
|
+
mentionUserIds: z.array(z.string().min(1)).max(25).optional(),
|
|
2238
|
+
requestId: CollectionCollaborationRequestIdSchema,
|
|
2239
|
+
});
|
|
2240
|
+
|
|
2241
|
+
export const UpdateCollectionCommentSchema = CollectionCollaborationRecordScopeSchema.extend({
|
|
2242
|
+
commentId: z.string().min(1),
|
|
2243
|
+
body: z.string().trim().min(1).max(10_000),
|
|
2244
|
+
mentionUserIds: z.array(z.string().min(1)).max(25).optional(),
|
|
2245
|
+
requestId: CollectionCollaborationRequestIdSchema,
|
|
2246
|
+
});
|
|
1888
2247
|
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
2248
|
+
export const DeleteCollectionCommentSchema = CollectionCollaborationRecordScopeSchema.extend({
|
|
2249
|
+
commentId: z.string().min(1),
|
|
2250
|
+
requestId: CollectionCollaborationRequestIdSchema,
|
|
2251
|
+
});
|
|
2252
|
+
|
|
2253
|
+
export const ListCollectionCommentsSchema = CollectionCollaborationRecordScopeSchema.extend({
|
|
2254
|
+
limit: z.coerce.number().int().min(1).max(100).optional(),
|
|
2255
|
+
offset: z.coerce.number().int().min(0).max(1_000_000).optional(),
|
|
2256
|
+
});
|
|
2257
|
+
|
|
2258
|
+
export const ListCollectionRecordActivitySchema = ListCollectionCommentsSchema;
|
|
2259
|
+
|
|
2260
|
+
export const ListCollectionRecordCollaboratorsSchema = CollectionCollaborationRecordScopeSchema;
|
|
2261
|
+
|
|
2262
|
+
export const SetCollectionRecordCollaboratorsSchema = CollectionCollaborationRecordScopeSchema.extend({
|
|
2263
|
+
assigneeIds: z.array(z.string().min(1)).max(20),
|
|
2264
|
+
watcherIds: z.array(z.string().min(1)).max(100),
|
|
2265
|
+
requestId: CollectionCollaborationRequestIdSchema,
|
|
2266
|
+
});
|
|
1892
2267
|
|
|
1893
|
-
|
|
1894
|
-
|
|
2268
|
+
export const ListCollectionNotificationsSchema = z.object({
|
|
2269
|
+
tenantId: z.string().min(1),
|
|
2270
|
+
limit: z.coerce.number().int().min(1).max(50).optional(),
|
|
2271
|
+
offset: z.coerce.number().int().min(0).max(1_000_000).optional(),
|
|
2272
|
+
unreadOnly: z.boolean().optional(),
|
|
2273
|
+
});
|
|
2274
|
+
|
|
2275
|
+
export const MarkCollectionNotificationsReadSchema = z.object({
|
|
2276
|
+
tenantId: z.string().min(1),
|
|
2277
|
+
notificationIds: z.array(z.string().min(1)).max(100),
|
|
1895
2278
|
});
|
|
1896
2279
|
|
|
1897
|
-
export const
|
|
2280
|
+
export const ListRecordPermissionsSchema = z.object({
|
|
1898
2281
|
tenantId: z.string(),
|
|
1899
2282
|
collectionId: z.string(),
|
|
1900
2283
|
recordId: z.string(),
|
|
2284
|
+
actor: z.string().optional(),
|
|
2285
|
+
subjectType: z.string().optional(),
|
|
2286
|
+
subjectId: z.string().optional(),
|
|
2287
|
+
});
|
|
1901
2288
|
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
// kaldırılacak aksiyonlar
|
|
1907
|
-
// tamamını kaldırmak için ["*"] gönderilebilir
|
|
1908
|
-
actions: z.array(z.string()),
|
|
2289
|
+
const RecordPermissionScopeSchema = z.object({
|
|
2290
|
+
tenantId: z.string(),
|
|
2291
|
+
collectionId: z.string(),
|
|
2292
|
+
recordId: z.string(),
|
|
1909
2293
|
});
|
|
1910
2294
|
|
|
2295
|
+
export const GrantRecordPermissionSchema = z.union([
|
|
2296
|
+
RecordPermissionScopeSchema.extend({
|
|
2297
|
+
// Canonical public shape.
|
|
2298
|
+
subjectType: z.string(), // user | role | group | service | custom
|
|
2299
|
+
subjectId: z.string(),
|
|
2300
|
+
actions: z.array(z.string()).min(1),
|
|
2301
|
+
effect: z.enum(["allow", "deny"]).optional(),
|
|
2302
|
+
grantedBy: z.string().optional(),
|
|
2303
|
+
actor: z.string().optional(),
|
|
2304
|
+
action: z.string().optional(),
|
|
2305
|
+
}),
|
|
2306
|
+
RecordPermissionScopeSchema.extend({
|
|
2307
|
+
// Compatibility with the original single-action backend contract.
|
|
2308
|
+
actor: z.string(),
|
|
2309
|
+
action: z.string(),
|
|
2310
|
+
effect: z.enum(["allow", "deny"]).optional(),
|
|
2311
|
+
grantedBy: z.string().optional(),
|
|
2312
|
+
subjectType: z.string().optional(),
|
|
2313
|
+
subjectId: z.string().optional(),
|
|
2314
|
+
actions: z.array(z.string()).optional(),
|
|
2315
|
+
}),
|
|
2316
|
+
]);
|
|
2317
|
+
|
|
2318
|
+
export const RevokeRecordPermissionSchema = z.union([
|
|
2319
|
+
RecordPermissionScopeSchema.extend({
|
|
2320
|
+
// Canonical public shape.
|
|
2321
|
+
subjectType: z.string(), // user | role | group | service | custom
|
|
2322
|
+
subjectId: z.string(),
|
|
2323
|
+
// tamamını kaldırmak için ["*"] gönderilebilir
|
|
2324
|
+
actions: z.array(z.string()).min(1),
|
|
2325
|
+
revokedBy: z.string().optional(),
|
|
2326
|
+
actor: z.string().optional(),
|
|
2327
|
+
action: z.string().optional(),
|
|
2328
|
+
}),
|
|
2329
|
+
RecordPermissionScopeSchema.extend({
|
|
2330
|
+
// Compatibility with the original single-action backend contract.
|
|
2331
|
+
actor: z.string(),
|
|
2332
|
+
action: z.string(),
|
|
2333
|
+
revokedBy: z.string().optional(),
|
|
2334
|
+
subjectType: z.string().optional(),
|
|
2335
|
+
subjectId: z.string().optional(),
|
|
2336
|
+
actions: z.array(z.string()).optional(),
|
|
2337
|
+
}),
|
|
2338
|
+
]);
|
|
2339
|
+
|
|
1911
2340
|
|
|
1912
2341
|
|
|
1913
2342
|
//---wiki--------------------------------
|
|
@@ -2248,6 +2677,68 @@ export const ListWorkerWhatsAppMessagesSchema = z.object({
|
|
|
2248
2677
|
limit: z.string().regex(/^\d+$/).optional()
|
|
2249
2678
|
});
|
|
2250
2679
|
|
|
2680
|
+
export const SendWorkerSlackMessageSchema = z.object({
|
|
2681
|
+
tenantId: z.string().min(1),
|
|
2682
|
+
workerId: z.string().min(1),
|
|
2683
|
+
channelId: z.string().min(1).optional(),
|
|
2684
|
+
conversationId: z.string().regex(/^[CGD][A-Z0-9]{8,}$/),
|
|
2685
|
+
body: z.string().min(1).refine((value) => Array.from(value).length <= 4000, 'Slack body must be at most 4,000 characters.'),
|
|
2686
|
+
threadTs: z.string().regex(/^\d{10,}\.\d{6}$/).optional(),
|
|
2687
|
+
idempotencyKey: z.string().min(1).max(255)
|
|
2688
|
+
});
|
|
2689
|
+
|
|
2690
|
+
export const TestWorkerSlackChannelSchema = z.object({
|
|
2691
|
+
tenantId: z.string().min(1),
|
|
2692
|
+
channelId: z.string().min(1)
|
|
2693
|
+
});
|
|
2694
|
+
|
|
2695
|
+
export const ListSlackConversationsSchema = z.object({
|
|
2696
|
+
tenantId: z.string().min(1),
|
|
2697
|
+
credentialRef: z.string().min(1)
|
|
2698
|
+
});
|
|
2699
|
+
|
|
2700
|
+
export const ListWorkerSlackMessagesSchema = z.object({
|
|
2701
|
+
tenantId: z.string().min(1),
|
|
2702
|
+
workerId: z.string().min(1),
|
|
2703
|
+
channelId: z.string().min(1).optional(),
|
|
2704
|
+
cursor: z.string().min(1).optional(),
|
|
2705
|
+
limit: z.string().regex(/^\d+$/).optional()
|
|
2706
|
+
});
|
|
2707
|
+
|
|
2708
|
+
export const SendWorkerDiscordMessageSchema = z.object({
|
|
2709
|
+
tenantId: z.string().min(1),
|
|
2710
|
+
workerId: z.string().min(1),
|
|
2711
|
+
channelId: z.string().min(1).optional(),
|
|
2712
|
+
conversationId: z.string().regex(/^\d{17,20}$/),
|
|
2713
|
+
body: z.string().min(1).refine((value) => Array.from(value).length <= 2000, 'Discord body must be at most 2,000 characters.'),
|
|
2714
|
+
replyToMessageId: z.string().regex(/^\d{17,20}$/).optional(),
|
|
2715
|
+
idempotencyKey: z.string().min(1).max(255)
|
|
2716
|
+
});
|
|
2717
|
+
|
|
2718
|
+
export const TestWorkerDiscordChannelSchema = z.object({
|
|
2719
|
+
tenantId: z.string().min(1),
|
|
2720
|
+
channelId: z.string().min(1)
|
|
2721
|
+
});
|
|
2722
|
+
|
|
2723
|
+
export const ListDiscordGuildsSchema = z.object({
|
|
2724
|
+
tenantId: z.string().min(1),
|
|
2725
|
+
credentialRef: z.string().min(1)
|
|
2726
|
+
});
|
|
2727
|
+
|
|
2728
|
+
export const ListDiscordGuildChannelsSchema = z.object({
|
|
2729
|
+
tenantId: z.string().min(1),
|
|
2730
|
+
credentialRef: z.string().min(1),
|
|
2731
|
+
guildId: z.string().regex(/^\d{17,20}$/)
|
|
2732
|
+
});
|
|
2733
|
+
|
|
2734
|
+
export const ListWorkerDiscordMessagesSchema = z.object({
|
|
2735
|
+
tenantId: z.string().min(1),
|
|
2736
|
+
workerId: z.string().min(1),
|
|
2737
|
+
channelId: z.string().min(1).optional(),
|
|
2738
|
+
cursor: z.string().min(1).optional(),
|
|
2739
|
+
limit: z.string().regex(/^\d+$/).optional()
|
|
2740
|
+
});
|
|
2741
|
+
|
|
2251
2742
|
export const ListGoogleMeetCalendarsSchema = z.object({
|
|
2252
2743
|
tenantId: z.string(),
|
|
2253
2744
|
credentialId: z.string(),
|
|
@@ -2541,3 +3032,278 @@ export const EnhanceTopicSchema = z.object({
|
|
|
2541
3032
|
entityDescription: z.string(),
|
|
2542
3033
|
categories: z.string().array().optional()
|
|
2543
3034
|
})
|
|
3035
|
+
|
|
3036
|
+
export const CollectionFormLayoutFieldSchema = z.object({
|
|
3037
|
+
fieldId: z.string().trim().min(1).max(191),
|
|
3038
|
+
label: z.string().max(255).optional(),
|
|
3039
|
+
helpText: z.string().max(1_000).optional(),
|
|
3040
|
+
placeholder: z.string().max(500).optional(),
|
|
3041
|
+
required: z.boolean().optional(),
|
|
3042
|
+
width: z.enum(["full", "half"]).optional(),
|
|
3043
|
+
}).strict();
|
|
3044
|
+
|
|
3045
|
+
export const CollectionFormLayoutSectionSchema = z.object({
|
|
3046
|
+
id: z.string().trim().min(1).max(128),
|
|
3047
|
+
title: z.string().max(255).optional(),
|
|
3048
|
+
description: z.string().max(2_000).optional(),
|
|
3049
|
+
fields: z.array(CollectionFormLayoutFieldSchema).max(50),
|
|
3050
|
+
}).strict();
|
|
3051
|
+
|
|
3052
|
+
export const CollectionFormLayoutSchema = z.object({
|
|
3053
|
+
sections: z.array(CollectionFormLayoutSectionSchema).min(1).max(10),
|
|
3054
|
+
}).strict().superRefine((layout, context) => {
|
|
3055
|
+
const sectionIds = new Set<string>();
|
|
3056
|
+
const fieldIds = new Set<string>();
|
|
3057
|
+
let fieldCount = 0;
|
|
3058
|
+
layout.sections.forEach((section, sectionIndex) => {
|
|
3059
|
+
if (sectionIds.has(section.id)) {
|
|
3060
|
+
context.addIssue({
|
|
3061
|
+
code: z.ZodIssueCode.custom,
|
|
3062
|
+
path: ["sections", sectionIndex, "id"],
|
|
3063
|
+
message: "Form section ids must be unique",
|
|
3064
|
+
});
|
|
3065
|
+
}
|
|
3066
|
+
sectionIds.add(section.id);
|
|
3067
|
+
section.fields.forEach((field, fieldIndex) => {
|
|
3068
|
+
fieldCount += 1;
|
|
3069
|
+
if (fieldIds.has(field.fieldId)) {
|
|
3070
|
+
context.addIssue({
|
|
3071
|
+
code: z.ZodIssueCode.custom,
|
|
3072
|
+
path: ["sections", sectionIndex, "fields", fieldIndex, "fieldId"],
|
|
3073
|
+
message: "A field can appear only once in a form",
|
|
3074
|
+
});
|
|
3075
|
+
}
|
|
3076
|
+
fieldIds.add(field.fieldId);
|
|
3077
|
+
});
|
|
3078
|
+
});
|
|
3079
|
+
if (fieldCount === 0 || fieldCount > 50) {
|
|
3080
|
+
context.addIssue({
|
|
3081
|
+
code: z.ZodIssueCode.custom,
|
|
3082
|
+
path: ["sections"],
|
|
3083
|
+
message: "A form must contain between 1 and 50 fields",
|
|
3084
|
+
});
|
|
3085
|
+
}
|
|
3086
|
+
});
|
|
3087
|
+
|
|
3088
|
+
export const ListCollectionFormsSchema = z.object({
|
|
3089
|
+
tenantId: z.string().min(1),
|
|
3090
|
+
dataModelId: z.string().min(1),
|
|
3091
|
+
collectionId: z.string().min(1),
|
|
3092
|
+
});
|
|
3093
|
+
|
|
3094
|
+
export const UpsertCollectionFormSchema = z.object({
|
|
3095
|
+
tenantId: z.string().min(1),
|
|
3096
|
+
dataModelId: z.string().min(1),
|
|
3097
|
+
collectionId: z.string().min(1),
|
|
3098
|
+
formId: z.string().min(1).optional(),
|
|
3099
|
+
name: z.string().trim().min(1).max(191),
|
|
3100
|
+
description: z.string().max(10_000).optional(),
|
|
3101
|
+
layout: CollectionFormLayoutSchema,
|
|
3102
|
+
submitLabel: z.string().trim().min(1).max(100).optional(),
|
|
3103
|
+
successMessage: z.string().trim().min(1).max(2_000).optional(),
|
|
3104
|
+
enabled: z.boolean().optional(),
|
|
3105
|
+
rateLimitPerMinute: z.number().int().min(1).max(100).optional(),
|
|
3106
|
+
maxSubmissions: z.number().int().min(1).max(1_000_000).nullable().optional(),
|
|
3107
|
+
});
|
|
3108
|
+
|
|
3109
|
+
export const ResolveCollectionFormSchema = z.object({
|
|
3110
|
+
tenantId: z.string().min(1),
|
|
3111
|
+
formId: z.string().min(1),
|
|
3112
|
+
});
|
|
3113
|
+
|
|
3114
|
+
export const SubmitCollectionFormSchema = ResolveCollectionFormSchema.extend({
|
|
3115
|
+
values: z.record(z.string(), z.unknown()).refine(
|
|
3116
|
+
(values) => Object.keys(values).length <= 50,
|
|
3117
|
+
"A form submission can contain at most 50 fields"
|
|
3118
|
+
),
|
|
3119
|
+
submissionKey: z.string().trim().min(8).max(128),
|
|
3120
|
+
});
|
|
3121
|
+
|
|
3122
|
+
export const PublishCollectionFormSchema = ResolveCollectionFormSchema.extend({
|
|
3123
|
+
expiresInDays: z.number().int().min(1).max(365).optional(),
|
|
3124
|
+
});
|
|
3125
|
+
|
|
3126
|
+
export const RevokeCollectionFormSchema = ResolveCollectionFormSchema;
|
|
3127
|
+
export const DeleteCollectionFormSchema = ResolveCollectionFormSchema;
|
|
3128
|
+
|
|
3129
|
+
export const CollectionReportTypeSchema = z.enum(["table", "metric", "chart"]);
|
|
3130
|
+
export const CollectionReportVisibilitySchema = z.enum(["personal", "shared"]);
|
|
3131
|
+
const CollectionReportFilterSchema = z.record(z.string(), z.unknown()).superRefine((filter, context) => {
|
|
3132
|
+
if (JSON.stringify(filter).length > 16 * 1024) {
|
|
3133
|
+
context.addIssue({ code: z.ZodIssueCode.custom, message: "Report filter is too large" });
|
|
3134
|
+
}
|
|
3135
|
+
});
|
|
3136
|
+
const CollectionReportBaseSchema = z.object({
|
|
3137
|
+
tenantId: z.string().min(1),
|
|
3138
|
+
dataModelId: z.string().min(1),
|
|
3139
|
+
collectionId: z.string().min(1),
|
|
3140
|
+
reportId: z.string().min(1).optional(),
|
|
3141
|
+
name: z.string().trim().min(1).max(191),
|
|
3142
|
+
description: z.string().max(4_000).optional(),
|
|
3143
|
+
visibility: CollectionReportVisibilitySchema.optional(),
|
|
3144
|
+
});
|
|
3145
|
+
export const CollectionReportTableConfigSchema = z.object({
|
|
3146
|
+
filter: CollectionReportFilterSchema.optional(),
|
|
3147
|
+
fields: z.array(z.string().min(1)).min(1).max(50),
|
|
3148
|
+
sort: z.record(z.string(), z.enum(["asc", "desc"])).refine(
|
|
3149
|
+
(sort) => Object.keys(sort).length <= 5,
|
|
3150
|
+
"Report sort cannot contain more than 5 fields"
|
|
3151
|
+
).optional(),
|
|
3152
|
+
limit: z.number().int().min(1).max(500).optional(),
|
|
3153
|
+
}).strict();
|
|
3154
|
+
const CollectionReportAggregateConfigBaseSchema = z.object({
|
|
3155
|
+
filter: CollectionReportFilterSchema.optional(),
|
|
3156
|
+
aggregate: z.enum(["count", "sum", "avg", "min", "max"]),
|
|
3157
|
+
valueField: z.string().min(1).optional(),
|
|
3158
|
+
});
|
|
3159
|
+
export const CollectionReportMetricConfigSchema = CollectionReportAggregateConfigBaseSchema.extend({
|
|
3160
|
+
limit: z.literal(1).optional(),
|
|
3161
|
+
}).strict().superRefine((config, context) => {
|
|
3162
|
+
if (config.aggregate !== "count" && !config.valueField) {
|
|
3163
|
+
context.addIssue({ code: z.ZodIssueCode.custom, path: ["valueField"], message: "This aggregate requires valueField" });
|
|
3164
|
+
}
|
|
3165
|
+
});
|
|
3166
|
+
export const CollectionReportChartConfigSchema = CollectionReportAggregateConfigBaseSchema.extend({
|
|
3167
|
+
groupBy: z.string().min(1),
|
|
3168
|
+
limit: z.number().int().min(1).max(100).optional(),
|
|
3169
|
+
}).strict().superRefine((config, context) => {
|
|
3170
|
+
if (config.aggregate !== "count" && !config.valueField) {
|
|
3171
|
+
context.addIssue({ code: z.ZodIssueCode.custom, path: ["valueField"], message: "This aggregate requires valueField" });
|
|
3172
|
+
}
|
|
3173
|
+
});
|
|
3174
|
+
export const UpsertCollectionReportSchema = z.discriminatedUnion("type", [
|
|
3175
|
+
CollectionReportBaseSchema.extend({ type: z.literal("table"), config: CollectionReportTableConfigSchema }),
|
|
3176
|
+
CollectionReportBaseSchema.extend({ type: z.literal("metric"), config: CollectionReportMetricConfigSchema }),
|
|
3177
|
+
CollectionReportBaseSchema.extend({ type: z.literal("chart"), config: CollectionReportChartConfigSchema }),
|
|
3178
|
+
]);
|
|
3179
|
+
export const ListCollectionReportsSchema = z.object({
|
|
3180
|
+
tenantId: z.string().min(1),
|
|
3181
|
+
dataModelId: z.string().min(1),
|
|
3182
|
+
collectionId: z.string().min(1),
|
|
3183
|
+
limit: z.number().int().min(1).max(200).optional(),
|
|
3184
|
+
offset: z.number().int().min(0).max(10_000).optional(),
|
|
3185
|
+
});
|
|
3186
|
+
export const CollectionReportReferenceSchema = z.object({
|
|
3187
|
+
tenantId: z.string().min(1),
|
|
3188
|
+
reportId: z.string().min(1),
|
|
3189
|
+
});
|
|
3190
|
+
export const DeleteCollectionReportSchema = CollectionReportReferenceSchema;
|
|
3191
|
+
export const EvaluateCollectionReportSchema = CollectionReportReferenceSchema;
|
|
3192
|
+
|
|
3193
|
+
const CollectionDashboardWidgetBaseSchema = z.object({
|
|
3194
|
+
id: z.string().min(1).optional(),
|
|
3195
|
+
reportId: z.string().min(1),
|
|
3196
|
+
title: z.string().trim().min(1).max(191),
|
|
3197
|
+
});
|
|
3198
|
+
export const CollectionDashboardWidgetSchema = z.discriminatedUnion("type", [
|
|
3199
|
+
CollectionDashboardWidgetBaseSchema.extend({
|
|
3200
|
+
type: z.literal("table"),
|
|
3201
|
+
config: z.object({
|
|
3202
|
+
pageSize: z.number().int().min(1).max(100).optional(),
|
|
3203
|
+
showHeaders: z.boolean().optional(),
|
|
3204
|
+
}).strict().optional(),
|
|
3205
|
+
}),
|
|
3206
|
+
CollectionDashboardWidgetBaseSchema.extend({
|
|
3207
|
+
type: z.literal("metric"),
|
|
3208
|
+
config: z.object({
|
|
3209
|
+
prefix: z.string().max(32).optional(),
|
|
3210
|
+
suffix: z.string().max(32).optional(),
|
|
3211
|
+
decimals: z.number().int().min(0).max(6).optional(),
|
|
3212
|
+
}).strict().optional(),
|
|
3213
|
+
}),
|
|
3214
|
+
CollectionDashboardWidgetBaseSchema.extend({
|
|
3215
|
+
type: z.literal("chart"),
|
|
3216
|
+
config: z.object({
|
|
3217
|
+
kind: z.enum(["bar", "line", "pie"]).optional(),
|
|
3218
|
+
showLegend: z.boolean().optional(),
|
|
3219
|
+
}).strict().optional(),
|
|
3220
|
+
}),
|
|
3221
|
+
]);
|
|
3222
|
+
export const ListCollectionDashboardsSchema = z.object({
|
|
3223
|
+
tenantId: z.string().min(1),
|
|
3224
|
+
dataModelId: z.string().min(1),
|
|
3225
|
+
collectionId: z.string().min(1),
|
|
3226
|
+
limit: z.number().int().min(1).max(100).optional(),
|
|
3227
|
+
offset: z.number().int().min(0).max(10_000).optional(),
|
|
3228
|
+
});
|
|
3229
|
+
export const UpsertCollectionDashboardSchema = z.object({
|
|
3230
|
+
tenantId: z.string().min(1),
|
|
3231
|
+
dataModelId: z.string().min(1),
|
|
3232
|
+
collectionId: z.string().min(1),
|
|
3233
|
+
dashboardId: z.string().min(1).optional(),
|
|
3234
|
+
name: z.string().trim().min(1).max(191),
|
|
3235
|
+
description: z.string().max(4_000).optional(),
|
|
3236
|
+
settings: z.object({
|
|
3237
|
+
columns: z.number().int().min(1).max(4).optional(),
|
|
3238
|
+
compact: z.boolean().optional(),
|
|
3239
|
+
}).strict().optional(),
|
|
3240
|
+
visibility: CollectionReportVisibilitySchema.optional(),
|
|
3241
|
+
widgets: z.array(CollectionDashboardWidgetSchema).max(20),
|
|
3242
|
+
});
|
|
3243
|
+
export const CollectionDashboardReferenceSchema = z.object({
|
|
3244
|
+
tenantId: z.string().min(1),
|
|
3245
|
+
dashboardId: z.string().min(1),
|
|
3246
|
+
});
|
|
3247
|
+
export const DeleteCollectionDashboardSchema = CollectionDashboardReferenceSchema;
|
|
3248
|
+
export const EvaluateCollectionDashboardSchema = CollectionDashboardReferenceSchema;
|
|
3249
|
+
|
|
3250
|
+
export const PreviewCollectionAppGenerationSchema = z.object({
|
|
3251
|
+
tenantId: z.string().trim().min(1).max(191),
|
|
3252
|
+
prompt: z.string().trim().min(1).max(4_000),
|
|
3253
|
+
}).strict();
|
|
3254
|
+
|
|
3255
|
+
export const ApplyCollectionAppGenerationSchema = z.object({
|
|
3256
|
+
tenantId: z.string().trim().min(1).max(191),
|
|
3257
|
+
planId: z.string().trim().min(1).max(191),
|
|
3258
|
+
expectedProposalHash: z.string().regex(/^[a-f0-9]{64}$/),
|
|
3259
|
+
idempotencyKey: z.string().trim().min(8).max(128),
|
|
3260
|
+
}).strict();
|
|
3261
|
+
|
|
3262
|
+
export const RollbackCollectionAppGenerationSchema = z.object({
|
|
3263
|
+
tenantId: z.string().trim().min(1).max(191),
|
|
3264
|
+
runId: z.string().trim().min(1).max(191),
|
|
3265
|
+
idempotencyKey: z.string().trim().min(8).max(128),
|
|
3266
|
+
}).strict();
|
|
3267
|
+
|
|
3268
|
+
export const ResumeCollectionAppGenerationRunSchema = z.object({
|
|
3269
|
+
tenantId: z.string().trim().min(1).max(191),
|
|
3270
|
+
runId: z.string().trim().min(1).max(191),
|
|
3271
|
+
}).strict();
|
|
3272
|
+
|
|
3273
|
+
export const GetCollectionAppGenerationPlanSchema = z.object({
|
|
3274
|
+
tenantId: z.string().trim().min(1).max(191),
|
|
3275
|
+
planId: z.string().trim().min(1).max(191),
|
|
3276
|
+
}).strict();
|
|
3277
|
+
|
|
3278
|
+
export const ListCollectionAppGenerationPlansSchema = z.object({
|
|
3279
|
+
tenantId: z.string().trim().min(1).max(191),
|
|
3280
|
+
status: z.enum(["previewed", "applying", "compensating", "applied", "failed", "compensation_failed", "rollback_retained", "rolled_back"]).optional(),
|
|
3281
|
+
offset: z.number().int().min(0).max(1_000_000).optional(),
|
|
3282
|
+
limit: z.number().int().min(1).max(50).optional(),
|
|
3283
|
+
}).strict();
|
|
3284
|
+
|
|
3285
|
+
export const GetCollectionAppGenerationRunSchema = z.object({
|
|
3286
|
+
tenantId: z.string().trim().min(1).max(191),
|
|
3287
|
+
runId: z.string().trim().min(1).max(191),
|
|
3288
|
+
}).strict();
|
|
3289
|
+
|
|
3290
|
+
export const ListCollectionAppGenerationRunsSchema = z.object({
|
|
3291
|
+
tenantId: z.string().trim().min(1).max(191),
|
|
3292
|
+
planId: z.string().trim().min(1).max(191).optional(),
|
|
3293
|
+
status: z.enum([
|
|
3294
|
+
"applying",
|
|
3295
|
+
"provisioning",
|
|
3296
|
+
"compensating",
|
|
3297
|
+
"applied",
|
|
3298
|
+
"failed",
|
|
3299
|
+
"compensation_failed",
|
|
3300
|
+
"rolling_back",
|
|
3301
|
+
"rollback_cleanup",
|
|
3302
|
+
"rollback_cleanup_failed",
|
|
3303
|
+
"rollback_failed",
|
|
3304
|
+
"rollback_retained",
|
|
3305
|
+
"rolled_back",
|
|
3306
|
+
]).optional(),
|
|
3307
|
+
offset: z.number().int().min(0).max(1_000_000).optional(),
|
|
3308
|
+
limit: z.number().int().min(1).max(50).optional(),
|
|
3309
|
+
}).strict();
|