khansama-api 1.65.0 → 1.67.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -334,16 +334,80 @@ export interface AgentPantryItem {
334
334
  item_type: ItemTypeEnum;
335
335
  location?: AgentPantryItemLocation;
336
336
  }
337
+ export type AgentPantryItemCreateExpirationDate = string | null;
338
+ export type AgentPantryItemCreateLocation = LocationEnum | null;
339
+ export type AgentPantryItemCreateNotes = string | null;
340
+ /**
341
+ * Add one pantry item on behalf of the token's household (PAN-535).
342
+
343
+ Deliberately smaller than the app's form: no images, no custom storage
344
+ locations, no restock hints — the agent gets the fields it can name.
345
+ */
346
+ export interface AgentPantryItemCreate {
347
+ /**
348
+ * @minLength 1
349
+ * @maxLength 200
350
+ */
351
+ name: string;
352
+ item_type: ItemTypeEnum;
353
+ quantity: number;
354
+ quantity_unit: QuantityUnitEnum;
355
+ expiration_date?: AgentPantryItemCreateExpirationDate;
356
+ location?: AgentPantryItemCreateLocation;
357
+ notes?: AgentPantryItemCreateNotes;
358
+ }
337
359
  export interface AgentPantryResponse {
338
360
  items: AgentPantryItem[];
339
361
  total: number;
340
362
  }
363
+ export type AgentPlanSlotCreateRecipeId = number | null;
364
+ export type AgentPlanSlotCreateCatalogRecipeId = number | null;
365
+ export type AgentPlanSlotCreateServingsOverride = number | null;
366
+ export type AgentPlanSlotCreateNotes = string | null;
367
+ /**
368
+ * Add one meal to the plan that covers today (PAN-535).
369
+
370
+ ``recipe_id`` (a household recipe) and ``catalog_recipe_id`` (a global
371
+ catalog recipe) are mutually exclusive — the app's slot rule.
372
+ */
373
+ export interface AgentPlanSlotCreate {
374
+ recipe_id?: AgentPlanSlotCreateRecipeId;
375
+ catalog_recipe_id?: AgentPlanSlotCreateCatalogRecipeId;
376
+ /**
377
+ * 0 = Monday of the plan's week (week_start)
378
+ * @minimum 0
379
+ * @maximum 6
380
+ */
381
+ day_index: number;
382
+ meal_type?: MealTypeEnum;
383
+ servings_override?: AgentPlanSlotCreateServingsOverride;
384
+ notes?: AgentPlanSlotCreateNotes;
385
+ }
386
+ export type AgentPlanSlotCreatedWeekStart = string | null;
387
+ export type AgentPlanSlotCreatedRecipeId = number | null;
388
+ export type AgentPlanSlotCreatedCatalogRecipeId = number | null;
389
+ export type AgentPlanSlotCreatedRecipeTitle = string | null;
390
+ /**
391
+ * What the agent gets back after adding a plan slot.
392
+ */
393
+ export interface AgentPlanSlotCreated {
394
+ plan_id: number;
395
+ plan_name: string;
396
+ week_start?: AgentPlanSlotCreatedWeekStart;
397
+ slot_id: number;
398
+ day_index: number;
399
+ meal_type: MealTypeEnum;
400
+ recipe_id?: AgentPlanSlotCreatedRecipeId;
401
+ catalog_recipe_id?: AgentPlanSlotCreatedCatalogRecipeId;
402
+ recipe_title?: AgentPlanSlotCreatedRecipeTitle;
403
+ }
341
404
  export interface AgentTokenCreate {
342
405
  /**
343
406
  * @minLength 1
344
407
  * @maxLength 100
345
408
  */
346
409
  name: string;
410
+ scope?: AgentTokenScopeEnum;
347
411
  }
348
412
  export type AgentTokenCreatedLastUsedAt = string | null;
349
413
  export type AgentTokenCreatedRevokedAt = string | null;
@@ -353,6 +417,7 @@ export type AgentTokenCreatedRevokedAt = string | null;
353
417
  export interface AgentTokenCreated {
354
418
  id: number;
355
419
  name: string;
420
+ scope: AgentTokenScopeEnum;
356
421
  created_at: string;
357
422
  last_used_at?: AgentTokenCreatedLastUsedAt;
358
423
  revoked_at?: AgentTokenCreatedRevokedAt;
@@ -366,10 +431,21 @@ export type AgentTokenResponseRevokedAt = string | null;
366
431
  export interface AgentTokenResponse {
367
432
  id: number;
368
433
  name: string;
434
+ scope: AgentTokenScopeEnum;
369
435
  created_at: string;
370
436
  last_used_at?: AgentTokenResponseLastUsedAt;
371
437
  revoked_at?: AgentTokenResponseRevokedAt;
372
438
  }
439
+ /**
440
+ * What an agent token may do (PAN-535): read anything under /agent/v1,
441
+ or additionally create pantry items and plan slots. Write is opt-in at
442
+ creation because a leaked read token must never change data.
443
+ */
444
+ export type AgentTokenScopeEnum = typeof AgentTokenScopeEnum[keyof typeof AgentTokenScopeEnum];
445
+ export declare const AgentTokenScopeEnum: {
446
+ readonly read: "read";
447
+ readonly write: "write";
448
+ };
373
449
  export interface BarcodeRequest {
374
450
  /**
375
451
  * UPC/EAN barcode (8-14 digits)
@@ -2391,6 +2467,17 @@ export interface PlanGroceryListResponse {
2391
2467
  skipped?: string[];
2392
2468
  have_some?: string[];
2393
2469
  }
2470
+ /**
2471
+ * Per-day macros for a saved plan (``GET /plans/{id}/macros``, PAN-537).
2472
+
2473
+ The same recomputation as ``PlanWeekViewResponse.days`` — totals from the
2474
+ plan's persisted slots plus the household's targets — but strictly
2475
+ read-only: no shopping-list refresh, so a plain view of the plan never
2476
+ writes list rows.
2477
+ */
2478
+ export interface PlanMacrosResponse {
2479
+ days: AIWeekPlanDay[];
2480
+ }
2394
2481
  export type PlanSlotBulkItemId = number | null;
2395
2482
  export type PlanSlotBulkItemRecipeId = number | null;
2396
2483
  export type PlanSlotBulkItemCatalogRecipeId = number | null;
@@ -7110,6 +7197,31 @@ export declare function useGetPlanWeekViewPlansPlanIdWeekViewGet<TData = Awaited
7110
7197
  }): UseQueryResult<TData, TError> & {
7111
7198
  queryKey: QueryKey;
7112
7199
  };
7200
+ /**
7201
+ * Read-only per-day macros for a plan (PAN-537), recomputed from its
7202
+ persisted slots — the week-view numbers without the shopping-list
7203
+ refresh, so viewing the plan never writes list rows.
7204
+ * @summary Get Plan Macros
7205
+ */
7206
+ export declare const getPlanMacrosPlansPlanIdMacrosGet: (planId: number, options?: AxiosRequestConfig) => Promise<AxiosResponse<PlanMacrosResponse>>;
7207
+ export declare const getGetPlanMacrosPlansPlanIdMacrosGetQueryKey: (planId?: number) => readonly ["/plans/undefined/macros" | `/plans/${number}/macros`];
7208
+ export declare const getGetPlanMacrosPlansPlanIdMacrosGetQueryOptions: <TData = Awaited<ReturnType<typeof getPlanMacrosPlansPlanIdMacrosGet>>, TError = AxiosError<HTTPValidationError>>(planId: number, options?: {
7209
+ query?: UseQueryOptions<Awaited<ReturnType<typeof getPlanMacrosPlansPlanIdMacrosGet>>, TError, TData>;
7210
+ axios?: AxiosRequestConfig;
7211
+ }) => UseQueryOptions<Awaited<ReturnType<typeof getPlanMacrosPlansPlanIdMacrosGet>>, TError, TData> & {
7212
+ queryKey: QueryKey;
7213
+ };
7214
+ export type GetPlanMacrosPlansPlanIdMacrosGetQueryResult = NonNullable<Awaited<ReturnType<typeof getPlanMacrosPlansPlanIdMacrosGet>>>;
7215
+ export type GetPlanMacrosPlansPlanIdMacrosGetQueryError = AxiosError<HTTPValidationError>;
7216
+ /**
7217
+ * @summary Get Plan Macros
7218
+ */
7219
+ export declare function useGetPlanMacrosPlansPlanIdMacrosGet<TData = Awaited<ReturnType<typeof getPlanMacrosPlansPlanIdMacrosGet>>, TError = AxiosError<HTTPValidationError>>(planId: number, options?: {
7220
+ query?: UseQueryOptions<Awaited<ReturnType<typeof getPlanMacrosPlansPlanIdMacrosGet>>, TError, TData>;
7221
+ axios?: AxiosRequestConfig;
7222
+ }): UseQueryResult<TData, TError> & {
7223
+ queryKey: QueryKey;
7224
+ };
7113
7225
  /**
7114
7226
  * The plan editor's workhorse (§5.5): create/update/delete slot cells
7115
7227
  with per-item results. Items without id create; with id update (or delete
@@ -8769,6 +8881,36 @@ export declare function useGetPantryAgentV1PantryGet<TData = Awaited<ReturnType<
8769
8881
  }): UseQueryResult<TData, TError> & {
8770
8882
  queryKey: QueryKey;
8771
8883
  };
8884
+ /**
8885
+ * Add one pantry item to the token's household (write scope required).
8886
+
8887
+ It goes through the same service the app uses, so catalog linking, the
8888
+ expiry heuristic and the ``added`` inventory event all happen as usual.
8889
+ * @summary Add Pantry Item
8890
+ */
8891
+ export declare const addPantryItemAgentV1PantryPost: (agentPantryItemCreate: AgentPantryItemCreate, options?: AxiosRequestConfig) => Promise<AxiosResponse<AgentPantryItem>>;
8892
+ export declare const getAddPantryItemAgentV1PantryPostMutationOptions: <TError = AxiosError<HTTPValidationError>, TContext = unknown>(options?: {
8893
+ mutation?: UseMutationOptions<Awaited<ReturnType<typeof addPantryItemAgentV1PantryPost>>, TError, {
8894
+ data: AgentPantryItemCreate;
8895
+ }, TContext>;
8896
+ axios?: AxiosRequestConfig;
8897
+ }) => UseMutationOptions<Awaited<ReturnType<typeof addPantryItemAgentV1PantryPost>>, TError, {
8898
+ data: AgentPantryItemCreate;
8899
+ }, TContext>;
8900
+ export type AddPantryItemAgentV1PantryPostMutationResult = NonNullable<Awaited<ReturnType<typeof addPantryItemAgentV1PantryPost>>>;
8901
+ export type AddPantryItemAgentV1PantryPostMutationBody = AgentPantryItemCreate;
8902
+ export type AddPantryItemAgentV1PantryPostMutationError = AxiosError<HTTPValidationError>;
8903
+ /**
8904
+ * @summary Add Pantry Item
8905
+ */
8906
+ export declare const useAddPantryItemAgentV1PantryPost: <TError = AxiosError<HTTPValidationError>, TContext = unknown>(options?: {
8907
+ mutation?: UseMutationOptions<Awaited<ReturnType<typeof addPantryItemAgentV1PantryPost>>, TError, {
8908
+ data: AgentPantryItemCreate;
8909
+ }, TContext>;
8910
+ axios?: AxiosRequestConfig;
8911
+ }) => UseMutationResult<Awaited<ReturnType<typeof addPantryItemAgentV1PantryPost>>, TError, {
8912
+ data: AgentPantryItemCreate;
8913
+ }, TContext>;
8772
8914
  /**
8773
8915
  * Items that expire today or within ``days`` days, soonest first. Already-expired items are not included.
8774
8916
  * @summary Get Expiring
@@ -8792,6 +8934,36 @@ export declare function useGetExpiringAgentV1ExpiringGet<TData = Awaited<ReturnT
8792
8934
  }): UseQueryResult<TData, TError> & {
8793
8935
  queryKey: QueryKey;
8794
8936
  };
8937
+ /**
8938
+ * Add one meal to the plan that covers today (write scope required).
8939
+
8940
+ ``day_index`` is 0-6 from the plan's ``week_start``; ``meal_type`` defaults
8941
+ to dinner. No active plan covering today is a 409.
8942
+ * @summary Add To Plan
8943
+ */
8944
+ export declare const addToPlanAgentV1PlanPost: (agentPlanSlotCreate: AgentPlanSlotCreate, options?: AxiosRequestConfig) => Promise<AxiosResponse<AgentPlanSlotCreated>>;
8945
+ export declare const getAddToPlanAgentV1PlanPostMutationOptions: <TError = AxiosError<HTTPValidationError>, TContext = unknown>(options?: {
8946
+ mutation?: UseMutationOptions<Awaited<ReturnType<typeof addToPlanAgentV1PlanPost>>, TError, {
8947
+ data: AgentPlanSlotCreate;
8948
+ }, TContext>;
8949
+ axios?: AxiosRequestConfig;
8950
+ }) => UseMutationOptions<Awaited<ReturnType<typeof addToPlanAgentV1PlanPost>>, TError, {
8951
+ data: AgentPlanSlotCreate;
8952
+ }, TContext>;
8953
+ export type AddToPlanAgentV1PlanPostMutationResult = NonNullable<Awaited<ReturnType<typeof addToPlanAgentV1PlanPost>>>;
8954
+ export type AddToPlanAgentV1PlanPostMutationBody = AgentPlanSlotCreate;
8955
+ export type AddToPlanAgentV1PlanPostMutationError = AxiosError<HTTPValidationError>;
8956
+ /**
8957
+ * @summary Add To Plan
8958
+ */
8959
+ export declare const useAddToPlanAgentV1PlanPost: <TError = AxiosError<HTTPValidationError>, TContext = unknown>(options?: {
8960
+ mutation?: UseMutationOptions<Awaited<ReturnType<typeof addToPlanAgentV1PlanPost>>, TError, {
8961
+ data: AgentPlanSlotCreate;
8962
+ }, TContext>;
8963
+ axios?: AxiosRequestConfig;
8964
+ }) => UseMutationResult<Awaited<ReturnType<typeof addToPlanAgentV1PlanPost>>, TError, {
8965
+ data: AgentPlanSlotCreate;
8966
+ }, TContext>;
8795
8967
  /**
8796
8968
  * @summary Read Root
8797
8969
  */