# programming-exercise-juezlti

> A class that abstract a YAPEXIL schema also allows to serialize and deserialize exercise as well load remotely

Latest version **1.1.8** (published 2023-03-14) · ISC license · 0 weekly downloads

## Install

```sh
npm install programming-exercise-juezlti
pnpm add programming-exercise-juezlti
yarn add programming-exercise-juezlti
bun add programming-exercise-juezlti
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.8 |
| Published | 2023-03-14 |
| First published | 2021-11-30 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 11 |
| Unpacked size | 32.9 KB |
| Known vulnerabilities | 0 (+4 in 3 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Marco Primo FCUP up201800388 |
| Maintainers | sushll0, luijinho |

## Links

- npm: https://www.npmjs.com/package/programming-exercise-juezlti
- Repository: https://github.com/JuezLTI/xml-evaluator
- Homepage: https://github.com/JuezLTI/xml-evaluator#readme
- Issues: https://github.com/JuezLTI/xml-evaluator/issues
- npm.io page: https://npm.io/package/programming-exercise-juezlti

## Dependencies (11)

- [ajv](https://npm.io/package/ajv.md) ^8.6.0
- [got](https://npm.io/package/got.md) ^11.8.2
- [rimraf](https://npm.io/package/rimraf.md) ^3.0.2
- [request](https://npm.io/package/request.md) ^2.88.2
- [archiver](https://npm.io/package/archiver.md) ^5.3.0
- [file-type](https://npm.io/package/file-type.md) ^16.5.3
- [form-data](https://npm.io/package/form-data.md) ^4.0.0
- [read-chunk](https://npm.io/package/read-chunk.md) ^3.0.0
- [ajv-formats](https://npm.io/package/ajv-formats.md) ^2.1.1
- [base64topdf](https://npm.io/package/base64topdf.md) ^1.1.8
- [extract-zip](https://npm.io/package/extract-zip.md) ^2.0.1

## Recent versions

- 1.1.8 (latest) — 2023-03-14
- 1.1.7 — 2022-09-13
- 1.1.6 — 2022-08-05
- 1.1.5 — 2022-08-02
- 1.1.4 — 2022-07-28
- 1.1.3 — 2022-06-21
- 1.1.2 — 2022-06-17
- 1.1.1 — 2022-04-10
- 1.1.0 — 2022-04-02
- 1.0.9 — 2022-03-21
- 1.0.8 — 2022-02-03
- 1.0.7 — 2022-02-03
- 1.0.6 — 2022-02-03
- 1.0.5-a — 2021-12-01
- 1.0.5 — 2021-12-01
- … 6 more at https://npm.io/package/programming-exercise-juezlti/versions

## README

# Programming-exercise-juezlti
## _A simple and efficient way to represent YAPEXIL format as JS objects_

[![N|Solid](https://www.inesctec.pt/assets/images/logo-black.svg)](https://www.inesctec.pt/pt)


_YAPEXIL_ is a _JSON_ format in which the goal is to represent in an orthodoxy manner Programming exercises. This type of representation although efficient could sometimes lead to a complexity that can not be handled by a non-expert in this schema. Therefore this npm package focusing in:

- Facilitate serialization and deserialization
- Translation of YAPEXIL formatted exercises to JS object
- ✨ And more Magics ✨

## Examples
### Fetching remotely exercise 
For loading an exercise placed remotely on the internet do the following:
```js
loadSchemaYAPEXIL().then(() => {
    ProgrammingExercise.loadRemoteExercise(learningObject, {
       'BASE_URL': process.env.BASE_URL,
       'EMAIL': process.env.EMAIL,
       'PASSWORD': process.env.PASSWORD,
        }).then((programmingExercise) => {
            //...stuff
        })
})
```
First, it is necessary to load the schema to evaluate the JSON that will be fetched. The 'loadSchemaYAPEXIL' method does not generate overhead when called multiple times as this method implements a cache.
When the script knows the form of the YAPEXIL Schama it is possible to fetch an exercise in this format by doing 'ProgrammingExercise.loadRemoteExercise'. This method will then load an exercise remotely and expose the exercise as an instance of the ProgrammingExercise class.
### Fetching local exercise 
The ProgrammingExercise class besides making possible the fetch of remotely exercise also makes it possible to load exercise from your file system. To achieve this just do the following
```js
loadSchemaYAPEXIL().then(() => {
    ProgrammingExercise.deserialize(path_to_zip_folder_exercise), `${learningObject}.zip`)
    .then((programmingExercise) => {
            //...stuff
    }).catch((error) => {
            //...stuff
    })
})
```
### Persisting a remotely exercise 
When bandwidth savings or other reasons are needed to persist the exercise, this can be achieved by calling the serialization method on an instance of the Programming Exercise class
```js
programmingExercise.serialize(path_to_folder).then(() => {
    //...stuff
    }).catch((err) => {
    //...stuff
    });
})
```
### Creating an exercise programmatically 
In order to create an exercise programmatically, the user needs to have in his possession the correct values that fit the YAPEXIL schema. More information about the schema could be found at  [YAPEXIL Github](https://raw.githubusercontent.com/JuezLTI/APIs/main/schemas/YAPEXIL/YAPEXIL.json)


## Installation
To install this package you just need to do

```sh
npm i programming-exercise-juezlti
```


## License

MIT

**Free Software, Hell Yeah!**

---
_Source: https://npm.io/package/programming-exercise-juezlti · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
