Skip to content

Package: adapt

Generated from api/packages/adapt

Source: api/packages/adapt. The sections after the README are extracted from the code on every docs build.

Adapt Learning course sources as versioned JSON, built into SCORM by an isolated GPL-3.0 worker (ADR 0013). Off by default: ADAPT_SOURCE_ENABLED=true turns the API on; the worker runs in the optional compose profile adapt (not built yet, see the ADR).

Path A, uploading an Adapt export made with adapt-contrib-spoor, needs none of this: it is a SCORM upload, labelled source_format = adapt (packages/scorm).

API (permission adapt_manage; 404 when the flag is off)

Section titled “API (permission adapt_manage; 404 when the flag is off)”
Method Path
GET / POST /api/admin/adapt list; create from {"source": {course, config, contentObjects, articles, blocks, components}}
GET / DELETE /api/admin/adapt/{id} show (status draft, building, built or failed; scorm_id of the build) / delete
GET /api/admin/adapt/{id}/source?version= the JSON of a version
POST /api/admin/adapt/{id}/versions add a version (source, change_note)
POST /api/admin/adapt/{id}/build queue a build of the current version (202)

Validation (no GPL code): the six parts, unique _ids, _parentId links down the hierarchy, articles under pages, components from the core-plugin allow-list (config.php). Errors come back with paths, e.g. /components/3/_component.

Build: POST <ADAPT_BUILDER_URL>/build with X-Internal-Token: <ADAPT_BUILDER_TOKEN> and {"id", "source"}; the worker answers with a SCORM zip, which is imported through the SCORM upload (upload guard, safe extraction, content origin).

Terminal window
vendor/bin/phpunit --testsuite adapt

The worker is faked (Http::fake) with a generated spoor-style SCORM zip.

Method Path Auth Action
GET /api/admin/adapt yes AdaptSourceController@index
POST /api/admin/adapt yes AdaptSourceController@store
GET /api/admin/adapt/{id} yes AdaptSourceController@show
DELETE /api/admin/adapt/{id} yes AdaptSourceController@destroy
GET /api/admin/adapt/{id}/source yes AdaptSourceController@source
GET /api/admin/adapt/{id}/versions yes AdaptSourceController@versions
POST /api/admin/adapt/{id}/versions yes AdaptSourceController@addVersion
POST /api/admin/adapt/{id}/build yes AdaptSourceController@build

None.

Registered with AdministrableConfig::registerConfig (editable in the admin panel under Configuration → Settings).

None.

None.

None.

None.

ADAPT_BUILDER_TIMEOUT, ADAPT_BUILDER_TOKEN, ADAPT_BUILDER_URL, ADAPT_MAX_SOURCE_KB, ADAPT_QUEUE, ADAPT_QUEUE_CONNECTION, ADAPT_SOURCE_ENABLED, QUEUE_CONNECTION