@omni-commerce/sdk 0.26.0 → 0.28.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/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # @omni-commerce/sdk
2
2
 
3
+ SDK 0.27.0 adds `email.listAccounts`, `email.search`, `email.getMessage` and `email.createDraft` for your own connected Gmail or Outlook mailbox (`email:read`, drafts `email:write`). They need a credential that acts for you; nothing is sent.
4
+
3
5
  SDK 0.26.0 adds normalized order attribution to `orders.list`, `orders.get`, and `analytics.getOrders`. Read `attribution.channels`, `creatorHandles`, and `storefront`; analytics includes creator/channel Net Revenue by exact store and currency.
4
6
 
5
7
  SDK 0.25.0 supports marketplace-only bulk import and enrichment, later store assignment with `products.assignMarketplaceStores`, and publishing to those exact stores.
package/dist/index.cjs CHANGED
@@ -35,7 +35,7 @@ function normalizeClientOptions(options = {}) {
35
35
  }
36
36
 
37
37
  // src/version.ts
38
- var SDK_VERSION = "0.26.0";
38
+ var SDK_VERSION = "0.28.0";
39
39
  var SDK_USER_AGENT = `omnicommerce-js/${SDK_VERSION}`;
40
40
 
41
41
  // src/environments.ts
@@ -712,7 +712,13 @@ var AgentsGeneralClient = class {
712
712
  *
713
713
  * Run the general Omni agent and wait until it completes, pauses for approval, or fails. Requires `agents:invoke`.
714
714
 
715
- A waiting call can take several minutes; raise the client timeout. Send `decisions` with the same `thread_id` to approve or reject a paused run. Omit `config.enabled_tools` to use the organization's agent tools. Attach images on the latest user message as `{ type: "image", url }` HTTP(S) URLs.
715
+ ### Waiting and approvals
716
+
717
+ A waiting call can take several minutes; raise the client timeout. Send `decisions` with the same `thread_id` to approve or reject a paused run.
718
+
719
+ ### Messages and tools
720
+
721
+ Omit `config.enabled_tools` to use the organization's agent tools. Send only new messages on each turn; thread_id continues the conversation stored in Omni sessions and checkpoints. Omit thread_id for a new conversation. Optional message IDs use native LangGraph replacement semantics, not run idempotency. audience=customer restricts tools to public storefront access without establishing a verified customer identity. Attach images on the latest user message as `{ type: "image", url }`
716
722
  *
717
723
  * `POST /api/v1/agents/general/invoke`
718
724
  */
@@ -768,35 +774,61 @@ var AgentsClient = class {
768
774
  this.general = new AgentsGeneralClient(this._http);
769
775
  }
770
776
  /**
771
- * Send a message to an agent
777
+ * Invoke a saved agent
772
778
  *
773
- * Message the exact built-in or custom agent in the URL, using its saved model, instructions, tools, permissions and Programmatic starting mode.
779
+ * Invoke the exact built-in or custom agent in the URL using its saved configuration and Programmatic starting mode. Uses the same invocation request and run response as the general agent and MCP.
774
780
 
775
- ### Authentication
776
- Requires an API key with `agents:invoke`, or a sign-in session. Organization-owned keys use their recorded creator's current membership and agent access; keys without a valid owner are refused. API keys identify their organization; session requests include `organizationId`.
781
+ ### Authorization
782
+
783
+ Requires agents:invoke and current organization membership and agent access. Organization-owned keys use their recorded creator; no alternate organization member is substituted. Session requests include organizationId.
784
+
785
+ ### Messages and conversation history
786
+
787
+ Send one or more new messages (at most 50 and 100000 text characters) ending with a user message. Omit thread_id to create a conversation, or reuse the returned thread_id to continue its stored history. An initial batch can import external history, including human replies. Do not resend history on subsequent turns. Optional
788
+ *
789
+ * `POST /api/v1/agents/{agentId}/invoke`
790
+ */
791
+ invoke(request, requestOptions) {
792
+ const { agentId, ...body } = request ?? {};
793
+ return this._http.request({
794
+ method: "POST",
795
+ path: `/api/v1/agents/${encodePathParam("agentId", agentId)}/invoke`,
796
+ query: void 0,
797
+ body,
798
+ ...mergeRequestOptions(requestOptions)
799
+ });
800
+ }
801
+ /**
802
+ * Start a saved agent run
803
+ *
804
+ * Queue durable execution using the identical invocation contract. Poll Location, honoring Retry-After.
805
+
806
+ Invoke the exact built-in or custom agent in the URL using its saved configuration and Programmatic starting mode. Uses the same invocation request and run response as the general agent and MCP.
807
+
808
+ ### Authorization
809
+
810
+ Requires agents:invoke and current organization membership and agent access. Organization-owned keys use their recorded creator; no alternate organization member is substituted. Session requests include organizationId.
777
811
 
778
- ### Conversation and execution
779
- - The same caller, agent and `clientThreadKey` continue one conversation. Different callers, agents and organizations are isolated.
780
- - No model, prompt or tool overrides are accepted.
781
- - `wait=false` queues durable work and returns 202; `wait=true` returns the final reply or pending approvals.
782
- - Send `decisions` with the same `cli
812
+ ### Messages and conversation history
813
+
814
+ Send one or more new messages (at most 50 and 100000 text characters) ending with a user message. Omit thread_id to create a conversation, or reuse the returned thread_id to continue its stored history. An initial batch can
783
815
  *
784
- * `POST /api/v1/agents/{agentId}/messages`
816
+ * `POST /api/v1/agents/{agentId}/runs`
785
817
  */
786
- messages(request, requestOptions) {
818
+ runs(request, requestOptions) {
787
819
  const { agentId, ...body } = request ?? {};
788
820
  return this._http.request({
789
821
  method: "POST",
790
- path: `/api/v1/agents/${encodePathParam("agentId", agentId)}/messages`,
822
+ path: `/api/v1/agents/${encodePathParam("agentId", agentId)}/runs`,
791
823
  query: void 0,
792
824
  body,
793
825
  ...mergeRequestOptions(requestOptions)
794
826
  });
795
827
  }
796
828
  /**
797
- * Get an agent message run
829
+ * Get a saved agent run
798
830
  *
799
- * Read an agent message run belonging to the authenticated caller and the exact agent in the URL. Current organization membership and agent sharing are checked again. Requires agents:invoke.
831
+ * Read the canonical run resource. Organization, caller, credential and exact agent access are checked again. Requires agents:invoke.
800
832
  *
801
833
  * `GET /api/v1/agents/{agentId}/runs/{runId}`
802
834
  */
@@ -2302,6 +2334,113 @@ var DocumentsClient = class {
2302
2334
  });
2303
2335
  }
2304
2336
  };
2337
+ var EmailClient = class {
2338
+ constructor(_http) {
2339
+ __publicField(this, "_http", _http);
2340
+ }
2341
+ /**
2342
+ * List Email Accounts
2343
+ *
2344
+ * Your connected Gmail and Outlook accounts, default first. Pass an account's `connectionId` to the other email endpoints to choose it.
2345
+
2346
+ ### Authorization
2347
+
2348
+ Requires `email:read` and the integration permission the matching chat tool needs, with a person's credential: a CLI login, a signed-in session, or the SDK key inside your own chat sandbox. Only your own connected mailboxes are reachable; another account's `connectionId` is refused.
2349
+ *
2350
+ * `GET /api/v1/email/accounts`
2351
+ */
2352
+ listAccounts(request = {}, requestOptions) {
2353
+ const { organizationId } = request ?? {};
2354
+ return this._http.request({
2355
+ method: "GET",
2356
+ path: "/api/v1/email/accounts",
2357
+ query: { organizationId },
2358
+ body: void 0,
2359
+ ...mergeRequestOptions(requestOptions)
2360
+ });
2361
+ }
2362
+ /**
2363
+ * Create Email Draft
2364
+ *
2365
+ * Save a draft in your mailbox; nothing is sent. Pass `replyToMessageId` (and `threadId`) from Search Emails to draft a reply in its conversation. Review and send it from Gmail or Outlook.
2366
+
2367
+ When the provider saved a draft whose threading could not be verified, the request fails with `unverifiedDraftId` in `data` so you can find or discard it.
2368
+
2369
+ ### Authorization
2370
+
2371
+ Requires `email:write` and the integration permission the matching chat tool needs, with a person's credential: a CLI login, a signed-in session, or the SDK key inside your own chat sandbox. Only your own connected mailboxes are reachable; another account's `connectionId` is refused.
2372
+ *
2373
+ * `POST /api/v1/email/drafts`
2374
+ */
2375
+ createDraft(request, requestOptions) {
2376
+ const { ...body } = request ?? {};
2377
+ return this._http.request({
2378
+ method: "POST",
2379
+ path: "/api/v1/email/drafts",
2380
+ query: void 0,
2381
+ body,
2382
+ ...mergeRequestOptions(requestOptions)
2383
+ });
2384
+ }
2385
+ /**
2386
+ * Get Email Message
2387
+ *
2388
+ * One message from your mailbox: headers, plain-text body (at most 12,000 characters) and attachment metadata. Use a message `id` from Search Emails; encode it as one path segment.
2389
+
2390
+ ### Authorization
2391
+
2392
+ Requires `email:read` and the integration permission the matching chat tool needs, with a person's credential: a CLI login, a signed-in session, or the SDK key inside your own chat sandbox. Only your own connected mailboxes are reachable; another account's `connectionId` is refused.
2393
+ *
2394
+ * `GET /api/v1/email/messages/{messageId}`
2395
+ */
2396
+ getMessage(request, requestOptions) {
2397
+ const { messageId, connectionId, organizationId } = request ?? {};
2398
+ return this._http.request({
2399
+ method: "GET",
2400
+ path: `/api/v1/email/messages/${encodePathParam("messageId", messageId)}`,
2401
+ query: { connectionId, organizationId },
2402
+ body: void 0,
2403
+ ...mergeRequestOptions(requestOptions)
2404
+ });
2405
+ }
2406
+ /**
2407
+ * Search Emails
2408
+ *
2409
+ * One page of message summaries (subject, from, to, date, snippet, read and draft state) from your mailbox. Gmail accepts its search operators (`from:`, `subject:`, `newer_than:`); Outlook takes free text.
2410
+
2411
+ Pass `nextPageToken` back as `pageToken` with the same mailbox, query, `readState` and `maxResults` until it is null; a token is refused with different search arguments. `readState=unread` filters unread messages, which is not the same as unreplied.
2412
+
2413
+ ### Authorization
2414
+
2415
+ Requires `email:read` and the integration permission the matching chat tool needs, with a person's credential: a CLI login, a signed-in session, or the SDK key inside your own chat sandbox. Only your own connected mailboxes are reachable; another account's `connectionId` is refused.
2416
+ *
2417
+ * `GET /api/v1/email/search`
2418
+ */
2419
+ search(request = {}, requestOptions) {
2420
+ const {
2421
+ query,
2422
+ connectionId,
2423
+ maxResults,
2424
+ pageToken,
2425
+ readState,
2426
+ organizationId
2427
+ } = request ?? {};
2428
+ return this._http.request({
2429
+ method: "GET",
2430
+ path: "/api/v1/email/search",
2431
+ query: {
2432
+ query,
2433
+ connectionId,
2434
+ maxResults,
2435
+ pageToken,
2436
+ readState,
2437
+ organizationId
2438
+ },
2439
+ body: void 0,
2440
+ ...mergeRequestOptions(requestOptions)
2441
+ });
2442
+ }
2443
+ };
2305
2444
  var EvaluateClient = class {
2306
2445
  constructor(_http) {
2307
2446
  __publicField(this, "_http", _http);
@@ -2811,7 +2950,8 @@ var OrdersClient = class {
2811
2950
  dateFrom,
2812
2951
  dateTo,
2813
2952
  limit,
2814
- offset
2953
+ offset,
2954
+ includeSummary
2815
2955
  } = request ?? {};
2816
2956
  return this._http.request({
2817
2957
  method: "GET",
@@ -2828,7 +2968,8 @@ var OrdersClient = class {
2828
2968
  dateFrom,
2829
2969
  dateTo,
2830
2970
  limit,
2831
- offset
2971
+ offset,
2972
+ includeSummary
2832
2973
  },
2833
2974
  body: void 0,
2834
2975
  ...mergeRequestOptions(requestOptions)
@@ -2851,9 +2992,9 @@ var OrdersClient = class {
2851
2992
 
2852
2993
  ### Pricing and catalog defaults
2853
2994
 
2854
- - Each line can provide `price`, `unitPrice`, `paidPrice`, and `costPrice`.
2995
+ - Each line can provide `unitPrice`, `paidPrice`, and `costPrice`.
2855
2996
  - When `productId` is provided, missing price or currency values may resolve from the product catalog.
2856
- - An explicit `costPrice` updates `product_data.costPrice` and is snaps
2997
+ - An explicit `costPrice` updates `product_data.costPrice` and is snapshotted on
2857
2998
  *
2858
2999
  * `POST /api/v1/orders`
2859
3000
  */
@@ -3589,7 +3730,7 @@ var ProductsClient = class {
3589
3730
 
3590
3731
  Supply targetMarketplaces and marketplaceStoreSelections to prepare for specific connected stores. Set deferStoreSelection=true to choose marketplaces only and assign stores later with POST /api/v1/products/marketplace-stores. Omit marketplaceStoreSelections and leave workflow.publish off when deferring. Automatic publishing requires catalog:sync in addition to catalog:write.
3591
3732
 
3592
- Supply explicit SKU options in each row's `variationAttributes` and native marketplace attributes in `marketplaceAttributes`. Enrichment never infers SKU options. At Zalora publish time, a missing required Size defaults to One Size only when valid for the selected category and supplied size system. Supplied sizes are preserved; missing
3733
+ Supply explicit SKU options in each row's `variationAttributes` and native marketplace attributes in `marketplaceAttributes`. Taxonomy enrichment can propose missing required sale attributes in its existing attribute request when supported by product evidence. Supplied values take precedence. At Zalora publish time, a missing required
3593
3734
  *
3594
3735
  * `POST /api/v1/products/bulk-import`
3595
3736
  */
@@ -5564,6 +5705,7 @@ var OmniGeneratedClient = class {
5564
5705
  __publicField(this, "compare");
5565
5706
  __publicField(this, "directory");
5566
5707
  __publicField(this, "documents");
5708
+ __publicField(this, "email");
5567
5709
  __publicField(this, "evaluate");
5568
5710
  __publicField(this, "feed");
5569
5711
  __publicField(this, "followUps");
@@ -5607,6 +5749,7 @@ var OmniGeneratedClient = class {
5607
5749
  this.compare = new CompareClient(this._http);
5608
5750
  this.directory = new DirectoryClient(this._http);
5609
5751
  this.documents = new DocumentsClient(this._http);
5752
+ this.email = new EmailClient(this._http);
5610
5753
  this.evaluate = new EvaluateClient(this._http);
5611
5754
  this.feed = new FeedClient(this._http);
5612
5755
  this.followUps = new FollowUpsClient(this._http);