@brightspace-hmc/siren-sdk
Advanced tools
Comparing version 2.130.0 to 2.131.0
{ | ||
"name": "@brightspace-hmc/siren-sdk", | ||
"version": "2.130.0", | ||
"version": "2.131.0", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "description": "", |
@@ -5,2 +5,5 @@ import { Actions, Classes, Rels } from '../../hypermedia-constants.js'; | ||
const HUMAN_GENERATED = 0; | ||
const AI_INSPIRED = 3; | ||
const actions = { | ||
@@ -270,2 +273,6 @@ delete: 'delete-folder', | ||
isAiInspired() { | ||
return this._entity && this._entity.hasClass(Classes.assignments.aiInspired); | ||
} | ||
/** | ||
@@ -464,2 +471,22 @@ * @returns {bool} If the assignment type is set to individual assignment | ||
/** | ||
* @summary Formats action and fields if assignment has been ai inspired | ||
* @param {object} isAiInspired whether this assignment has been ai inspired | ||
* @returns {object} action and fields for updating isAiInspired | ||
*/ | ||
_formatUpdateAiInspiredAction(isAiInspired) { | ||
if (typeof isAiInspired === 'undefined') return; | ||
if (!this._hasAiInspiredChanged(isAiInspired)) return; | ||
const action = this._entity.getActionByName(Actions.assignments.updateName); | ||
if (!action) { | ||
return; | ||
} | ||
const fields = [ | ||
{ name: 'aiHumanOrigin', value: isAiInspired ? AI_INSPIRED : HUMAN_GENERATED }, | ||
]; | ||
return { action, fields }; | ||
} | ||
/** | ||
* Sets the submission type of the assignment | ||
@@ -919,2 +946,3 @@ * @param {number} submissionType Submission type - see SUBMISSIONTYPE_T under https://docs.valence.desire2learn.com/res/dropbox.html#attributes for more info | ||
const updateAllowTextSubmissionAction = this._formatUpdateAllowTextSubmissionAction(assignment.allowTextSubmission); | ||
const updateIsAiInspiredAction = this._formatUpdateAiInspiredAction(assignment.isAiInspired); | ||
@@ -935,3 +963,4 @@ const sirenActions = [ | ||
updateNotificationEmailAction, | ||
updateAllowTextSubmissionAction | ||
updateAllowTextSubmissionAction, | ||
updateIsAiInspiredAction | ||
]; | ||
@@ -1026,2 +1055,6 @@ | ||
_hasAiInspiredChanged(aiInspired) { | ||
return aiInspired !== this.isAiInspired(); | ||
} | ||
_hasInstructionsChanged(instructions) { | ||
@@ -1028,0 +1061,0 @@ return instructions !== this.instructionsHtml(); |
@@ -202,2 +202,3 @@ import { Actions, Classes, Rels } from '../../hypermedia-constants.js'; | ||
[this.url(), contentWebLink.url], | ||
[this.descriptionRichText(), contentWebLink.descriptionRichText], | ||
[this.isExternalResource(), contentWebLink.isExternalResource] | ||
@@ -204,0 +205,0 @@ ]; |
@@ -353,3 +353,4 @@ export const Rels = { | ||
annotationDisabled: 'disabled', | ||
collection: 'collection' | ||
collection: 'collection', | ||
aiInspired: 'ai-inspired' | ||
}, | ||
@@ -356,0 +357,0 @@ associations: { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
406885
11269