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