@agentforge-io/sdk-server 4.35.0 → 4.37.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/index.d.ts CHANGED
@@ -3,7 +3,7 @@ export type { AgentForgeClientOptions, RequestOptions } from './client';
3
3
  export { AgentForgeError, AgentForgeAuthError, AgentForgeNotFoundError, AgentForgeNetworkError, } from './errors';
4
4
  export { APP_WEBHOOK_HEADERS, TOOL_CALLBACK_HEADERS, ToolCallbackSignatureError, signToolCallbackPayload, verifyAppWebhook, verifyToolCallbackSignature, } from './webhooks';
5
5
  export { WebhookResource, type SetAppWebhookInput } from './resources/webhook';
6
- export type { AppWebhook, AppWebhookEvent, AppWebhookEventName, AgentMe, AgentSummary, AppUserConnectorStatus, ApprovalCopyBundle, ChannelContext, ChatStreamChunk, ChatStreamEvent, ChatTokenRecord, ConnectorDefaultsResult, ConnectorDefaultsSource, ConnectorResourceItem, ConnectorStatus, ConnectorToolInfo, ConversationHistory, ConversationStatus, CreateAgentInput, CreateClickupTaskInput, CreateClickupTaskResult, ExternalToolSummary, IssueChatTokenInput, ListAgentsResult, ListConnectorResourcesResult, McpServerConfig, MessageRecord, MessageRole, PublicAppBranding, PublicProfileBlock, PublicProfileTemplate, PublicTeamLanding, CreateTeamInput, UpdateTeamInput, TeamSummary, TeamDetail, TeamTheme, TeamBusinessHours, TeamWeekday, TeamProfileBlock, AppInstallation, TemplateConfigField, TemplateSummary, TemplateDetail, TemplateCategoryRef, MarketplaceCategory, MarketplaceCategoryGroup, MarketplaceLocale, TemplateInstallResult, TenantConfigEntry, Place, PlaceSuggestion, SearchPlacesInput, AutocompletePlacesInput, PlacesScope, CaseField, CaseBusinessState, CaseType, CaseState, CasePayment, CasePaymentAccount, CasePaymentStatus, CaseReceiptPayment, CaseView, CreateDirectOrderInput, DirectOrderForm, CaseReceipt, CaseReceiptLine, ListCasesInput, AddressValue, DeliveryLocalPricing, DeliverySettings, PaymentMethodKind, PaymentSettings, PaymentSettingsInput, PaymentAccount, PaymentCountry, PaymentFieldDef, PaymentMethodDef, StructuredConfigInput, StructuredConfigEntry, DeliveryQuoteStatus, DeliveryQuoteInput, DeliveryQuote, AppSelf, AppSelfConnector, AppSelfConnectors, AppSelfConnectorTools, AppSelfConnectorToolsResponse, RegisterToolInput, RegisterToolsInput, BusinessRoleEntry, Catalog, CatalogCheckoutCta, CatalogCategory, CatalogProduct, CatalogProductPhoto, CatalogProductKind, CatalogProductStatus, CatalogPriceKind, CatalogAvailability, CatalogLockableField, CatalogProductPage, UpsertCatalogInput, CreateCatalogCategoryInput, UpdateCatalogCategoryInput, CreateCatalogProductInput, UpdateCatalogProductInput, ListCatalogProductsInput, CatalogPhotoUploadTarget, SignCatalogPhotoUploadInput, AttachCatalogPhotoInput, CatalogImportItem, CatalogImportPreview, CatalogImportApplyResult, CatalogFileMapping, CatalogFilePlan, CatalogFilePreview, CatalogFileApplyResult, CatalogFileInput, CatalogFilePreviewInput, CatalogMenuItem, CatalogMenuRead, CatalogMenuReadInput, CatalogOption, CatalogOptionGroup, SaveCatalogOptionGroupInput, CatalogOptionChoice, CatalogOptionChange, CatalogOptionChangesPlan, CatalogFileApplyInput, CatalogFileErrorCode, CatalogImportSourceStatus, CatalogImportColumnMapping, CatalogImportRunResult, CatalogImportSource, CreateCatalogImportSourceInput, UpdateCatalogImportSourceInput, PreviewCatalogImportSourceInput, CatalogImportSourcePreview, CatalogSheetTab, CatalogTemplateSheet, CreateCatalogTemplateSheetInput, GoogleSheetsPickerInput, GoogleSheetsPickerSession, GoogleSheetsPickerErrorCode, GoogleSheetsPickerResult, RegisterToolsResult, ToolCallbackPayload, ToolCallRecord, ToolPermission, ToolPermissionMode, TokenUsage, TenantSecretEntry, UpdateAgentInput, InboxThreadMode, InboxMessageDirection, InboxMessageSource, InboxMessageType, InboxThreadCustomerProfileView, InboxThreadView, InboxMessageView, SupportKpiTotals, SupportKpiResponse, AgentAttentionLogRow, } from './types';
6
+ export type { AppWebhook, AppWebhookEvent, AppWebhookEventName, AgentMe, AgentSummary, AppUserConnectorStatus, ApprovalCopyBundle, ChannelContext, ChatStreamChunk, ChatStreamEvent, ChatTokenRecord, ConnectorDefaultsResult, ConnectorDefaultsSource, ConnectorResourceItem, ConnectorStatus, ConnectorToolInfo, ConversationHistory, ConversationStatus, CreateAgentInput, CreateClickupTaskInput, CreateClickupTaskResult, ExternalToolSummary, IssueChatTokenInput, ListAgentsResult, ListConnectorResourcesResult, McpServerConfig, MessageRecord, MessageRole, PublicAppBranding, PublicProfileBlock, PublicProfileTemplate, PublicTeamLanding, CreateTeamInput, UpdateTeamInput, TeamSummary, TeamDetail, TeamTheme, TeamBusinessHours, TeamWeekday, TeamProfileBlock, AppInstallation, TemplateConfigField, TemplateSummary, TemplateDetail, TemplateCategoryRef, MarketplaceCategory, MarketplaceCategoryGroup, MarketplaceLocale, TemplateInstallResult, TenantConfigEntry, Place, PlaceSuggestion, SearchPlacesInput, AutocompletePlacesInput, PlacesScope, CaseField, CaseBusinessState, CaseType, CaseState, CasePayment, CasePaymentAccount, CasePaymentStatus, CaseReceiptPayment, CaseView, CreateDirectOrderInput, DirectOrderForm, CaseReceipt, CaseReceiptLine, ListCasesInput, AddressValue, DeliveryLocalPricing, DeliverySettings, PaymentMethodKind, PaymentSettings, PaymentSettingsInput, PaymentAccount, PaymentCountry, PaymentFieldDef, PaymentMethodDef, StructuredConfigInput, StructuredConfigEntry, DeliveryQuoteStatus, DeliveryQuoteInput, DeliveryQuote, AppSelf, AppSelfConnector, AppSelfConnectors, AppSelfConnectorTools, AppSelfConnectorToolsResponse, RegisterToolInput, RegisterToolsInput, BusinessRoleEntry, Catalog, CatalogCheckoutCta, CatalogCategory, CatalogProduct, CatalogProductPhoto, CatalogProductKind, CatalogProductStatus, CatalogPriceKind, CatalogAvailability, CatalogLockableField, CatalogProductPage, UpsertCatalogInput, CreateCatalogCategoryInput, UpdateCatalogCategoryInput, CreateCatalogProductInput, UpdateCatalogProductInput, ListCatalogProductsInput, CatalogPhotoUploadTarget, SignCatalogPhotoUploadInput, AttachCatalogPhotoInput, CatalogImportItem, CatalogImportPreview, CatalogImportApplyResult, CatalogFileMapping, CatalogFilePlan, CatalogFilePreview, CatalogFileApplyResult, CatalogFileInput, CatalogFilePreviewInput, CatalogMenuItem, CatalogMenuRead, CatalogMenuReadInput, CatalogOption, CatalogOptionGroup, SaveCatalogOptionGroupInput, CatalogOptionChoice, CatalogOptionChange, CatalogOptionChangesPlan, CatalogUnit, SaveCatalogUnitInput, CatalogSaleRule, CatalogFileApplyInput, CatalogFileErrorCode, CatalogImportSourceStatus, CatalogImportColumnMapping, CatalogImportRunResult, CatalogImportSource, CreateCatalogImportSourceInput, UpdateCatalogImportSourceInput, PreviewCatalogImportSourceInput, CatalogImportSourcePreview, CatalogSheetTab, CatalogTemplateSheet, CreateCatalogTemplateSheetInput, GoogleSheetsPickerInput, GoogleSheetsPickerSession, GoogleSheetsPickerErrorCode, GoogleSheetsPickerResult, RegisterToolsResult, ToolCallbackPayload, ToolCallRecord, ToolPermission, ToolPermissionMode, TokenUsage, TenantSecretEntry, UpdateAgentInput, InboxThreadMode, InboxMessageDirection, InboxMessageSource, InboxMessageType, InboxThreadCustomerProfileView, InboxThreadView, InboxMessageView, SupportKpiTotals, SupportKpiResponse, AgentAttentionLogRow, } from './types';
7
7
  export { AgentsResource } from './resources/agents';
8
8
  export { AnalyticsResource } from './resources/analytics';
9
9
  export type { GetSupportKpisInput, GetAgentAttentionLogInput, } from './resources/analytics';
@@ -26,7 +26,7 @@ export type { ContactVerificationChannel, LinkContactInput, LinkContactResult, A
26
26
  export { DeliveryResource } from './resources/delivery';
27
27
  export { CasesResource } from './resources/cases';
28
28
  export { BusinessRolesResource } from './resources/business-roles';
29
- export { CatalogResource, CatalogCategoriesResource, CatalogProductsResource, CatalogPhotosResource, CatalogImportResource, CatalogFileImportResource, CatalogMenuImportResource, CatalogOptionGroupsResource, CatalogSourcesResource, AgentForgeCatalogImportLimitError, CATALOG_IMPORT_MAX_ITEMS, } from './resources/catalog';
29
+ export { CatalogResource, CatalogCategoriesResource, CatalogProductsResource, CatalogPhotosResource, CatalogImportResource, CatalogFileImportResource, CatalogMenuImportResource, CatalogOptionGroupsResource, CatalogUnitsResource, CatalogSourcesResource, AgentForgeCatalogImportLimitError, CATALOG_IMPORT_MAX_ITEMS, } from './resources/catalog';
30
30
  export type { ListThreadsOptions, SendMessageInput, AssignThreadInput, UnassignThreadInput, SetThreadModeInput, CloseThreadInput, } from './resources/inbox';
31
31
  export { ProvisioningResource } from './resources/provisioning';
32
32
  export type { ProvisionedTenant, ProvisionedApp, ProvisionedTeam, } from './resources/provisioning';
package/dist/index.js CHANGED
@@ -28,7 +28,7 @@
28
28
  // const payload = af.tools.verifyCallback({ rawBody, signatureHeader, secretPlaintext });
29
29
  // await af.tools.respondToCallback({ resultUrl: payload.resultUrl, tenantId: payload.tenantId, secret, result });
30
30
  Object.defineProperty(exports, "__esModule", { value: true });
31
- exports.ToolsResource = exports.TeamsResource = exports.SecretsResource = exports.ProvisioningResource = exports.CATALOG_IMPORT_MAX_ITEMS = exports.AgentForgeCatalogImportLimitError = exports.CatalogSourcesResource = exports.CatalogOptionGroupsResource = exports.CatalogMenuImportResource = exports.CatalogFileImportResource = exports.CatalogImportResource = exports.CatalogPhotosResource = exports.CatalogProductsResource = exports.CatalogCategoriesResource = exports.CatalogResource = exports.BusinessRolesResource = exports.CasesResource = exports.DeliveryResource = exports.ContactVerificationResource = exports.ContactsResource = exports.PlacesResource = exports.TenantConfigResource = exports.MarketplaceResource = exports.TemplatesResource = exports.InstallationsResource = exports.InboxResource = exports.parseGoogleSheetsPickerResult = exports.ConnectorsResource = exports.ChatResource = exports.AppsResource = exports.AnalyticsResource = exports.AgentsResource = exports.WebhookResource = exports.verifyToolCallbackSignature = exports.verifyAppWebhook = exports.signToolCallbackPayload = exports.ToolCallbackSignatureError = exports.TOOL_CALLBACK_HEADERS = exports.APP_WEBHOOK_HEADERS = exports.AgentForgeNetworkError = exports.AgentForgeNotFoundError = exports.AgentForgeAuthError = exports.AgentForgeError = exports.INSTALLED_TENANT_HEADER = exports.AgentForgeClient = void 0;
31
+ exports.ToolsResource = exports.TeamsResource = exports.SecretsResource = exports.ProvisioningResource = exports.CATALOG_IMPORT_MAX_ITEMS = exports.AgentForgeCatalogImportLimitError = exports.CatalogSourcesResource = exports.CatalogUnitsResource = exports.CatalogOptionGroupsResource = exports.CatalogMenuImportResource = exports.CatalogFileImportResource = exports.CatalogImportResource = exports.CatalogPhotosResource = exports.CatalogProductsResource = exports.CatalogCategoriesResource = exports.CatalogResource = exports.BusinessRolesResource = exports.CasesResource = exports.DeliveryResource = exports.ContactVerificationResource = exports.ContactsResource = exports.PlacesResource = exports.TenantConfigResource = exports.MarketplaceResource = exports.TemplatesResource = exports.InstallationsResource = exports.InboxResource = exports.parseGoogleSheetsPickerResult = exports.ConnectorsResource = exports.ChatResource = exports.AppsResource = exports.AnalyticsResource = exports.AgentsResource = exports.WebhookResource = exports.verifyToolCallbackSignature = exports.verifyAppWebhook = exports.signToolCallbackPayload = exports.ToolCallbackSignatureError = exports.TOOL_CALLBACK_HEADERS = exports.APP_WEBHOOK_HEADERS = exports.AgentForgeNetworkError = exports.AgentForgeNotFoundError = exports.AgentForgeAuthError = exports.AgentForgeError = exports.INSTALLED_TENANT_HEADER = exports.AgentForgeClient = void 0;
32
32
  var client_1 = require("./client");
33
33
  Object.defineProperty(exports, "AgentForgeClient", { enumerable: true, get: function () { return client_1.AgentForgeClient; } });
34
34
  Object.defineProperty(exports, "INSTALLED_TENANT_HEADER", { enumerable: true, get: function () { return client_1.INSTALLED_TENANT_HEADER; } });
@@ -87,6 +87,7 @@ Object.defineProperty(exports, "CatalogImportResource", { enumerable: true, get:
87
87
  Object.defineProperty(exports, "CatalogFileImportResource", { enumerable: true, get: function () { return catalog_1.CatalogFileImportResource; } });
88
88
  Object.defineProperty(exports, "CatalogMenuImportResource", { enumerable: true, get: function () { return catalog_1.CatalogMenuImportResource; } });
89
89
  Object.defineProperty(exports, "CatalogOptionGroupsResource", { enumerable: true, get: function () { return catalog_1.CatalogOptionGroupsResource; } });
90
+ Object.defineProperty(exports, "CatalogUnitsResource", { enumerable: true, get: function () { return catalog_1.CatalogUnitsResource; } });
90
91
  Object.defineProperty(exports, "CatalogSourcesResource", { enumerable: true, get: function () { return catalog_1.CatalogSourcesResource; } });
91
92
  Object.defineProperty(exports, "AgentForgeCatalogImportLimitError", { enumerable: true, get: function () { return catalog_1.AgentForgeCatalogImportLimitError; } });
92
93
  Object.defineProperty(exports, "CATALOG_IMPORT_MAX_ITEMS", { enumerable: true, get: function () { return catalog_1.CATALOG_IMPORT_MAX_ITEMS; } });
@@ -7,6 +7,13 @@ export declare class CasesResource {
7
7
  list(input?: ListCasesInput): Promise<CaseView[]>;
8
8
  /** `GET /api/v1/cases/:id` — 404 when it is not this workspace's. */
9
9
  get(caseId: string): Promise<CaseView>;
10
+ /**
11
+ * `POST /api/v1/cases/:id/weigh` — AGF-UNITS U3: what a line sold by value
12
+ * («$3.000 de queso») really weighed, in the product's unit (`line` = the
13
+ * receipt line's `weigh`). Corrects the stock, never the price; the receipt
14
+ * then says it was weighed.
15
+ */
16
+ weighLine(caseId: string, line: string, weight: number): Promise<CaseView>;
10
17
  /**
11
18
  * `POST /api/v1/cases/:id/transition` — the business moves a case:
12
19
  * `accepted` / `rejected` from `submitted`, then the type's states,
@@ -29,6 +29,15 @@ class CasesResource {
29
29
  async get(caseId) {
30
30
  return this.client.request('GET', `/api/v1/cases/${encodeURIComponent(caseId)}`);
31
31
  }
32
+ /**
33
+ * `POST /api/v1/cases/:id/weigh` — AGF-UNITS U3: what a line sold by value
34
+ * («$3.000 de queso») really weighed, in the product's unit (`line` = the
35
+ * receipt line's `weigh`). Corrects the stock, never the price; the receipt
36
+ * then says it was weighed.
37
+ */
38
+ async weighLine(caseId, line, weight) {
39
+ return this.client.request('POST', `/api/v1/cases/${encodeURIComponent(caseId)}/weigh`, { line, weight });
40
+ }
32
41
  /**
33
42
  * `POST /api/v1/cases/:id/transition` — the business moves a case:
34
43
  * `accepted` / `rejected` from `submitted`, then the type's states,
@@ -1,6 +1,6 @@
1
1
  import type { AgentForgeClient } from '../client';
2
2
  import { AgentForgeError } from '../errors';
3
- import type { AttachCatalogPhotoInput, Catalog, CatalogCategory, CatalogFileApplyInput, CatalogFileApplyResult, CatalogOptionChange, CatalogOptionChangesPlan, CatalogOptionGroup, SaveCatalogOptionGroupInput, CatalogMenuItem, CatalogMenuRead, CatalogMenuReadInput, CatalogFilePreview, CatalogFilePreviewInput, CatalogImportApplyResult, CatalogImportItem, CatalogImportPreview, CatalogImportSource, CatalogImportSourcePreview, CatalogImportRunResult, CatalogPhotoUploadTarget, CatalogProduct, CatalogProductPage, CatalogSheetTab, CatalogTemplateSheet, CreateCatalogTemplateSheetInput, CreateCatalogCategoryInput, CreateCatalogImportSourceInput, CreateCatalogProductInput, ListCatalogProductsInput, PreviewCatalogImportSourceInput, SignCatalogPhotoUploadInput, UpdateCatalogCategoryInput, UpdateCatalogImportSourceInput, UpdateCatalogProductInput, UpsertCatalogInput } from '../types';
3
+ import type { AttachCatalogPhotoInput, Catalog, CatalogCategory, CatalogFileApplyInput, CatalogFileApplyResult, CatalogOptionChange, CatalogOptionChangesPlan, CatalogOptionGroup, CatalogUnit, SaveCatalogUnitInput, SaveCatalogOptionGroupInput, CatalogMenuItem, CatalogMenuRead, CatalogMenuReadInput, CatalogFilePreview, CatalogFilePreviewInput, CatalogImportApplyResult, CatalogImportItem, CatalogImportPreview, CatalogImportSource, CatalogImportSourcePreview, CatalogImportRunResult, CatalogPhotoUploadTarget, CatalogProduct, CatalogProductPage, CatalogSheetTab, CatalogTemplateSheet, CreateCatalogTemplateSheetInput, CreateCatalogCategoryInput, CreateCatalogImportSourceInput, CreateCatalogProductInput, ListCatalogProductsInput, PreviewCatalogImportSourceInput, SignCatalogPhotoUploadInput, UpdateCatalogCategoryInput, UpdateCatalogImportSourceInput, UpdateCatalogProductInput, UpsertCatalogInput } from '../types';
4
4
  /** Max structured items per `import.preview/apply` call (platform cap). */
5
5
  export declare const CATALOG_IMPORT_MAX_ITEMS = 200;
6
6
  /** Thrown client-side, before any request, when `items` exceeds the cap. */
@@ -38,6 +38,22 @@ export declare class CatalogPhotosResource {
38
38
  /** `PATCH …/photos/cover` */
39
39
  setCover(productId: string, url: string): Promise<CatalogProduct>;
40
40
  }
41
+ /** AGF-UNITS U1 — units of measure: the standard ones and the business's own. */
42
+ export declare class CatalogUnitsResource {
43
+ private readonly client;
44
+ constructor(client: AgentForgeClient);
45
+ /** `GET /units` */
46
+ list(): Promise<{
47
+ standard: CatalogUnit[];
48
+ custom: CatalogUnit[];
49
+ }>;
50
+ /** `POST /units` — create (or replace, same key). 400 `INVALID_UNIT`. */
51
+ save(input: SaveCatalogUnitInput): Promise<CatalogUnit>;
52
+ /** `DELETE /units/:key` — 409 `UNIT_IN_USE` while a product is measured in it. */
53
+ delete(key: string): Promise<{
54
+ removed: boolean;
55
+ }>;
56
+ }
41
57
  /**
42
58
  * AGF-MENU-OPTIONS M2 — the catalog's option groups library (sauces, sizes,
43
59
  * sides, «sin cebolla»), reused by products through `optionGroupIds`.
@@ -175,6 +191,7 @@ export declare class CatalogResource {
175
191
  readonly import: CatalogImportResource;
176
192
  readonly sources: CatalogSourcesResource;
177
193
  readonly optionGroups: CatalogOptionGroupsResource;
194
+ readonly units: CatalogUnitsResource;
178
195
  constructor(client: AgentForgeClient);
179
196
  /** `GET /api/v1/catalog` — the tenant's catalog, or `null` when it has none yet
180
197
  * (404 `CATALOG_NOT_FOUND`). Other 404s still throw. */
@@ -16,7 +16,7 @@
16
16
  // machine-readable code (`CATALOG_NOT_FOUND`, `FILE_EMPTY_FILE`,
17
17
  // `INVALID_MAPPING`, `TOO_MANY_ITEMS`, …).
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.CatalogResource = exports.CatalogSourcesResource = exports.CatalogImportResource = exports.CatalogMenuImportResource = exports.CatalogFileImportResource = exports.CatalogProductsResource = exports.CatalogOptionGroupsResource = exports.CatalogPhotosResource = exports.CatalogCategoriesResource = exports.AgentForgeCatalogImportLimitError = exports.CATALOG_IMPORT_MAX_ITEMS = void 0;
19
+ exports.CatalogResource = exports.CatalogSourcesResource = exports.CatalogImportResource = exports.CatalogMenuImportResource = exports.CatalogFileImportResource = exports.CatalogProductsResource = exports.CatalogOptionGroupsResource = exports.CatalogUnitsResource = exports.CatalogPhotosResource = exports.CatalogCategoriesResource = exports.AgentForgeCatalogImportLimitError = exports.CATALOG_IMPORT_MAX_ITEMS = void 0;
20
20
  const errors_1 = require("../errors");
21
21
  const BASE = '/api/v1/catalog';
22
22
  const TENANT_AUTH = { forceApiKey: true };
@@ -110,6 +110,25 @@ class CatalogPhotosResource {
110
110
  }
111
111
  }
112
112
  exports.CatalogPhotosResource = CatalogPhotosResource;
113
+ /** AGF-UNITS U1 — units of measure: the standard ones and the business's own. */
114
+ class CatalogUnitsResource {
115
+ constructor(client) {
116
+ this.client = client;
117
+ }
118
+ /** `GET /units` */
119
+ async list() {
120
+ return this.client.request('GET', `${BASE}/units`, undefined, TENANT_AUTH);
121
+ }
122
+ /** `POST /units` — create (or replace, same key). 400 `INVALID_UNIT`. */
123
+ async save(input) {
124
+ return this.client.request('POST', `${BASE}/units`, input, TENANT_AUTH);
125
+ }
126
+ /** `DELETE /units/:key` — 409 `UNIT_IN_USE` while a product is measured in it. */
127
+ async delete(key) {
128
+ return this.client.request('DELETE', `${BASE}/units/${seg(key)}`, undefined, TENANT_AUTH);
129
+ }
130
+ }
131
+ exports.CatalogUnitsResource = CatalogUnitsResource;
113
132
  /**
114
133
  * AGF-MENU-OPTIONS M2 — the catalog's option groups library (sauces, sizes,
115
134
  * sides, «sin cebolla»), reused by products through `optionGroupIds`.
@@ -334,6 +353,7 @@ class CatalogResource {
334
353
  this.products = new CatalogProductsResource(client);
335
354
  this.import = new CatalogImportResource(client);
336
355
  this.optionGroups = new CatalogOptionGroupsResource(client);
356
+ this.units = new CatalogUnitsResource(client);
337
357
  this.sources = new CatalogSourcesResource(client);
338
358
  }
339
359
  /** `GET /api/v1/catalog` — the tenant's catalog, or `null` when it has none yet
package/dist/types.d.ts CHANGED
@@ -1047,6 +1047,9 @@ export interface CatalogProduct {
1047
1047
  lockedFields: CatalogLockableField[];
1048
1048
  /** AGF-MENU-OPTIONS M2 — the catalog's option groups this product offers, in order. */
1049
1049
  optionGroupIds?: string[];
1050
+ /** AGF-UNITS U2 — how it is sold; null = by unit. Sold by measure, `stock` counts the unit
1051
+ * kind's base (g, ml, cm): divide by the unit's `base` to read it in the product's unit. */
1052
+ saleRule?: CatalogSaleRule | null;
1050
1053
  lastSoldAt?: string | null;
1051
1054
  demandCount: number;
1052
1055
  createdAt: string;
@@ -1077,6 +1080,49 @@ export interface UpdateCatalogProductInput extends Partial<CreateCatalogProductI
1077
1080
  sortOrder?: number;
1078
1081
  /** AGF-MENU-OPTIONS M2 — ids from `catalog.optionGroups.list()`, in order ([] removes them). */
1079
1082
  optionGroupIds?: string[];
1083
+ /** AGF-UNITS U2 — `{ by: 'measure', step?, min? }` (in the product's unit) or `{ by: 'unit' }`.
1084
+ * Switching converts the stock; a measure needs a weight/volume/length/area/time unit. */
1085
+ saleRule?: CatalogSaleRule;
1086
+ }
1087
+ /** AGF-UNITS U2 — how a product is sold. */
1088
+ export interface CatalogSaleRule {
1089
+ by: 'unit' | 'measure';
1090
+ /** Units of the product's unit per step (0.25 lb). */
1091
+ step?: number;
1092
+ /** Fewest units of the product's unit per line. */
1093
+ min?: number;
1094
+ /**
1095
+ * AGF-UNITS U3 — also sold by value («3000 de queso»): a line may be an
1096
+ * amount of money (cents), at least `min`, on `step`. The customer pays the
1097
+ * amount; the measure is estimated from the price. Measure only.
1098
+ */
1099
+ value?: {
1100
+ min: number;
1101
+ step: number;
1102
+ };
1103
+ }
1104
+ /** AGF-UNITS U1 — a unit of measure: standard (unidad, kg, libra, litro, metro, caja…) or the business's own. */
1105
+ export interface CatalogUnit {
1106
+ /** What a product stores in `unit` (absent = unidad). */
1107
+ key: string;
1108
+ name: string;
1109
+ plural: string;
1110
+ /** Short label after a number or a price («kg», «lb»). */
1111
+ short?: string;
1112
+ kind: 'count' | 'weight' | 'volume' | 'length' | 'area' | 'time';
1113
+ /** Decimals a quantity of it may have (count units: 0). */
1114
+ decimals: number;
1115
+ /** Size in the kind's base unit (g, ml, cm, cm², min). */
1116
+ base?: number;
1117
+ aliases?: string[];
1118
+ }
1119
+ /** Create (or replace, same key) one of the business's units. */
1120
+ export interface SaveCatalogUnitInput {
1121
+ key?: string;
1122
+ name: string;
1123
+ plural?: string;
1124
+ kind?: CatalogUnit['kind'];
1125
+ decimals?: number;
1080
1126
  }
1081
1127
  /** AGF-MENU-OPTIONS M2 — one option of a group («BBQ», +1.000). */
1082
1128
  export interface CatalogOption {
@@ -1992,6 +2038,14 @@ export interface CaseReceiptLine {
1992
2038
  currency: string;
1993
2039
  priceKind: 'fixed' | 'from' | 'per_unit' | 'on_request';
1994
2040
  unit?: string;
2041
+ /** AGF-UNITS U2 — sold by measure: `qty` is in `unit` (0.75 lb), not a count of items. */
2042
+ measured?: boolean;
2043
+ /** AGF-UNITS U3 — sold by value: the line costs this (cents); `qty` is the measure it buys (an estimate). */
2044
+ amountCents?: number;
2045
+ /** A value line the business can weigh: pass it to `cases.weighLine`. */
2046
+ weigh?: string;
2047
+ /** The business typed its real weight: `qty` is that, not an estimate. */
2048
+ weighed?: boolean;
1995
2049
  /** AGF-MENU-OPTIONS M2 — the options chosen; `unitCents` already includes them. */
1996
2050
  options?: Array<{
1997
2051
  group: string;
@@ -2071,7 +2125,11 @@ export interface CreateDirectOrderInput {
2071
2125
  * product with option groups (AGF-MENU-OPTIONS M2; a required group left out → 400). */
2072
2126
  lines: Array<{
2073
2127
  productId: string;
2128
+ /** In the product's unit: whole for products sold by unit, a measure on the product's step (0.5 lb) otherwise.
2129
+ * Ignored (send 0) with `amountCents`. */
2074
2130
  quantity: number;
2131
+ /** AGF-UNITS U3 — sold by value («$3.000 de queso»): the amount in cents instead of a quantity; its own line. */
2132
+ amountCents?: number;
2075
2133
  options?: CatalogOptionChoice[];
2076
2134
  }>;
2077
2135
  /** The order type's other fields (entrega, direccion, notas…), by key. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentforge-io/sdk-server",
3
- "version": "4.35.0",
3
+ "version": "4.37.0",
4
4
  "description": "Server-side SDK for backend apps integrating with AgentForge platform. Auth via ChatToken, ak_live_ API key or App secret (sk_live_), with App installations across tenants.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",