@lunnoa/client 0.0.0-development → 1.1.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/react.js CHANGED
@@ -1038,6 +1038,21 @@ var EntitiesResource = class {
1038
1038
  };
1039
1039
 
1040
1040
  // src/resources/entity-types.ts
1041
+ function entityTypeDefinitionToUpsert(def) {
1042
+ return {
1043
+ slug: def.slug,
1044
+ name: def.name,
1045
+ namePlural: def.namePlural,
1046
+ description: def.description,
1047
+ icon: def.icon,
1048
+ color: def.color,
1049
+ attributeSchema: def.attributeSchema,
1050
+ stateSchema: def.stateSchema,
1051
+ isEnabled: def.isEnabled,
1052
+ allowUnknownAttributes: def.allowUnknownAttributes ?? false,
1053
+ managedByCode: true
1054
+ };
1055
+ }
1041
1056
  var EntityTypesResource = class {
1042
1057
  constructor(http) {
1043
1058
  this.http = http;
@@ -1068,6 +1083,19 @@ var EntityTypesResource = class {
1068
1083
  query: { expansion: serializeCsv(options.expansion) }
1069
1084
  });
1070
1085
  }
1086
+ /**
1087
+ * Creates or updates an entity type by workspace-scoped slug.
1088
+ * Prefer the CLI (`npx @lunnoa/client entity-types deploy`) for happy-path deploy.
1089
+ */
1090
+ upsertBySlug(definition) {
1091
+ const payload = "kind" in definition && definition.kind === "entityType" ? entityTypeDefinitionToUpsert(definition) : definition;
1092
+ return this.http.post("/api/object-types/upsert", {
1093
+ body: payload,
1094
+ query: {
1095
+ expansion: "attributeSchema,stateSchema,description"
1096
+ }
1097
+ });
1098
+ }
1071
1099
  };
1072
1100
 
1073
1101
  // src/resources/approvals.ts
@@ -1528,12 +1556,42 @@ var QueueItemsResource = class {
1528
1556
  `/api/queues/${queueId}/items/${itemId}`
1529
1557
  );
1530
1558
  }
1531
- /** Adds an item to a queue. */
1559
+ /** Adds an item to a queue. Pass `objectId` to link the item to an entity. */
1532
1560
  create(queueId, data) {
1533
1561
  return this.http.post(`/api/queues/${queueId}/items`, {
1534
1562
  body: data
1535
1563
  });
1536
1564
  }
1565
+ /**
1566
+ * Lists queue items linked to an Object across all queues in the workspace.
1567
+ * Use for Object detail "Work" panels.
1568
+ */
1569
+ listByObject(objectId, options = {}) {
1570
+ return this.http.get(
1571
+ `/api/objects/${objectId}/queue-items`,
1572
+ {
1573
+ query: {
1574
+ status: options.status,
1575
+ limit: options.limit,
1576
+ offset: options.offset,
1577
+ expansion: serializeCsv(options.expansion)
1578
+ }
1579
+ }
1580
+ );
1581
+ }
1582
+ /** Async-iterates every queue item linked to an Object. */
1583
+ iterateByObject(objectId, options = {}) {
1584
+ return iterateOffset(async (offset) => {
1585
+ const result = await this.listByObject(objectId, {
1586
+ ...options,
1587
+ offset
1588
+ });
1589
+ return {
1590
+ items: result.items ?? [],
1591
+ pagination: result.pagination
1592
+ };
1593
+ });
1594
+ }
1537
1595
  /** Adds many items to a queue in one call. */
1538
1596
  bulkCreate(queueId, data) {
1539
1597
  return this.http.post(