@augno/sdk 0.12.7 → 0.13.1

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 (287) hide show
  1. package/CHANGELOG.md +2 -4
  2. package/client.d.mts +2 -2
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +2 -2
  5. package/client.d.ts.map +1 -1
  6. package/client.js.map +1 -1
  7. package/client.mjs +1 -1
  8. package/client.mjs.map +1 -1
  9. package/package.json +1 -1
  10. package/resources/catalog/catalog.d.mts +4 -4
  11. package/resources/catalog/catalog.d.mts.map +1 -1
  12. package/resources/catalog/catalog.d.ts +4 -4
  13. package/resources/catalog/catalog.d.ts.map +1 -1
  14. package/resources/catalog/catalog.js.map +1 -1
  15. package/resources/catalog/catalog.mjs.map +1 -1
  16. package/resources/catalog/index.d.mts +2 -2
  17. package/resources/catalog/index.d.mts.map +1 -1
  18. package/resources/catalog/index.d.ts +2 -2
  19. package/resources/catalog/index.d.ts.map +1 -1
  20. package/resources/catalog/index.js.map +1 -1
  21. package/resources/catalog/index.mjs.map +1 -1
  22. package/resources/catalog/items/index.d.mts +1 -1
  23. package/resources/catalog/items/index.d.mts.map +1 -1
  24. package/resources/catalog/items/index.d.ts +1 -1
  25. package/resources/catalog/items/index.d.ts.map +1 -1
  26. package/resources/catalog/items/index.js.map +1 -1
  27. package/resources/catalog/items/index.mjs.map +1 -1
  28. package/resources/catalog/items/items.d.mts +77 -1
  29. package/resources/catalog/items/items.d.mts.map +1 -1
  30. package/resources/catalog/items/items.d.ts +77 -1
  31. package/resources/catalog/items/items.d.ts.map +1 -1
  32. package/resources/catalog/items/items.js +29 -0
  33. package/resources/catalog/items/items.js.map +1 -1
  34. package/resources/catalog/items/items.mjs +29 -0
  35. package/resources/catalog/items/items.mjs.map +1 -1
  36. package/resources/catalog/product-lines.d.mts +42 -8
  37. package/resources/catalog/product-lines.d.mts.map +1 -1
  38. package/resources/catalog/product-lines.d.ts +42 -8
  39. package/resources/catalog/product-lines.d.ts.map +1 -1
  40. package/resources/catalog/product-lines.js +3 -3
  41. package/resources/catalog/product-lines.js.map +1 -1
  42. package/resources/catalog/product-lines.mjs +3 -3
  43. package/resources/catalog/product-lines.mjs.map +1 -1
  44. package/resources/catalog/products.d.mts +2 -2
  45. package/resources/catalog/products.d.ts +2 -2
  46. package/resources/catalog/products.js +2 -2
  47. package/resources/catalog/products.mjs +2 -2
  48. package/resources/core/analytics.d.mts +547 -0
  49. package/resources/core/analytics.d.mts.map +1 -0
  50. package/resources/core/analytics.d.ts +547 -0
  51. package/resources/core/analytics.d.ts.map +1 -0
  52. package/resources/core/analytics.js +67 -0
  53. package/resources/core/analytics.js.map +1 -0
  54. package/resources/core/analytics.mjs +63 -0
  55. package/resources/core/analytics.mjs.map +1 -0
  56. package/resources/core/audit-events.d.mts +4 -4
  57. package/resources/core/audit-events.d.mts.map +1 -1
  58. package/resources/core/audit-events.d.ts +4 -4
  59. package/resources/core/audit-events.d.ts.map +1 -1
  60. package/resources/core/core.d.mts +6 -2
  61. package/resources/core/core.d.mts.map +1 -1
  62. package/resources/core/core.d.ts +6 -2
  63. package/resources/core/core.d.ts.map +1 -1
  64. package/resources/core/core.js +4 -0
  65. package/resources/core/core.js.map +1 -1
  66. package/resources/core/core.mjs +4 -0
  67. package/resources/core/core.mjs.map +1 -1
  68. package/resources/core/index.d.mts +1 -0
  69. package/resources/core/index.d.mts.map +1 -1
  70. package/resources/core/index.d.ts +1 -0
  71. package/resources/core/index.d.ts.map +1 -1
  72. package/resources/core/index.js +3 -1
  73. package/resources/core/index.js.map +1 -1
  74. package/resources/core/index.mjs +1 -0
  75. package/resources/core/index.mjs.map +1 -1
  76. package/resources/index.d.mts +1 -1
  77. package/resources/index.d.mts.map +1 -1
  78. package/resources/index.d.ts +1 -1
  79. package/resources/index.d.ts.map +1 -1
  80. package/resources/index.js.map +1 -1
  81. package/resources/index.mjs +1 -1
  82. package/resources/index.mjs.map +1 -1
  83. package/resources/messaging/conversations/conversations.d.mts +3 -3
  84. package/resources/messaging/conversations/conversations.d.mts.map +1 -1
  85. package/resources/messaging/conversations/conversations.d.ts +3 -3
  86. package/resources/messaging/conversations/conversations.d.ts.map +1 -1
  87. package/resources/messaging/conversations/conversations.js.map +1 -1
  88. package/resources/messaging/conversations/conversations.mjs.map +1 -1
  89. package/resources/messaging/conversations/links.d.mts +2 -2
  90. package/resources/messaging/conversations/links.d.mts.map +1 -1
  91. package/resources/messaging/conversations/links.d.ts +2 -2
  92. package/resources/messaging/conversations/links.d.ts.map +1 -1
  93. package/resources/messaging/conversations/messages.d.mts +2 -2
  94. package/resources/messaging/conversations/messages.d.mts.map +1 -1
  95. package/resources/messaging/conversations/messages.d.ts +2 -2
  96. package/resources/messaging/conversations/messages.d.ts.map +1 -1
  97. package/resources/messaging/notifications/notifications.d.mts +2 -2
  98. package/resources/messaging/notifications/notifications.d.mts.map +1 -1
  99. package/resources/messaging/notifications/notifications.d.ts +2 -2
  100. package/resources/messaging/notifications/notifications.d.ts.map +1 -1
  101. package/resources/messaging/notifications/notifications.js.map +1 -1
  102. package/resources/messaging/notifications/notifications.mjs.map +1 -1
  103. package/resources/operations/demand-overrides.d.mts +468 -0
  104. package/resources/operations/demand-overrides.d.mts.map +1 -0
  105. package/resources/operations/demand-overrides.d.ts +468 -0
  106. package/resources/operations/demand-overrides.d.ts.map +1 -0
  107. package/resources/operations/demand-overrides.js +120 -0
  108. package/resources/operations/demand-overrides.js.map +1 -0
  109. package/resources/operations/demand-overrides.mjs +116 -0
  110. package/resources/operations/demand-overrides.mjs.map +1 -0
  111. package/resources/operations/index.d.mts +5 -1
  112. package/resources/operations/index.d.mts.map +1 -1
  113. package/resources/operations/index.d.ts +5 -1
  114. package/resources/operations/index.d.ts.map +1 -1
  115. package/resources/operations/index.js +9 -1
  116. package/resources/operations/index.js.map +1 -1
  117. package/resources/operations/index.mjs +5 -1
  118. package/resources/operations/index.mjs.map +1 -1
  119. package/resources/operations/machine-downtime-events.d.mts +424 -0
  120. package/resources/operations/machine-downtime-events.d.mts.map +1 -0
  121. package/resources/operations/machine-downtime-events.d.ts +424 -0
  122. package/resources/operations/machine-downtime-events.d.ts.map +1 -0
  123. package/resources/operations/machine-downtime-events.js +110 -0
  124. package/resources/operations/machine-downtime-events.js.map +1 -0
  125. package/resources/operations/machine-downtime-events.mjs +106 -0
  126. package/resources/operations/machine-downtime-events.mjs.map +1 -0
  127. package/resources/operations/operations.d.mts +444 -0
  128. package/resources/operations/operations.d.mts.map +1 -1
  129. package/resources/operations/operations.d.ts +444 -0
  130. package/resources/operations/operations.d.ts.map +1 -1
  131. package/resources/operations/operations.js +89 -0
  132. package/resources/operations/operations.js.map +1 -1
  133. package/resources/operations/operations.mjs +89 -0
  134. package/resources/operations/operations.mjs.map +1 -1
  135. package/resources/operations/production-schedule-settings/index.d.mts +3 -0
  136. package/resources/operations/production-schedule-settings/index.d.mts.map +1 -0
  137. package/resources/operations/production-schedule-settings/index.d.ts +3 -0
  138. package/resources/operations/production-schedule-settings/index.d.ts.map +1 -0
  139. package/resources/operations/production-schedule-settings/index.js +9 -0
  140. package/resources/operations/production-schedule-settings/index.js.map +1 -0
  141. package/resources/operations/production-schedule-settings/index.mjs +4 -0
  142. package/resources/operations/production-schedule-settings/index.mjs.map +1 -0
  143. package/resources/operations/production-schedule-settings/production-schedule-settings.d.mts +470 -0
  144. package/resources/operations/production-schedule-settings/production-schedule-settings.d.mts.map +1 -0
  145. package/resources/operations/production-schedule-settings/production-schedule-settings.d.ts +470 -0
  146. package/resources/operations/production-schedule-settings/production-schedule-settings.d.ts.map +1 -0
  147. package/resources/operations/production-schedule-settings/production-schedule-settings.js +88 -0
  148. package/resources/operations/production-schedule-settings/production-schedule-settings.js.map +1 -0
  149. package/resources/operations/production-schedule-settings/production-schedule-settings.mjs +83 -0
  150. package/resources/operations/production-schedule-settings/production-schedule-settings.mjs.map +1 -0
  151. package/resources/operations/production-schedule-settings/resources.d.mts +176 -0
  152. package/resources/operations/production-schedule-settings/resources.d.mts.map +1 -0
  153. package/resources/operations/production-schedule-settings/resources.d.ts +176 -0
  154. package/resources/operations/production-schedule-settings/resources.d.ts.map +1 -0
  155. package/resources/operations/production-schedule-settings/resources.js +74 -0
  156. package/resources/operations/production-schedule-settings/resources.js.map +1 -0
  157. package/resources/operations/production-schedule-settings/resources.mjs +70 -0
  158. package/resources/operations/production-schedule-settings/resources.mjs.map +1 -0
  159. package/resources/operations/production-schedule-settings.d.mts +2 -0
  160. package/resources/operations/production-schedule-settings.d.mts.map +1 -0
  161. package/resources/operations/production-schedule-settings.d.ts +2 -0
  162. package/resources/operations/production-schedule-settings.d.ts.map +1 -0
  163. package/resources/operations/production-schedule-settings.js +6 -0
  164. package/resources/operations/production-schedule-settings.js.map +1 -0
  165. package/resources/operations/production-schedule-settings.mjs +3 -0
  166. package/resources/operations/production-schedule-settings.mjs.map +1 -0
  167. package/resources/operations/production-schedules/actions.d.mts +668 -0
  168. package/resources/operations/production-schedules/actions.d.mts.map +1 -0
  169. package/resources/operations/production-schedules/actions.d.ts +668 -0
  170. package/resources/operations/production-schedules/actions.d.ts.map +1 -0
  171. package/resources/operations/production-schedules/actions.js +181 -0
  172. package/resources/operations/production-schedules/actions.js.map +1 -0
  173. package/resources/operations/production-schedules/actions.mjs +177 -0
  174. package/resources/operations/production-schedules/actions.mjs.map +1 -0
  175. package/resources/operations/production-schedules/index.d.mts +4 -0
  176. package/resources/operations/production-schedules/index.d.mts.map +1 -0
  177. package/resources/operations/production-schedules/index.d.ts +4 -0
  178. package/resources/operations/production-schedules/index.d.ts.map +1 -0
  179. package/resources/operations/production-schedules/index.js +11 -0
  180. package/resources/operations/production-schedules/index.js.map +1 -0
  181. package/resources/operations/production-schedules/index.mjs +5 -0
  182. package/resources/operations/production-schedules/index.mjs.map +1 -0
  183. package/resources/operations/production-schedules/lines.d.mts +420 -0
  184. package/resources/operations/production-schedules/lines.d.mts.map +1 -0
  185. package/resources/operations/production-schedules/lines.d.ts +420 -0
  186. package/resources/operations/production-schedules/lines.d.ts.map +1 -0
  187. package/resources/operations/production-schedules/lines.js +106 -0
  188. package/resources/operations/production-schedules/lines.js.map +1 -0
  189. package/resources/operations/production-schedules/lines.mjs +102 -0
  190. package/resources/operations/production-schedules/lines.mjs.map +1 -0
  191. package/resources/operations/production-schedules/production-schedules.d.mts +1177 -0
  192. package/resources/operations/production-schedules/production-schedules.d.mts.map +1 -0
  193. package/resources/operations/production-schedules/production-schedules.d.ts +1177 -0
  194. package/resources/operations/production-schedules/production-schedules.d.ts.map +1 -0
  195. package/resources/operations/production-schedules/production-schedules.js +238 -0
  196. package/resources/operations/production-schedules/production-schedules.js.map +1 -0
  197. package/resources/operations/production-schedules/production-schedules.mjs +233 -0
  198. package/resources/operations/production-schedules/production-schedules.mjs.map +1 -0
  199. package/resources/operations/production-schedules.d.mts +2 -0
  200. package/resources/operations/production-schedules.d.mts.map +1 -0
  201. package/resources/operations/production-schedules.d.ts +2 -0
  202. package/resources/operations/production-schedules.d.ts.map +1 -0
  203. package/resources/operations/production-schedules.js +6 -0
  204. package/resources/operations/production-schedules.js.map +1 -0
  205. package/resources/operations/production-schedules.mjs +3 -0
  206. package/resources/operations/production-schedules.mjs.map +1 -0
  207. package/resources/operations/shipping-terms.d.mts +9 -8
  208. package/resources/operations/shipping-terms.d.mts.map +1 -1
  209. package/resources/operations/shipping-terms.d.ts +9 -8
  210. package/resources/operations/shipping-terms.d.ts.map +1 -1
  211. package/resources/operations/shipping-terms.js.map +1 -1
  212. package/resources/operations/shipping-terms.mjs.map +1 -1
  213. package/resources/sales/customers/customers.d.mts +6 -18
  214. package/resources/sales/customers/customers.d.mts.map +1 -1
  215. package/resources/sales/customers/customers.d.ts +6 -18
  216. package/resources/sales/customers/customers.d.ts.map +1 -1
  217. package/resources/sales/customers/customers.js.map +1 -1
  218. package/resources/sales/customers/customers.mjs.map +1 -1
  219. package/resources/sales/customers/index.d.mts +1 -1
  220. package/resources/sales/customers/index.d.mts.map +1 -1
  221. package/resources/sales/customers/index.d.ts +1 -1
  222. package/resources/sales/customers/index.d.ts.map +1 -1
  223. package/resources/sales/customers/index.js.map +1 -1
  224. package/resources/sales/customers/index.mjs.map +1 -1
  225. package/resources/sales/index.d.mts +1 -1
  226. package/resources/sales/index.d.mts.map +1 -1
  227. package/resources/sales/index.d.ts +1 -1
  228. package/resources/sales/index.d.ts.map +1 -1
  229. package/resources/sales/index.js.map +1 -1
  230. package/resources/sales/index.mjs.map +1 -1
  231. package/resources/sales/sales-orders/lines/lines.d.mts +5 -5
  232. package/resources/sales/sales-orders/lines/lines.d.mts.map +1 -1
  233. package/resources/sales/sales-orders/lines/lines.d.ts +5 -5
  234. package/resources/sales/sales-orders/lines/lines.d.ts.map +1 -1
  235. package/resources/sales/sales-orders/sales-orders.d.mts +3 -2
  236. package/resources/sales/sales-orders/sales-orders.d.mts.map +1 -1
  237. package/resources/sales/sales-orders/sales-orders.d.ts +3 -2
  238. package/resources/sales/sales-orders/sales-orders.d.ts.map +1 -1
  239. package/resources/sales/sales-orders/sales-orders.js.map +1 -1
  240. package/resources/sales/sales-orders/sales-orders.mjs.map +1 -1
  241. package/resources/sales/sales.d.mts +2 -2
  242. package/resources/sales/sales.d.mts.map +1 -1
  243. package/resources/sales/sales.d.ts +2 -2
  244. package/resources/sales/sales.d.ts.map +1 -1
  245. package/resources/sales/sales.js.map +1 -1
  246. package/resources/sales/sales.mjs.map +1 -1
  247. package/src/client.ts +30 -2
  248. package/src/resources/catalog/catalog.ts +6 -0
  249. package/src/resources/catalog/index.ts +3 -0
  250. package/src/resources/catalog/items/index.ts +2 -0
  251. package/src/resources/catalog/items/items.ts +92 -0
  252. package/src/resources/catalog/product-lines.ts +49 -7
  253. package/src/resources/catalog/products.ts +2 -2
  254. package/src/resources/core/analytics.ts +677 -0
  255. package/src/resources/core/audit-events.ts +84 -0
  256. package/src/resources/core/core.ts +82 -0
  257. package/src/resources/core/index.ts +18 -0
  258. package/src/resources/index.ts +15 -1
  259. package/src/resources/messaging/conversations/conversations.ts +63 -0
  260. package/src/resources/messaging/conversations/links.ts +42 -0
  261. package/src/resources/messaging/conversations/messages.ts +42 -0
  262. package/src/resources/messaging/notifications/notifications.ts +42 -0
  263. package/src/resources/operations/demand-overrides.ts +631 -0
  264. package/src/resources/operations/index.ts +72 -1
  265. package/src/resources/operations/machine-downtime-events.ts +584 -0
  266. package/src/resources/operations/operations.ts +673 -0
  267. package/src/resources/operations/production-schedule-settings/index.ts +15 -0
  268. package/src/resources/operations/production-schedule-settings/production-schedule-settings.ts +595 -0
  269. package/src/resources/operations/production-schedule-settings/resources.ts +217 -0
  270. package/src/resources/operations/production-schedule-settings.ts +3 -0
  271. package/src/resources/operations/production-schedules/actions.ts +835 -0
  272. package/src/resources/operations/production-schedules/index.ts +64 -0
  273. package/src/resources/operations/production-schedules/lines.ts +584 -0
  274. package/src/resources/operations/production-schedules/production-schedules.ts +1548 -0
  275. package/src/resources/operations/production-schedules.ts +3 -0
  276. package/src/resources/operations/shipping-terms.ts +9 -8
  277. package/src/resources/sales/customers/customers.ts +5 -20
  278. package/src/resources/sales/customers/index.ts +0 -1
  279. package/src/resources/sales/index.ts +0 -1
  280. package/src/resources/sales/sales-orders/lines/lines.ts +5 -5
  281. package/src/resources/sales/sales-orders/sales-orders.ts +3 -2
  282. package/src/resources/sales/sales.ts +0 -2
  283. package/src/version.ts +1 -1
  284. package/version.d.mts +1 -1
  285. package/version.d.ts +1 -1
  286. package/version.js +1 -1
  287. package/version.mjs +1 -1
@@ -0,0 +1,835 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../../core/resource';
4
+ import * as CoreAPI from '../../core/core';
5
+ import * as APIKeysAPI from '../../auth/api-keys/api-keys';
6
+ import * as ProductionSchedulesAPI from './production-schedules';
7
+ import * as SalesOrdersActionsAPI from '../../sales/sales-orders/actions';
8
+ import { APIPromise } from '../../../core/api-promise';
9
+ import { RequestOptions } from '../../../internal/request-options';
10
+ import { path } from '../../../internal/utils/path';
11
+
12
+ /**
13
+ * Generate and review machine-level production schedules.
14
+ */
15
+ export class Actions extends APIResource {
16
+ /**
17
+ * Runs the production scheduling solver and returns the plan without saving it.
18
+ *
19
+ * This is the inspection surface for the scheduler: it takes the same path a
20
+ * generated schedule will take, minus the write, so a plan can be reviewed and
21
+ * compared before anything depends on it. Machines must be marked as the planning
22
+ * constraint in production schedule settings, otherwise there is nothing to
23
+ * schedule.
24
+ *
25
+ * This endpoint requires the permission: `production_schedules:read`.
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * const productionSchedulePreview =
30
+ * await client.operations.productionSchedules.actions.preview(
31
+ * { horizon_weeks: 13 },
32
+ * );
33
+ * ```
34
+ */
35
+ preview(
36
+ body: ActionPreviewParams | null | undefined = {},
37
+ options?: RequestOptions,
38
+ ): APIPromise<ProductionSchedulePreview> {
39
+ return this._client.put('/v1/operations/production-schedules/actions/preview', { body, ...options });
40
+ }
41
+
42
+ /**
43
+ * Returns what regenerating this draft would change, without changing it.
44
+ *
45
+ * Every campaign either plan holds is listed, including the ones both agree on, so
46
+ * the caller can render a full side-by-side rather than a list of surprises.
47
+ * `discarded_manual_count` is what `replace_all` would destroy — a regenerate that
48
+ * silently eats hand-work is abandoned within two cycles, so the destructive mode
49
+ * has to be able to state its cost before it runs.
50
+ *
51
+ * Planning inputs default to the ones the version was generated with, so a plain
52
+ * preview answers "what would the solver say now" rather than answering a
53
+ * different question with a different horizon.
54
+ *
55
+ * This endpoint requires the permission: `production_schedules:read`.
56
+ *
57
+ * @example
58
+ * ```ts
59
+ * const productionScheduleRegeneratePreview =
60
+ * await client.operations.productionSchedules.actions.previewRegenerate(
61
+ * 'pnsc_0192a4c17b3e4f8a91c2d0',
62
+ * { horizon_weeks: 13 },
63
+ * );
64
+ * ```
65
+ */
66
+ previewRegenerate(
67
+ id: string,
68
+ body: ActionPreviewRegenerateParams | null | undefined = {},
69
+ options?: RequestOptions,
70
+ ): APIPromise<ProductionScheduleRegeneratePreview> {
71
+ return this._client.put(path`/v1/operations/production-schedules/${id}/actions/preview-regenerate`, {
72
+ body,
73
+ ...options,
74
+ });
75
+ }
76
+
77
+ /**
78
+ * Re-solves a draft in place, keeping its version number.
79
+ *
80
+ * Only a draft can be regenerated. A published version is a commitment the floor
81
+ * is already working to, and a superseded or archived one is history; re-solving
82
+ * either in place would change what a week was measured against after the fact. To
83
+ * replan against a published version, generate a new one — publishing it
84
+ * supersedes the current one.
85
+ *
86
+ * The version number is kept deliberately: minting a new version for every
87
+ * re-solve would fill the list with drafts nobody asked for and make the version
88
+ * number meaningless as a count of the plans actually considered.
89
+ *
90
+ * `preserve_manual` keeps every hand-edited campaign and replaces the rest.
91
+ * `replace_all` takes the fresh solve whole, and each hand edit it destroys is
92
+ * written to the deviation log first — "where did my change go" has to stay
93
+ * answerable. Call `preview-regenerate` first to see the cost as a number.
94
+ *
95
+ * This endpoint requires the permission: `production_schedules:update`.
96
+ *
97
+ * @example
98
+ * ```ts
99
+ * const productionSchedule =
100
+ * await client.operations.productionSchedules.actions.regenerate(
101
+ * 'pnsc_0192a4c17b3e4f8a91c2d0',
102
+ * { merge_mode: 'preserve_manual' },
103
+ * );
104
+ * ```
105
+ */
106
+ regenerate(
107
+ id: string,
108
+ body: ActionRegenerateParams | null | undefined = {},
109
+ options?: RequestOptions,
110
+ ): APIPromise<ProductionSchedulesAPI.ProductionSchedule> {
111
+ return this._client.put(path`/v1/operations/production-schedules/${id}/actions/regenerate`, {
112
+ body,
113
+ ...options,
114
+ });
115
+ }
116
+
117
+ /**
118
+ * Publishes a draft schedule, freezing its first weeks.
119
+ *
120
+ * Publishing is what makes a plan a commitment: the frozen weeks' lines are marked
121
+ * frozen, the frozen line count and quantity are captured onto the version, and
122
+ * any published version covering the same horizon is superseded rather than
123
+ * rewritten. After this, changes inside the frozen window require a reason and are
124
+ * recorded as deviations.
125
+ *
126
+ * The frozen counts are snapshotted here and never recomputed, so adherence keeps
127
+ * the denominator it was committed to.
128
+ *
129
+ * This endpoint requires the permission: `production_schedules:update`.
130
+ *
131
+ * @example
132
+ * ```ts
133
+ * const productionSchedule =
134
+ * await client.operations.productionSchedules.actions.publish(
135
+ * 'pnsc_0192a4c17b3e4f8a91c2d0',
136
+ * );
137
+ * ```
138
+ */
139
+ publish(id: string, options?: RequestOptions): APIPromise<ProductionSchedulesAPI.ProductionSchedule> {
140
+ return this._client.put(path`/v1/operations/production-schedules/${id}/actions/publish`, options);
141
+ }
142
+
143
+ /**
144
+ * Turns one planned week into a production run.
145
+ *
146
+ * Each campaign in the week becomes one batch per planned lot, using the lot size
147
+ * the campaign was planned at. A 360-unit campaign at a 60-unit lot arrives on the
148
+ * floor as six batches, not one instruction to make 360; a quantity that is not a
149
+ * whole number of lots trails a single short lot at the end of the run.
150
+ *
151
+ * The release is atomic. A run holding half a week's batches is worse than no run,
152
+ * because the missing half looks like work nobody was asked to do and attainment
153
+ * would count it as unplanned production.
154
+ *
155
+ * Releasing the same week twice fails rather than creating a second run. Each
156
+ * released line records the run now carrying it, and a line that is already
157
+ * released is never re-pointed.
158
+ *
159
+ * This endpoint requires the permissions: `production_schedules:update`,
160
+ * `production_runs:create`.
161
+ *
162
+ * @example
163
+ * ```ts
164
+ * const releaseScheduleWeekResult =
165
+ * await client.operations.productionSchedules.actions.releaseWeek(
166
+ * 'pnsc_0192a4c17b3e4f8a91c2d0',
167
+ * {
168
+ * responsible_user_id: 'us_0151164dcaea4cbded27b50aae',
169
+ * week_index: 0,
170
+ * },
171
+ * );
172
+ * ```
173
+ */
174
+ releaseWeek(
175
+ id: string,
176
+ body: ActionReleaseWeekParams,
177
+ options?: RequestOptions,
178
+ ): APIPromise<ReleaseScheduleWeekResult> {
179
+ return this._client.post(path`/v1/operations/production-schedules/${id}/actions/release-week`, {
180
+ body,
181
+ ...options,
182
+ });
183
+ }
184
+
185
+ /**
186
+ * Archives a schedule version, retiring it without discarding its history.
187
+ *
188
+ * This is how a published version is taken out of use: it stays readable and still
189
+ * backs any attainment already measured against it.
190
+ *
191
+ * This endpoint requires the permission: `production_schedules:update`.
192
+ *
193
+ * @example
194
+ * ```ts
195
+ * const productionSchedule =
196
+ * await client.operations.productionSchedules.actions.archive(
197
+ * 'pnsc_0192a4c17b3e4f8a91c2d0',
198
+ * );
199
+ * ```
200
+ */
201
+ archive(id: string, options?: RequestOptions): APIPromise<ProductionSchedulesAPI.ProductionSchedule> {
202
+ return this._client.put(path`/v1/operations/production-schedules/${id}/actions/archive`, options);
203
+ }
204
+ }
205
+
206
+ /**
207
+ * List represents a paginated list of resources.
208
+ */
209
+ export interface ListScheduleCampaign {
210
+ /**
211
+ * Resources in this page.
212
+ */
213
+ data: Array<ScheduleCampaign>;
214
+
215
+ /**
216
+ * Resource type identifier.
217
+ */
218
+ object: 'list';
219
+
220
+ /**
221
+ * PageInfo contains URL-based pagination metadata.
222
+ */
223
+ page_info: APIKeysAPI.PageInfo;
224
+ }
225
+
226
+ /**
227
+ * List represents a paginated list of resources.
228
+ */
229
+ export interface ListScheduleDiffLine {
230
+ /**
231
+ * Resources in this page.
232
+ */
233
+ data: Array<ScheduleDiffLine>;
234
+
235
+ /**
236
+ * Resource type identifier.
237
+ */
238
+ object: 'list';
239
+
240
+ /**
241
+ * PageInfo contains URL-based pagination metadata.
242
+ */
243
+ page_info: APIKeysAPI.PageInfo;
244
+ }
245
+
246
+ /**
247
+ * List represents a paginated list of resources.
248
+ */
249
+ export interface ListSchedulePolicy {
250
+ /**
251
+ * Resources in this page.
252
+ */
253
+ data: Array<SchedulePolicy>;
254
+
255
+ /**
256
+ * Resource type identifier.
257
+ */
258
+ object: 'list';
259
+
260
+ /**
261
+ * PageInfo contains URL-based pagination metadata.
262
+ */
263
+ page_info: APIKeysAPI.PageInfo;
264
+ }
265
+
266
+ /**
267
+ * List represents a paginated list of resources.
268
+ */
269
+ export interface ListScheduleProjection {
270
+ /**
271
+ * Resources in this page.
272
+ */
273
+ data: Array<ScheduleProjection>;
274
+
275
+ /**
276
+ * Resource type identifier.
277
+ */
278
+ object: 'list';
279
+
280
+ /**
281
+ * PageInfo contains URL-based pagination metadata.
282
+ */
283
+ page_info: APIKeysAPI.PageInfo;
284
+ }
285
+
286
+ /**
287
+ * Request to preview a production schedule.
288
+ */
289
+ export interface PreviewProductionScheduleRequest {
290
+ /**
291
+ * Overrides the configured demand basis for this preview only.
292
+ */
293
+ demand_basis?: 'trailing_12' | 'seasonal_ema';
294
+
295
+ /**
296
+ * Overrides the configured horizon for this preview only.
297
+ */
298
+ horizon_weeks?: number;
299
+
300
+ /**
301
+ * The instant to plan against. Defaults to now.
302
+ */
303
+ planning_as_of?: string;
304
+ }
305
+
306
+ /**
307
+ * Request to see what a re-solve would change.
308
+ */
309
+ export interface PreviewRegenerateProductionScheduleRequest {
310
+ /**
311
+ * How demand is derived. Defaults to the version's own basis.
312
+ */
313
+ demand_basis?: 'trailing_12' | 'seasonal_ema';
314
+
315
+ /**
316
+ * Weeks the plan should cover. Defaults to the version's own horizon.
317
+ */
318
+ horizon_weeks?: number;
319
+
320
+ /**
321
+ * Date to plan from. Defaults to the date the version was generated for.
322
+ */
323
+ planning_as_of?: string;
324
+ }
325
+
326
+ /**
327
+ * A production plan produced by the scheduling solver.
328
+ */
329
+ export interface ProductionSchedulePreview {
330
+ /**
331
+ * List represents a paginated list of resources.
332
+ */
333
+ campaigns: ListScheduleCampaign | null;
334
+
335
+ /**
336
+ * What the solver could not do, and why the plan differs from raw history.
337
+ */
338
+ diagnostics: ProductionSchedulesAPI.ScheduleDiagnostics;
339
+
340
+ /**
341
+ * Resource type identifier.
342
+ */
343
+ object: 'production_schedule_preview';
344
+
345
+ /**
346
+ * The instant the plan was calculated against.
347
+ */
348
+ planning_as_of_at: string;
349
+
350
+ /**
351
+ * List represents a paginated list of resources.
352
+ */
353
+ policies: ListSchedulePolicy | null;
354
+
355
+ /**
356
+ * List represents a paginated list of resources.
357
+ */
358
+ projections: ListScheduleProjection | null;
359
+
360
+ /**
361
+ * Version of the solver that produced this plan.
362
+ */
363
+ solver_version: string;
364
+ }
365
+
366
+ /**
367
+ * What a regenerate would change about a draft, without changing it.
368
+ *
369
+ * A regenerate that silently discards hand-work is abandoned within two cycles, so
370
+ * the destructive mode states its cost as a number before it runs:
371
+ * `discarded_manual_count` is exactly how many hand-edited campaigns `replace_all`
372
+ * would destroy.
373
+ */
374
+ export interface ProductionScheduleRegeneratePreview {
375
+ /**
376
+ * Campaigns the fresh solve wants that the current plan does not have.
377
+ */
378
+ added_count: number;
379
+
380
+ /**
381
+ * Campaigns both hold, in different quantities.
382
+ */
383
+ changed_count: number;
384
+
385
+ /**
386
+ * Hand-edited campaigns `replace_all` would destroy.
387
+ */
388
+ discarded_manual_count: number;
389
+
390
+ /**
391
+ * List represents a paginated list of resources.
392
+ */
393
+ lines: ListScheduleDiffLine | null;
394
+
395
+ /**
396
+ * Hand-edited campaigns currently on the draft.
397
+ */
398
+ manual_line_count: number;
399
+
400
+ /**
401
+ * Resource type identifier.
402
+ */
403
+ object: 'production_schedule_regenerate_preview';
404
+
405
+ /**
406
+ * The instant the fresh solve planned from.
407
+ */
408
+ planning_as_of_at: string;
409
+
410
+ /**
411
+ * Entity is a polymorphic reference to any resource in the system.
412
+ */
413
+ production_schedule: CoreAPI.Entity | null;
414
+
415
+ /**
416
+ * Campaigns the current plan has that the fresh solve does not want.
417
+ */
418
+ removed_count: number;
419
+
420
+ /**
421
+ * Which solver produced the proposal.
422
+ */
423
+ solver_version: string;
424
+ }
425
+
426
+ /**
427
+ * Request to re-solve a draft in place.
428
+ */
429
+ export interface RegenerateProductionScheduleRequest {
430
+ /**
431
+ * How demand is derived. Defaults to the version's own basis.
432
+ */
433
+ demand_basis?: 'trailing_12' | 'seasonal_ema';
434
+
435
+ /**
436
+ * Weeks the plan should cover. Defaults to the version's own horizon.
437
+ */
438
+ horizon_weeks?: number;
439
+
440
+ /**
441
+ * What happens to hand-edited campaigns. Defaults to keeping them.
442
+ */
443
+ merge_mode?: 'preserve_manual' | 'replace_all';
444
+
445
+ /**
446
+ * Date to plan from. Defaults to the date the version was generated for.
447
+ */
448
+ planning_as_of?: string;
449
+ }
450
+
451
+ /**
452
+ * Request to release one week of a production schedule to the floor.
453
+ */
454
+ export interface ReleaseProductionScheduleWeekRequest {
455
+ /**
456
+ * ID of the account user accountable for executing the run.
457
+ *
458
+ * Accepts either an account user ID or a user ID; it is resolved and stored as the
459
+ * account user.
460
+ */
461
+ responsible_user_id: string;
462
+
463
+ /**
464
+ * Zero-based week offset from the start of the horizon.
465
+ */
466
+ week_index: number;
467
+
468
+ /**
469
+ * ID of the scanning station the batches will be scanned at.
470
+ */
471
+ scanning_station_id?: string;
472
+ }
473
+
474
+ /**
475
+ * The production run created from one week of a schedule.
476
+ *
477
+ * Each planned campaign becomes one batch per lot, so a 360-unit week at a 60-unit
478
+ * lot arrives on the floor as six batches rather than one instruction to make 360.
479
+ */
480
+ export interface ReleaseScheduleWeekResult {
481
+ /**
482
+ * How many batches were created across all campaigns.
483
+ */
484
+ batch_count: number;
485
+
486
+ /**
487
+ * List represents a paginated list of resources.
488
+ */
489
+ lines: ProductionSchedulesAPI.ListReleasedScheduleLine | null;
490
+
491
+ /**
492
+ * Resource type identifier.
493
+ */
494
+ object: 'production_schedule_week_release';
495
+
496
+ /**
497
+ * Production run resource.
498
+ */
499
+ production_run: SalesOrdersActionsAPI.ProductionRun | null;
500
+
501
+ /**
502
+ * How many campaigns were released.
503
+ */
504
+ released_line_count: number;
505
+
506
+ /**
507
+ * Total units released.
508
+ */
509
+ total_quantity: number;
510
+
511
+ /**
512
+ * Zero-based week offset from the start of the horizon.
513
+ */
514
+ week_index: number;
515
+
516
+ /**
517
+ * First instant of the released week.
518
+ */
519
+ week_starts_at: string;
520
+ }
521
+
522
+ /**
523
+ * One planned production block: make this item, on this machine, in this week.
524
+ */
525
+ export interface ScheduleCampaign {
526
+ /**
527
+ * Entity is a polymorphic reference to any resource in the system.
528
+ */
529
+ item: CoreAPI.Entity | null;
530
+
531
+ /**
532
+ * Whole lots the quantity rounds to.
533
+ */
534
+ lots: number;
535
+
536
+ /**
537
+ * Entity is a polymorphic reference to any resource in the system.
538
+ */
539
+ machine: CoreAPI.Entity | null;
540
+
541
+ /**
542
+ * Constraint hours the campaign consumes.
543
+ */
544
+ run_hours: number;
545
+
546
+ /**
547
+ * SKU of the item.
548
+ */
549
+ sku: string;
550
+
551
+ /**
552
+ * Quantity to produce.
553
+ */
554
+ units: number;
555
+
556
+ /**
557
+ * Zero-based week offset from the start of the horizon.
558
+ */
559
+ week_index: number;
560
+ }
561
+
562
+ /**
563
+ * One campaign as the current plan and a fresh solve each see it.
564
+ */
565
+ export interface ScheduleDiffLine {
566
+ /**
567
+ * What the regenerate would do to this campaign.
568
+ */
569
+ change: 'added' | 'removed' | 'changed' | 'unchanged';
570
+
571
+ /**
572
+ * Whether the current campaign was created or edited by a person.
573
+ */
574
+ current_is_manual: boolean;
575
+
576
+ /**
577
+ * Units the current plan asks for. Zero when the campaign is being added.
578
+ */
579
+ current_quantity: number;
580
+
581
+ /**
582
+ * Entity is a polymorphic reference to any resource in the system.
583
+ */
584
+ item: CoreAPI.Entity | null;
585
+
586
+ /**
587
+ * Entity is a polymorphic reference to any resource in the system.
588
+ */
589
+ machine: CoreAPI.Entity | null;
590
+
591
+ /**
592
+ * Units the fresh solve asks for. Zero when the campaign is being removed.
593
+ */
594
+ proposed_quantity: number;
595
+
596
+ /**
597
+ * SKU of that item.
598
+ */
599
+ sku: string;
600
+
601
+ /**
602
+ * Zero-based horizon week.
603
+ */
604
+ week_index: number;
605
+ }
606
+
607
+ /**
608
+ * The inventory policy computed for one item.
609
+ */
610
+ export interface SchedulePolicy {
611
+ /**
612
+ * ABC class by share of constraint run hours.
613
+ */
614
+ abc_class: 'a' | 'b' | 'c' | null;
615
+
616
+ /**
617
+ * Demand used for planning, annualized.
618
+ */
619
+ annual_demand: number;
620
+
621
+ /**
622
+ * Constraint hours this item's annual demand consumes.
623
+ */
624
+ annual_run_hours: number;
625
+
626
+ /**
627
+ * What the constraint stage holds on average: its buffer plus half a campaign.
628
+ */
629
+ average_greige_inventory: number;
630
+
631
+ /**
632
+ * Observed or default lead time at the constraint.
633
+ */
634
+ constraint_lead_time_weeks: number;
635
+
636
+ /**
637
+ * Economic order quantity.
638
+ */
639
+ eoq_units: number;
640
+
641
+ /**
642
+ * Lead time from the constraint to sellable stock.
643
+ */
644
+ finish_lead_time_weeks: number;
645
+
646
+ /**
647
+ * Annual cost of holding one unit.
648
+ */
649
+ holding_cost: number;
650
+
651
+ /**
652
+ * Entity is a polymorphic reference to any resource in the system.
653
+ */
654
+ item: CoreAPI.Entity | null;
655
+
656
+ /**
657
+ * What the constraint stage holds at its peak: its buffer plus a whole campaign.
658
+ */
659
+ max_greige_inventory: number;
660
+
661
+ /**
662
+ * Stock on hand at the constraint plus everything downstream of it.
663
+ */
664
+ on_hand_echelon: number;
665
+
666
+ /**
667
+ * Stock sitting at the constraint stage on its own.
668
+ */
669
+ on_hand_greige: number;
670
+
671
+ /**
672
+ * Ceiling on how far ahead this item is built.
673
+ */
674
+ order_up_to: number;
675
+
676
+ /**
677
+ * Stock position at which a campaign is triggered.
678
+ */
679
+ reorder_point: number;
680
+
681
+ /**
682
+ * Buffer held as finished goods.
683
+ */
684
+ safety_stock_downstream: number;
685
+
686
+ /**
687
+ * Buffer held at the constraint, pooled across the finished goods it feeds.
688
+ */
689
+ safety_stock_primary: number;
690
+
691
+ /**
692
+ * How long one unit occupies the constraint.
693
+ */
694
+ seconds_per_unit: number;
695
+
696
+ /**
697
+ * Cost of one changeover, used as the setup cost in the lot-size calculation.
698
+ */
699
+ setup_cost: number;
700
+
701
+ /**
702
+ * SKU of the item.
703
+ */
704
+ sku: string;
705
+
706
+ /**
707
+ * Standard cost per unit.
708
+ */
709
+ unit_cost: number;
710
+
711
+ /**
712
+ * Demand used for planning, per week.
713
+ */
714
+ weekly_demand: number;
715
+
716
+ /**
717
+ * Weeks of demand the current stock covers.
718
+ */
719
+ weeks_of_cover: number;
720
+ }
721
+
722
+ /**
723
+ * An item's projected stock position across the horizon.
724
+ */
725
+ export interface ScheduleProjection {
726
+ /**
727
+ * Entity is a polymorphic reference to any resource in the system.
728
+ */
729
+ item: CoreAPI.Entity | null;
730
+
731
+ /**
732
+ * Projected stock at the end of each week of the horizon.
733
+ */
734
+ on_hand_by_week: Array<number>;
735
+ }
736
+
737
+ export interface ActionPreviewParams {
738
+ /**
739
+ * Overrides the configured demand basis for this preview only.
740
+ */
741
+ demand_basis?: 'trailing_12' | 'seasonal_ema';
742
+
743
+ /**
744
+ * Overrides the configured horizon for this preview only.
745
+ */
746
+ horizon_weeks?: number;
747
+
748
+ /**
749
+ * The instant to plan against. Defaults to now.
750
+ */
751
+ planning_as_of?: string;
752
+ }
753
+
754
+ export interface ActionPreviewRegenerateParams {
755
+ /**
756
+ * How demand is derived. Defaults to the version's own basis.
757
+ */
758
+ demand_basis?: 'trailing_12' | 'seasonal_ema';
759
+
760
+ /**
761
+ * Weeks the plan should cover. Defaults to the version's own horizon.
762
+ */
763
+ horizon_weeks?: number;
764
+
765
+ /**
766
+ * Date to plan from. Defaults to the date the version was generated for.
767
+ */
768
+ planning_as_of?: string;
769
+ }
770
+
771
+ export interface ActionRegenerateParams {
772
+ /**
773
+ * How demand is derived. Defaults to the version's own basis.
774
+ */
775
+ demand_basis?: 'trailing_12' | 'seasonal_ema';
776
+
777
+ /**
778
+ * Weeks the plan should cover. Defaults to the version's own horizon.
779
+ */
780
+ horizon_weeks?: number;
781
+
782
+ /**
783
+ * What happens to hand-edited campaigns. Defaults to keeping them.
784
+ */
785
+ merge_mode?: 'preserve_manual' | 'replace_all';
786
+
787
+ /**
788
+ * Date to plan from. Defaults to the date the version was generated for.
789
+ */
790
+ planning_as_of?: string;
791
+ }
792
+
793
+ export interface ActionReleaseWeekParams {
794
+ /**
795
+ * ID of the account user accountable for executing the run.
796
+ *
797
+ * Accepts either an account user ID or a user ID; it is resolved and stored as the
798
+ * account user.
799
+ */
800
+ responsible_user_id: string;
801
+
802
+ /**
803
+ * Zero-based week offset from the start of the horizon.
804
+ */
805
+ week_index: number;
806
+
807
+ /**
808
+ * ID of the scanning station the batches will be scanned at.
809
+ */
810
+ scanning_station_id?: string;
811
+ }
812
+
813
+ export declare namespace Actions {
814
+ export {
815
+ type ListScheduleCampaign as ListScheduleCampaign,
816
+ type ListScheduleDiffLine as ListScheduleDiffLine,
817
+ type ListSchedulePolicy as ListSchedulePolicy,
818
+ type ListScheduleProjection as ListScheduleProjection,
819
+ type PreviewProductionScheduleRequest as PreviewProductionScheduleRequest,
820
+ type PreviewRegenerateProductionScheduleRequest as PreviewRegenerateProductionScheduleRequest,
821
+ type ProductionSchedulePreview as ProductionSchedulePreview,
822
+ type ProductionScheduleRegeneratePreview as ProductionScheduleRegeneratePreview,
823
+ type RegenerateProductionScheduleRequest as RegenerateProductionScheduleRequest,
824
+ type ReleaseProductionScheduleWeekRequest as ReleaseProductionScheduleWeekRequest,
825
+ type ReleaseScheduleWeekResult as ReleaseScheduleWeekResult,
826
+ type ScheduleCampaign as ScheduleCampaign,
827
+ type ScheduleDiffLine as ScheduleDiffLine,
828
+ type SchedulePolicy as SchedulePolicy,
829
+ type ScheduleProjection as ScheduleProjection,
830
+ type ActionPreviewParams as ActionPreviewParams,
831
+ type ActionPreviewRegenerateParams as ActionPreviewRegenerateParams,
832
+ type ActionRegenerateParams as ActionRegenerateParams,
833
+ type ActionReleaseWeekParams as ActionReleaseWeekParams,
834
+ };
835
+ }