@dgpholdings/greatoak-shared 1.2.70 → 1.2.71

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.
@@ -46,6 +46,9 @@ export type TAiEnrichedContext = {
46
46
  yesterdaysExercises: string[];
47
47
  };
48
48
  };
49
+ /**
50
+ * @deprecated This api will be deprecated since Sync api is being replaced with async polling-api which uses TApiJobStatusRes.
51
+ */
49
52
  export type TApiAiQuickStartWorkoutRes = {
50
53
  status: 200;
51
54
  state: "success";
@@ -66,3 +69,72 @@ export type TApiAiQuickStartWorkoutRes = {
66
69
  state: "failed" | "unauthorized";
67
70
  message: string;
68
71
  };
72
+ /**
73
+ * Job Status: Where is this job in the pipeline?
74
+ * - pending: Just created, waiting in queue
75
+ * - processing: Worker picked it up, working on it
76
+ * - success: Done! Plan is ready
77
+ * - failed: Something went wrong
78
+ */
79
+ export type TJobState = "pending" | "processing" | "success" | "failed" | "timeout";
80
+ /**
81
+ * Job Record: Stored in DynamoDB
82
+ * This is what we write to the database when a job is created
83
+ */
84
+ export interface TQuickStartJob {
85
+ jobId: string;
86
+ userId: string;
87
+ state: TJobState;
88
+ requestPayload: TApiAiQuickStartWorkoutReq;
89
+ plan?: Extract<TTemplate, {
90
+ type: "ai-generated";
91
+ }>;
92
+ enrichedContext?: TAiEnrichedContext;
93
+ errorMessage?: string;
94
+ createdAt: string;
95
+ startedAt?: string;
96
+ completedAt?: string;
97
+ ttl: number;
98
+ }
99
+ /**
100
+ * API Response for Job Creation
101
+ * What we return when someone calls POST /plans/quickstart/jobs-initiate
102
+ */
103
+ export type TApiCreateJobReq = TApiAiQuickStartWorkoutReq;
104
+ export type TApiCreateJobRes = {
105
+ jobId: string;
106
+ state: "pending";
107
+ message: string;
108
+ status: 200;
109
+ } | {
110
+ status: 500;
111
+ message: string;
112
+ };
113
+ export type TApiJobStatusReq = {
114
+ jobId: string;
115
+ };
116
+ export type TApiJobStatusRes = {
117
+ jobId: string;
118
+ state: TJobState;
119
+ plan?: Extract<TTemplate, {
120
+ type: "ai-generated";
121
+ }>;
122
+ enrichedContext?: TAiEnrichedContext;
123
+ errorMessage?: string;
124
+ createdAt: string;
125
+ completedAt?: string;
126
+ status: 200;
127
+ } | {
128
+ status: 500;
129
+ message: string;
130
+ };
131
+ /**
132
+ * Async Quick Start Architecture
133
+ *
134
+ * Flow:
135
+ * 1. Client → POST /plans/quickstart/jobs → TApiCreateJobRes { jobId }
136
+ * 2. SQS worker processes job in background
137
+ * 3. Client → GET /plans/quickstart/jobs/{jobId} → TApiJobStatusRes { plan? }
138
+ *
139
+ * This replaces the deprecated sync endpoint to avoid API Gateway 29s timeout.
140
+ */
@@ -1,2 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * Async Quick Start Architecture
5
+ *
6
+ * Flow:
7
+ * 1. Client → POST /plans/quickstart/jobs → TApiCreateJobRes { jobId }
8
+ * 2. SQS worker processes job in background
9
+ * 3. Client → GET /plans/quickstart/jobs/{jobId} → TApiJobStatusRes { plan? }
10
+ *
11
+ * This replaces the deprecated sync endpoint to avoid API Gateway 29s timeout.
12
+ */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dgpholdings/greatoak-shared",
3
- "version": "1.2.70",
3
+ "version": "1.2.71",
4
4
  "description": "Shared TypeScript types and utilities for @dgpholdings projects",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",