@agentforge-io/sdk-server 4.49.0 → 4.50.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 +1 -1
- package/dist/resources/cases.d.ts +12 -1
- package/dist/resources/cases.js +12 -0
- package/dist/types.d.ts +111 -0
- package/package.json +1 -1
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, TemplateReview, TemplateRatingSummary, TemplateReviewsPage, BusinessReview, BusinessReviewsPage, ListTemplateReviewsInput, SaveTemplateReviewInput, TemplateReportKind, CreateTemplateReportInput, TenantConfigEntry, Place, PlaceSuggestion, SearchPlacesInput, AutocompletePlacesInput, PlacesScope, CaseField, CaseBusinessState, CaseType, CaseState, CasePayment, CasePaymentAccount, CasePaymentStatus, CaseReceiptPayment, CaseDestination, CaseView, CaseStateStep, CreateDirectOrderInput, CreateDirectBookingInput, MoveCaseSlotInput, CaseSlot, CatalogAttendedAt, CatalogBookingRule, CaseOrigin, CaseOriginChannel, DirectOrderForm, DirectPaymentOption, 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, CatalogMenuAttachInput, CatalogMenuChatFile, CatalogMenuKeepInSyncInput, CatalogMenuKeepInSyncResult, 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';
|
|
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, TemplateReview, TemplateRatingSummary, TemplateReviewsPage, BusinessReview, BusinessReviewsPage, ListTemplateReviewsInput, SaveTemplateReviewInput, TemplateReportKind, CreateTemplateReportInput, TenantConfigEntry, Place, PlaceSuggestion, SearchPlacesInput, AutocompletePlacesInput, PlacesScope, CaseField, CaseBusinessState, CaseType, CaseState, CasePayment, CasePaymentAccount, CasePaymentStatus, CaseReceiptPayment, CaseDestination, CaseView, CaseStateStep, CreateDirectOrderInput, CreateDirectBookingInput, MoveCaseSlotInput, CaseSlot, CatalogAttendedAt, CatalogBookingRule, CaseOrigin, CaseOriginChannel, DirectOrderForm, DirectPaymentOption, CaseClosingMethod, CaseClosingOrder, CaseClosingReport, 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, CatalogMenuAttachInput, CatalogMenuChatFile, CatalogMenuKeepInSyncInput, CatalogMenuKeepInSyncResult, 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';
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import type { AgentForgeClient } from '../client';
|
|
2
|
-
import type { CasePaymentStatus, CaseReceipt, CaseState, CaseView, CreateDirectBookingInput, CreateDirectOrderInput, DirectOrderForm, ListCasesInput, MoveCaseSlotInput } from '../types';
|
|
2
|
+
import type { CaseClosingReport, CasePaymentStatus, CaseReceipt, CaseState, CaseView, CreateDirectBookingInput, CreateDirectOrderInput, DirectOrderForm, ListCasesInput, MoveCaseSlotInput } from '../types';
|
|
3
3
|
export declare class CasesResource {
|
|
4
4
|
private readonly client;
|
|
5
5
|
constructor(client: AgentForgeClient);
|
|
6
6
|
/** `GET /api/v1/cases` — most recently active first. */
|
|
7
7
|
list(input?: ListCasesInput): Promise<CaseView[]>;
|
|
8
|
+
/**
|
|
9
|
+
* `GET /api/v1/cases/reports/closing` — AGF-CASH-REGISTER: a closing between two
|
|
10
|
+
* instants, (`from`, `to`], so consecutive closings never count a payment twice
|
|
11
|
+
* nor miss one. 400 on a bad range; at most 400 days.
|
|
12
|
+
*/
|
|
13
|
+
closingReport(input: {
|
|
14
|
+
from: string | Date;
|
|
15
|
+
to: string | Date;
|
|
16
|
+
}): Promise<CaseClosingReport>;
|
|
8
17
|
/** `GET /api/v1/cases/:id` — 404 when it is not this workspace's. */
|
|
9
18
|
get(caseId: string): Promise<CaseView>;
|
|
10
19
|
/**
|
|
@@ -71,11 +80,13 @@ export declare class CasesResource {
|
|
|
71
80
|
* `POST /api/v1/cases/:id/payment` — AGF-PAYMENT-ACCOUNTS: the business moves the
|
|
72
81
|
* payment: `paid` (confirmed, or cash received), `rejected` (did not arrive),
|
|
73
82
|
* `refunded`, `partially_refunded` (with `amountCents` returned), `reversed`.
|
|
83
|
+
* `accountId` with `paid`: how the money came in, one of the business's accounts.
|
|
74
84
|
* The customer is told of paid, rejected and refunds.
|
|
75
85
|
*/
|
|
76
86
|
setPayment(caseId: string, status: CasePaymentStatus, opts?: {
|
|
77
87
|
note?: string;
|
|
78
88
|
amountCents?: number;
|
|
89
|
+
accountId?: string;
|
|
79
90
|
}): Promise<CaseView>;
|
|
80
91
|
/**
|
|
81
92
|
* `POST /api/v1/cases/receipts/:token/payment/choose` — the customer chooses how
|
package/dist/resources/cases.js
CHANGED
|
@@ -32,6 +32,16 @@ class CasesResource {
|
|
|
32
32
|
const q = qs.toString();
|
|
33
33
|
return (await this.client.request('GET', `/api/v1/cases${q ? `?${q}` : ''}`)).items;
|
|
34
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* `GET /api/v1/cases/reports/closing` — AGF-CASH-REGISTER: a closing between two
|
|
37
|
+
* instants, (`from`, `to`], so consecutive closings never count a payment twice
|
|
38
|
+
* nor miss one. 400 on a bad range; at most 400 days.
|
|
39
|
+
*/
|
|
40
|
+
async closingReport(input) {
|
|
41
|
+
const at = (v) => (v instanceof Date ? v.toISOString() : v);
|
|
42
|
+
const qs = new URLSearchParams({ from: at(input.from), to: at(input.to) });
|
|
43
|
+
return this.client.request('GET', `/api/v1/cases/reports/closing?${qs}`);
|
|
44
|
+
}
|
|
35
45
|
/** `GET /api/v1/cases/:id` — 404 when it is not this workspace's. */
|
|
36
46
|
async get(caseId) {
|
|
37
47
|
return this.client.request('GET', `/api/v1/cases/${encodeURIComponent(caseId)}`);
|
|
@@ -118,6 +128,7 @@ class CasesResource {
|
|
|
118
128
|
* `POST /api/v1/cases/:id/payment` — AGF-PAYMENT-ACCOUNTS: the business moves the
|
|
119
129
|
* payment: `paid` (confirmed, or cash received), `rejected` (did not arrive),
|
|
120
130
|
* `refunded`, `partially_refunded` (with `amountCents` returned), `reversed`.
|
|
131
|
+
* `accountId` with `paid`: how the money came in, one of the business's accounts.
|
|
121
132
|
* The customer is told of paid, rejected and refunds.
|
|
122
133
|
*/
|
|
123
134
|
async setPayment(caseId, status, opts = {}) {
|
|
@@ -125,6 +136,7 @@ class CasesResource {
|
|
|
125
136
|
status,
|
|
126
137
|
...(opts.note ? { note: opts.note } : {}),
|
|
127
138
|
...(opts.amountCents ? { amountCents: opts.amountCents } : {}),
|
|
139
|
+
...(opts.accountId ? { accountId: opts.accountId } : {}),
|
|
128
140
|
});
|
|
129
141
|
}
|
|
130
142
|
/**
|
package/dist/types.d.ts
CHANGED
|
@@ -1811,6 +1811,10 @@ export interface PlacesScope {
|
|
|
1811
1811
|
national: boolean;
|
|
1812
1812
|
/** A customer may search outside the area (`area: 'country'`). */
|
|
1813
1813
|
canWiden: boolean;
|
|
1814
|
+
/** A customer may pick the order up at the business. */
|
|
1815
|
+
pickup: boolean;
|
|
1816
|
+
/** It has delivery settings: without them, `local`, `national` and `pickup` say nothing about what it offers. */
|
|
1817
|
+
configured: boolean;
|
|
1814
1818
|
}
|
|
1815
1819
|
/** A geocoded address: a confirmed pin, never static text. */
|
|
1816
1820
|
export interface AddressValue {
|
|
@@ -2416,6 +2420,113 @@ export interface DirectOrderForm {
|
|
|
2416
2420
|
options: DirectPaymentOption[];
|
|
2417
2421
|
};
|
|
2418
2422
|
}
|
|
2423
|
+
/** AGF-CASH-REGISTER — one payment method in a closing. */
|
|
2424
|
+
export interface CaseClosingMethod {
|
|
2425
|
+
/** The method's key; null when the payment has no account. */
|
|
2426
|
+
method: string | null;
|
|
2427
|
+
methodName: string;
|
|
2428
|
+
/** Paid before it is sent, or on delivery; null when the payment has no account. */
|
|
2429
|
+
when: 'before' | 'on_delivery' | null;
|
|
2430
|
+
/** Payments confirmed in the range. */
|
|
2431
|
+
count: number;
|
|
2432
|
+
collectedCents: number;
|
|
2433
|
+
refundedCents: number;
|
|
2434
|
+
netCents: number;
|
|
2435
|
+
}
|
|
2436
|
+
/** AGF-CASH-REGISTER — one order sent in a closing's range. */
|
|
2437
|
+
export interface CaseClosingOrder {
|
|
2438
|
+
code: string;
|
|
2439
|
+
submittedAt: string;
|
|
2440
|
+
customerFirstName: string | null;
|
|
2441
|
+
place: string | null;
|
|
2442
|
+
channel: CaseOriginChannel | null;
|
|
2443
|
+
method: string | null;
|
|
2444
|
+
paymentStatus: CasePaymentStatus | null;
|
|
2445
|
+
totalCents: number | null;
|
|
2446
|
+
deliveryCents: number;
|
|
2447
|
+
state: string;
|
|
2448
|
+
stateLabel: string;
|
|
2449
|
+
}
|
|
2450
|
+
/**
|
|
2451
|
+
* AGF-CASH-REGISTER — a register's closing between two instants, (`from`, `to`]:
|
|
2452
|
+
* `sold` by when the order was sent, without deliveries; `collected` by when each
|
|
2453
|
+
* payment moved, with them. Two numbers on purpose.
|
|
2454
|
+
*/
|
|
2455
|
+
export interface CaseClosingReport {
|
|
2456
|
+
from: string;
|
|
2457
|
+
to: string;
|
|
2458
|
+
timeZone: string;
|
|
2459
|
+
currency: string | null;
|
|
2460
|
+
sold: {
|
|
2461
|
+
orders: {
|
|
2462
|
+
total: number;
|
|
2463
|
+
completed: number;
|
|
2464
|
+
inProgress: number;
|
|
2465
|
+
cancelled: number;
|
|
2466
|
+
};
|
|
2467
|
+
revenueCents: {
|
|
2468
|
+
completed: number;
|
|
2469
|
+
inProgress: number;
|
|
2470
|
+
};
|
|
2471
|
+
deliveryCents: {
|
|
2472
|
+
completed: number;
|
|
2473
|
+
inProgress: number;
|
|
2474
|
+
};
|
|
2475
|
+
averageTicketCents: number | null;
|
|
2476
|
+
/** Orders whose total is not known (a line priced on request). */
|
|
2477
|
+
unpricedOrders: number;
|
|
2478
|
+
topProducts: Array<{
|
|
2479
|
+
title: string;
|
|
2480
|
+
qty: number;
|
|
2481
|
+
revenueCents: number | null;
|
|
2482
|
+
}>;
|
|
2483
|
+
/** Absent when no order carries a place. */
|
|
2484
|
+
byPlace?: Array<{
|
|
2485
|
+
place: string | null;
|
|
2486
|
+
orders: number;
|
|
2487
|
+
revenueCents: number;
|
|
2488
|
+
}>;
|
|
2489
|
+
byChannel: Array<{
|
|
2490
|
+
channel: CaseOriginChannel | null;
|
|
2491
|
+
label: string | null;
|
|
2492
|
+
orders: number;
|
|
2493
|
+
revenueCents: number;
|
|
2494
|
+
}>;
|
|
2495
|
+
};
|
|
2496
|
+
collected: {
|
|
2497
|
+
byMethod: CaseClosingMethod[];
|
|
2498
|
+
collectedCents: number;
|
|
2499
|
+
refundedCents: number;
|
|
2500
|
+
netCents: number;
|
|
2501
|
+
/** Payments confirmed whose order has no known total: in no sum. */
|
|
2502
|
+
unpricedPayments: number;
|
|
2503
|
+
};
|
|
2504
|
+
/** The cash the register should have received, for the count. */
|
|
2505
|
+
cash: {
|
|
2506
|
+
collectedCents: number;
|
|
2507
|
+
refundedCents: number;
|
|
2508
|
+
netCents: number;
|
|
2509
|
+
};
|
|
2510
|
+
/** As of now, whenever those orders were sent: what the next closing inherits. */
|
|
2511
|
+
pending: {
|
|
2512
|
+
toCollect: {
|
|
2513
|
+
count: number;
|
|
2514
|
+
cents: number;
|
|
2515
|
+
};
|
|
2516
|
+
reported: {
|
|
2517
|
+
count: number;
|
|
2518
|
+
cents: number;
|
|
2519
|
+
};
|
|
2520
|
+
refundDue: {
|
|
2521
|
+
count: number;
|
|
2522
|
+
cents: number;
|
|
2523
|
+
};
|
|
2524
|
+
inProgress: number;
|
|
2525
|
+
};
|
|
2526
|
+
/** Oldest first, at most 2000 (`ordersTruncated`); the sums always cover every order. */
|
|
2527
|
+
orders: CaseClosingOrder[];
|
|
2528
|
+
ordersTruncated: boolean;
|
|
2529
|
+
}
|
|
2419
2530
|
export interface ListCasesInput {
|
|
2420
2531
|
state?: CaseState[];
|
|
2421
2532
|
type?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentforge-io/sdk-server",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.50.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",
|