@lunnoa/client 1.0.0 → 1.2.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