@learnpack/learnpack 5.0.363 → 5.0.365

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.
@@ -26,6 +26,7 @@ export type TCompletionJob = {
26
26
  status: "PENDING" | "SUCCESS" | "ERROR" | string;
27
27
  status_text?: string | null;
28
28
  parsed?: Record<string, any> | null;
29
+ ended_at?: string | null;
29
30
  };
30
31
  type TTranslateAndWaitOptions = {
31
32
  /** How often the job status is checked while it is still running. */
@@ -35,7 +36,9 @@ type TTranslateAndWaitOptions = {
35
36
  /** Called after every successful poll, useful to keep a heartbeat alive. */
36
37
  onPoll?: (job: TCompletionJob) => void | Promise<void>;
37
38
  };
38
- export declare const getCompletionJob: (token: string, completionId: number | string) => Promise<TCompletionJob>;
39
+ export declare const getCompletionJob: (token: string, completionId: number | string, options?: {
40
+ timeoutMs?: number;
41
+ }) => Promise<TCompletionJob>;
39
42
  export declare const translateExerciseAndWait: (token: string, inputs: TTranslateInputs, options?: TTranslateAndWaitOptions) => Promise<TCompletionJob>;
40
43
  type TGenerateCourseIntroductionInputs = {
41
44
  course_title: string;
@@ -167,7 +170,7 @@ type TAddInteractivityInputs = {
167
170
  lesson_info: string;
168
171
  current_syllabus: string;
169
172
  };
170
- export declare const addInteractivity: (token: string, inputs: TAddInteractivityInputs, webhookUrl?: string) => Promise<any>;
173
+ export declare const addInteractivity: (token: string, inputs: TAddInteractivityInputs, webhookUrl?: string, templateSlug?: string) => Promise<any>;
171
174
  type TGenerateCodeChallengeInputs = {
172
175
  lesson_content: string;
173
176
  challenge_proposal: string;
@@ -114,12 +114,14 @@ const assertJobSucceeded = (job) => {
114
114
  }
115
115
  return job;
116
116
  };
117
- const getCompletionJob = async (token, completionId) => {
117
+ const getCompletionJob = async (token, completionId, options = {}) => {
118
118
  const response = await axios_1.default.get(`${api_1.RIGOBOT_HOST}/v1/prompting/completion/${completionId}/`, {
119
119
  headers: {
120
120
  "Content-Type": "application/json",
121
121
  Authorization: "Token " + token,
122
122
  },
123
+ // No timeout by default: the translation polling waits as long as it needs.
124
+ timeout: options.timeoutMs,
123
125
  });
124
126
  return response.data;
125
127
  };
@@ -479,9 +481,9 @@ const generateStepDescriptions = async (token, params, endpointSlug = "generate-
479
481
  }
480
482
  };
481
483
  exports.generateStepDescriptions = generateStepDescriptions;
482
- const addInteractivity = async (token, inputs, webhookUrl) => {
484
+ const addInteractivity = async (token, inputs, webhookUrl, templateSlug = "add-lesson-interactivy") => {
483
485
  try {
484
- const response = await axios_1.default.post(`${api_1.RIGOBOT_HOST}/v1/prompting/completion/add-lesson-interactivy/`, {
486
+ const response = await axios_1.default.post(`${api_1.RIGOBOT_HOST}/v1/prompting/completion/${templateSlug}/`, {
485
487
  inputs,
486
488
  include_purpose_objective: false,
487
489
  execute_async: !!webhookUrl,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@learnpack/learnpack",
3
3
  "description": "Seamlessly build, sell and/or take interactive & auto-graded tutorials, start learning now or build a new tutorial to your audience.",
4
- "version": "5.0.363",
4
+ "version": "5.0.365",
5
5
  "author": "Alejandro Sanchez @alesanchezr",
6
6
  "contributors": [
7
7
  {