@chrt-inc/typescript-sdk 1.562.0 → 1.575.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.
Files changed (84) hide show
  1. package/dist/cjs/Client.js +2 -2
  2. package/dist/cjs/api/resources/shipping/resources/docs/client/Client.d.ts +1 -11
  3. package/dist/cjs/api/resources/shipping/resources/docs/client/Client.js +1 -10
  4. package/dist/cjs/api/resources/shipping/resources/docs/client/requests/GenerateShippingDocReq.d.ts +2 -2
  5. package/dist/cjs/api/resources/shipping/resources/orderDrafts/resources/expanded/client/Client.d.ts +3 -3
  6. package/dist/cjs/api/resources/shipping/resources/orderDrafts/resources/expanded/client/Client.js +7 -7
  7. package/dist/cjs/api/resources/shipping/resources/orders/resources/expanded/client/Client.d.ts +8 -6
  8. package/dist/cjs/api/resources/shipping/resources/orders/resources/expanded/client/Client.js +32 -24
  9. package/dist/cjs/api/resources/shipping/resources/orders/resources/expanded/client/requests/ExpandedListForForwarderOperatorsV1Request.d.ts +2 -0
  10. package/dist/cjs/api/resources/shipping/resources/orders/resources/expanded/client/requests/ExpandedListForShipperOperatorsV1Request.d.ts +2 -0
  11. package/dist/cjs/api/resources/shipping/resources/taskGroups/resources/expanded/client/Client.d.ts +2 -0
  12. package/dist/cjs/api/resources/shipping/resources/taskGroups/resources/expanded/client/Client.js +18 -10
  13. package/dist/cjs/api/resources/shipping/resources/taskGroups/resources/expanded/client/requests/ExpandedListForCourierDriverV1Request.d.ts +2 -0
  14. package/dist/cjs/api/resources/shipping/resources/taskGroups/resources/expanded/client/requests/ExpandedListForCourierOperatorsV1Request.d.ts +2 -0
  15. package/dist/cjs/api/resources/shipping/resources/taskGroups/resources/taskGroupId/client/Client.d.ts +6 -6
  16. package/dist/cjs/api/resources/shipping/resources/taskGroups/resources/taskGroupId/client/Client.js +14 -14
  17. package/dist/cjs/api/resources/shipping/resources/tasks/client/Client.d.ts +1 -1
  18. package/dist/cjs/api/resources/shipping/resources/tasks/client/Client.js +1 -1
  19. package/dist/cjs/api/resources/tracking/resources/sharingSettings/client/Client.d.ts +4 -4
  20. package/dist/cjs/api/resources/tracking/resources/sharingSettings/client/Client.js +8 -8
  21. package/dist/cjs/api/resources/utils/index.d.ts +1 -1
  22. package/dist/cjs/api/resources/utils/index.js +1 -1
  23. package/dist/cjs/api/resources/utils/resources/dev/client/Client.d.ts +2 -13
  24. package/dist/cjs/api/resources/utils/resources/dev/client/Client.js +14 -13
  25. package/dist/cjs/api/resources/utils/resources/dev/index.d.ts +1 -0
  26. package/dist/cjs/api/resources/utils/resources/dev/index.js +1 -0
  27. package/dist/cjs/api/resources/utils/resources/dev/types/OrderBuilderStreamEvent.d.ts +27 -0
  28. package/dist/cjs/api/resources/utils/resources/dev/types/OrderBuilderStreamEvent.js +14 -0
  29. package/dist/cjs/api/resources/utils/resources/dev/types/index.d.ts +1 -0
  30. package/dist/cjs/api/resources/utils/resources/dev/types/index.js +17 -0
  31. package/dist/cjs/api/resources/utils/resources/index.d.ts +1 -0
  32. package/dist/cjs/api/resources/utils/resources/index.js +1 -0
  33. package/dist/cjs/api/types/TaskClientUpdate1.d.ts +2 -0
  34. package/dist/cjs/core/index.d.ts +1 -0
  35. package/dist/cjs/core/index.js +1 -0
  36. package/dist/cjs/core/stream/Stream.d.ts +46 -0
  37. package/dist/cjs/core/stream/Stream.js +169 -0
  38. package/dist/cjs/core/stream/index.d.ts +1 -0
  39. package/dist/cjs/core/stream/index.js +5 -0
  40. package/dist/cjs/version.d.ts +1 -1
  41. package/dist/cjs/version.js +1 -1
  42. package/dist/esm/Client.mjs +2 -2
  43. package/dist/esm/api/resources/shipping/resources/docs/client/Client.d.mts +1 -11
  44. package/dist/esm/api/resources/shipping/resources/docs/client/Client.mjs +1 -10
  45. package/dist/esm/api/resources/shipping/resources/docs/client/requests/GenerateShippingDocReq.d.mts +2 -2
  46. package/dist/esm/api/resources/shipping/resources/orderDrafts/resources/expanded/client/Client.d.mts +3 -3
  47. package/dist/esm/api/resources/shipping/resources/orderDrafts/resources/expanded/client/Client.mjs +7 -7
  48. package/dist/esm/api/resources/shipping/resources/orders/resources/expanded/client/Client.d.mts +8 -6
  49. package/dist/esm/api/resources/shipping/resources/orders/resources/expanded/client/Client.mjs +32 -24
  50. package/dist/esm/api/resources/shipping/resources/orders/resources/expanded/client/requests/ExpandedListForForwarderOperatorsV1Request.d.mts +2 -0
  51. package/dist/esm/api/resources/shipping/resources/orders/resources/expanded/client/requests/ExpandedListForShipperOperatorsV1Request.d.mts +2 -0
  52. package/dist/esm/api/resources/shipping/resources/taskGroups/resources/expanded/client/Client.d.mts +2 -0
  53. package/dist/esm/api/resources/shipping/resources/taskGroups/resources/expanded/client/Client.mjs +18 -10
  54. package/dist/esm/api/resources/shipping/resources/taskGroups/resources/expanded/client/requests/ExpandedListForCourierDriverV1Request.d.mts +2 -0
  55. package/dist/esm/api/resources/shipping/resources/taskGroups/resources/expanded/client/requests/ExpandedListForCourierOperatorsV1Request.d.mts +2 -0
  56. package/dist/esm/api/resources/shipping/resources/taskGroups/resources/taskGroupId/client/Client.d.mts +6 -6
  57. package/dist/esm/api/resources/shipping/resources/taskGroups/resources/taskGroupId/client/Client.mjs +14 -14
  58. package/dist/esm/api/resources/shipping/resources/tasks/client/Client.d.mts +1 -1
  59. package/dist/esm/api/resources/shipping/resources/tasks/client/Client.mjs +1 -1
  60. package/dist/esm/api/resources/tracking/resources/sharingSettings/client/Client.d.mts +4 -4
  61. package/dist/esm/api/resources/tracking/resources/sharingSettings/client/Client.mjs +8 -8
  62. package/dist/esm/api/resources/utils/index.d.mts +1 -1
  63. package/dist/esm/api/resources/utils/index.mjs +1 -1
  64. package/dist/esm/api/resources/utils/resources/dev/client/Client.d.mts +2 -13
  65. package/dist/esm/api/resources/utils/resources/dev/client/Client.mjs +14 -13
  66. package/dist/esm/api/resources/utils/resources/dev/index.d.mts +1 -0
  67. package/dist/esm/api/resources/utils/resources/dev/index.mjs +1 -0
  68. package/dist/esm/api/resources/utils/resources/dev/types/OrderBuilderStreamEvent.d.mts +27 -0
  69. package/dist/esm/api/resources/utils/resources/dev/types/OrderBuilderStreamEvent.mjs +11 -0
  70. package/dist/esm/api/resources/utils/resources/dev/types/index.d.mts +1 -0
  71. package/dist/esm/api/resources/utils/resources/dev/types/index.mjs +1 -0
  72. package/dist/esm/api/resources/utils/resources/index.d.mts +1 -0
  73. package/dist/esm/api/resources/utils/resources/index.mjs +1 -0
  74. package/dist/esm/api/types/TaskClientUpdate1.d.mts +2 -0
  75. package/dist/esm/core/index.d.mts +1 -0
  76. package/dist/esm/core/index.mjs +1 -0
  77. package/dist/esm/core/stream/Stream.d.mts +46 -0
  78. package/dist/esm/core/stream/Stream.mjs +164 -0
  79. package/dist/esm/core/stream/index.d.mts +1 -0
  80. package/dist/esm/core/stream/index.mjs +1 -0
  81. package/dist/esm/version.d.mts +1 -1
  82. package/dist/esm/version.mjs +1 -1
  83. package/package.json +1 -1
  84. package/reference.md +32 -25
@@ -58,23 +58,23 @@ class TaskGroupId {
58
58
  /**
59
59
  * Retrieves the task group IDs for the courier organization assigned to an order's task groups. | authz_personas=[courier_org_operators] | () -> (list[PydanticObjectId])
60
60
  *
61
- * @param {string} orderIdOrShortId
61
+ * @param {string} orderRef - Order ID, short ID, or off-chrt reference ID
62
62
  * @param {TaskGroupId.RequestOptions} requestOptions - Request-specific configuration.
63
63
  *
64
64
  * @throws {@link Chrt.UnprocessableEntityError}
65
65
  *
66
66
  * @example
67
- * await client.shipping.taskGroups.taskGroupId.forCourierOperatorsV1("order_id_or_short_id")
67
+ * await client.shipping.taskGroups.taskGroupId.forCourierOperatorsV1("order_ref")
68
68
  */
69
- forCourierOperatorsV1(orderIdOrShortId, requestOptions) {
70
- return core.HttpResponsePromise.fromPromise(this.__forCourierOperatorsV1(orderIdOrShortId, requestOptions));
69
+ forCourierOperatorsV1(orderRef, requestOptions) {
70
+ return core.HttpResponsePromise.fromPromise(this.__forCourierOperatorsV1(orderRef, requestOptions));
71
71
  }
72
- __forCourierOperatorsV1(orderIdOrShortId, requestOptions) {
72
+ __forCourierOperatorsV1(orderRef, requestOptions) {
73
73
  return __awaiter(this, void 0, void 0, function* () {
74
74
  var _a, _b, _c, _d;
75
75
  let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
76
76
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
77
- url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.ChrtEnvironment.Local, `shipping/task_groups/task_group_id/for_courier_operators/v1/${encodeURIComponent(orderIdOrShortId)}`),
77
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.ChrtEnvironment.Local, `shipping/task_groups/task_group_id/for_courier_operators/v1/${encodeURIComponent(orderRef)}`),
78
78
  method: "GET",
79
79
  headers: _headers,
80
80
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
@@ -105,7 +105,7 @@ class TaskGroupId {
105
105
  rawResponse: _response.rawResponse,
106
106
  });
107
107
  case "timeout":
108
- throw new errors.ChrtTimeoutError("Timeout exceeded when calling GET /shipping/task_groups/task_group_id/for_courier_operators/v1/{order_id_or_short_id}.");
108
+ throw new errors.ChrtTimeoutError("Timeout exceeded when calling GET /shipping/task_groups/task_group_id/for_courier_operators/v1/{order_ref}.");
109
109
  case "unknown":
110
110
  throw new errors.ChrtError({
111
111
  message: _response.error.errorMessage,
@@ -117,23 +117,23 @@ class TaskGroupId {
117
117
  /**
118
118
  * Retrieves the task group IDs for the courier driver assigned to an order's task groups. | authz_personas=[courier_driver] | () -> (list[PydanticObjectId])
119
119
  *
120
- * @param {string} orderIdOrShortId
120
+ * @param {string} orderRef - Order ID, short ID, or off-chrt reference ID
121
121
  * @param {TaskGroupId.RequestOptions} requestOptions - Request-specific configuration.
122
122
  *
123
123
  * @throws {@link Chrt.UnprocessableEntityError}
124
124
  *
125
125
  * @example
126
- * await client.shipping.taskGroups.taskGroupId.forCourierDriverV1("order_id_or_short_id")
126
+ * await client.shipping.taskGroups.taskGroupId.forCourierDriverV1("order_ref")
127
127
  */
128
- forCourierDriverV1(orderIdOrShortId, requestOptions) {
129
- return core.HttpResponsePromise.fromPromise(this.__forCourierDriverV1(orderIdOrShortId, requestOptions));
128
+ forCourierDriverV1(orderRef, requestOptions) {
129
+ return core.HttpResponsePromise.fromPromise(this.__forCourierDriverV1(orderRef, requestOptions));
130
130
  }
131
- __forCourierDriverV1(orderIdOrShortId, requestOptions) {
131
+ __forCourierDriverV1(orderRef, requestOptions) {
132
132
  return __awaiter(this, void 0, void 0, function* () {
133
133
  var _a, _b, _c, _d;
134
134
  let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
135
135
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
136
- url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.ChrtEnvironment.Local, `shipping/task_groups/task_group_id/for_courier_driver/v1/${encodeURIComponent(orderIdOrShortId)}`),
136
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.ChrtEnvironment.Local, `shipping/task_groups/task_group_id/for_courier_driver/v1/${encodeURIComponent(orderRef)}`),
137
137
  method: "GET",
138
138
  headers: _headers,
139
139
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
@@ -164,7 +164,7 @@ class TaskGroupId {
164
164
  rawResponse: _response.rawResponse,
165
165
  });
166
166
  case "timeout":
167
- throw new errors.ChrtTimeoutError("Timeout exceeded when calling GET /shipping/task_groups/task_group_id/for_courier_driver/v1/{order_id_or_short_id}.");
167
+ throw new errors.ChrtTimeoutError("Timeout exceeded when calling GET /shipping/task_groups/task_group_id/for_courier_driver/v1/{order_ref}.");
168
168
  case "unknown":
169
169
  throw new errors.ChrtError({
170
170
  message: _response.error.errorMessage,
@@ -51,7 +51,7 @@ export declare class Tasks {
51
51
  addToTaskGroupV1(taskGroupId: string, request: Chrt.shipping.AddTaskToGroupReq, requestOptions?: Tasks.RequestOptions): core.HttpResponsePromise<string>;
52
52
  private __addToTaskGroupV1;
53
53
  /**
54
- * Updates a task. Task must be in STAGED status. | authz_personas=[lig_owner_operators] | (TaskClientUpdate1) -> (PydanticObjectId)
54
+ * Updates a task. Operational fields require STAGED status (lig_owner_operators). order_placer_comments can be edited on any non-DRAFT task (order_creator_org_operators). | (TaskClientUpdate1) -> (PydanticObjectId)
55
55
  *
56
56
  * @param {string} taskId
57
57
  * @param {Chrt.TaskClientUpdate1} request
@@ -125,7 +125,7 @@ class Tasks {
125
125
  });
126
126
  }
127
127
  /**
128
- * Updates a task. Task must be in STAGED status. | authz_personas=[lig_owner_operators] | (TaskClientUpdate1) -> (PydanticObjectId)
128
+ * Updates a task. Operational fields require STAGED status (lig_owner_operators). order_placer_comments can be edited on any non-DRAFT task (order_creator_org_operators). | (TaskClientUpdate1) -> (PydanticObjectId)
129
129
  *
130
130
  * @param {string} taskId
131
131
  * @param {Chrt.TaskClientUpdate1} request
@@ -84,17 +84,17 @@ export declare class SharingSettings {
84
84
  cargoByDeviceSettingsV1(request: Chrt.tracking.CargoByDeviceSharingSettingsUpdateReq, requestOptions?: SharingSettings.RequestOptions): core.HttpResponsePromise<Chrt.CargoByDeviceSharingSettings1>;
85
85
  private __cargoByDeviceSettingsV1;
86
86
  /**
87
- * Get all tracking datasets and their sharing settings for a given order. If authenticated, returns datasets the user has direct access to plus public datasets. If unauthenticated, returns only datasets with public=True. | () -> (list[TrackingSharingSettingsRes])
87
+ * Get all tracking datasets and their sharing settings for a given order. If authenticated, returns datasets the user has direct access to plus public datasets. If unauthenticated, returns only datasets with public=True. Note: looking up by off_chrt_reference_id requires authentication because it is only org-level unique and needs the caller's org_id to resolve unambiguously. | () -> (list[TrackingSharingSettingsRes])
88
88
  *
89
- * @param {string} orderIdOrShortId
89
+ * @param {string} orderRef - Order ID, short ID, or off-chrt reference ID
90
90
  * @param {SharingSettings.RequestOptions} requestOptions - Request-specific configuration.
91
91
  *
92
92
  * @throws {@link Chrt.UnprocessableEntityError}
93
93
  *
94
94
  * @example
95
- * await client.tracking.sharingSettings.getSettingsV1("order_id_or_short_id")
95
+ * await client.tracking.sharingSettings.getSettingsV1("order_ref")
96
96
  */
97
- getSettingsV1(orderIdOrShortId: string, requestOptions?: SharingSettings.RequestOptions): core.HttpResponsePromise<Chrt.TrackingSharingSettingsRes[]>;
97
+ getSettingsV1(orderRef: string, requestOptions?: SharingSettings.RequestOptions): core.HttpResponsePromise<Chrt.TrackingSharingSettingsRes[]>;
98
98
  private __getSettingsV1;
99
99
  protected _getAuthorizationHeader(): Promise<string | undefined>;
100
100
  }
@@ -259,25 +259,25 @@ class SharingSettings {
259
259
  });
260
260
  }
261
261
  /**
262
- * Get all tracking datasets and their sharing settings for a given order. If authenticated, returns datasets the user has direct access to plus public datasets. If unauthenticated, returns only datasets with public=True. | () -> (list[TrackingSharingSettingsRes])
262
+ * Get all tracking datasets and their sharing settings for a given order. If authenticated, returns datasets the user has direct access to plus public datasets. If unauthenticated, returns only datasets with public=True. Note: looking up by off_chrt_reference_id requires authentication because it is only org-level unique and needs the caller's org_id to resolve unambiguously. | () -> (list[TrackingSharingSettingsRes])
263
263
  *
264
- * @param {string} orderIdOrShortId
264
+ * @param {string} orderRef - Order ID, short ID, or off-chrt reference ID
265
265
  * @param {SharingSettings.RequestOptions} requestOptions - Request-specific configuration.
266
266
  *
267
267
  * @throws {@link Chrt.UnprocessableEntityError}
268
268
  *
269
269
  * @example
270
- * await client.tracking.sharingSettings.getSettingsV1("order_id_or_short_id")
270
+ * await client.tracking.sharingSettings.getSettingsV1("order_ref")
271
271
  */
272
- getSettingsV1(orderIdOrShortId, requestOptions) {
273
- return core.HttpResponsePromise.fromPromise(this.__getSettingsV1(orderIdOrShortId, requestOptions));
272
+ getSettingsV1(orderRef, requestOptions) {
273
+ return core.HttpResponsePromise.fromPromise(this.__getSettingsV1(orderRef, requestOptions));
274
274
  }
275
- __getSettingsV1(orderIdOrShortId, requestOptions) {
275
+ __getSettingsV1(orderRef, requestOptions) {
276
276
  return __awaiter(this, void 0, void 0, function* () {
277
277
  var _a, _b, _c, _d;
278
278
  let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
279
279
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
280
- url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.ChrtEnvironment.Local, `tracking/sharing_settings/by_order/v1/${encodeURIComponent(orderIdOrShortId)}`),
280
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.ChrtEnvironment.Local, `tracking/sharing_settings/by_order/v1/${encodeURIComponent(orderRef)}`),
281
281
  method: "GET",
282
282
  headers: _headers,
283
283
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
@@ -308,7 +308,7 @@ class SharingSettings {
308
308
  rawResponse: _response.rawResponse,
309
309
  });
310
310
  case "timeout":
311
- throw new errors.ChrtTimeoutError("Timeout exceeded when calling GET /tracking/sharing_settings/by_order/v1/{order_id_or_short_id}.");
311
+ throw new errors.ChrtTimeoutError("Timeout exceeded when calling GET /tracking/sharing_settings/by_order/v1/{order_ref}.");
312
312
  case "unknown":
313
313
  throw new errors.ChrtError({
314
314
  message: _response.error.errorMessage,
@@ -1,2 +1,2 @@
1
- export * from "./client/index.js";
2
1
  export * from "./resources/index.js";
2
+ export * from "./client/index.js";
@@ -14,5 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./client/index.js"), exports);
18
17
  __exportStar(require("./resources/index.js"), exports);
18
+ __exportStar(require("./client/index.js"), exports);
@@ -75,20 +75,9 @@ export declare class Dev {
75
75
  postAgentOrderBuilderV1(request: Chrt.OrderBuilderReq, requestOptions?: Dev.RequestOptions): core.HttpResponsePromise<Chrt.OrderBuilderRes>;
76
76
  private __postAgentOrderBuilderV1;
77
77
  /**
78
- * Same as /agent/order-builder/v1 but streams progress events via SSE as each workflow step completes. | (OrderBuilderReq) -> SSE stream of OrderBuilderProgressEvent, final OrderBuilderRes
79
- *
80
- * @param {Chrt.OrderBuilderReq} request
81
- * @param {Dev.RequestOptions} requestOptions - Request-specific configuration.
82
- *
83
- * @throws {@link Chrt.UnprocessableEntityError}
84
- *
85
- * @example
86
- * await client.utils.dev.postAgentOrderBuilderStreamV1({
87
- * order_short_id: "order_short_id",
88
- * text: "text"
89
- * })
78
+ * Same as /agent/order-builder/v1 but streams progress events via SSE as each workflow step completes. | (OrderBuilderReq) -> SSE stream of OrderBuilderStreamEvent
90
79
  */
91
- postAgentOrderBuilderStreamV1(request: Chrt.OrderBuilderReq, requestOptions?: Dev.RequestOptions): core.HttpResponsePromise<void>;
80
+ postAgentOrderBuilderStreamV1(request: Chrt.OrderBuilderReq, requestOptions?: Dev.RequestOptions): core.HttpResponsePromise<core.Stream<Chrt.utils.OrderBuilderStreamEvent>>;
92
81
  private __postAgentOrderBuilderStreamV1;
93
82
  /**
94
83
  * (DEPRECATED) Extracts and returns the user ID from the authenticated request's JWT token. | () -> (str)
@@ -247,18 +247,7 @@ class Dev {
247
247
  });
248
248
  }
249
249
  /**
250
- * Same as /agent/order-builder/v1 but streams progress events via SSE as each workflow step completes. | (OrderBuilderReq) -> SSE stream of OrderBuilderProgressEvent, final OrderBuilderRes
251
- *
252
- * @param {Chrt.OrderBuilderReq} request
253
- * @param {Dev.RequestOptions} requestOptions - Request-specific configuration.
254
- *
255
- * @throws {@link Chrt.UnprocessableEntityError}
256
- *
257
- * @example
258
- * await client.utils.dev.postAgentOrderBuilderStreamV1({
259
- * order_short_id: "order_short_id",
260
- * text: "text"
261
- * })
250
+ * Same as /agent/order-builder/v1 but streams progress events via SSE as each workflow step completes. | (OrderBuilderReq) -> SSE stream of OrderBuilderStreamEvent
262
251
  */
263
252
  postAgentOrderBuilderStreamV1(request, requestOptions) {
264
253
  return core.HttpResponsePromise.fromPromise(this.__postAgentOrderBuilderStreamV1(request, requestOptions));
@@ -275,12 +264,24 @@ class Dev {
275
264
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
276
265
  requestType: "json",
277
266
  body: request,
267
+ responseType: "sse",
278
268
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
279
269
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
280
270
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
281
271
  });
282
272
  if (_response.ok) {
283
- return { data: undefined, rawResponse: _response.rawResponse };
273
+ return {
274
+ data: new core.Stream({
275
+ stream: _response.body,
276
+ parse: (data) => data,
277
+ signal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
278
+ eventShape: {
279
+ type: "sse",
280
+ streamTerminator: "[DONE]",
281
+ },
282
+ }),
283
+ rawResponse: _response.rawResponse,
284
+ };
284
285
  }
285
286
  if (_response.error.reason === "status-code") {
286
287
  switch (_response.error.statusCode) {
@@ -1 +1,2 @@
1
+ export * from "./types/index.js";
1
2
  export * from "./client/index.js";
@@ -14,4 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./types/index.js"), exports);
17
18
  __exportStar(require("./client/index.js"), exports);
@@ -0,0 +1,27 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * Unified SSE data schema for Fern SDK generation. The SSE `event:` frame
6
+ * carries the discriminator (progress | complete | error); only relevant
7
+ * fields are serialized per event type via exclude_none.
8
+ */
9
+ export interface OrderBuilderStreamEvent {
10
+ event: OrderBuilderStreamEvent.Event;
11
+ message?: string | null;
12
+ order_id?: string | null;
13
+ order_short_id?: string | null;
14
+ summary?: string | null;
15
+ validation_passed?: boolean | null;
16
+ validation_issues?: string[] | null;
17
+ notes?: string[] | null;
18
+ error?: string | null;
19
+ }
20
+ export declare namespace OrderBuilderStreamEvent {
21
+ type Event = "progress" | "complete" | "error";
22
+ const Event: {
23
+ readonly Progress: "progress";
24
+ readonly Complete: "complete";
25
+ readonly Error: "error";
26
+ };
27
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.OrderBuilderStreamEvent = void 0;
7
+ var OrderBuilderStreamEvent;
8
+ (function (OrderBuilderStreamEvent) {
9
+ OrderBuilderStreamEvent.Event = {
10
+ Progress: "progress",
11
+ Complete: "complete",
12
+ Error: "error",
13
+ };
14
+ })(OrderBuilderStreamEvent || (exports.OrderBuilderStreamEvent = OrderBuilderStreamEvent = {}));
@@ -0,0 +1 @@
1
+ export * from "./OrderBuilderStreamEvent.js";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./OrderBuilderStreamEvent.js"), exports);
@@ -1,3 +1,4 @@
1
1
  export * as dev from "./dev/index.js";
2
+ export * from "./dev/types/index.js";
2
3
  export * as root from "./root/index.js";
3
4
  export * from "./dev/client/requests/index.js";
@@ -38,5 +38,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.root = exports.dev = void 0;
40
40
  exports.dev = __importStar(require("./dev/index.js"));
41
+ __exportStar(require("./dev/types/index.js"), exports);
41
42
  exports.root = __importStar(require("./root/index.js"));
42
43
  __exportStar(require("./dev/client/requests/index.js"), exports);
@@ -6,6 +6,8 @@ export interface TaskClientUpdate1 {
6
6
  location?: Chrt.LocationFeature | null;
7
7
  action?: TaskClientUpdate1.Action | null;
8
8
  time_windows?: Chrt.TimeWindow1[];
9
+ order_placer_comments?: string | null;
10
+ order_placer_comments__set_to_None?: boolean;
9
11
  directory_entry_ids?: string[];
10
12
  }
11
13
  export declare namespace TaskClientUpdate1 {
@@ -4,4 +4,5 @@ export * as url from "./url/index.js";
4
4
  export * from "./auth/index.js";
5
5
  export * from "./base64.js";
6
6
  export * from "./form-data-utils/index.js";
7
+ export * from "./stream/index.js";
7
8
  export * as file from "./file/index.js";
@@ -43,4 +43,5 @@ exports.url = __importStar(require("./url/index.js"));
43
43
  __exportStar(require("./auth/index.js"), exports);
44
44
  __exportStar(require("./base64.js"), exports);
45
45
  __exportStar(require("./form-data-utils/index.js"), exports);
46
+ __exportStar(require("./stream/index.js"), exports);
46
47
  exports.file = __importStar(require("./file/index.js"));
@@ -0,0 +1,46 @@
1
+ export declare namespace Stream {
2
+ interface Args {
3
+ /**
4
+ * The HTTP response stream to read from.
5
+ */
6
+ stream: ReadableStream;
7
+ /**
8
+ * The event shape to use for parsing the stream data.
9
+ */
10
+ eventShape: JsonEvent | SseEvent;
11
+ /**
12
+ * An abort signal to stop the stream.
13
+ */
14
+ signal?: AbortSignal;
15
+ }
16
+ interface JsonEvent {
17
+ type: "json";
18
+ messageTerminator: string;
19
+ }
20
+ interface SseEvent {
21
+ type: "sse";
22
+ streamTerminator?: string;
23
+ }
24
+ }
25
+ export declare class Stream<T> implements AsyncIterable<T> {
26
+ private stream;
27
+ private parse;
28
+ /**
29
+ * The prefix to use for each message. For example,
30
+ * for SSE, the prefix is "data: ".
31
+ */
32
+ private prefix;
33
+ private messageTerminator;
34
+ private streamTerminator;
35
+ private controller;
36
+ constructor({ stream, parse, eventShape, signal }: Stream.Args & {
37
+ parse: (val: unknown) => Promise<T>;
38
+ });
39
+ private iterMessages;
40
+ [Symbol.asyncIterator](): AsyncIterator<T, void, unknown>;
41
+ private decodeChunk;
42
+ }
43
+ /**
44
+ * Browser polyfill for ReadableStream
45
+ */
46
+ export declare function readableStreamAsyncIterable<T>(stream: any): AsyncIterableIterator<T>;
@@ -0,0 +1,169 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __asyncValues = (this && this.__asyncValues) || function (o) {
12
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
13
+ var m = o[Symbol.asyncIterator], i;
14
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
15
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
16
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
17
+ };
18
+ var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
19
+ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
20
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
21
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
22
+ return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
23
+ function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
24
+ function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
25
+ function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
26
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
27
+ function fulfill(value) { resume("next", value); }
28
+ function reject(value) { resume("throw", value); }
29
+ function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
30
+ };
31
+ Object.defineProperty(exports, "__esModule", { value: true });
32
+ exports.Stream = void 0;
33
+ exports.readableStreamAsyncIterable = readableStreamAsyncIterable;
34
+ const index_js_1 = require("../runtime/index.js");
35
+ const DATA_PREFIX = "data:";
36
+ class Stream {
37
+ constructor({ stream, parse, eventShape, signal }) {
38
+ this.controller = new AbortController();
39
+ this.stream = stream;
40
+ this.parse = parse;
41
+ if (eventShape.type === "sse") {
42
+ this.prefix = DATA_PREFIX;
43
+ this.messageTerminator = "\n";
44
+ this.streamTerminator = eventShape.streamTerminator;
45
+ }
46
+ else {
47
+ this.messageTerminator = eventShape.messageTerminator;
48
+ }
49
+ signal === null || signal === void 0 ? void 0 : signal.addEventListener("abort", () => this.controller.abort());
50
+ }
51
+ iterMessages() {
52
+ return __asyncGenerator(this, arguments, function* iterMessages_1() {
53
+ var _a, e_1, _b, _c;
54
+ this.controller.signal;
55
+ const stream = readableStreamAsyncIterable(this.stream);
56
+ let buf = "";
57
+ let prefixSeen = false;
58
+ try {
59
+ for (var _d = true, stream_1 = __asyncValues(stream), stream_1_1; stream_1_1 = yield __await(stream_1.next()), _a = stream_1_1.done, !_a; _d = true) {
60
+ _c = stream_1_1.value;
61
+ _d = false;
62
+ const chunk = _c;
63
+ buf += this.decodeChunk(chunk);
64
+ let terminatorIndex;
65
+ while ((terminatorIndex = buf.indexOf(this.messageTerminator)) >= 0) {
66
+ let line = buf.slice(0, terminatorIndex + 1);
67
+ buf = buf.slice(terminatorIndex + this.messageTerminator.length);
68
+ if (!line.trim()) {
69
+ continue;
70
+ }
71
+ if (!prefixSeen && this.prefix != null) {
72
+ const prefixIndex = line.indexOf(this.prefix);
73
+ if (prefixIndex === -1) {
74
+ continue;
75
+ }
76
+ prefixSeen = true;
77
+ line = line.slice(prefixIndex + this.prefix.length);
78
+ }
79
+ if (this.streamTerminator != null && line.includes(this.streamTerminator)) {
80
+ return yield __await(void 0);
81
+ }
82
+ const message = yield __await(this.parse(JSON.parse(line)));
83
+ yield yield __await(message);
84
+ prefixSeen = false;
85
+ }
86
+ }
87
+ }
88
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
89
+ finally {
90
+ try {
91
+ if (!_d && !_a && (_b = stream_1.return)) yield __await(_b.call(stream_1));
92
+ }
93
+ finally { if (e_1) throw e_1.error; }
94
+ }
95
+ });
96
+ }
97
+ [Symbol.asyncIterator]() {
98
+ return __asyncGenerator(this, arguments, function* _a() {
99
+ var _b, e_2, _c, _d;
100
+ try {
101
+ for (var _e = true, _f = __asyncValues(this.iterMessages()), _g; _g = yield __await(_f.next()), _b = _g.done, !_b; _e = true) {
102
+ _d = _g.value;
103
+ _e = false;
104
+ const message = _d;
105
+ yield yield __await(message);
106
+ }
107
+ }
108
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
109
+ finally {
110
+ try {
111
+ if (!_e && !_b && (_c = _f.return)) yield __await(_c.call(_f));
112
+ }
113
+ finally { if (e_2) throw e_2.error; }
114
+ }
115
+ });
116
+ }
117
+ decodeChunk(chunk) {
118
+ let decoded = "";
119
+ // If TextDecoder is present, use it
120
+ if (typeof TextDecoder !== "undefined") {
121
+ const decoder = new TextDecoder("utf8");
122
+ decoded += decoder.decode(chunk);
123
+ }
124
+ // Buffer is present in Node.js environment
125
+ else if (index_js_1.RUNTIME.type === "node" && typeof chunk !== "undefined") {
126
+ decoded += Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
127
+ }
128
+ return decoded;
129
+ }
130
+ }
131
+ exports.Stream = Stream;
132
+ /**
133
+ * Browser polyfill for ReadableStream
134
+ */
135
+ // biome-ignore lint/suspicious/noExplicitAny: allow explicit any
136
+ function readableStreamAsyncIterable(stream) {
137
+ if (stream[Symbol.asyncIterator]) {
138
+ return stream;
139
+ }
140
+ const reader = stream.getReader();
141
+ return {
142
+ next() {
143
+ return __awaiter(this, void 0, void 0, function* () {
144
+ try {
145
+ const result = yield reader.read();
146
+ if (result === null || result === void 0 ? void 0 : result.done) {
147
+ reader.releaseLock();
148
+ } // release lock when stream becomes closed
149
+ return result;
150
+ }
151
+ catch (e) {
152
+ reader.releaseLock(); // release lock when stream becomes errored
153
+ throw e;
154
+ }
155
+ });
156
+ },
157
+ return() {
158
+ return __awaiter(this, void 0, void 0, function* () {
159
+ const cancelPromise = reader.cancel();
160
+ reader.releaseLock();
161
+ yield cancelPromise;
162
+ return { done: true, value: undefined };
163
+ });
164
+ },
165
+ [Symbol.asyncIterator]() {
166
+ return this;
167
+ },
168
+ };
169
+ }
@@ -0,0 +1 @@
1
+ export { Stream } from "./Stream.js";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Stream = void 0;
4
+ var Stream_js_1 = require("./Stream.js");
5
+ Object.defineProperty(exports, "Stream", { enumerable: true, get: function () { return Stream_js_1.Stream; } });
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "1.562.0";
1
+ export declare const SDK_VERSION = "1.575.0";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "1.562.0";
4
+ exports.SDK_VERSION = "1.575.0";
@@ -17,8 +17,8 @@ export class ChrtClient {
17
17
  this._options = Object.assign(Object.assign({}, _options), { headers: mergeHeaders({
18
18
  "X-Fern-Language": "JavaScript",
19
19
  "X-Fern-SDK-Name": "@chrt-inc/typescript-sdk",
20
- "X-Fern-SDK-Version": "1.562.0",
21
- "User-Agent": "@chrt-inc/typescript-sdk/1.562.0",
20
+ "X-Fern-SDK-Version": "1.575.0",
21
+ "User-Agent": "@chrt-inc/typescript-sdk/1.575.0",
22
22
  "X-Fern-Runtime": core.RUNTIME.type,
23
23
  "X-Fern-Runtime-Version": core.RUNTIME.version,
24
24
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });