diff --git a/README.md b/README.md index b336a64..3e0e8c7 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ To build the final product, we have a couple of additional steps: - Either download the latest `openapi.yaml` manually or run `./bin/download-api.sh` - Run `./bin/generate-api.sh` to generate any new API files +- **OR** run `./bin/generate-filtered-api.sh` to generate API docs without internal/admin endpoints 3. Deployment diff --git a/api-reference-backup-20250807-005941/asset/export-enumeration-domains.mdx b/api-reference-backup-20250807-005941/asset/export-enumeration-domains.mdx new file mode 100644 index 0000000..52079c7 --- /dev/null +++ b/api-reference-backup-20250807-005941/asset/export-enumeration-domains.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/asset/enumerate/{enumerate_id}/domains/export +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/asset/export-list-of-unique-domains-discovered-in-an-enumeration.mdx b/api-reference-backup-20250807-005941/asset/export-list-of-unique-domains-discovered-in-an-enumeration.mdx new file mode 100644 index 0000000..52079c7 --- /dev/null +++ b/api-reference-backup-20250807-005941/asset/export-list-of-unique-domains-discovered-in-an-enumeration.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/asset/enumerate/{enumerate_id}/domains/export +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/asset/export-list-of-unique-domains-discovered-in-current-month.mdx b/api-reference-backup-20250807-005941/asset/export-list-of-unique-domains-discovered-in-current-month.mdx new file mode 100644 index 0000000..67a2617 --- /dev/null +++ b/api-reference-backup-20250807-005941/asset/export-list-of-unique-domains-discovered-in-current-month.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/asset/enumerate/domains/export +--- \ No newline at end of file diff --git a/api-reference/asset/get-exposure-metrics.mdx b/api-reference-backup-20250807-005941/asset/get-exposure-metrics.mdx similarity index 100% rename from api-reference/asset/get-exposure-metrics.mdx rename to api-reference-backup-20250807-005941/asset/get-exposure-metrics.mdx diff --git a/api-reference-backup-20250807-005941/asset/get-list-of-unique-domains-discovered-in-an-enumeration.mdx b/api-reference-backup-20250807-005941/asset/get-list-of-unique-domains-discovered-in-an-enumeration.mdx new file mode 100644 index 0000000..bf47917 --- /dev/null +++ b/api-reference-backup-20250807-005941/asset/get-list-of-unique-domains-discovered-in-an-enumeration.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/asset/enumerate/{enumerate_id}/domains +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/asset/get-list-of-unique-domains-discovered-in-current-month.mdx b/api-reference-backup-20250807-005941/asset/get-list-of-unique-domains-discovered-in-current-month.mdx new file mode 100644 index 0000000..6f3bacf --- /dev/null +++ b/api-reference-backup-20250807-005941/asset/get-list-of-unique-domains-discovered-in-current-month.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/asset/enumerate/domains +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/assets/add-labels-to-an-asset.mdx b/api-reference-backup-20250807-005941/assets/add-labels-to-an-asset.mdx new file mode 100644 index 0000000..dfd921d --- /dev/null +++ b/api-reference-backup-20250807-005941/assets/add-labels-to-an-asset.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/asset/{asset_id}/labels +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/assets/delete-asset-by-filters.mdx b/api-reference-backup-20250807-005941/assets/delete-asset-by-filters.mdx new file mode 100644 index 0000000..c0e6add --- /dev/null +++ b/api-reference-backup-20250807-005941/assets/delete-asset-by-filters.mdx @@ -0,0 +1,3 @@ +--- +openapi: delete /v1/asset +--- \ No newline at end of file diff --git a/api-reference/assets/delete-asset.mdx b/api-reference-backup-20250807-005941/assets/delete-asset.mdx similarity index 100% rename from api-reference/assets/delete-asset.mdx rename to api-reference-backup-20250807-005941/assets/delete-asset.mdx diff --git a/api-reference/assets/delete-enumerated-asset.mdx b/api-reference-backup-20250807-005941/assets/delete-enumerated-asset.mdx similarity index 100% rename from api-reference/assets/delete-enumerated-asset.mdx rename to api-reference-backup-20250807-005941/assets/delete-enumerated-asset.mdx diff --git a/api-reference-backup-20250807-005941/assets/delete-labels-of-an-asset.mdx b/api-reference-backup-20250807-005941/assets/delete-labels-of-an-asset.mdx new file mode 100644 index 0000000..a0a325c --- /dev/null +++ b/api-reference-backup-20250807-005941/assets/delete-labels-of-an-asset.mdx @@ -0,0 +1,3 @@ +--- +openapi: delete /v1/asset/{asset_id}/labels +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/assets/get-asset-changelogs-for-a-given-asset_id.mdx b/api-reference-backup-20250807-005941/assets/get-asset-changelogs-for-a-given-asset_id.mdx new file mode 100644 index 0000000..7acf163 --- /dev/null +++ b/api-reference-backup-20250807-005941/assets/get-asset-changelogs-for-a-given-asset_id.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/asset/{asset_id}/changelogs +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/assets/get-asset-changelogs-for-all-assets.mdx b/api-reference-backup-20250807-005941/assets/get-asset-changelogs-for-all-assets.mdx new file mode 100644 index 0000000..e3c6938 --- /dev/null +++ b/api-reference-backup-20250807-005941/assets/get-asset-changelogs-for-all-assets.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/asset/changelogs +--- \ No newline at end of file diff --git a/api-reference/assets/get-asset-content.mdx b/api-reference-backup-20250807-005941/assets/get-asset-content.mdx similarity index 100% rename from api-reference/assets/get-asset-content.mdx rename to api-reference-backup-20250807-005941/assets/get-asset-content.mdx diff --git a/api-reference/assets/get-asset-list.mdx b/api-reference-backup-20250807-005941/assets/get-asset-list.mdx similarity index 100% rename from api-reference/assets/get-asset-list.mdx rename to api-reference-backup-20250807-005941/assets/get-asset-list.mdx diff --git a/api-reference/assets/get-asset-metadata.mdx b/api-reference-backup-20250807-005941/assets/get-asset-metadata.mdx similarity index 100% rename from api-reference/assets/get-asset-metadata.mdx rename to api-reference-backup-20250807-005941/assets/get-asset-metadata.mdx diff --git a/api-reference/assets/get-asset-screenshot.mdx b/api-reference-backup-20250807-005941/assets/get-asset-screenshot.mdx similarity index 100% rename from api-reference/assets/get-asset-screenshot.mdx rename to api-reference-backup-20250807-005941/assets/get-asset-screenshot.mdx diff --git a/api-reference/assets/get-enumerated-asset-details.mdx b/api-reference-backup-20250807-005941/assets/get-enumerated-asset-details.mdx similarity index 100% rename from api-reference/assets/get-enumerated-asset-details.mdx rename to api-reference-backup-20250807-005941/assets/get-enumerated-asset-details.mdx diff --git a/api-reference-backup-20250807-005941/assets/modify-labels-of-an-asset.mdx b/api-reference-backup-20250807-005941/assets/modify-labels-of-an-asset.mdx new file mode 100644 index 0000000..eab4c3b --- /dev/null +++ b/api-reference-backup-20250807-005941/assets/modify-labels-of-an-asset.mdx @@ -0,0 +1,3 @@ +--- +openapi: patch /v1/asset/{asset_id}/labels +--- \ No newline at end of file diff --git a/api-reference/assets/update-asset-content.mdx b/api-reference-backup-20250807-005941/assets/update-asset-content.mdx similarity index 100% rename from api-reference/assets/update-asset-content.mdx rename to api-reference-backup-20250807-005941/assets/update-asset-content.mdx diff --git a/api-reference/assets/update-asset-details.mdx b/api-reference-backup-20250807-005941/assets/update-asset-details.mdx similarity index 100% rename from api-reference/assets/update-asset-details.mdx rename to api-reference-backup-20250807-005941/assets/update-asset-details.mdx diff --git a/api-reference-backup-20250807-005941/assets/update-asset-labels.mdx b/api-reference-backup-20250807-005941/assets/update-asset-labels.mdx new file mode 100644 index 0000000..864957a --- /dev/null +++ b/api-reference-backup-20250807-005941/assets/update-asset-labels.mdx @@ -0,0 +1,3 @@ +--- +openapi: patch /v1/asset/labels +--- \ No newline at end of file diff --git a/api-reference/assets/update-asset-metadata.mdx b/api-reference-backup-20250807-005941/assets/update-asset-metadata.mdx similarity index 100% rename from api-reference/assets/update-asset-metadata.mdx rename to api-reference-backup-20250807-005941/assets/update-asset-metadata.mdx diff --git a/api-reference/assets/upload-asset.mdx b/api-reference-backup-20250807-005941/assets/upload-asset.mdx similarity index 100% rename from api-reference/assets/upload-asset.mdx rename to api-reference-backup-20250807-005941/assets/upload-asset.mdx diff --git a/api-reference-backup-20250807-005941/automations/create-automation.mdx b/api-reference-backup-20250807-005941/automations/create-automation.mdx new file mode 100644 index 0000000..9ff1917 --- /dev/null +++ b/api-reference-backup-20250807-005941/automations/create-automation.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/automations +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/automations/delete-automation.mdx b/api-reference-backup-20250807-005941/automations/delete-automation.mdx new file mode 100644 index 0000000..ed8c40b --- /dev/null +++ b/api-reference-backup-20250807-005941/automations/delete-automation.mdx @@ -0,0 +1,3 @@ +--- +openapi: delete /v1/automations/{event} +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/automations/get-automation.mdx b/api-reference-backup-20250807-005941/automations/get-automation.mdx new file mode 100644 index 0000000..a07a62f --- /dev/null +++ b/api-reference-backup-20250807-005941/automations/get-automation.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/automations/{event} +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/automations/get-automations.mdx b/api-reference-backup-20250807-005941/automations/get-automations.mdx new file mode 100644 index 0000000..25afec6 --- /dev/null +++ b/api-reference-backup-20250807-005941/automations/get-automations.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/automations +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/automations/update-automation.mdx b/api-reference-backup-20250807-005941/automations/update-automation.mdx new file mode 100644 index 0000000..2d1005a --- /dev/null +++ b/api-reference-backup-20250807-005941/automations/update-automation.mdx @@ -0,0 +1,3 @@ +--- +openapi: patch /v1/automations/{event} +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/billing/get-the-monthly-billing-cycle-dates.mdx b/api-reference-backup-20250807-005941/billing/get-the-monthly-billing-cycle-dates.mdx new file mode 100644 index 0000000..1cb20db --- /dev/null +++ b/api-reference-backup-20250807-005941/billing/get-the-monthly-billing-cycle-dates.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/billing-cycles +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/bulk-update-user-template.mdx b/api-reference-backup-20250807-005941/bulk-update-user-template.mdx new file mode 100644 index 0000000..22e3f02 --- /dev/null +++ b/api-reference-backup-20250807-005941/bulk-update-user-template.mdx @@ -0,0 +1,3 @@ +--- +openapi: patch /v2/template/user/upload +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/chaos/domain-&-organization-name-search.mdx b/api-reference-backup-20250807-005941/chaos/domain-&-organization-name-search.mdx new file mode 100644 index 0000000..4ff4e4f --- /dev/null +++ b/api-reference-backup-20250807-005941/chaos/domain-&-organization-name-search.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/domain/search +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/chaos/get-organization-by-domain.mdx b/api-reference-backup-20250807-005941/chaos/get-organization-by-domain.mdx new file mode 100644 index 0000000..1acb6dd --- /dev/null +++ b/api-reference-backup-20250807-005941/chaos/get-organization-by-domain.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/organization/search +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/configurations/add-config.mdx b/api-reference-backup-20250807-005941/configurations/add-config.mdx new file mode 100644 index 0000000..53fcffc --- /dev/null +++ b/api-reference-backup-20250807-005941/configurations/add-config.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/scans/config +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/configurations/add-custom-severity-mapping.mdx b/api-reference-backup-20250807-005941/configurations/add-custom-severity-mapping.mdx new file mode 100644 index 0000000..9611ded --- /dev/null +++ b/api-reference-backup-20250807-005941/configurations/add-custom-severity-mapping.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/scans/config/severity +--- \ No newline at end of file diff --git a/api-reference/configurations/add-excluded-templates.mdx b/api-reference-backup-20250807-005941/configurations/add-excluded-templates-and-targets.mdx similarity index 100% rename from api-reference/configurations/add-excluded-templates.mdx rename to api-reference-backup-20250807-005941/configurations/add-excluded-templates-and-targets.mdx diff --git a/api-reference-backup-20250807-005941/configurations/add-excluded-templates.mdx b/api-reference-backup-20250807-005941/configurations/add-excluded-templates.mdx new file mode 100644 index 0000000..55bb8e4 --- /dev/null +++ b/api-reference-backup-20250807-005941/configurations/add-excluded-templates.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/scans/config/exclude +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/configurations/delete-config.mdx b/api-reference-backup-20250807-005941/configurations/delete-config.mdx new file mode 100644 index 0000000..d75d0e7 --- /dev/null +++ b/api-reference-backup-20250807-005941/configurations/delete-config.mdx @@ -0,0 +1,3 @@ +--- +openapi: delete /v1/scans/config/{config_id} +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/configurations/delete-custom-severity-mapping.mdx b/api-reference-backup-20250807-005941/configurations/delete-custom-severity-mapping.mdx new file mode 100644 index 0000000..a4b9247 --- /dev/null +++ b/api-reference-backup-20250807-005941/configurations/delete-custom-severity-mapping.mdx @@ -0,0 +1,3 @@ +--- +openapi: delete /v1/scans/config/severity +--- \ No newline at end of file diff --git a/api-reference/configurations/delete-excluded-template-ids.mdx b/api-reference-backup-20250807-005941/configurations/delete-excluded-template-ids.mdx similarity index 100% rename from api-reference/configurations/delete-excluded-template-ids.mdx rename to api-reference-backup-20250807-005941/configurations/delete-excluded-template-ids.mdx diff --git a/api-reference-backup-20250807-005941/configurations/delete-excluded-templates-or-targets-by-ids.mdx b/api-reference-backup-20250807-005941/configurations/delete-excluded-templates-or-targets-by-ids.mdx new file mode 100644 index 0000000..f682af9 --- /dev/null +++ b/api-reference-backup-20250807-005941/configurations/delete-excluded-templates-or-targets-by-ids.mdx @@ -0,0 +1,3 @@ +--- +openapi: delete /v1/scans/config/exclude +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/configurations/get-config.mdx b/api-reference-backup-20250807-005941/configurations/get-config.mdx new file mode 100644 index 0000000..96eed91 --- /dev/null +++ b/api-reference-backup-20250807-005941/configurations/get-config.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/scans/config/{config_id} +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/configurations/get-configs-list.mdx b/api-reference-backup-20250807-005941/configurations/get-configs-list.mdx new file mode 100644 index 0000000..652fa7f --- /dev/null +++ b/api-reference-backup-20250807-005941/configurations/get-configs-list.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/scans/config +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/configurations/get-custom-severity-mappings.mdx b/api-reference-backup-20250807-005941/configurations/get-custom-severity-mappings.mdx new file mode 100644 index 0000000..3270199 --- /dev/null +++ b/api-reference-backup-20250807-005941/configurations/get-custom-severity-mappings.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/scans/config/severity +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/configurations/get-excluded-templates.mdx b/api-reference-backup-20250807-005941/configurations/get-excluded-templates.mdx new file mode 100644 index 0000000..b03b0ea --- /dev/null +++ b/api-reference-backup-20250807-005941/configurations/get-excluded-templates.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/scans/config/exclude +--- \ No newline at end of file diff --git a/api-reference/configurations/get-verify-config-contents.mdx b/api-reference-backup-20250807-005941/configurations/get-verify-config-contents.mdx similarity index 100% rename from api-reference/configurations/get-verify-config-contents.mdx rename to api-reference-backup-20250807-005941/configurations/get-verify-config-contents.mdx diff --git a/api-reference-backup-20250807-005941/configurations/modify-custom-severity-mapping.mdx b/api-reference-backup-20250807-005941/configurations/modify-custom-severity-mapping.mdx new file mode 100644 index 0000000..62172db --- /dev/null +++ b/api-reference-backup-20250807-005941/configurations/modify-custom-severity-mapping.mdx @@ -0,0 +1,3 @@ +--- +openapi: patch /v1/scans/config/{config_id}/severity +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/configurations/update-config.mdx b/api-reference-backup-20250807-005941/configurations/update-config.mdx new file mode 100644 index 0000000..e8dffbb --- /dev/null +++ b/api-reference-backup-20250807-005941/configurations/update-config.mdx @@ -0,0 +1,3 @@ +--- +openapi: patch /v1/scans/config/{config_id} +--- \ No newline at end of file diff --git a/api-reference/configurations/verify-config.mdx b/api-reference-backup-20250807-005941/configurations/verify-config.mdx similarity index 100% rename from api-reference/configurations/verify-config.mdx rename to api-reference-backup-20250807-005941/configurations/verify-config.mdx diff --git a/api-reference/elog/download-elogs-of-given-scan-id.mdx b/api-reference-backup-20250807-005941/elog/download-elogs-of-given-scan-id.mdx similarity index 100% rename from api-reference/elog/download-elogs-of-given-scan-id.mdx rename to api-reference-backup-20250807-005941/elog/download-elogs-of-given-scan-id.mdx diff --git a/api-reference/elog/get-elogs-of-given-scan-id.mdx b/api-reference-backup-20250807-005941/elog/get-elogs-of-given-scan-id.mdx similarity index 100% rename from api-reference/elog/get-elogs-of-given-scan-id.mdx rename to api-reference-backup-20250807-005941/elog/get-elogs-of-given-scan-id.mdx diff --git a/api-reference-backup-20250807-005941/enumeration/get-categories-for-all-enumerations.mdx b/api-reference-backup-20250807-005941/enumeration/get-categories-for-all-enumerations.mdx new file mode 100644 index 0000000..f82bbf0 --- /dev/null +++ b/api-reference-backup-20250807-005941/enumeration/get-categories-for-all-enumerations.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/asset/enumerate/categories +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/enumeration/get-categories-for-specific-enumeration.mdx b/api-reference-backup-20250807-005941/enumeration/get-categories-for-specific-enumeration.mdx new file mode 100644 index 0000000..55f1178 --- /dev/null +++ b/api-reference-backup-20250807-005941/enumeration/get-categories-for-specific-enumeration.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/asset/enumerate/{enumerate_id}/categories +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/enumerations/create-an-asset-group.mdx b/api-reference-backup-20250807-005941/enumerations/create-an-asset-group.mdx new file mode 100644 index 0000000..b811991 --- /dev/null +++ b/api-reference-backup-20250807-005941/enumerations/create-an-asset-group.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/asset/enumerate/group +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/enumerations/create-enumeration.mdx b/api-reference-backup-20250807-005941/enumerations/create-enumeration.mdx new file mode 100644 index 0000000..c1a5e53 --- /dev/null +++ b/api-reference-backup-20250807-005941/enumerations/create-enumeration.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/asset/enumerate +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/enumerations/delete-an-asset-group.mdx b/api-reference-backup-20250807-005941/enumerations/delete-an-asset-group.mdx new file mode 100644 index 0000000..f882440 --- /dev/null +++ b/api-reference-backup-20250807-005941/enumerations/delete-an-asset-group.mdx @@ -0,0 +1,3 @@ +--- +openapi: delete /v1/asset/enumerate/group/{group_id} +--- \ No newline at end of file diff --git a/api-reference/enumerations/delete-bulk-enumeration.mdx b/api-reference-backup-20250807-005941/enumerations/delete-assets-in-bulk.mdx similarity index 100% rename from api-reference/enumerations/delete-bulk-enumeration.mdx rename to api-reference-backup-20250807-005941/enumerations/delete-assets-in-bulk.mdx diff --git a/api-reference-backup-20250807-005941/enumerations/delete-bulk-enumeration.mdx b/api-reference-backup-20250807-005941/enumerations/delete-bulk-enumeration.mdx new file mode 100644 index 0000000..1b29673 --- /dev/null +++ b/api-reference-backup-20250807-005941/enumerations/delete-bulk-enumeration.mdx @@ -0,0 +1,3 @@ +--- +openapi: delete /v1/asset/enumerate +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/enumerations/delete-enumeration-schedule.mdx b/api-reference-backup-20250807-005941/enumerations/delete-enumeration-schedule.mdx new file mode 100644 index 0000000..d1476c5 --- /dev/null +++ b/api-reference-backup-20250807-005941/enumerations/delete-enumeration-schedule.mdx @@ -0,0 +1,3 @@ +--- +openapi: delete /v1/enumeration/schedule +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/enumerations/delete-enumeration.mdx b/api-reference-backup-20250807-005941/enumerations/delete-enumeration.mdx new file mode 100644 index 0000000..d733c80 --- /dev/null +++ b/api-reference-backup-20250807-005941/enumerations/delete-enumeration.mdx @@ -0,0 +1,3 @@ +--- +openapi: delete /v1/asset/enumerate/{enumerate_id} +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/enumerations/export-enumeration-of-user-by-domain.mdx b/api-reference-backup-20250807-005941/enumerations/export-enumeration-of-user-by-domain.mdx new file mode 100644 index 0000000..8c791d3 --- /dev/null +++ b/api-reference-backup-20250807-005941/enumerations/export-enumeration-of-user-by-domain.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/asset/domain/{domain_name}/export +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/enumerations/export-enumeration-of-user.mdx b/api-reference-backup-20250807-005941/enumerations/export-enumeration-of-user.mdx new file mode 100644 index 0000000..9bab521 --- /dev/null +++ b/api-reference-backup-20250807-005941/enumerations/export-enumeration-of-user.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/asset/enumerate/export +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/enumerations/export-enumeration.mdx b/api-reference-backup-20250807-005941/enumerations/export-enumeration.mdx new file mode 100644 index 0000000..12a3f01 --- /dev/null +++ b/api-reference-backup-20250807-005941/enumerations/export-enumeration.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/asset/enumerate/{enum_id}/export +--- \ No newline at end of file diff --git a/api-reference/enumerations/get-all-enumeration-contents.mdx b/api-reference-backup-20250807-005941/enumerations/get-all-enumeration-contents.mdx similarity index 100% rename from api-reference/enumerations/get-all-enumeration-contents.mdx rename to api-reference-backup-20250807-005941/enumerations/get-all-enumeration-contents.mdx diff --git a/api-reference/enumerations/get-all-enumeration-stats.mdx b/api-reference-backup-20250807-005941/enumerations/get-all-enumeration-stats.mdx similarity index 100% rename from api-reference/enumerations/get-all-enumeration-stats.mdx rename to api-reference-backup-20250807-005941/enumerations/get-all-enumeration-stats.mdx diff --git a/api-reference-backup-20250807-005941/enumerations/get-domain-stats.mdx b/api-reference-backup-20250807-005941/enumerations/get-domain-stats.mdx new file mode 100644 index 0000000..33afd43 --- /dev/null +++ b/api-reference-backup-20250807-005941/enumerations/get-domain-stats.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/asset/domain/{domain_name}/stats +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/enumerations/get-enumeration-config.mdx b/api-reference-backup-20250807-005941/enumerations/get-enumeration-config.mdx new file mode 100644 index 0000000..81cc062 --- /dev/null +++ b/api-reference-backup-20250807-005941/enumerations/get-enumeration-config.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/asset/enumerate/{enumerate_id}/config +--- \ No newline at end of file diff --git a/api-reference/enumerations/get-enumeration-contents.mdx b/api-reference-backup-20250807-005941/enumerations/get-enumeration-contents.mdx similarity index 100% rename from api-reference/enumerations/get-enumeration-contents.mdx rename to api-reference-backup-20250807-005941/enumerations/get-enumeration-contents.mdx diff --git a/api-reference-backup-20250807-005941/enumerations/get-enumeration-domain-contents.mdx b/api-reference-backup-20250807-005941/enumerations/get-enumeration-domain-contents.mdx new file mode 100644 index 0000000..02a8f70 --- /dev/null +++ b/api-reference-backup-20250807-005941/enumerations/get-enumeration-domain-contents.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/asset/domain/{domain_name} +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/enumerations/get-enumeration-list.mdx b/api-reference-backup-20250807-005941/enumerations/get-enumeration-list.mdx new file mode 100644 index 0000000..162902d --- /dev/null +++ b/api-reference-backup-20250807-005941/enumerations/get-enumeration-list.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/asset/enumerate +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/enumerations/get-enumeration-schedules.mdx b/api-reference-backup-20250807-005941/enumerations/get-enumeration-schedules.mdx new file mode 100644 index 0000000..c280793 --- /dev/null +++ b/api-reference-backup-20250807-005941/enumerations/get-enumeration-schedules.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/enumeration/schedule +--- \ No newline at end of file diff --git a/api-reference/enumerations/get-enumeration-stats.mdx b/api-reference-backup-20250807-005941/enumerations/get-enumeration-stats.mdx similarity index 100% rename from api-reference/enumerations/get-enumeration-stats.mdx rename to api-reference-backup-20250807-005941/enumerations/get-enumeration-stats.mdx diff --git a/api-reference-backup-20250807-005941/enumerations/get-enumeration.mdx b/api-reference-backup-20250807-005941/enumerations/get-enumeration.mdx new file mode 100644 index 0000000..072bf1e --- /dev/null +++ b/api-reference-backup-20250807-005941/enumerations/get-enumeration.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/asset/enumerate/{enumerate_id} +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/enumerations/group-assets-by-filters-for-an-domain.mdx b/api-reference-backup-20250807-005941/enumerations/group-assets-by-filters-for-an-domain.mdx new file mode 100644 index 0000000..3e624eb --- /dev/null +++ b/api-reference-backup-20250807-005941/enumerations/group-assets-by-filters-for-an-domain.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/asset/domain/{domain_name}/filters +--- \ No newline at end of file diff --git a/api-reference/enumerations/group-assets-by-filters-for-an-enumeration.mdx b/api-reference-backup-20250807-005941/enumerations/group-assets-by-filters-for-an-enumeration.mdx similarity index 100% rename from api-reference/enumerations/group-assets-by-filters-for-an-enumeration.mdx rename to api-reference-backup-20250807-005941/enumerations/group-assets-by-filters-for-an-enumeration.mdx diff --git a/api-reference/enumerations/group-assets-by-filters.mdx b/api-reference-backup-20250807-005941/enumerations/group-assets-by-filters.mdx similarity index 100% rename from api-reference/enumerations/group-assets-by-filters.mdx rename to api-reference-backup-20250807-005941/enumerations/group-assets-by-filters.mdx diff --git a/api-reference-backup-20250807-005941/enumerations/rescan-enumeration.mdx b/api-reference-backup-20250807-005941/enumerations/rescan-enumeration.mdx new file mode 100644 index 0000000..907466a --- /dev/null +++ b/api-reference-backup-20250807-005941/enumerations/rescan-enumeration.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/asset/enumerate/{enumerate_id}/rescan +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/enumerations/set-enumeration-schedule.mdx b/api-reference-backup-20250807-005941/enumerations/set-enumeration-schedule.mdx new file mode 100644 index 0000000..b82b2be --- /dev/null +++ b/api-reference-backup-20250807-005941/enumerations/set-enumeration-schedule.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/enumeration/schedule +--- \ No newline at end of file diff --git a/api-reference/enumerations/stop-enumeration.mdx b/api-reference-backup-20250807-005941/enumerations/stop-enumeration.mdx similarity index 100% rename from api-reference/enumerations/stop-enumeration.mdx rename to api-reference-backup-20250807-005941/enumerations/stop-enumeration.mdx diff --git a/api-reference-backup-20250807-005941/enumerations/update-an-asset-group.mdx b/api-reference-backup-20250807-005941/enumerations/update-an-asset-group.mdx new file mode 100644 index 0000000..d741a9d --- /dev/null +++ b/api-reference-backup-20250807-005941/enumerations/update-an-asset-group.mdx @@ -0,0 +1,3 @@ +--- +openapi: patch /v1/asset/enumerate/group/{group_id} +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/enumerations/update-enumeration.mdx b/api-reference-backup-20250807-005941/enumerations/update-enumeration.mdx new file mode 100644 index 0000000..060e69d --- /dev/null +++ b/api-reference-backup-20250807-005941/enumerations/update-enumeration.mdx @@ -0,0 +1,3 @@ +--- +openapi: patch /v1/asset/enumerate/{enumerate_id} +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/export/export-filtered-scan-results.mdx b/api-reference-backup-20250807-005941/export/export-filtered-scan-results.mdx new file mode 100644 index 0000000..908ac01 --- /dev/null +++ b/api-reference-backup-20250807-005941/export/export-filtered-scan-results.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/scans/results/export +--- \ No newline at end of file diff --git a/api-reference/export/get-export-list-for-user.mdx b/api-reference-backup-20250807-005941/export/get-export-list-for-user.mdx similarity index 100% rename from api-reference/export/get-export-list-for-user.mdx rename to api-reference-backup-20250807-005941/export/get-export-list-for-user.mdx diff --git a/api-reference-backup-20250807-005941/full-text-search.mdx b/api-reference-backup-20250807-005941/full-text-search.mdx new file mode 100644 index 0000000..bea401f --- /dev/null +++ b/api-reference-backup-20250807-005941/full-text-search.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v2/vulnerability/search +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/get-a-list-of-invoices-for-a-customer.mdx b/api-reference-backup-20250807-005941/get-a-list-of-invoices-for-a-customer.mdx new file mode 100644 index 0000000..85daafe --- /dev/null +++ b/api-reference-backup-20250807-005941/get-a-list-of-invoices-for-a-customer.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/payment/stripe/invoices +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/get-all-filters-for-vulnerabilities.mdx b/api-reference-backup-20250807-005941/get-all-filters-for-vulnerabilities.mdx new file mode 100644 index 0000000..76331ce --- /dev/null +++ b/api-reference-backup-20250807-005941/get-all-filters-for-vulnerabilities.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v2/vulnerability/filters +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/get-asset-enumeration-history-data.mdx b/api-reference-backup-20250807-005941/get-asset-enumeration-history-data.mdx new file mode 100644 index 0000000..8911dd4 --- /dev/null +++ b/api-reference-backup-20250807-005941/get-asset-enumeration-history-data.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/asset/enumerate/{enumerate_id}/history +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/get-audit-logs-for-team.mdx b/api-reference-backup-20250807-005941/get-audit-logs-for-team.mdx new file mode 100644 index 0000000..cc40ba5 --- /dev/null +++ b/api-reference-backup-20250807-005941/get-audit-logs-for-team.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/team/audit_log +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/get-enumeration-history.mdx b/api-reference-backup-20250807-005941/get-enumeration-history.mdx new file mode 100644 index 0000000..8911dd4 --- /dev/null +++ b/api-reference-backup-20250807-005941/get-enumeration-history.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/asset/enumerate/{enumerate_id}/history +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/get-error-statistics-of-given-scan-id.mdx b/api-reference-backup-20250807-005941/get-error-statistics-of-given-scan-id.mdx new file mode 100644 index 0000000..d01ced5 --- /dev/null +++ b/api-reference-backup-20250807-005941/get-error-statistics-of-given-scan-id.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/scans/{scan_id}/error_stats +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/get-leaderboard-id-details.mdx b/api-reference-backup-20250807-005941/get-leaderboard-id-details.mdx new file mode 100644 index 0000000..5cca401 --- /dev/null +++ b/api-reference-backup-20250807-005941/get-leaderboard-id-details.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/template/leaderboard/{name} +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/get-vulnerability-by-id.mdx b/api-reference-backup-20250807-005941/get-vulnerability-by-id.mdx new file mode 100644 index 0000000..f1f1e56 --- /dev/null +++ b/api-reference-backup-20250807-005941/get-vulnerability-by-id.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v2/vulnerability/{id} +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/history/get-scan-log-stats-of-given-scan-id.mdx b/api-reference-backup-20250807-005941/history/get-scan-log-stats-of-given-scan-id.mdx new file mode 100644 index 0000000..51e3e0d --- /dev/null +++ b/api-reference-backup-20250807-005941/history/get-scan-log-stats-of-given-scan-id.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/scans/vulns/history +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/introduction.mdx b/api-reference-backup-20250807-005941/introduction.mdx new file mode 100644 index 0000000..1eecb4a --- /dev/null +++ b/api-reference-backup-20250807-005941/introduction.mdx @@ -0,0 +1,73 @@ +--- +title: "Cloud API Reference Introduction" +description: 'Details on the ProjectDiscovery API' +sidebarTitle: 'Introduction' +--- + +## Overview + +The ProjectDiscovery API v1 is organized around [REST](http://en.wikipedia.org/wiki/Representational_State_Transfer). Our API has resource-oriented URLs, accepts and returns JSON in most cases, and the API uses standard HTTP response codes, authentication, and verbs. Our API also conforms to the [OpenAPI Specification](https://www.openapis.org/). + +This API documentation will walk you through each of the available resources, and provides code examples for `cURL`, `Python`, `JavaScript`, `PHP`, `Go` and `Java`. Each endpoint includes the required authorization information and parameters, and provides examples of the response you should expect. + +## Authentication + +The ProjectDiscovery API uses API keys to authenticate requests. You can view and manage your API key in ProjectDiscovery at https://cloud.projectdiscovery.io/ under your user information. + +Authentication with the API is performed using a custom request header - `X-Api-Key` - which should simply be the value of your API key found with your ProjectDiscovery account. + +You must make all API calls over `HTTPS`. Calls made over plain HTTP will fail, as will requests without authentication or without all required parameters. + +## Resources +Below (and in the menu on the left) you can find the various resources available to the ProjectDiscovery API. + + + + Your assets (hosts, CIDR ranges, etc.) for scanning. + + + Access public and private templates as well as AI template creation. + + + Manage scans, scan schedules, and create new scans. + + + See and manage vulnerabilities detected by PDCP. + + + Retest vulnerabilities or run single template/target scans. + + + See and manage user settings, API keys and more. + + \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/leaks/your-get-endpoint-for-domain-stats.mdx b/api-reference-backup-20250807-005941/leaks/your-get-endpoint-for-domain-stats.mdx new file mode 100644 index 0000000..e58c189 --- /dev/null +++ b/api-reference-backup-20250807-005941/leaks/your-get-endpoint-for-domain-stats.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/leaks/stats/domain +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/leaks/your-get-endpoint-for-email-stats.mdx b/api-reference-backup-20250807-005941/leaks/your-get-endpoint-for-email-stats.mdx new file mode 100644 index 0000000..bca7748 --- /dev/null +++ b/api-reference-backup-20250807-005941/leaks/your-get-endpoint-for-email-stats.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/leaks/stats/email +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/oauth/exchange-code-for-access-token.mdx b/api-reference-backup-20250807-005941/oauth/exchange-code-for-access-token.mdx new file mode 100644 index 0000000..c15e66d --- /dev/null +++ b/api-reference-backup-20250807-005941/oauth/exchange-code-for-access-token.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/integration/oauth/{name}/exchange-token +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/oauth/get-oauth-status.mdx b/api-reference-backup-20250807-005941/oauth/get-oauth-status.mdx new file mode 100644 index 0000000..6b51307 --- /dev/null +++ b/api-reference-backup-20250807-005941/oauth/get-oauth-status.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/integration/oauth/{name}/status +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/oauth/get-oauth-url-for-the-service-provider.mdx b/api-reference-backup-20250807-005941/oauth/get-oauth-url-for-the-service-provider.mdx new file mode 100644 index 0000000..c12cf3f --- /dev/null +++ b/api-reference-backup-20250807-005941/oauth/get-oauth-url-for-the-service-provider.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/integration/oauth/{name}/generate-url +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/oauth/revoke-oauth-token.mdx b/api-reference-backup-20250807-005941/oauth/revoke-oauth-token.mdx new file mode 100644 index 0000000..e192a3e --- /dev/null +++ b/api-reference-backup-20250807-005941/oauth/revoke-oauth-token.mdx @@ -0,0 +1,3 @@ +--- +openapi: delete /v1/integration/oauth/{name}/revoke +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/rename-tunnel.mdx b/api-reference-backup-20250807-005941/rename-tunnel.mdx new file mode 100644 index 0000000..0d93eaa --- /dev/null +++ b/api-reference-backup-20250807-005941/rename-tunnel.mdx @@ -0,0 +1,3 @@ +--- +openapi: patch /v1/user/tunnels +--- \ No newline at end of file diff --git a/api-reference/results/get-all-results.mdx b/api-reference-backup-20250807-005941/results/get-all-results.mdx similarity index 100% rename from api-reference/results/get-all-results.mdx rename to api-reference-backup-20250807-005941/results/get-all-results.mdx diff --git a/api-reference-backup-20250807-005941/results/get-all-vulnerability-changelogs.mdx b/api-reference-backup-20250807-005941/results/get-all-vulnerability-changelogs.mdx new file mode 100644 index 0000000..0b30ba3 --- /dev/null +++ b/api-reference-backup-20250807-005941/results/get-all-vulnerability-changelogs.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/scans/vuln/changelogs +--- \ No newline at end of file diff --git a/api-reference/results/get-results-stats.mdx b/api-reference-backup-20250807-005941/results/get-results-stats.mdx similarity index 100% rename from api-reference/results/get-results-stats.mdx rename to api-reference-backup-20250807-005941/results/get-results-stats.mdx diff --git a/api-reference/results/get-scan-results.mdx b/api-reference-backup-20250807-005941/results/get-scan-results.mdx similarity index 100% rename from api-reference/results/get-scan-results.mdx rename to api-reference-backup-20250807-005941/results/get-scan-results.mdx diff --git a/api-reference-backup-20250807-005941/results/get-scan-vulnerability.mdx b/api-reference-backup-20250807-005941/results/get-scan-vulnerability.mdx new file mode 100644 index 0000000..d57ac5e --- /dev/null +++ b/api-reference-backup-20250807-005941/results/get-scan-vulnerability.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/scans/vuln/{vuln_id} +--- \ No newline at end of file diff --git a/api-reference/results/get-scans-result-filters.mdx b/api-reference-backup-20250807-005941/results/get-scans-result-filters.mdx similarity index 100% rename from api-reference/results/get-scans-result-filters.mdx rename to api-reference-backup-20250807-005941/results/get-scans-result-filters.mdx diff --git a/api-reference-backup-20250807-005941/results/get-vulnerability-changelogs.mdx b/api-reference-backup-20250807-005941/results/get-vulnerability-changelogs.mdx new file mode 100644 index 0000000..2464795 --- /dev/null +++ b/api-reference-backup-20250807-005941/results/get-vulnerability-changelogs.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/scans/vuln/{vuln_id}/changelogs +--- \ No newline at end of file diff --git a/api-reference/retests/create-retest.mdx b/api-reference-backup-20250807-005941/retests/create-retest.mdx similarity index 100% rename from api-reference/retests/create-retest.mdx rename to api-reference-backup-20250807-005941/retests/create-retest.mdx diff --git a/api-reference/retests/get-all-retest.mdx b/api-reference-backup-20250807-005941/retests/get-all-retest.mdx similarity index 100% rename from api-reference/retests/get-all-retest.mdx rename to api-reference-backup-20250807-005941/retests/get-all-retest.mdx diff --git a/api-reference-backup-20250807-005941/retests/get-retest-vulnerability.mdx b/api-reference-backup-20250807-005941/retests/get-retest-vulnerability.mdx new file mode 100644 index 0000000..60ad6ed --- /dev/null +++ b/api-reference-backup-20250807-005941/retests/get-retest-vulnerability.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/retest/{vuln_id} +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/scan/get-remediation-efficiency-stats.mdx b/api-reference-backup-20250807-005941/scan/get-remediation-efficiency-stats.mdx new file mode 100644 index 0000000..e7cd579 --- /dev/null +++ b/api-reference-backup-20250807-005941/scan/get-remediation-efficiency-stats.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/scans/remediation-efficiency +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/scan/get-scan-vuln-exposure-metrics.mdx b/api-reference-backup-20250807-005941/scan/get-scan-vuln-exposure-metrics.mdx new file mode 100644 index 0000000..f7f948d --- /dev/null +++ b/api-reference-backup-20250807-005941/scan/get-scan-vuln-exposure-metrics.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/scans/vulns/exposures/metrics +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/scan/get-scan-vuln-regression-metrics.mdx b/api-reference-backup-20250807-005941/scan/get-scan-vuln-regression-metrics.mdx new file mode 100644 index 0000000..8803be2 --- /dev/null +++ b/api-reference-backup-20250807-005941/scan/get-scan-vuln-regression-metrics.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/scans/vulns/regression/metrics +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/scan/get-scan-vuln-remediation-metrics.mdx b/api-reference-backup-20250807-005941/scan/get-scan-vuln-remediation-metrics.mdx new file mode 100644 index 0000000..f55e0cf --- /dev/null +++ b/api-reference-backup-20250807-005941/scan/get-scan-vuln-remediation-metrics.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/scans/vulns/remediation/metrics +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/scan/validate-scan-token-before-starting-scan.mdx b/api-reference-backup-20250807-005941/scan/validate-scan-token-before-starting-scan.mdx new file mode 100644 index 0000000..a596aa8 --- /dev/null +++ b/api-reference-backup-20250807-005941/scan/validate-scan-token-before-starting-scan.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/scans/validate +--- \ No newline at end of file diff --git a/api-reference/scan_log/download-scan-log-of-given-scan-id.mdx b/api-reference-backup-20250807-005941/scan_log/download-scan-log-of-given-scan-id.mdx similarity index 100% rename from api-reference/scan_log/download-scan-log-of-given-scan-id.mdx rename to api-reference-backup-20250807-005941/scan_log/download-scan-log-of-given-scan-id.mdx diff --git a/api-reference-backup-20250807-005941/scan_log/export-scan-log-of-given-scan-id.mdx b/api-reference-backup-20250807-005941/scan_log/export-scan-log-of-given-scan-id.mdx new file mode 100644 index 0000000..db35ebd --- /dev/null +++ b/api-reference-backup-20250807-005941/scan_log/export-scan-log-of-given-scan-id.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/scans/{scan_id}/scan_log/export +--- \ No newline at end of file diff --git a/api-reference/scan_log/get-scan-log-of-given-scan-id.mdx b/api-reference-backup-20250807-005941/scan_log/get-scan-log-of-given-scan-id.mdx similarity index 100% rename from api-reference/scan_log/get-scan-log-of-given-scan-id.mdx rename to api-reference-backup-20250807-005941/scan_log/get-scan-log-of-given-scan-id.mdx diff --git a/api-reference-backup-20250807-005941/scan_log/get-scan-log-stats-of-given-scan-id.mdx b/api-reference-backup-20250807-005941/scan_log/get-scan-log-stats-of-given-scan-id.mdx new file mode 100644 index 0000000..596cd2e --- /dev/null +++ b/api-reference-backup-20250807-005941/scan_log/get-scan-log-stats-of-given-scan-id.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/scans/{scan_id}/scan_log/stats +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/scans/create-scan.mdx b/api-reference-backup-20250807-005941/scans/create-scan.mdx new file mode 100644 index 0000000..6914f6f --- /dev/null +++ b/api-reference-backup-20250807-005941/scans/create-scan.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/scans +--- \ No newline at end of file diff --git a/api-reference/scans/create-vulns-export-to-tracker.mdx b/api-reference-backup-20250807-005941/scans/create-vulns-export-to-tracker.mdx similarity index 100% rename from api-reference/scans/create-vulns-export-to-tracker.mdx rename to api-reference-backup-20250807-005941/scans/create-vulns-export-to-tracker.mdx diff --git a/api-reference/scans/delete-bulk-scans.mdx b/api-reference-backup-20250807-005941/scans/delete-bulk-scans.mdx similarity index 100% rename from api-reference/scans/delete-bulk-scans.mdx rename to api-reference-backup-20250807-005941/scans/delete-bulk-scans.mdx diff --git a/api-reference-backup-20250807-005941/scans/delete-scan-in-bulk.mdx b/api-reference-backup-20250807-005941/scans/delete-scan-in-bulk.mdx new file mode 100644 index 0000000..c33cfaf --- /dev/null +++ b/api-reference-backup-20250807-005941/scans/delete-scan-in-bulk.mdx @@ -0,0 +1,3 @@ +--- +openapi: delete /v1/scans +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/scans/delete-scan-schedule.mdx b/api-reference-backup-20250807-005941/scans/delete-scan-schedule.mdx new file mode 100644 index 0000000..5b5a1f5 --- /dev/null +++ b/api-reference-backup-20250807-005941/scans/delete-scan-schedule.mdx @@ -0,0 +1,3 @@ +--- +openapi: delete /v1/scans/schedule +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/scans/delete-scan-vulnerability.mdx b/api-reference-backup-20250807-005941/scans/delete-scan-vulnerability.mdx new file mode 100644 index 0000000..37432ab --- /dev/null +++ b/api-reference-backup-20250807-005941/scans/delete-scan-vulnerability.mdx @@ -0,0 +1,3 @@ +--- +openapi: delete /v1/scans/vulns +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/scans/delete-scan.mdx b/api-reference-backup-20250807-005941/scans/delete-scan.mdx new file mode 100644 index 0000000..4eadbc8 --- /dev/null +++ b/api-reference-backup-20250807-005941/scans/delete-scan.mdx @@ -0,0 +1,3 @@ +--- +openapi: delete /v1/scans/{scan_id} +--- \ No newline at end of file diff --git a/api-reference/scans/delete-vulns-tracker-association.mdx b/api-reference-backup-20250807-005941/scans/delete-vulns-tracker-association.mdx similarity index 100% rename from api-reference/scans/delete-vulns-tracker-association.mdx rename to api-reference-backup-20250807-005941/scans/delete-vulns-tracker-association.mdx diff --git a/api-reference-backup-20250807-005941/scans/export-filtered-scan.mdx b/api-reference-backup-20250807-005941/scans/export-filtered-scan.mdx new file mode 100644 index 0000000..d4f8abc --- /dev/null +++ b/api-reference-backup-20250807-005941/scans/export-filtered-scan.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/scans/{scan_id}/export +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/scans/export-list-of-unique-assets-for-a-scan.mdx b/api-reference-backup-20250807-005941/scans/export-list-of-unique-assets-for-a-scan.mdx new file mode 100644 index 0000000..554cce6 --- /dev/null +++ b/api-reference-backup-20250807-005941/scans/export-list-of-unique-assets-for-a-scan.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/scans/{scan_id}/asset/export +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/scans/export-list-of-unique-assets-scanned-in-current-month.mdx b/api-reference-backup-20250807-005941/scans/export-list-of-unique-assets-scanned-in-current-month.mdx new file mode 100644 index 0000000..151cc24 --- /dev/null +++ b/api-reference-backup-20250807-005941/scans/export-list-of-unique-assets-scanned-in-current-month.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/scans/asset/export +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/scans/export-scan-assets.mdx b/api-reference-backup-20250807-005941/scans/export-scan-assets.mdx new file mode 100644 index 0000000..554cce6 --- /dev/null +++ b/api-reference-backup-20250807-005941/scans/export-scan-assets.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/scans/{scan_id}/asset/export +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/scans/export-scan-vulnerability.mdx b/api-reference-backup-20250807-005941/scans/export-scan-vulnerability.mdx new file mode 100644 index 0000000..8473e3b --- /dev/null +++ b/api-reference-backup-20250807-005941/scans/export-scan-vulnerability.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/scans/vuln/{vuln_id}/export +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/scans/export-scan.mdx b/api-reference-backup-20250807-005941/scans/export-scan.mdx new file mode 100644 index 0000000..38d0757 --- /dev/null +++ b/api-reference-backup-20250807-005941/scans/export-scan.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/scans/{scan_id}/export +--- \ No newline at end of file diff --git a/api-reference/scans/get-all-scan-stats.mdx b/api-reference-backup-20250807-005941/scans/get-all-scan-stats.mdx similarity index 100% rename from api-reference/scans/get-all-scan-stats.mdx rename to api-reference-backup-20250807-005941/scans/get-all-scan-stats.mdx diff --git a/api-reference-backup-20250807-005941/scans/get-all-scans-history.mdx b/api-reference-backup-20250807-005941/scans/get-all-scans-history.mdx new file mode 100644 index 0000000..2328863 --- /dev/null +++ b/api-reference-backup-20250807-005941/scans/get-all-scans-history.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/scans/history +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/scans/get-list-of-unique-assets-for-a-scan.mdx b/api-reference-backup-20250807-005941/scans/get-list-of-unique-assets-for-a-scan.mdx new file mode 100644 index 0000000..58aa4a2 --- /dev/null +++ b/api-reference-backup-20250807-005941/scans/get-list-of-unique-assets-for-a-scan.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/scans/{scan_id}/asset +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/scans/get-list-of-unique-assets-scanned-in-current-month.mdx b/api-reference-backup-20250807-005941/scans/get-list-of-unique-assets-scanned-in-current-month.mdx new file mode 100644 index 0000000..807b288 --- /dev/null +++ b/api-reference-backup-20250807-005941/scans/get-list-of-unique-assets-scanned-in-current-month.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/scans/asset +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/scans/get-scan-config.mdx b/api-reference-backup-20250807-005941/scans/get-scan-config.mdx new file mode 100644 index 0000000..131fcc2 --- /dev/null +++ b/api-reference-backup-20250807-005941/scans/get-scan-config.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/scans/{scan_id}/config +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/scans/get-scan-history.mdx b/api-reference-backup-20250807-005941/scans/get-scan-history.mdx new file mode 100644 index 0000000..e54893c --- /dev/null +++ b/api-reference-backup-20250807-005941/scans/get-scan-history.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/scans/{scanId}/history +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/scans/get-scan-ips.mdx b/api-reference-backup-20250807-005941/scans/get-scan-ips.mdx new file mode 100644 index 0000000..a5b9983 --- /dev/null +++ b/api-reference-backup-20250807-005941/scans/get-scan-ips.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/scans/scan_ips +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/scans/get-scan-list.mdx b/api-reference-backup-20250807-005941/scans/get-scan-list.mdx new file mode 100644 index 0000000..73dfb67 --- /dev/null +++ b/api-reference-backup-20250807-005941/scans/get-scan-list.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/scans +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/scans/get-scan-schedules.mdx b/api-reference-backup-20250807-005941/scans/get-scan-schedules.mdx new file mode 100644 index 0000000..06f84c5 --- /dev/null +++ b/api-reference-backup-20250807-005941/scans/get-scan-schedules.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/scans/schedule +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/scans/get-scan.mdx b/api-reference-backup-20250807-005941/scans/get-scan.mdx new file mode 100644 index 0000000..5cb3f2a --- /dev/null +++ b/api-reference-backup-20250807-005941/scans/get-scan.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/scans/{scan_id} +--- \ No newline at end of file diff --git a/api-reference/scans/get-scans-token.mdx b/api-reference-backup-20250807-005941/scans/get-scans-token.mdx similarity index 100% rename from api-reference/scans/get-scans-token.mdx rename to api-reference-backup-20250807-005941/scans/get-scans-token.mdx diff --git a/api-reference-backup-20250807-005941/scans/import-oss-scan.mdx b/api-reference-backup-20250807-005941/scans/import-oss-scan.mdx new file mode 100644 index 0000000..e046039 --- /dev/null +++ b/api-reference-backup-20250807-005941/scans/import-oss-scan.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/scans/import +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/scans/rescan-scan.mdx b/api-reference-backup-20250807-005941/scans/rescan-scan.mdx new file mode 100644 index 0000000..c1f85c5 --- /dev/null +++ b/api-reference-backup-20250807-005941/scans/rescan-scan.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/scans/{scan_id}/rescan +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/scans/retest-vulnerability.mdx b/api-reference-backup-20250807-005941/scans/retest-vulnerability.mdx new file mode 100644 index 0000000..614fad2 --- /dev/null +++ b/api-reference-backup-20250807-005941/scans/retest-vulnerability.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/scans/{vuln_id}/retest +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/scans/set-scan-schedule.mdx b/api-reference-backup-20250807-005941/scans/set-scan-schedule.mdx new file mode 100644 index 0000000..b5c53f1 --- /dev/null +++ b/api-reference-backup-20250807-005941/scans/set-scan-schedule.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/scans/schedule +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/scans/stop-scan.mdx b/api-reference-backup-20250807-005941/scans/stop-scan.mdx new file mode 100644 index 0000000..119f1d9 --- /dev/null +++ b/api-reference-backup-20250807-005941/scans/stop-scan.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/scans/{scan_id}/stop +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/scans/update-imported-scan.mdx b/api-reference-backup-20250807-005941/scans/update-imported-scan.mdx new file mode 100644 index 0000000..cc926b8 --- /dev/null +++ b/api-reference-backup-20250807-005941/scans/update-imported-scan.mdx @@ -0,0 +1,3 @@ +--- +openapi: patch /v1/scans/{scan_id}/import +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/scans/update-scan-config.mdx b/api-reference-backup-20250807-005941/scans/update-scan-config.mdx new file mode 100644 index 0000000..bb2a5ee --- /dev/null +++ b/api-reference-backup-20250807-005941/scans/update-scan-config.mdx @@ -0,0 +1,3 @@ +--- +openapi: patch /v1/scans/{scan_id}/config +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/scans/update-scan.mdx b/api-reference-backup-20250807-005941/scans/update-scan.mdx new file mode 100644 index 0000000..e036b14 --- /dev/null +++ b/api-reference-backup-20250807-005941/scans/update-scan.mdx @@ -0,0 +1,3 @@ +--- +openapi: patch /v1/scans/{scan_id} +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/scans/update-vulnerability-labels.mdx b/api-reference-backup-20250807-005941/scans/update-vulnerability-labels.mdx new file mode 100644 index 0000000..efa7b6a --- /dev/null +++ b/api-reference-backup-20250807-005941/scans/update-vulnerability-labels.mdx @@ -0,0 +1,3 @@ +--- +openapi: patch /v1/scans/vulns/labels +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/scans/update-vulnerability-status.mdx b/api-reference-backup-20250807-005941/scans/update-vulnerability-status.mdx new file mode 100644 index 0000000..b33965d --- /dev/null +++ b/api-reference-backup-20250807-005941/scans/update-vulnerability-status.mdx @@ -0,0 +1,3 @@ +--- +openapi: patch /v1/scans/vulns +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/templates/create-template.mdx b/api-reference-backup-20250807-005941/templates/create-template.mdx new file mode 100644 index 0000000..d964ba6 --- /dev/null +++ b/api-reference-backup-20250807-005941/templates/create-template.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/template +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/templates/delete-template.mdx b/api-reference-backup-20250807-005941/templates/delete-template.mdx new file mode 100644 index 0000000..53d9c9f --- /dev/null +++ b/api-reference-backup-20250807-005941/templates/delete-template.mdx @@ -0,0 +1,3 @@ +--- +openapi: delete /v1/template/{template_id} +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/templates/generate-ai-template.mdx b/api-reference-backup-20250807-005941/templates/generate-ai-template.mdx new file mode 100644 index 0000000..b98d948 --- /dev/null +++ b/api-reference-backup-20250807-005941/templates/generate-ai-template.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/template/ai +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/templates/get-early-template-list.mdx b/api-reference-backup-20250807-005941/templates/get-early-template-list.mdx new file mode 100644 index 0000000..ac86d5d --- /dev/null +++ b/api-reference-backup-20250807-005941/templates/get-early-template-list.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/template/early +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/templates/get-early-template.mdx b/api-reference-backup-20250807-005941/templates/get-early-template.mdx new file mode 100644 index 0000000..3c46e49 --- /dev/null +++ b/api-reference-backup-20250807-005941/templates/get-early-template.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/template/early/{id} +--- \ No newline at end of file diff --git a/api-reference/templates/get-github-template-list.mdx b/api-reference-backup-20250807-005941/templates/get-github-template-list.mdx similarity index 100% rename from api-reference/templates/get-github-template-list.mdx rename to api-reference-backup-20250807-005941/templates/get-github-template-list.mdx diff --git a/api-reference/templates/get-github-template.mdx b/api-reference-backup-20250807-005941/templates/get-github-template.mdx similarity index 100% rename from api-reference/templates/get-github-template.mdx rename to api-reference-backup-20250807-005941/templates/get-github-template.mdx diff --git a/api-reference-backup-20250807-005941/templates/get-public-template-list.mdx b/api-reference-backup-20250807-005941/templates/get-public-template-list.mdx new file mode 100644 index 0000000..a2792d1 --- /dev/null +++ b/api-reference-backup-20250807-005941/templates/get-public-template-list.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/template/public +--- \ No newline at end of file diff --git a/api-reference/templates/get-public-template-stats.mdx b/api-reference-backup-20250807-005941/templates/get-public-template-stats.mdx similarity index 100% rename from api-reference/templates/get-public-template-stats.mdx rename to api-reference-backup-20250807-005941/templates/get-public-template-stats.mdx diff --git a/api-reference-backup-20250807-005941/templates/get-public-template.mdx b/api-reference-backup-20250807-005941/templates/get-public-template.mdx new file mode 100644 index 0000000..7ce9998 --- /dev/null +++ b/api-reference-backup-20250807-005941/templates/get-public-template.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/template/public/{template_id} +--- diff --git a/api-reference/templates/get-share-status.mdx b/api-reference-backup-20250807-005941/templates/get-share-status.mdx similarity index 100% rename from api-reference/templates/get-share-status.mdx rename to api-reference-backup-20250807-005941/templates/get-share-status.mdx diff --git a/api-reference-backup-20250807-005941/templates/get-shared-template-list.mdx b/api-reference-backup-20250807-005941/templates/get-shared-template-list.mdx new file mode 100644 index 0000000..07c872b --- /dev/null +++ b/api-reference-backup-20250807-005941/templates/get-shared-template-list.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/template/share +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/templates/get-shared-template.mdx b/api-reference-backup-20250807-005941/templates/get-shared-template.mdx new file mode 100644 index 0000000..03d83e5 --- /dev/null +++ b/api-reference-backup-20250807-005941/templates/get-shared-template.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/template/share/{template_id} +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/templates/get-template-list.mdx b/api-reference-backup-20250807-005941/templates/get-template-list.mdx new file mode 100644 index 0000000..73c49cc --- /dev/null +++ b/api-reference-backup-20250807-005941/templates/get-template-list.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/template +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/templates/get-template.mdx b/api-reference-backup-20250807-005941/templates/get-template.mdx new file mode 100644 index 0000000..8532512 --- /dev/null +++ b/api-reference-backup-20250807-005941/templates/get-template.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/template/{template_id} +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/templates/share-template.mdx b/api-reference-backup-20250807-005941/templates/share-template.mdx new file mode 100644 index 0000000..3c29baa --- /dev/null +++ b/api-reference-backup-20250807-005941/templates/share-template.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/template/share +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/templates/update-template.mdx b/api-reference-backup-20250807-005941/templates/update-template.mdx new file mode 100644 index 0000000..739b934 --- /dev/null +++ b/api-reference-backup-20250807-005941/templates/update-template.mdx @@ -0,0 +1,3 @@ +--- +openapi: patch /v1/template +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/templatev2/search-templates.mdx b/api-reference-backup-20250807-005941/templatev2/search-templates.mdx new file mode 100644 index 0000000..55c8724 --- /dev/null +++ b/api-reference-backup-20250807-005941/templatev2/search-templates.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v2/template/search +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/unsharedelete-template.mdx b/api-reference-backup-20250807-005941/unsharedelete-template.mdx new file mode 100644 index 0000000..015c1ea --- /dev/null +++ b/api-reference-backup-20250807-005941/unsharedelete-template.mdx @@ -0,0 +1,3 @@ +--- +openapi: delete /v1/template/share/{template_id} +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/update-enumeration-config.mdx b/api-reference-backup-20250807-005941/update-enumeration-config.mdx new file mode 100644 index 0000000..8cfe12d --- /dev/null +++ b/api-reference-backup-20250807-005941/update-enumeration-config.mdx @@ -0,0 +1,3 @@ +--- +openapi: patch /v1/asset/enumerate/{enumerate_id}/config +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/update-shared-template.mdx b/api-reference-backup-20250807-005941/update-shared-template.mdx new file mode 100644 index 0000000..aa853a8 --- /dev/null +++ b/api-reference-backup-20250807-005941/update-shared-template.mdx @@ -0,0 +1,3 @@ +--- +openapi: patch /v1/template/share/{template_id} +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/upload-templates.mdx b/api-reference-backup-20250807-005941/upload-templates.mdx new file mode 100644 index 0000000..b49b1e7 --- /dev/null +++ b/api-reference-backup-20250807-005941/upload-templates.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v2/template/user/upload +--- \ No newline at end of file diff --git a/api-reference/usage/get-api-services-usage.mdx b/api-reference-backup-20250807-005941/usage/get-api-services-usage.mdx similarity index 100% rename from api-reference/usage/get-api-services-usage.mdx rename to api-reference-backup-20250807-005941/usage/get-api-services-usage.mdx diff --git a/api-reference-backup-20250807-005941/user/get-user-notification-preferences.mdx b/api-reference-backup-20250807-005941/user/get-user-notification-preferences.mdx new file mode 100644 index 0000000..79da46c --- /dev/null +++ b/api-reference-backup-20250807-005941/user/get-user-notification-preferences.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/user/notification_preference +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/user/migrate-personal-workspace-data-to-a-new-team.mdx b/api-reference-backup-20250807-005941/user/migrate-personal-workspace-data-to-a-new-team.mdx new file mode 100644 index 0000000..edfc59c --- /dev/null +++ b/api-reference-backup-20250807-005941/user/migrate-personal-workspace-data-to-a-new-team.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/user/migrate_to_team +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/user/update-user-notification-preferences.mdx b/api-reference-backup-20250807-005941/user/update-user-notification-preferences.mdx new file mode 100644 index 0000000..550721c --- /dev/null +++ b/api-reference-backup-20250807-005941/user/update-user-notification-preferences.mdx @@ -0,0 +1,3 @@ +--- +openapi: patch /v1/user/notification_preference +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/users/apply-promocode.mdx b/api-reference-backup-20250807-005941/users/apply-promocode.mdx new file mode 100644 index 0000000..53be041 --- /dev/null +++ b/api-reference-backup-20250807-005941/users/apply-promocode.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/user/promo_code +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/users/confirm-domain-verification.mdx b/api-reference-backup-20250807-005941/users/confirm-domain-verification.mdx new file mode 100644 index 0000000..689570c --- /dev/null +++ b/api-reference-backup-20250807-005941/users/confirm-domain-verification.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/user/domain-verification/confirm +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/users/create-api-key.mdx b/api-reference-backup-20250807-005941/users/create-api-key.mdx new file mode 100644 index 0000000..c9e6893 --- /dev/null +++ b/api-reference-backup-20250807-005941/users/create-api-key.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/user/apikey +--- \ No newline at end of file diff --git a/api-reference/users/create-feedback.mdx b/api-reference-backup-20250807-005941/users/create-feedback.mdx similarity index 100% rename from api-reference/users/create-feedback.mdx rename to api-reference-backup-20250807-005941/users/create-feedback.mdx diff --git a/api-reference-backup-20250807-005941/users/delete-api-key.mdx b/api-reference-backup-20250807-005941/users/delete-api-key.mdx new file mode 100644 index 0000000..d5deaa5 --- /dev/null +++ b/api-reference-backup-20250807-005941/users/delete-api-key.mdx @@ -0,0 +1,3 @@ +--- +openapi: delete /v1/user/apikey +--- \ No newline at end of file diff --git a/api-reference/users/delete-user-from-system-along-with-all-data.mdx b/api-reference-backup-20250807-005941/users/delete-user-from-system-along-with-all-data.mdx similarity index 100% rename from api-reference/users/delete-user-from-system-along-with-all-data.mdx rename to api-reference-backup-20250807-005941/users/delete-user-from-system-along-with-all-data.mdx diff --git a/api-reference/users/email-user-deletion-verification-code.mdx b/api-reference-backup-20250807-005941/users/email-user-deletion-verification-code.mdx similarity index 100% rename from api-reference/users/email-user-deletion-verification-code.mdx rename to api-reference-backup-20250807-005941/users/email-user-deletion-verification-code.mdx diff --git a/api-reference-backup-20250807-005941/users/get-api-key.mdx b/api-reference-backup-20250807-005941/users/get-api-key.mdx new file mode 100644 index 0000000..5d60010 --- /dev/null +++ b/api-reference-backup-20250807-005941/users/get-api-key.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/user/apikey +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/users/get-domain-verification-status.mdx b/api-reference-backup-20250807-005941/users/get-domain-verification-status.mdx new file mode 100644 index 0000000..e4eef81 --- /dev/null +++ b/api-reference-backup-20250807-005941/users/get-domain-verification-status.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/user/domain-verification/status +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/users/get-promocode-details.mdx b/api-reference-backup-20250807-005941/users/get-promocode-details.mdx new file mode 100644 index 0000000..9b83c00 --- /dev/null +++ b/api-reference-backup-20250807-005941/users/get-promocode-details.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/user/promo_code +--- \ No newline at end of file diff --git a/api-reference/users/get-subscription-status.mdx b/api-reference-backup-20250807-005941/users/get-subscription-status.mdx similarity index 100% rename from api-reference/users/get-subscription-status.mdx rename to api-reference-backup-20250807-005941/users/get-subscription-status.mdx diff --git a/api-reference-backup-20250807-005941/users/get-tunnels-list.mdx b/api-reference-backup-20250807-005941/users/get-tunnels-list.mdx new file mode 100644 index 0000000..ff62aa8 --- /dev/null +++ b/api-reference-backup-20250807-005941/users/get-tunnels-list.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/user/tunnels +--- \ No newline at end of file diff --git a/api-reference/users/get-user-profile.mdx b/api-reference-backup-20250807-005941/users/get-user-profile.mdx similarity index 100% rename from api-reference/users/get-user-profile.mdx rename to api-reference-backup-20250807-005941/users/get-user-profile.mdx diff --git a/api-reference-backup-20250807-005941/users/request-domain-verification.mdx b/api-reference-backup-20250807-005941/users/request-domain-verification.mdx new file mode 100644 index 0000000..83160ce --- /dev/null +++ b/api-reference-backup-20250807-005941/users/request-domain-verification.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/user/domain-verification/request +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/users/rotate-api-key.mdx b/api-reference-backup-20250807-005941/users/rotate-api-key.mdx new file mode 100644 index 0000000..93e7417 --- /dev/null +++ b/api-reference-backup-20250807-005941/users/rotate-api-key.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/user/apikey/rotate +--- \ No newline at end of file diff --git a/api-reference/users/update-current-subscription.mdx b/api-reference-backup-20250807-005941/users/update-current-subscription.mdx similarity index 100% rename from api-reference/users/update-current-subscription.mdx rename to api-reference-backup-20250807-005941/users/update-current-subscription.mdx diff --git a/api-reference-backup-20250807-005941/vulns/get-vuln-score-metrics.mdx b/api-reference-backup-20250807-005941/vulns/get-vuln-score-metrics.mdx new file mode 100644 index 0000000..b839464 --- /dev/null +++ b/api-reference-backup-20250807-005941/vulns/get-vuln-score-metrics.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/scans/vulns/score/metrics +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/your-get-endpoint-1.mdx b/api-reference-backup-20250807-005941/your-get-endpoint-1.mdx new file mode 100644 index 0000000..643efc7 --- /dev/null +++ b/api-reference-backup-20250807-005941/your-get-endpoint-1.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/leaks/domain +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/your-get-endpoint-2.mdx b/api-reference-backup-20250807-005941/your-get-endpoint-2.mdx new file mode 100644 index 0000000..ec081f4 --- /dev/null +++ b/api-reference-backup-20250807-005941/your-get-endpoint-2.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/leaks/email +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/your-get-endpoint-3.mdx b/api-reference-backup-20250807-005941/your-get-endpoint-3.mdx new file mode 100644 index 0000000..3c073fa --- /dev/null +++ b/api-reference-backup-20250807-005941/your-get-endpoint-3.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/leaks/domain/customers +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/your-get-endpoint.mdx b/api-reference-backup-20250807-005941/your-get-endpoint.mdx new file mode 100644 index 0000000..3867005 --- /dev/null +++ b/api-reference-backup-20250807-005941/your-get-endpoint.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v2/template +--- \ No newline at end of file diff --git a/api-reference-backup-20250807-005941/your-post-endpoint.mdx b/api-reference-backup-20250807-005941/your-post-endpoint.mdx new file mode 100644 index 0000000..aaffbc8 --- /dev/null +++ b/api-reference-backup-20250807-005941/your-post-endpoint.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/leaks/status +--- \ No newline at end of file diff --git a/api-reference/asset/export-enumeration-domains.mdx b/api-reference/asset/export-enumeration-domains.mdx new file mode 100644 index 0000000..52079c7 --- /dev/null +++ b/api-reference/asset/export-enumeration-domains.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/asset/enumerate/{enumerate_id}/domains/export +--- \ No newline at end of file diff --git a/api-reference/assets/create-an-asset-group.mdx b/api-reference/assets/create-an-asset-group.mdx new file mode 100644 index 0000000..b811991 --- /dev/null +++ b/api-reference/assets/create-an-asset-group.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/asset/enumerate/group +--- \ No newline at end of file diff --git a/api-reference/assets/create-enumeration.mdx b/api-reference/assets/create-enumeration.mdx new file mode 100644 index 0000000..c1a5e53 --- /dev/null +++ b/api-reference/assets/create-enumeration.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/asset/enumerate +--- \ No newline at end of file diff --git a/api-reference/assets/delete-assets-in-bulk.mdx b/api-reference/assets/delete-assets-in-bulk.mdx new file mode 100644 index 0000000..1b29673 --- /dev/null +++ b/api-reference/assets/delete-assets-in-bulk.mdx @@ -0,0 +1,3 @@ +--- +openapi: delete /v1/asset/enumerate +--- \ No newline at end of file diff --git a/api-reference/assets/delete-enumeration-schedule.mdx b/api-reference/assets/delete-enumeration-schedule.mdx new file mode 100644 index 0000000..d1476c5 --- /dev/null +++ b/api-reference/assets/delete-enumeration-schedule.mdx @@ -0,0 +1,3 @@ +--- +openapi: delete /v1/enumeration/schedule +--- \ No newline at end of file diff --git a/api-reference/assets/delete-enumeration.mdx b/api-reference/assets/delete-enumeration.mdx new file mode 100644 index 0000000..d733c80 --- /dev/null +++ b/api-reference/assets/delete-enumeration.mdx @@ -0,0 +1,3 @@ +--- +openapi: delete /v1/asset/enumerate/{enumerate_id} +--- \ No newline at end of file diff --git a/api-reference/assets/export-enumeration-of-user.mdx b/api-reference/assets/export-enumeration-of-user.mdx new file mode 100644 index 0000000..9bab521 --- /dev/null +++ b/api-reference/assets/export-enumeration-of-user.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/asset/enumerate/export +--- \ No newline at end of file diff --git a/api-reference/assets/export-enumeration.mdx b/api-reference/assets/export-enumeration.mdx new file mode 100644 index 0000000..12a3f01 --- /dev/null +++ b/api-reference/assets/export-enumeration.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/asset/enumerate/{enum_id}/export +--- \ No newline at end of file diff --git a/api-reference/assets/get-asset-changelogs-for-a-given-asset_id.mdx b/api-reference/assets/get-asset-changelogs-for-a-given-asset_id.mdx new file mode 100644 index 0000000..7acf163 --- /dev/null +++ b/api-reference/assets/get-asset-changelogs-for-a-given-asset_id.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/asset/{asset_id}/changelogs +--- \ No newline at end of file diff --git a/api-reference/assets/get-enumeration-config.mdx b/api-reference/assets/get-enumeration-config.mdx new file mode 100644 index 0000000..81cc062 --- /dev/null +++ b/api-reference/assets/get-enumeration-config.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/asset/enumerate/{enumerate_id}/config +--- \ No newline at end of file diff --git a/api-reference/assets/get-enumeration-list.mdx b/api-reference/assets/get-enumeration-list.mdx new file mode 100644 index 0000000..162902d --- /dev/null +++ b/api-reference/assets/get-enumeration-list.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/asset/enumerate +--- \ No newline at end of file diff --git a/api-reference/assets/get-enumeration-schedules.mdx b/api-reference/assets/get-enumeration-schedules.mdx new file mode 100644 index 0000000..c280793 --- /dev/null +++ b/api-reference/assets/get-enumeration-schedules.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/enumeration/schedule +--- \ No newline at end of file diff --git a/api-reference/assets/get-enumeration.mdx b/api-reference/assets/get-enumeration.mdx new file mode 100644 index 0000000..072bf1e --- /dev/null +++ b/api-reference/assets/get-enumeration.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/asset/enumerate/{enumerate_id} +--- \ No newline at end of file diff --git a/api-reference/assets/rescan-enumeration.mdx b/api-reference/assets/rescan-enumeration.mdx new file mode 100644 index 0000000..907466a --- /dev/null +++ b/api-reference/assets/rescan-enumeration.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/asset/enumerate/{enumerate_id}/rescan +--- \ No newline at end of file diff --git a/api-reference/assets/set-enumeration-schedule.mdx b/api-reference/assets/set-enumeration-schedule.mdx new file mode 100644 index 0000000..b82b2be --- /dev/null +++ b/api-reference/assets/set-enumeration-schedule.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/enumeration/schedule +--- \ No newline at end of file diff --git a/api-reference/assets/update-an-asset-group.mdx b/api-reference/assets/update-an-asset-group.mdx new file mode 100644 index 0000000..d741a9d --- /dev/null +++ b/api-reference/assets/update-an-asset-group.mdx @@ -0,0 +1,3 @@ +--- +openapi: patch /v1/asset/enumerate/group/{group_id} +--- \ No newline at end of file diff --git a/api-reference/assets/update-enumeration.mdx b/api-reference/assets/update-enumeration.mdx new file mode 100644 index 0000000..060e69d --- /dev/null +++ b/api-reference/assets/update-enumeration.mdx @@ -0,0 +1,3 @@ +--- +openapi: patch /v1/asset/enumerate/{enumerate_id} +--- \ No newline at end of file diff --git a/api-reference/configurations/add-custom-severity-mapping.mdx b/api-reference/configurations/add-custom-severity-mapping.mdx new file mode 100644 index 0000000..9611ded --- /dev/null +++ b/api-reference/configurations/add-custom-severity-mapping.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/scans/config/severity +--- \ No newline at end of file diff --git a/api-reference/configurations/add-excluded-templates-and-targets.mdx b/api-reference/configurations/add-excluded-templates-and-targets.mdx new file mode 100644 index 0000000..55bb8e4 --- /dev/null +++ b/api-reference/configurations/add-excluded-templates-and-targets.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/scans/config/exclude +--- \ No newline at end of file diff --git a/api-reference/configurations/delete-custom-severity-mapping.mdx b/api-reference/configurations/delete-custom-severity-mapping.mdx new file mode 100644 index 0000000..a4b9247 --- /dev/null +++ b/api-reference/configurations/delete-custom-severity-mapping.mdx @@ -0,0 +1,3 @@ +--- +openapi: delete /v1/scans/config/severity +--- \ No newline at end of file diff --git a/api-reference/configurations/delete-excluded-templates-or-targets-by-ids.mdx b/api-reference/configurations/delete-excluded-templates-or-targets-by-ids.mdx new file mode 100644 index 0000000..f682af9 --- /dev/null +++ b/api-reference/configurations/delete-excluded-templates-or-targets-by-ids.mdx @@ -0,0 +1,3 @@ +--- +openapi: delete /v1/scans/config/exclude +--- \ No newline at end of file diff --git a/api-reference/configurations/get-custom-severity-mappings.mdx b/api-reference/configurations/get-custom-severity-mappings.mdx new file mode 100644 index 0000000..3270199 --- /dev/null +++ b/api-reference/configurations/get-custom-severity-mappings.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/scans/config/severity +--- \ No newline at end of file diff --git a/api-reference/configurations/modify-custom-severity-mapping.mdx b/api-reference/configurations/modify-custom-severity-mapping.mdx new file mode 100644 index 0000000..62172db --- /dev/null +++ b/api-reference/configurations/modify-custom-severity-mapping.mdx @@ -0,0 +1,3 @@ +--- +openapi: patch /v1/scans/config/{config_id}/severity +--- \ No newline at end of file diff --git a/api-reference/customer-domain-analysis.mdx b/api-reference/customer-domain-analysis.mdx new file mode 100644 index 0000000..d9c1076 --- /dev/null +++ b/api-reference/customer-domain-analysis.mdx @@ -0,0 +1,4 @@ +--- +title: "Customer Domain Analysis" +openapi: get /v1/leaks/domain/customers +--- \ No newline at end of file diff --git a/api-reference/domain-leak-detection.mdx b/api-reference/domain-leak-detection.mdx new file mode 100644 index 0000000..4f8f6b8 --- /dev/null +++ b/api-reference/domain-leak-detection.mdx @@ -0,0 +1,4 @@ +--- +title: "Domain Leak Detection" +openapi: get /v1/leaks/domain +--- \ No newline at end of file diff --git a/api-reference/email-leak-detection.mdx b/api-reference/email-leak-detection.mdx new file mode 100644 index 0000000..1999b62 --- /dev/null +++ b/api-reference/email-leak-detection.mdx @@ -0,0 +1,4 @@ +--- +title: "Email Leak Detection" +openapi: get /v1/leaks/email +--- \ No newline at end of file diff --git a/api-reference/enumerations/create-an-asset-group.mdx b/api-reference/enumerations/create-an-asset-group.mdx new file mode 100644 index 0000000..b811991 --- /dev/null +++ b/api-reference/enumerations/create-an-asset-group.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/asset/enumerate/group +--- \ No newline at end of file diff --git a/api-reference/enumerations/update-an-asset-group.mdx b/api-reference/enumerations/update-an-asset-group.mdx new file mode 100644 index 0000000..d741a9d --- /dev/null +++ b/api-reference/enumerations/update-an-asset-group.mdx @@ -0,0 +1,3 @@ +--- +openapi: patch /v1/asset/enumerate/group/{group_id} +--- \ No newline at end of file diff --git a/api-reference/full-text-search.mdx b/api-reference/full-text-search.mdx new file mode 100644 index 0000000..bea401f --- /dev/null +++ b/api-reference/full-text-search.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v2/vulnerability/search +--- \ No newline at end of file diff --git a/api-reference/get-all-filters-for-vulnerabilities.mdx b/api-reference/get-all-filters-for-vulnerabilities.mdx new file mode 100644 index 0000000..76331ce --- /dev/null +++ b/api-reference/get-all-filters-for-vulnerabilities.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v2/vulnerability/filters +--- \ No newline at end of file diff --git a/api-reference/get-enumeration-history.mdx b/api-reference/get-enumeration-history.mdx new file mode 100644 index 0000000..8911dd4 --- /dev/null +++ b/api-reference/get-enumeration-history.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/asset/enumerate/{enumerate_id}/history +--- \ No newline at end of file diff --git a/api-reference/get-vulnerability-by-id.mdx b/api-reference/get-vulnerability-by-id.mdx new file mode 100644 index 0000000..f1f1e56 --- /dev/null +++ b/api-reference/get-vulnerability-by-id.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v2/vulnerability/{id} +--- \ No newline at end of file diff --git a/api-reference/history/get-scan-log-stats-of-given-scan-id.mdx b/api-reference/history/get-scan-log-stats-of-given-scan-id.mdx new file mode 100644 index 0000000..51e3e0d --- /dev/null +++ b/api-reference/history/get-scan-log-stats-of-given-scan-id.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/scans/vulns/history +--- \ No newline at end of file diff --git a/api-reference/internal/add-team-member-admin.mdx b/api-reference/internal/add-team-member-admin.mdx deleted file mode 100644 index 4aec0ac..0000000 --- a/api-reference/internal/add-team-member-admin.mdx +++ /dev/null @@ -1,3 +0,0 @@ ---- -openapi: post /v1/admin/team/member ---- \ No newline at end of file diff --git a/api-reference/internal/add-team-member.mdx b/api-reference/internal/add-team-member.mdx deleted file mode 100644 index b837429..0000000 --- a/api-reference/internal/add-team-member.mdx +++ /dev/null @@ -1,3 +0,0 @@ ---- -openapi: post /v1/user/team/member ---- \ No newline at end of file diff --git a/api-reference/internal/contribute-to-public-templates.mdx b/api-reference/internal/contribute-to-public-templates.mdx deleted file mode 100644 index 14cb69e..0000000 --- a/api-reference/internal/contribute-to-public-templates.mdx +++ /dev/null @@ -1,3 +0,0 @@ ---- -openapi: post /v1/template/contribute ---- \ No newline at end of file diff --git a/api-reference/internal/create-integration.mdx b/api-reference/internal/create-integration.mdx deleted file mode 100644 index 789fad6..0000000 --- a/api-reference/internal/create-integration.mdx +++ /dev/null @@ -1,3 +0,0 @@ ---- -openapi: post /v1/integration/{name} ---- \ No newline at end of file diff --git a/api-reference/internal/create-new-user.mdx b/api-reference/internal/create-new-user.mdx deleted file mode 100644 index b7fb99a..0000000 --- a/api-reference/internal/create-new-user.mdx +++ /dev/null @@ -1,3 +0,0 @@ ---- -openapi: post /v1/admin/users ---- \ No newline at end of file diff --git a/api-reference/internal/create-subscription-checkout.mdx b/api-reference/internal/create-subscription-checkout.mdx deleted file mode 100644 index 72ce389..0000000 --- a/api-reference/internal/create-subscription-checkout.mdx +++ /dev/null @@ -1,3 +0,0 @@ ---- -openapi: post /v1/payment/stripe/checkout_session ---- \ No newline at end of file diff --git a/api-reference/internal/create-team.mdx b/api-reference/internal/create-team.mdx deleted file mode 100644 index cb64033..0000000 --- a/api-reference/internal/create-team.mdx +++ /dev/null @@ -1,3 +0,0 @@ ---- -openapi: post /v1/user/team ---- \ No newline at end of file diff --git a/api-reference/internal/delete-integration.mdx b/api-reference/internal/delete-integration.mdx deleted file mode 100644 index e9c080e..0000000 --- a/api-reference/internal/delete-integration.mdx +++ /dev/null @@ -1,3 +0,0 @@ ---- -openapi: delete /v1/integration/{name} ---- \ No newline at end of file diff --git a/api-reference/internal/delete-team-member.mdx b/api-reference/internal/delete-team-member.mdx deleted file mode 100644 index 3ee755f..0000000 --- a/api-reference/internal/delete-team-member.mdx +++ /dev/null @@ -1,3 +0,0 @@ ---- -openapi: delete /v1/user/team/member ---- \ No newline at end of file diff --git a/api-reference/internal/delete-team.mdx b/api-reference/internal/delete-team.mdx deleted file mode 100644 index 40e3ef0..0000000 --- a/api-reference/internal/delete-team.mdx +++ /dev/null @@ -1,3 +0,0 @@ ---- -openapi: delete /v1/user/team ---- \ No newline at end of file diff --git a/api-reference/internal/get-all-integrations.mdx b/api-reference/internal/get-all-integrations.mdx deleted file mode 100644 index f4063e8..0000000 --- a/api-reference/internal/get-all-integrations.mdx +++ /dev/null @@ -1,3 +0,0 @@ ---- -openapi: get /v1/integration/{name}/all ---- \ No newline at end of file diff --git a/api-reference/internal/get-integration-user-profile.mdx b/api-reference/internal/get-integration-user-profile.mdx deleted file mode 100644 index 0e4b410..0000000 --- a/api-reference/internal/get-integration-user-profile.mdx +++ /dev/null @@ -1,3 +0,0 @@ ---- -openapi: get /v1/integration/{name}/profile ---- \ No newline at end of file diff --git a/api-reference/internal/get-integration.mdx b/api-reference/internal/get-integration.mdx deleted file mode 100644 index 5e253f9..0000000 --- a/api-reference/internal/get-integration.mdx +++ /dev/null @@ -1,3 +0,0 @@ ---- -openapi: get /v1/integration/{name} ---- \ No newline at end of file diff --git a/api-reference/internal/get-leaderboard.mdx b/api-reference/internal/get-leaderboard.mdx deleted file mode 100644 index a865f5c..0000000 --- a/api-reference/internal/get-leaderboard.mdx +++ /dev/null @@ -1,3 +0,0 @@ ---- -openapi: get /v1/template/leaderboard ---- \ No newline at end of file diff --git a/api-reference/internal/get-team-members.mdx b/api-reference/internal/get-team-members.mdx deleted file mode 100644 index 794ce49..0000000 --- a/api-reference/internal/get-team-members.mdx +++ /dev/null @@ -1,3 +0,0 @@ ---- -openapi: get /v1/user/team/member ---- \ No newline at end of file diff --git a/api-reference/internal/get-team.mdx b/api-reference/internal/get-team.mdx deleted file mode 100644 index 932d5a3..0000000 --- a/api-reference/internal/get-team.mdx +++ /dev/null @@ -1,3 +0,0 @@ ---- -openapi: get /v1/user/team ---- \ No newline at end of file diff --git a/api-reference/internal/get-token-usage-admin.mdx b/api-reference/internal/get-token-usage-admin.mdx deleted file mode 100644 index 516220a..0000000 --- a/api-reference/internal/get-token-usage-admin.mdx +++ /dev/null @@ -1,3 +0,0 @@ ---- -openapi: get /v1/admin/scan/token ---- \ No newline at end of file diff --git a/api-reference/internal/patch-user-profile.mdx b/api-reference/internal/patch-user-profile.mdx deleted file mode 100644 index c3573f0..0000000 --- a/api-reference/internal/patch-user-profile.mdx +++ /dev/null @@ -1,3 +0,0 @@ ---- -openapi: patch /v1/admin/user/profile ---- \ No newline at end of file diff --git a/api-reference/internal/set-scan-token-for-user.mdx b/api-reference/internal/set-scan-token-for-user.mdx deleted file mode 100644 index 971e886..0000000 --- a/api-reference/internal/set-scan-token-for-user.mdx +++ /dev/null @@ -1,3 +0,0 @@ ---- -openapi: post /v1/admin/scan/token ---- \ No newline at end of file diff --git a/api-reference/internal/update-team-member.mdx b/api-reference/internal/update-team-member.mdx deleted file mode 100644 index a9dd591..0000000 --- a/api-reference/internal/update-team-member.mdx +++ /dev/null @@ -1,3 +0,0 @@ ---- -openapi: patch /v1/user/team/member ---- \ No newline at end of file diff --git a/api-reference/internal/update-team.mdx b/api-reference/internal/update-team.mdx deleted file mode 100644 index b407b3e..0000000 --- a/api-reference/internal/update-team.mdx +++ /dev/null @@ -1,3 +0,0 @@ ---- -openapi: patch /v1/user/team ---- \ No newline at end of file diff --git a/api-reference/internal/verify-integration.mdx b/api-reference/internal/verify-integration.mdx deleted file mode 100644 index 974be88..0000000 --- a/api-reference/internal/verify-integration.mdx +++ /dev/null @@ -1,3 +0,0 @@ ---- -openapi: patch /v1/integration/{name} ---- \ No newline at end of file diff --git a/api-reference/introduction.mdx b/api-reference/introduction.mdx index 1eecb4a..3b4df2c 100644 --- a/api-reference/introduction.mdx +++ b/api-reference/introduction.mdx @@ -12,7 +12,7 @@ This API documentation will walk you through each of the available resources, an ## Authentication -The ProjectDiscovery API uses API keys to authenticate requests. You can view and manage your API key in ProjectDiscovery at https://cloud.projectdiscovery.io/ under your user information. +The ProjectDiscovery API uses API keys to authenticate requests. You can view and manage your API key by visiting the ProjectDiscovery cloud dashboard at https://cloud.projectdiscovery.io/ and finding the API key there, or go to Settings in the left bottom and click API Key. Authentication with the API is performed using a custom request header - `X-Api-Key` - which should simply be the value of your API key found with your ProjectDiscovery account. @@ -26,47 +26,63 @@ Below (and in the menu on the left) you can find the various resources available title="Assets" icon="server" iconType="duotone" - href="/api-reference/assets" + href="/api-reference/assets/get-asset-changelogs-for-a-given-asset_id" > Your assets (hosts, CIDR ranges, etc.) for scanning. - Access public and private templates as well as AI template creation. + Manage scan configurations and custom settings. - Manage scans, scan schedules, and create new scans. + Export scan results and filtered data. + + + Access scan logs and historical data. See and manage vulnerabilities detected by PDCP. + Manage scans, scan schedules, and create new scans. + + - Retest vulnerabilities or run single template/target scans. + Access public and private templates as well as AI template creation. See and manage user settings, API keys and more. diff --git a/api-reference/rename-tunnel.mdx b/api-reference/rename-tunnel.mdx new file mode 100644 index 0000000..0d93eaa --- /dev/null +++ b/api-reference/rename-tunnel.mdx @@ -0,0 +1,3 @@ +--- +openapi: patch /v1/user/tunnels +--- \ No newline at end of file diff --git a/api-reference/results/get-all-vulnerability-changelogs.mdx b/api-reference/results/get-all-vulnerability-changelogs.mdx new file mode 100644 index 0000000..0b30ba3 --- /dev/null +++ b/api-reference/results/get-all-vulnerability-changelogs.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/scans/vuln/changelogs +--- \ No newline at end of file diff --git a/api-reference/results/get-vulnerability-changelogs.mdx b/api-reference/results/get-vulnerability-changelogs.mdx new file mode 100644 index 0000000..2464795 --- /dev/null +++ b/api-reference/results/get-vulnerability-changelogs.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/scans/vuln/{vuln_id}/changelogs +--- \ No newline at end of file diff --git a/api-reference/scan_log/export-scan-log-of-given-scan-id.mdx b/api-reference/scan_log/export-scan-log-of-given-scan-id.mdx new file mode 100644 index 0000000..db35ebd --- /dev/null +++ b/api-reference/scan_log/export-scan-log-of-given-scan-id.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/scans/{scan_id}/scan_log/export +--- \ No newline at end of file diff --git a/api-reference/scans/export-scan-assets.mdx b/api-reference/scans/export-scan-assets.mdx new file mode 100644 index 0000000..554cce6 --- /dev/null +++ b/api-reference/scans/export-scan-assets.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/scans/{scan_id}/asset/export +--- \ No newline at end of file diff --git a/api-reference/scans/get-vulnerability-by-id.mdx b/api-reference/scans/get-vulnerability-by-id.mdx new file mode 100644 index 0000000..f1f1e56 --- /dev/null +++ b/api-reference/scans/get-vulnerability-by-id.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v2/vulnerability/{id} +--- \ No newline at end of file diff --git a/api-reference/scans/get-vulnerability-filters.mdx b/api-reference/scans/get-vulnerability-filters.mdx new file mode 100644 index 0000000..76331ce --- /dev/null +++ b/api-reference/scans/get-vulnerability-filters.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v2/vulnerability/filters +--- \ No newline at end of file diff --git a/api-reference/scans/vulnerability-search.mdx b/api-reference/scans/vulnerability-search.mdx new file mode 100644 index 0000000..064bbc3 --- /dev/null +++ b/api-reference/scans/vulnerability-search.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v2/vulnerability/search +--- diff --git a/api-reference/templates/get-public-template.mdx b/api-reference/templates/get-public-template.mdx index 7ce9998..8e83b4e 100644 --- a/api-reference/templates/get-public-template.mdx +++ b/api-reference/templates/get-public-template.mdx @@ -1,3 +1,3 @@ --- openapi: get /v1/template/public/{template_id} ---- +--- \ No newline at end of file diff --git a/api-reference/templates/get-shared-template-list.mdx b/api-reference/templates/get-shared-template-list.mdx new file mode 100644 index 0000000..07c872b --- /dev/null +++ b/api-reference/templates/get-shared-template-list.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/template/share +--- \ No newline at end of file diff --git a/api-reference/templatev2/search-templates.mdx b/api-reference/templatev2/search-templates.mdx new file mode 100644 index 0000000..55c8724 --- /dev/null +++ b/api-reference/templatev2/search-templates.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v2/template/search +--- \ No newline at end of file diff --git a/api-reference/unsharedelete-template.mdx b/api-reference/unsharedelete-template.mdx new file mode 100644 index 0000000..015c1ea --- /dev/null +++ b/api-reference/unsharedelete-template.mdx @@ -0,0 +1,3 @@ +--- +openapi: delete /v1/template/share/{template_id} +--- \ No newline at end of file diff --git a/api-reference/update-shared-template.mdx b/api-reference/update-shared-template.mdx new file mode 100644 index 0000000..aa853a8 --- /dev/null +++ b/api-reference/update-shared-template.mdx @@ -0,0 +1,3 @@ +--- +openapi: patch /v1/template/share/{template_id} +--- \ No newline at end of file diff --git a/bin/README-auto-grouped-api.md b/bin/README-auto-grouped-api.md new file mode 100644 index 0000000..c65b44f --- /dev/null +++ b/bin/README-auto-grouped-api.md @@ -0,0 +1,111 @@ +# Auto-Grouped API Documentation Generator + +This script **automatically generates and maintains** API documentation with logical grouping based on OpenAPI tags. It combines the best of both worlds: auto-generation (no missing endpoints) and logical organization. + +## Usage + +```bash +# Use default source file (Downloads directory) +./bin/generate-auto-grouped-api.sh + +# Use custom source file +./bin/generate-auto-grouped-api.sh /path/to/your/openapi.yaml +``` + +## What it does + +### 🤖 **Auto-Generation** +- Reads OpenAPI specification +- Filters out admin and internal APIs +- Generates MDX files for all public endpoints +- **Never misses endpoints** - everything is included automatically + +### 📁 **Logical Grouping** +The script organizes endpoints into logical groups based on OpenAPI tags: + +- **Assets** → `assets` + `enumerations` tags +- **Templates** → `templates` + `template/v2` tags +- **Scans** → `scans` tag +- **Results** → `results` + `retests` tags +- **Configurations** → `configurations` tag +- **Users** → `users` + `user` tags +- **Logs** → `elog` + `scan_log` tags +- **Export** → `export` tag +- **Automations** → `automations` tag +- **Integration** → `oauth` tag +- **Utilities** → `chaos`, `vulns`, `leaks`, `billing`, `usage` tags + +### 🔄 **Auto-Updates Navigation** +- Automatically updates `mint.json` with new structure +- Maintains logical grouping +- Sorts endpoints alphabetically within groups +- Handles new endpoints automatically + +## Benefits + +✅ **No Manual Maintenance** - Add new endpoints to OpenAPI spec and they appear automatically +✅ **Never Miss Endpoints** - All public endpoints are included +✅ **Logical Organization** - Grouped by functionality, not alphabetically +✅ **Consistent Naming** - Uses OpenAPI summaries and operation IDs +✅ **Future-Proof** - Works with any OpenAPI specification changes + +## Output Structure + +After running, your `mint.json` will have clean navigation like: + +```json +{ + "group": "API Reference", + "pages": [ + "api-reference/introduction", + { + "group": "Assets", + "pages": [ + "api-reference/assets/get-asset-list", + "api-reference/assets/upload-asset", + "api-reference/enumerations/create-enumeration", + "..." + ] + }, + { + "group": "Templates", + "pages": [ + "api-reference/templates/create-template", + "api-reference/templates/get-template-list", + "..." + ] + } + ] +} +``` + +## Comparison with Manual Approach + +| Feature | Manual (`generate-filtered-api.sh`) | Auto-Grouped (`generate-auto-grouped-api.sh`) | +|---------|--------------------------------------|-----------------------------------------------| +| **Missing Endpoints** | ❌ Requires manual addition to `mint.json` | ✅ Never - all endpoints auto-included | +| **Logical Grouping** | ✅ Full manual control | ✅ Smart tag-based grouping | +| **Maintenance** | ❌ High - update `mint.json` for new endpoints | ✅ Zero - fully automated | +| **Consistency** | ❌ Depends on manual updates | ✅ Always consistent | +| **New API Versions** | ❌ Manual review and updates needed | ✅ Automatically handles changes | + +## When to Use + +**Use Auto-Grouped when:** +- You want zero maintenance overhead +- You frequently add/remove API endpoints +- You have a team that might forget to update navigation +- You want consistent organization based on API design + +**Use Manual when:** +- You need very specific custom grouping that doesn't match tags +- You want to exclude certain public endpoints from docs +- You have complex navigation requirements + +## Next Steps + +After running this script: + +1. **Preview:** `mintlify dev` +2. **Deploy:** Your CI/CD can run this script automatically when OpenAPI changes +3. **Customize:** Modify the `logicalGroups` mapping in the script if needed \ No newline at end of file diff --git a/bin/README-filtered-api.md b/bin/README-filtered-api.md new file mode 100644 index 0000000..811bf80 --- /dev/null +++ b/bin/README-filtered-api.md @@ -0,0 +1,59 @@ +# Filtered API Documentation Generator + +This script generates API documentation from an OpenAPI specification while excluding internal and admin endpoints. + +## Usage + +```bash +# Use default source file (Downloads directory) +./bin/generate-filtered-api.sh + +# Use custom source file +./bin/generate-filtered-api.sh /path/to/your/openapi.yaml +``` + +**Note:** The script will create a filtered `openapi.yaml` file in the current directory for Mintlify to use. + +## What gets filtered out + +The script automatically excludes: + +1. **Admin APIs**: All paths starting with `/v1/admin/` + - Examples: `/v1/admin/user/search`, `/v1/admin/team/change_owner` + +2. **Internal APIs**: Endpoints tagged with `internal` + - Any endpoint with `"internal"` in its tags array + +## Output + +- Creates filtered API documentation in the `api-reference/` directory +- Removes existing `internal/` and `admin/` folders before regenerating +- Uses Mintlify scraping to generate MDX files for each endpoint +- Provides detailed console output showing what was filtered + +## Requirements + +- Node.js and npm/npx +- Internet connection (to download @mintlify/scraping package) +- Valid OpenAPI 3.x specification file + +## Integration with existing workflow + +You can replace the existing `./bin/generate-api.sh` call in your build process with: + +```bash +# Old way (includes internal/admin APIs) +./bin/generate-api.sh + +# New way (excludes internal/admin APIs) +./bin/generate-filtered-api.sh +``` + +## Troubleshooting + +If you encounter errors: + +1. **"OpenAPI source file not found"**: Ensure the file path is correct +2. **"Node.js is required"**: Install Node.js from https://nodejs.org +3. **Network errors**: Check internet connection for npm package downloads +4. **Permission errors**: Ensure the script is executable (`chmod +x bin/generate-filtered-api.sh`) \ No newline at end of file diff --git a/bin/generate-api.sh b/bin/generate-api.sh index 1baa1ec..4f04f81 100755 --- a/bin/generate-api.sh +++ b/bin/generate-api.sh @@ -1,4 +1,4 @@ #! /bin/bash echo "Generating from Mintlify scraping" -npx @mintlify/scraping@latest openapi-file openapi.yaml -o api-reference +npx @mintlify/scraping@latest openapi-file ../openapi.yaml -o api-reference diff --git a/bin/generate-auto-grouped-api.sh b/bin/generate-auto-grouped-api.sh new file mode 100755 index 0000000..4bc09f6 --- /dev/null +++ b/bin/generate-auto-grouped-api.sh @@ -0,0 +1,275 @@ +#!/bin/bash + +set -euo pipefail + +# Colors for output +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +NC='\033[0m' # No Color + +# Configuration +OPENAPI_SOURCE="${1:-/Users/nikhil/Downloads/openapi.yaml}" +FILTERED_OPENAPI="openapi.yaml" +OUTPUT_DIR="api-reference" +MINT_CONFIG="mint.json" + +echo -e "${GREEN}[INFO]${NC} Starting auto-grouped API documentation generation..." + +# Check if source OpenAPI file exists +if [[ ! -f "$OPENAPI_SOURCE" ]]; then + echo -e "${RED}[ERROR]${NC} OpenAPI source file '$OPENAPI_SOURCE' not found!" + echo "Usage: $0 [openapi-file-path]" + echo "Default: $0 /Users/nikhil/Downloads/openapi.yaml" + exit 1 +fi + +echo -e "${GREEN}[INFO]${NC} Using OpenAPI source: $OPENAPI_SOURCE" + +# Check if required tools are installed +command -v node >/dev/null 2>&1 || { echo -e "${RED}[ERROR]${NC} Node.js is required but not installed. Aborting." >&2; exit 1; } +command -v npx >/dev/null 2>&1 || { echo -e "${RED}[ERROR]${NC} npx is required but not installed. Aborting." >&2; exit 1; } + +# Create a Node.js script to filter and auto-generate navigation +echo -e "${YELLOW}[STEP 1]${NC} Creating OpenAPI auto-generation script..." + +cat > auto_generate_navigation.js << 'EOF' +const fs = require('fs'); +const yaml = require('js-yaml'); + +function generateFilteredAPIAndNavigation(inputFile, outputApiFile, mintConfigFile) { + try { + // Read and parse the OpenAPI file + const fileContents = fs.readFileSync(inputFile, 'utf8'); + const openApiSpec = yaml.load(fileContents); + + console.log(`📖 Loaded OpenAPI spec with ${Object.keys(openApiSpec.paths || {}).length} total paths`); + + // Read existing mint.json + const mintConfig = JSON.parse(fs.readFileSync(mintConfigFile, 'utf8')); + + // Track filtered endpoints and group by tags + let filteredCount = 0; + const tagGroups = {}; + const ungroupedEndpoints = []; + + // Filter paths and group by tags + const filteredPaths = {}; + + for (const [path, pathItem] of Object.entries(openApiSpec.paths || {})) { + let shouldInclude = true; + + // Skip admin paths + if (path.startsWith('/v1/admin/')) { + console.log(`🚫 Filtering admin path: ${path}`); + shouldInclude = false; + filteredCount++; + } + + // Check each HTTP method in the path + if (shouldInclude) { + const filteredMethods = {}; + + for (const [method, operation] of Object.entries(pathItem)) { + if (typeof operation !== 'object' || operation === null) { + filteredMethods[method] = operation; + continue; + } + + let includeMethod = true; + + // Check for internal tag + if (operation.tags && operation.tags.includes('internal')) { + console.log(`🚫 Filtering internal tagged endpoint: ${method.toUpperCase()} ${path}`); + includeMethod = false; + filteredCount++; + } + + if (includeMethod) { + filteredMethods[method] = operation; + + // Group by primary tag for navigation + const primaryTag = operation.tags && operation.tags[0]; + if (primaryTag && primaryTag !== 'internal') { + if (!tagGroups[primaryTag]) { + tagGroups[primaryTag] = []; + } + + // Generate file path (this matches what @mintlify/scraping generates) + const operationId = operation.operationId || `${method}-${path.replace(/\//g, '-').replace(/[{}]/g, '')}`; + const summary = operation.summary || `${method.toUpperCase()} ${path}`; + + // Convert operationId to kebab-case filename + const fileName = operationId.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); + const filePath = `api-reference/${primaryTag}/${fileName}`; + + tagGroups[primaryTag].push({ + path: filePath, + method: method.toUpperCase(), + endpoint: path, + summary: summary + }); + } else { + ungroupedEndpoints.push({ + method: method.toUpperCase(), + endpoint: path, + summary: operation.summary || `${method.toUpperCase()} ${path}` + }); + } + } + } + + // Only include path if it has at least one method left + if (Object.keys(filteredMethods).length > 0) { + filteredPaths[path] = filteredMethods; + } + } + } + + // Update the OpenAPI spec with filtered paths + openApiSpec.paths = filteredPaths; + + // Write the filtered OpenAPI spec + const filteredYaml = yaml.dump(openApiSpec, { + lineWidth: -1, + noArrayIndent: true, + quotingType: '"', + forceQuotes: false + }); + + fs.writeFileSync(outputApiFile, filteredYaml, 'utf8'); + console.log(`✅ Filtered OpenAPI spec written to: ${outputApiFile}`); + + // Define logical group mappings and order + const logicalGroups = { + 'Assets': ['assets', 'enumerations'], + 'Templates': ['templates', 'template/v2'], + 'Scans': ['scans'], + 'Results': ['results', 'retests'], + 'Configurations': ['configurations'], + 'Users': ['users', 'user'], + 'Logs': ['elog', 'scan_log'], + 'Export': ['export'], + 'Automations': ['automations'], + 'Integration': ['oauth'], + 'Utilities': ['chaos', 'vulns', 'leaks', 'billing', 'usage'] + }; + + // Generate new navigation structure + const newGroups = []; + + // Add introduction + newGroups.push("api-reference/introduction"); + + // Process each logical group + for (const [groupName, tagNames] of Object.entries(logicalGroups)) { + const groupPages = []; + + for (const tagName of tagNames) { + if (tagGroups[tagName]) { + // Sort endpoints within each tag alphabetically by summary + tagGroups[tagName].sort((a, b) => a.summary.localeCompare(b.summary)); + groupPages.push(...tagGroups[tagName].map(item => item.path)); + + console.log(`📁 ${groupName} (${tagName}): ${tagGroups[tagName].length} endpoints`); + } + } + + if (groupPages.length > 0) { + newGroups.push({ + group: groupName, + pages: groupPages + }); + } + } + + // Handle any ungrouped endpoints + const ungroupedPages = []; + for (const [tagName, endpoints] of Object.entries(tagGroups)) { + const isGrouped = Object.values(logicalGroups).some(tags => tags.includes(tagName)); + if (!isGrouped) { + console.log(`❓ Ungrouped tag "${tagName}": ${endpoints.length} endpoints`); + ungroupedPages.push(...endpoints.map(item => item.path)); + } + } + + if (ungroupedPages.length > 0) { + newGroups.push({ + group: "Other", + pages: ungroupedPages + }); + } + + // Update mint.json navigation + // Find the API Reference group and replace it + let updated = false; + for (let i = 0; i < mintConfig.navigation.length; i++) { + if (mintConfig.navigation[i].group === "API Reference") { + mintConfig.navigation[i].pages = newGroups; + updated = true; + break; + } + } + + if (!updated) { + console.log("⚠️ API Reference group not found in mint.json"); + } + + // Write updated mint.json + fs.writeFileSync(mintConfigFile, JSON.stringify(mintConfig, null, 2), 'utf8'); + console.log(`✅ Updated navigation in: ${mintConfigFile}`); + + console.log(`📊 Summary: ${filteredCount} endpoints filtered, ${Object.keys(filteredPaths).length} paths remaining`); + console.log(`📁 Created ${newGroups.length - 1} logical groups`); // -1 for introduction + + return true; + } catch (error) { + console.error('❌ Error:', error.message); + return false; + } +} + +// Get command line arguments +const inputFile = process.argv[2]; +const outputApiFile = process.argv[3]; +const mintConfigFile = process.argv[4]; + +if (!inputFile || !outputApiFile || !mintConfigFile) { + console.error('Usage: node auto_generate_navigation.js '); + process.exit(1); +} + +// Run the generator +const success = generateFilteredAPIAndNavigation(inputFile, outputApiFile, mintConfigFile); +process.exit(success ? 0 : 1); +EOF + +# Install js-yaml if not already installed +echo -e "${YELLOW}[STEP 2]${NC} Installing dependencies..." +if ! npm list js-yaml >/dev/null 2>&1; then + npm install js-yaml +fi + +# Run the auto-generation script +echo -e "${YELLOW}[STEP 3]${NC} Auto-generating navigation structure..." +node auto_generate_navigation.js "$OPENAPI_SOURCE" "$FILTERED_OPENAPI" "$MINT_CONFIG" + +if [[ ! -f "$FILTERED_OPENAPI" ]]; then + echo -e "${RED}[ERROR]${NC} Failed to create filtered OpenAPI file!" + exit 1 +fi + +# Generate API documentation using Mintlify scraping +echo -e "${YELLOW}[STEP 4]${NC} Generating API documentation with Mintlify..." +npx @mintlify/scraping@latest openapi-file "$FILTERED_OPENAPI" -o "$OUTPUT_DIR" + +# Clean up temporary files +echo -e "${YELLOW}[STEP 5]${NC} Cleaning up temporary files..." +rm -f auto_generate_navigation.js + +echo -e "${GREEN}[SUCCESS]${NC} Auto-grouped API documentation generated successfully!" +echo -e "${GREEN}[INFO]${NC} Documentation available in: $OUTPUT_DIR" +echo -e "${GREEN}[INFO]${NC} Navigation automatically updated in: $MINT_CONFIG" +echo -e "${GREEN}[INFO]${NC} All endpoints are now auto-grouped by logical categories!" +echo -e "${BLUE}[NEXT]${NC} Run 'mintlify dev' to preview your documentation" \ No newline at end of file diff --git a/bin/generate-filtered-api.sh b/bin/generate-filtered-api.sh new file mode 100755 index 0000000..8cae1e5 --- /dev/null +++ b/bin/generate-filtered-api.sh @@ -0,0 +1,171 @@ +#!/bin/bash + +set -euo pipefail + +# Colors for output +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +NC='\033[0m' # No Color + +# Configuration +OPENAPI_SOURCE="${1:-/Users/nikhil/Downloads/openapi.yaml}" +FILTERED_OPENAPI="openapi.yaml" +OUTPUT_DIR="api-reference" + +echo -e "${GREEN}[INFO]${NC} Starting filtered API documentation generation..." + +# Check if source OpenAPI file exists +if [[ ! -f "$OPENAPI_SOURCE" ]]; then + echo -e "${RED}[ERROR]${NC} OpenAPI source file '$OPENAPI_SOURCE' not found!" + echo "Usage: $0 [openapi-file-path]" + echo "Default: $0 /Users/nikhil/Downloads/openapi.yaml" + exit 1 +fi + +echo -e "${GREEN}[INFO]${NC} Using OpenAPI source: $OPENAPI_SOURCE" + +# Check if required tools are installed +command -v node >/dev/null 2>&1 || { echo -e "${RED}[ERROR]${NC} Node.js is required but not installed. Aborting." >&2; exit 1; } +command -v npx >/dev/null 2>&1 || { echo -e "${RED}[ERROR]${NC} npx is required but not installed. Aborting." >&2; exit 1; } + +# Create a Node.js script to filter the OpenAPI spec +echo -e "${YELLOW}[STEP 1]${NC} Creating OpenAPI filter script..." + +cat > filter_openapi.js << 'EOF' +const fs = require('fs'); +const yaml = require('js-yaml'); + +function filterOpenAPI(inputFile, outputFile) { + try { + // Read and parse the OpenAPI file + const fileContents = fs.readFileSync(inputFile, 'utf8'); + const openApiSpec = yaml.load(fileContents); + + console.log(`📖 Loaded OpenAPI spec with ${Object.keys(openApiSpec.paths || {}).length} total paths`); + + // Track filtered endpoints + let filteredCount = 0; + let totalCount = 0; + + // Filter paths + const filteredPaths = {}; + + for (const [path, pathItem] of Object.entries(openApiSpec.paths || {})) { + totalCount++; + let shouldInclude = true; + + // Skip admin paths + if (path.startsWith('/v1/admin/')) { + console.log(`🚫 Filtering admin path: ${path}`); + shouldInclude = false; + filteredCount++; + } + + // Check each HTTP method in the path + if (shouldInclude) { + const filteredMethods = {}; + + for (const [method, operation] of Object.entries(pathItem)) { + if (typeof operation !== 'object' || operation === null) { + filteredMethods[method] = operation; + continue; + } + + let includeMethod = true; + + // Check for internal tag + if (operation.tags && operation.tags.includes('internal')) { + console.log(`🚫 Filtering internal tagged endpoint: ${method.toUpperCase()} ${path}`); + includeMethod = false; + filteredCount++; + } + + if (includeMethod) { + filteredMethods[method] = operation; + } + } + + // Only include path if it has at least one method left + if (Object.keys(filteredMethods).length > 0) { + filteredPaths[path] = filteredMethods; + } + } + } + + // Update the spec with filtered paths + openApiSpec.paths = filteredPaths; + + // Write the filtered spec + const filteredYaml = yaml.dump(openApiSpec, { + lineWidth: -1, + noArrayIndent: true, + quotingType: '"', + forceQuotes: false + }); + + fs.writeFileSync(outputFile, filteredYaml, 'utf8'); + + console.log(`✅ Filtered OpenAPI spec written to: ${outputFile}`); + console.log(`📊 Summary: ${filteredCount} endpoints filtered, ${Object.keys(filteredPaths).length} paths remaining`); + + return true; + } catch (error) { + console.error('❌ Error filtering OpenAPI spec:', error.message); + return false; + } +} + +// Get command line arguments +const inputFile = process.argv[2]; +const outputFile = process.argv[3]; + +if (!inputFile || !outputFile) { + console.error('Usage: node filter_openapi.js '); + process.exit(1); +} + +// Run the filter +const success = filterOpenAPI(inputFile, outputFile); +process.exit(success ? 0 : 1); +EOF + +# Install js-yaml if not already installed +echo -e "${YELLOW}[STEP 2]${NC} Installing dependencies..." +if ! npm list js-yaml >/dev/null 2>&1; then + npm install js-yaml +fi + +# Run the filter script +echo -e "${YELLOW}[STEP 3]${NC} Filtering OpenAPI specification..." +node filter_openapi.js "$OPENAPI_SOURCE" "$FILTERED_OPENAPI" + +if [[ ! -f "$FILTERED_OPENAPI" ]]; then + echo -e "${RED}[ERROR]${NC} Failed to create filtered OpenAPI file!" + exit 1 +fi + +# Remove existing internal and admin directories from api-reference +echo -e "${YELLOW}[STEP 4]${NC} Cleaning up existing internal/admin documentation..." +if [[ -d "$OUTPUT_DIR/internal" ]]; then + echo "🗑️ Removing existing internal API docs..." + rm -rf "$OUTPUT_DIR/internal" +fi + +if [[ -d "$OUTPUT_DIR/admin" ]]; then + echo "🗑️ Removing existing admin API docs..." + rm -rf "$OUTPUT_DIR/admin" +fi + +# Generate API documentation using Mintlify scraping +echo -e "${YELLOW}[STEP 5]${NC} Generating API documentation with Mintlify..." +npx @mintlify/scraping@latest openapi-file "$FILTERED_OPENAPI" -o "$OUTPUT_DIR" + +# Clean up temporary files +echo -e "${YELLOW}[STEP 6]${NC} Cleaning up temporary files..." +rm -f filter_openapi.js + +echo -e "${GREEN}[SUCCESS]${NC} Filtered API documentation generated successfully!" +echo -e "${GREEN}[INFO]${NC} Documentation available in: $OUTPUT_DIR" +echo -e "${GREEN}[INFO]${NC} Filtered OpenAPI spec saved as: $FILTERED_OPENAPI" +echo -e "${GREEN}[INFO]${NC} Admin APIs (/v1/admin/*) and internal tagged endpoints have been excluded from the build" \ No newline at end of file diff --git a/bin/generate-smart-grouped-api.sh b/bin/generate-smart-grouped-api.sh new file mode 100755 index 0000000..5e3106b --- /dev/null +++ b/bin/generate-smart-grouped-api.sh @@ -0,0 +1,306 @@ +#!/bin/bash + +set -euo pipefail + +# Colors for output +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +NC='\033[0m' # No Color + +# Configuration +OPENAPI_SOURCE="${1:-/Users/nikhil/Downloads/openapi.yaml}" +FILTERED_OPENAPI="openapi.yaml" +OUTPUT_DIR="api-reference" +MINT_CONFIG="mint.json" + +echo -e "${GREEN}[INFO]${NC} Starting smart auto-grouped API documentation generation..." + +# Check if source OpenAPI file exists +if [[ ! -f "$OPENAPI_SOURCE" ]]; then + echo -e "${RED}[ERROR]${NC} OpenAPI source file '$OPENAPI_SOURCE' not found!" + echo "Usage: $0 [openapi-file-path]" + echo "Default: $0 /Users/nikhil/Downloads/openapi.yaml" + exit 1 +fi + +echo -e "${GREEN}[INFO]${NC} Using OpenAPI source: $OPENAPI_SOURCE" + +# Check if required tools are installed +command -v node >/dev/null 2>&1 || { echo -e "${RED}[ERROR]${NC} Node.js is required but not installed. Aborting." >&2; exit 1; } +command -v npx >/dev/null 2>&1 || { echo -e "${RED}[ERROR]${NC} npx is required but not installed. Aborting." >&2; exit 1; } + +# Create a Node.js script to filter OpenAPI and later group files +echo -e "${YELLOW}[STEP 1]${NC} Creating OpenAPI filter script..." + +cat > filter_and_group.js << 'EOF' +const fs = require('fs'); +const yaml = require('js-yaml'); +const path = require('path'); + +function filterOpenAPI(inputFile, outputApiFile) { + try { + // Read and parse the OpenAPI file + const fileContents = fs.readFileSync(inputFile, 'utf8'); + const openApiSpec = yaml.load(fileContents); + + console.log(`📖 Loaded OpenAPI spec with ${Object.keys(openApiSpec.paths || {}).length} total paths`); + + // Track filtered endpoints + let filteredCount = 0; + + // Filter paths + const filteredPaths = {}; + + for (const [pathName, pathItem] of Object.entries(openApiSpec.paths || {})) { + let shouldInclude = true; + + // Skip admin paths + if (pathName.startsWith('/v1/admin/')) { + console.log(`🚫 Filtering admin path: ${pathName}`); + shouldInclude = false; + filteredCount++; + } + + // Check each HTTP method in the path + if (shouldInclude) { + const filteredMethods = {}; + + for (const [method, operation] of Object.entries(pathItem)) { + if (typeof operation !== 'object' || operation === null) { + filteredMethods[method] = operation; + continue; + } + + let includeMethod = true; + + // Check for internal tag + if (operation.tags && operation.tags.includes('internal')) { + console.log(`🚫 Filtering internal tagged endpoint: ${method.toUpperCase()} ${pathName}`); + includeMethod = false; + filteredCount++; + } + + if (includeMethod) { + filteredMethods[method] = operation; + } + } + + // Only include path if it has at least one method left + if (Object.keys(filteredMethods).length > 0) { + filteredPaths[pathName] = filteredMethods; + } + } + } + + // Update the spec with filtered paths + openApiSpec.paths = filteredPaths; + + // Write the filtered spec + const filteredYaml = yaml.dump(openApiSpec, { + lineWidth: -1, + noArrayIndent: true, + quotingType: '"', + forceQuotes: false + }); + + fs.writeFileSync(outputApiFile, filteredYaml, 'utf8'); + console.log(`✅ Filtered OpenAPI spec written to: ${outputApiFile}`); + console.log(`📊 Summary: ${filteredCount} endpoints filtered, ${Object.keys(filteredPaths).length} paths remaining`); + + return true; + } catch (error) { + console.error('❌ Error filtering OpenAPI spec:', error.message); + return false; + } +} + +function groupGeneratedFiles(apiDir, mintConfigFile) { + try { + console.log(`📁 Reading generated files from: ${apiDir}`); + + // Read existing mint.json + const mintConfig = JSON.parse(fs.readFileSync(mintConfigFile, 'utf8')); + + // Define logical group mappings + const logicalGroups = { + 'Assets': ['assets', 'enumerations', 'asset', 'enumeration'], + 'Templates': ['templates', 'templatev2'], + 'Scans': ['scans', 'scan'], + 'Results': ['results', 'retests'], + 'Configurations': ['configurations'], + 'Users': ['users', 'user'], + 'Logs': ['elog', 'scan_log', 'history'], + 'Export': ['export'], + 'Automations': ['automations'], + 'Integration': ['oauth'], + 'Utilities': ['chaos', 'vulns', 'leaks', 'billing', 'usage'] + }; + + // Recursively find all MDX files + function findMdxFiles(dir, basePath = '') { + const files = []; + const items = fs.readdirSync(dir); + + for (const item of items) { + const fullPath = path.join(dir, item); + const relativePath = basePath ? `${basePath}/${item}` : item; + + if (fs.statSync(fullPath).isDirectory()) { + files.push(...findMdxFiles(fullPath, relativePath)); + } else if (item.endsWith('.mdx')) { + files.push(relativePath.replace('.mdx', '')); + } + } + + return files; + } + + // Get all generated MDX files + const allFiles = findMdxFiles(apiDir); + console.log(`📄 Found ${allFiles.length} generated MDX files`); + + // Group files by their directory (which corresponds to OpenAPI tags) + const groupedFiles = {}; + const ungroupedFiles = []; + + for (const file of allFiles) { + if (file === 'introduction') { + continue; // Skip introduction file + } + + const parts = file.split('/'); + if (parts.length >= 2) { + const directory = parts[0]; + const filePath = `api-reference/${file}`; + + // Find which logical group this directory belongs to + let assignedGroup = null; + for (const [groupName, directories] of Object.entries(logicalGroups)) { + if (directories.includes(directory)) { + assignedGroup = groupName; + break; + } + } + + if (assignedGroup) { + if (!groupedFiles[assignedGroup]) { + groupedFiles[assignedGroup] = []; + } + groupedFiles[assignedGroup].push(filePath); + } else { + console.log(`❓ Ungrouped directory "${directory}": ${filePath}`); + ungroupedFiles.push(filePath); + } + } else { + ungroupedFiles.push(`api-reference/${file}`); + } + } + + // Generate new navigation structure + const newGroups = []; + + // Add introduction + newGroups.push("api-reference/introduction"); + + // Add grouped files + for (const [groupName, files] of Object.entries(groupedFiles)) { + if (files.length > 0) { + // Sort files alphabetically + files.sort(); + newGroups.push({ + group: groupName, + pages: files + }); + console.log(`📁 ${groupName}: ${files.length} endpoints`); + } + } + + // Add ungrouped files if any + if (ungroupedFiles.length > 0) { + ungroupedFiles.sort(); + newGroups.push({ + group: "Other", + pages: ungroupedFiles + }); + console.log(`📁 Other: ${ungroupedFiles.length} endpoints`); + } + + // Update mint.json navigation + let updated = false; + for (let i = 0; i < mintConfig.navigation.length; i++) { + if (mintConfig.navigation[i].group === "API Reference") { + mintConfig.navigation[i].pages = newGroups; + updated = true; + break; + } + } + + if (!updated) { + console.log("⚠️ API Reference group not found in mint.json"); + } + + // Write updated mint.json + fs.writeFileSync(mintConfigFile, JSON.stringify(mintConfig, null, 2), 'utf8'); + console.log(`✅ Updated navigation in: ${mintConfigFile}`); + console.log(`📁 Created ${newGroups.length - 1} logical groups`); // -1 for introduction + + return true; + } catch (error) { + console.error('❌ Error grouping files:', error.message); + return false; + } +} + +// Get command line arguments +const action = process.argv[2]; + +if (action === 'filter') { + const inputFile = process.argv[3]; + const outputFile = process.argv[4]; + const success = filterOpenAPI(inputFile, outputFile); + process.exit(success ? 0 : 1); +} else if (action === 'group') { + const apiDir = process.argv[3]; + const mintConfigFile = process.argv[4]; + const success = groupGeneratedFiles(apiDir, mintConfigFile); + process.exit(success ? 0 : 1); +} else { + console.error('Usage: node filter_and_group.js [args...]'); + process.exit(1); +} +EOF + +# Install js-yaml if not already installed +echo -e "${YELLOW}[STEP 2]${NC} Installing dependencies..." +if ! npm list js-yaml >/dev/null 2>&1; then + npm install js-yaml +fi + +# Step 1: Filter OpenAPI +echo -e "${YELLOW}[STEP 3]${NC} Filtering OpenAPI specification..." +node filter_and_group.js filter "$OPENAPI_SOURCE" "$FILTERED_OPENAPI" + +if [[ ! -f "$FILTERED_OPENAPI" ]]; then + echo -e "${RED}[ERROR]${NC} Failed to create filtered OpenAPI file!" + exit 1 +fi + +# Step 2: Generate API documentation using Mintlify scraping +echo -e "${YELLOW}[STEP 4]${NC} Generating API documentation with Mintlify..." +npx @mintlify/scraping@latest openapi-file "$FILTERED_OPENAPI" -o "$OUTPUT_DIR" + +# Step 3: Read actual generated files and create navigation +echo -e "${YELLOW}[STEP 5]${NC} Creating navigation based on actual generated files..." +node filter_and_group.js group "$OUTPUT_DIR" "$MINT_CONFIG" + +# Clean up temporary files +echo -e "${YELLOW}[STEP 6]${NC} Cleaning up temporary files..." +rm -f filter_and_group.js + +echo -e "${GREEN}[SUCCESS]${NC} Smart auto-grouped API documentation generated successfully!" +echo -e "${GREEN}[INFO]${NC} Documentation available in: $OUTPUT_DIR" +echo -e "${GREEN}[INFO]${NC} Navigation automatically updated in: $MINT_CONFIG" +echo -e "${GREEN}[INFO]${NC} All endpoints grouped based on actual generated files!" +echo -e "${BLUE}[NEXT]${NC} Run 'mintlify dev' to preview your documentation" \ No newline at end of file diff --git a/mint.json b/mint.json index c1f0450..5d10b18 100644 --- a/mint.json +++ b/mint.json @@ -91,7 +91,9 @@ "navigation": [ { "group": "Home", - "pages": ["home"] + "pages": [ + "home" + ] }, { "group": "Quick Start", @@ -447,133 +449,142 @@ { "group": "Assets", "pages": [ - "api-reference/enumerations/get-enumeration-list", - "api-reference/enumerations/create-enumeration", - "api-reference/enumerations/get-enumeration", - "api-reference/enumerations/delete-enumeration", - "api-reference/enumerations/delete-assets-in-bulk", - "api-reference/enumerations/update-enumeration", - "api-reference/enumerations/get-enumeration-contents", - "api-reference/enumerations/get-all-enumeration-contents", - "api-reference/enumerations/stop-enumeration", - "api-reference/enumerations/rescan-enumeration", - "api-reference/enumerations/export-enumeration", - "api-reference/update-enumeration-config", - "api-reference/enumerations/get-enumeration-schedules", - "api-reference/enumerations/set-enumeration-schedule", - "api-reference/enumerations/delete-enumeration-schedule", - "api-reference/enumerations/get-enumeration-stats", - "api-reference/enumerations/get-all-enumeration-stats", - "api-reference/enumerations/get-enumeration-config", - "api-reference/enumerations/group-assets-by-filters", - "api-reference/enumerations/group-assets-by-filters-for-an-enumeration", - "api-reference/enumerations/export-enumeration-of-user", - "api-reference/assets/upload-asset", - "api-reference/assets/update-asset-content", - "api-reference/assets/get-asset-metadata", - "api-reference/assets/get-asset-content", - "api-reference/assets/delete-asset" + "api-reference/asset/export-enumeration-domains", + "api-reference/assets/get-asset-changelogs-for-a-given-asset_id", + "api-reference/assets/create-an-asset-group", + "api-reference/assets/create-enumeration", + "api-reference/assets/delete-assets-in-bulk", + "api-reference/assets/delete-enumeration", + "api-reference/assets/delete-enumeration-schedule", + "api-reference/assets/export-enumeration", + "api-reference/assets/export-enumeration-of-user", + "api-reference/assets/get-enumeration", + "api-reference/assets/get-enumeration-config", + "api-reference/assets/get-enumeration-list", + "api-reference/assets/get-enumeration-schedules", + "api-reference/assets/rescan-enumeration", + "api-reference/assets/set-enumeration-schedule", + "api-reference/assets/update-an-asset-group", + "api-reference/assets/update-enumeration" ] }, { - "group": "Templates", + "group": "Configurations", "pages": [ - "api-reference/templates/get-public-template-list", - "api-reference/templates/get-early-template-list", - "api-reference/templates/get-early-template", - "api-reference/templates/get-public-template", - "api-reference/templates/get-template-list", - "api-reference/templates/create-template", - "api-reference/templates/update-template", - "api-reference/templates/get-template", - "api-reference/templates/delete-template", - "api-reference/templates/generate-ai-template", - "api-reference/templates/get-share-status", - "api-reference/templates/share-template", - "api-reference/templates/get-shared-template", - "api-reference/templates/get-github-template-list", - "api-reference/templates/get-github-template", - "api-reference/templates/get-public-template-stats" + "api-reference/configurations/add-config", + "api-reference/configurations/add-custom-severity-mapping", + "api-reference/configurations/add-excluded-templates-and-targets", + "api-reference/configurations/delete-config", + "api-reference/configurations/delete-custom-severity-mapping", + "api-reference/configurations/delete-excluded-templates-or-targets-by-ids", + "api-reference/configurations/get-config", + "api-reference/configurations/get-configs-list", + "api-reference/configurations/get-custom-severity-mappings", + "api-reference/configurations/get-excluded-templates", + "api-reference/configurations/modify-custom-severity-mapping", + "api-reference/configurations/update-config" ] }, { - "group": "Scans", + "group": "Export", "pages": [ - "api-reference/scans/get-scan-list", - "api-reference/scans/create-scan", - "api-reference/scans/get-scan", - "api-reference/scans/delete-scan", - "api-reference/scans/delete-scan-in-bulk", - "api-reference/scans/update-scan", - "api-reference/scans/import-oss-scan", - "api-reference/scans/stop-scan", - "api-reference/scans/rescan-scan", - "api-reference/scans/get-all-scan-stats", - "api-reference/scans/retest-vulnerability", - "api-reference/scans/get-scan-schedules", - "api-reference/scans/set-scan-schedule", - "api-reference/scans/delete-scan-schedule", - "api-reference/scans/get-scan-ips", - "api-reference/scans/update-imported-scan", - "api-reference/scans/export-scan", - "api-reference/scans/export-filtered-scan", - "api-reference/scans/export-scan-vulnerability", - "api-reference/scans/delete-scan-vulnerability", - "api-reference/scans/update-vulnerability-status", - "api-reference/scans/update-vulnerability-labels", - "api-reference/scans/get-scan-config", - "api-reference/scans/update-scan-config", - "api-reference/scans/get-all-scans-history", - "api-reference/scans/get-scan-history", - "api-reference/scans/create-vulns-export-to-tracker", - "api-reference/scans/get-scans-token" + "api-reference/export/export-filtered-scan-results" ] }, { - "group": "Configurations", + "group": "Logs", "pages": [ - "api-reference/configurations/get-configs-list", - "api-reference/configurations/add-config", - "api-reference/configurations/get-config", - "api-reference/configurations/delete-config", - "api-reference/configurations/update-config", - "api-reference/configurations/get-excluded-templates", - "api-reference/configurations/add-excluded-templates", - "api-reference/configurations/delete-excluded-template-ids" + "api-reference/history/get-scan-log-stats-of-given-scan-id", + "api-reference/scan_log/export-scan-log-of-given-scan-id" ] }, { "group": "Results", "pages": [ + "api-reference/results/get-all-vulnerability-changelogs", "api-reference/results/get-scan-vulnerability", - "api-reference/results/get-scan-results", - "api-reference/results/get-all-results", - "api-reference/results/get-scans-result-filters", - "api-reference/results/get-results-stats" + "api-reference/results/get-vulnerability-changelogs", + "api-reference/retests/get-retest-vulnerability" ] }, { - "group": "Logs", + "group": "Scans", "pages": [ - "api-reference/elog/get-elogs-of-given-scan-id", - "api-reference/scan_log/get-scan-log-of-given-scan-id", - "api-reference/get-audit-logs-for-team" + "api-reference/scans/create-scan", + "api-reference/scans/delete-scan", + "api-reference/scans/delete-scan-in-bulk", + "api-reference/scans/delete-scan-schedule", + "api-reference/scans/delete-scan-vulnerability", + "api-reference/scans/export-filtered-scan", + "api-reference/scans/export-scan", + "api-reference/scans/export-scan-assets", + "api-reference/scans/export-scan-vulnerability", + "api-reference/scans/get-all-scans-history", + "api-reference/scans/get-scan", + "api-reference/scans/get-scan-config", + "api-reference/scans/get-scan-history", + "api-reference/scans/get-scan-ips", + "api-reference/scans/get-scan-list", + "api-reference/scans/get-scan-schedules", + "api-reference/scans/import-oss-scan", + "api-reference/scans/rescan-scan", + "api-reference/scans/retest-vulnerability", + "api-reference/scans/set-scan-schedule", + "api-reference/scans/stop-scan", + "api-reference/scans/update-imported-scan", + "api-reference/scans/update-scan", + "api-reference/scans/update-scan-config", + "api-reference/scans/update-vulnerability-labels", + "api-reference/scans/update-vulnerability-status", + "api-reference/scans/vulnerability-search", + "api-reference/scans/get-vulnerability-by-id", + "api-reference/scans/get-vulnerability-filters" + ] + }, + { + "group": "Templates", + "pages": [ + "api-reference/templates/create-template", + "api-reference/templates/delete-template", + "api-reference/templates/generate-ai-template", + "api-reference/templates/get-early-template", + "api-reference/templates/get-early-template-list", + "api-reference/templates/get-public-template", + "api-reference/templates/get-public-template-list", + "api-reference/templates/get-shared-template", + "api-reference/templates/get-shared-template-list", + "api-reference/templates/get-template", + "api-reference/templates/get-template-list", + "api-reference/templates/share-template", + "api-reference/templates/update-template", + "api-reference/templatev2/search-templates" ] }, { "group": "Users", "pages": [ - "api-reference/users/get-user-profile", - "api-reference/users/get-api-key", "api-reference/users/create-api-key", "api-reference/users/delete-api-key", + "api-reference/users/get-api-key", + "api-reference/users/get-tunnels-list", "api-reference/users/rotate-api-key" ] }, { - "group": "Help", + "group": "Other", "pages": [ - "help/home" + "api-reference/full-text-search", + "api-reference/get-all-filters-for-vulnerabilities", + "api-reference/get-audit-logs-for-team", + "api-reference/get-enumeration-history", + "api-reference/get-vulnerability-by-id", + "api-reference/rename-tunnel", + "api-reference/unsharedelete-template", + "api-reference/update-enumeration-config", + "api-reference/update-shared-template", + "api-reference/domain-leak-detection", + "api-reference/email-leak-detection", + "api-reference/customer-domain-analysis" ] } ] diff --git a/node_modules/.bin/js-yaml b/node_modules/.bin/js-yaml new file mode 120000 index 0000000..9dbd010 --- /dev/null +++ b/node_modules/.bin/js-yaml @@ -0,0 +1 @@ +../js-yaml/bin/js-yaml.js \ No newline at end of file diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json index 3910c4c..06f41c0 100644 --- a/node_modules/.package-lock.json +++ b/node_modules/.package-lock.json @@ -12,6 +12,12 @@ "csstype": "^3.0.2" } }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "license": "Python-2.0" + }, "node_modules/clsx": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", @@ -27,6 +33,18 @@ "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==", "license": "MIT" }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, "node_modules/react": { "version": "19.0.0", "resolved": "https://registry.npmjs.org/react/-/react-19.0.0.tgz", diff --git a/node_modules/argparse/CHANGELOG.md b/node_modules/argparse/CHANGELOG.md new file mode 100644 index 0000000..dc39ed6 --- /dev/null +++ b/node_modules/argparse/CHANGELOG.md @@ -0,0 +1,216 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + + +## [2.0.1] - 2020-08-29 +### Fixed +- Fix issue with `process.argv` when used with interpreters (`coffee`, `ts-node`, etc.), #150. + + +## [2.0.0] - 2020-08-14 +### Changed +- Full rewrite. Now port from python 3.9.0 & more precise following. + See [doc](./doc) for difference and migration info. +- node.js 10+ required +- Removed most of local docs in favour of original ones. + + +## [1.0.10] - 2018-02-15 +### Fixed +- Use .concat instead of + for arrays, #122. + + +## [1.0.9] - 2016-09-29 +### Changed +- Rerelease after 1.0.8 - deps cleanup. + + +## [1.0.8] - 2016-09-29 +### Changed +- Maintenance (deps bump, fix node 6.5+ tests, coverage report). + + +## [1.0.7] - 2016-03-17 +### Changed +- Teach `addArgument` to accept string arg names. #97, @tomxtobin. + + +## [1.0.6] - 2016-02-06 +### Changed +- Maintenance: moved to eslint & updated CS. + + +## [1.0.5] - 2016-02-05 +### Changed +- Removed lodash dependency to significantly reduce install size. + Thanks to @mourner. + + +## [1.0.4] - 2016-01-17 +### Changed +- Maintenance: lodash update to 4.0.0. + + +## [1.0.3] - 2015-10-27 +### Fixed +- Fix parse `=` in args: `--examplepath="C:\myfolder\env=x64"`. #84, @CatWithApple. + + +## [1.0.2] - 2015-03-22 +### Changed +- Relaxed lodash version dependency. + + +## [1.0.1] - 2015-02-20 +### Changed +- Changed dependencies to be compatible with ancient nodejs. + + +## [1.0.0] - 2015-02-19 +### Changed +- Maintenance release. +- Replaced `underscore` with `lodash`. +- Bumped version to 1.0.0 to better reflect semver meaning. +- HISTORY.md -> CHANGELOG.md + + +## [0.1.16] - 2013-12-01 +### Changed +- Maintenance release. Updated dependencies and docs. + + +## [0.1.15] - 2013-05-13 +### Fixed +- Fixed #55, @trebor89 + + +## [0.1.14] - 2013-05-12 +### Fixed +- Fixed #62, @maxtaco + + +## [0.1.13] - 2013-04-08 +### Changed +- Added `.npmignore` to reduce package size + + +## [0.1.12] - 2013-02-10 +### Fixed +- Fixed conflictHandler (#46), @hpaulj + + +## [0.1.11] - 2013-02-07 +### Added +- Added 70+ tests (ported from python), @hpaulj +- Added conflictHandler, @applepicke +- Added fromfilePrefixChar, @hpaulj + +### Fixed +- Multiple bugfixes, @hpaulj + + +## [0.1.10] - 2012-12-30 +### Added +- Added [mutual exclusion](http://docs.python.org/dev/library/argparse.html#mutual-exclusion) + support, thanks to @hpaulj + +### Fixed +- Fixed options check for `storeConst` & `appendConst` actions, thanks to @hpaulj + + +## [0.1.9] - 2012-12-27 +### Fixed +- Fixed option dest interferens with other options (issue #23), thanks to @hpaulj +- Fixed default value behavior with `*` positionals, thanks to @hpaulj +- Improve `getDefault()` behavior, thanks to @hpaulj +- Improve negative argument parsing, thanks to @hpaulj + + +## [0.1.8] - 2012-12-01 +### Fixed +- Fixed parser parents (issue #19), thanks to @hpaulj +- Fixed negative argument parse (issue #20), thanks to @hpaulj + + +## [0.1.7] - 2012-10-14 +### Fixed +- Fixed 'choices' argument parse (issue #16) +- Fixed stderr output (issue #15) + + +## [0.1.6] - 2012-09-09 +### Fixed +- Fixed check for conflict of options (thanks to @tomxtobin) + + +## [0.1.5] - 2012-09-03 +### Fixed +- Fix parser #setDefaults method (thanks to @tomxtobin) + + +## [0.1.4] - 2012-07-30 +### Fixed +- Fixed pseudo-argument support (thanks to @CGamesPlay) +- Fixed addHelp default (should be true), if not set (thanks to @benblank) + + +## [0.1.3] - 2012-06-27 +### Fixed +- Fixed formatter api name: Formatter -> HelpFormatter + + +## [0.1.2] - 2012-05-29 +### Fixed +- Removed excess whitespace in help +- Fixed error reporting, when parcer with subcommands + called with empty arguments + +### Added +- Added basic tests + + +## [0.1.1] - 2012-05-23 +### Fixed +- Fixed line wrapping in help formatter +- Added better error reporting on invalid arguments + + +## [0.1.0] - 2012-05-16 +### Added +- First release. + + +[2.0.1]: https://github.com/nodeca/argparse/compare/2.0.0...2.0.1 +[2.0.0]: https://github.com/nodeca/argparse/compare/1.0.10...2.0.0 +[1.0.10]: https://github.com/nodeca/argparse/compare/1.0.9...1.0.10 +[1.0.9]: https://github.com/nodeca/argparse/compare/1.0.8...1.0.9 +[1.0.8]: https://github.com/nodeca/argparse/compare/1.0.7...1.0.8 +[1.0.7]: https://github.com/nodeca/argparse/compare/1.0.6...1.0.7 +[1.0.6]: https://github.com/nodeca/argparse/compare/1.0.5...1.0.6 +[1.0.5]: https://github.com/nodeca/argparse/compare/1.0.4...1.0.5 +[1.0.4]: https://github.com/nodeca/argparse/compare/1.0.3...1.0.4 +[1.0.3]: https://github.com/nodeca/argparse/compare/1.0.2...1.0.3 +[1.0.2]: https://github.com/nodeca/argparse/compare/1.0.1...1.0.2 +[1.0.1]: https://github.com/nodeca/argparse/compare/1.0.0...1.0.1 +[1.0.0]: https://github.com/nodeca/argparse/compare/0.1.16...1.0.0 +[0.1.16]: https://github.com/nodeca/argparse/compare/0.1.15...0.1.16 +[0.1.15]: https://github.com/nodeca/argparse/compare/0.1.14...0.1.15 +[0.1.14]: https://github.com/nodeca/argparse/compare/0.1.13...0.1.14 +[0.1.13]: https://github.com/nodeca/argparse/compare/0.1.12...0.1.13 +[0.1.12]: https://github.com/nodeca/argparse/compare/0.1.11...0.1.12 +[0.1.11]: https://github.com/nodeca/argparse/compare/0.1.10...0.1.11 +[0.1.10]: https://github.com/nodeca/argparse/compare/0.1.9...0.1.10 +[0.1.9]: https://github.com/nodeca/argparse/compare/0.1.8...0.1.9 +[0.1.8]: https://github.com/nodeca/argparse/compare/0.1.7...0.1.8 +[0.1.7]: https://github.com/nodeca/argparse/compare/0.1.6...0.1.7 +[0.1.6]: https://github.com/nodeca/argparse/compare/0.1.5...0.1.6 +[0.1.5]: https://github.com/nodeca/argparse/compare/0.1.4...0.1.5 +[0.1.4]: https://github.com/nodeca/argparse/compare/0.1.3...0.1.4 +[0.1.3]: https://github.com/nodeca/argparse/compare/0.1.2...0.1.3 +[0.1.2]: https://github.com/nodeca/argparse/compare/0.1.1...0.1.2 +[0.1.1]: https://github.com/nodeca/argparse/compare/0.1.0...0.1.1 +[0.1.0]: https://github.com/nodeca/argparse/releases/tag/0.1.0 diff --git a/node_modules/argparse/LICENSE b/node_modules/argparse/LICENSE new file mode 100644 index 0000000..66a3ac8 --- /dev/null +++ b/node_modules/argparse/LICENSE @@ -0,0 +1,254 @@ +A. HISTORY OF THE SOFTWARE +========================== + +Python was created in the early 1990s by Guido van Rossum at Stichting +Mathematisch Centrum (CWI, see http://www.cwi.nl) in the Netherlands +as a successor of a language called ABC. Guido remains Python's +principal author, although it includes many contributions from others. + +In 1995, Guido continued his work on Python at the Corporation for +National Research Initiatives (CNRI, see http://www.cnri.reston.va.us) +in Reston, Virginia where he released several versions of the +software. + +In May 2000, Guido and the Python core development team moved to +BeOpen.com to form the BeOpen PythonLabs team. In October of the same +year, the PythonLabs team moved to Digital Creations, which became +Zope Corporation. In 2001, the Python Software Foundation (PSF, see +https://www.python.org/psf/) was formed, a non-profit organization +created specifically to own Python-related Intellectual Property. +Zope Corporation was a sponsoring member of the PSF. + +All Python releases are Open Source (see http://www.opensource.org for +the Open Source Definition). Historically, most, but not all, Python +releases have also been GPL-compatible; the table below summarizes +the various releases. + + Release Derived Year Owner GPL- + from compatible? (1) + + 0.9.0 thru 1.2 1991-1995 CWI yes + 1.3 thru 1.5.2 1.2 1995-1999 CNRI yes + 1.6 1.5.2 2000 CNRI no + 2.0 1.6 2000 BeOpen.com no + 1.6.1 1.6 2001 CNRI yes (2) + 2.1 2.0+1.6.1 2001 PSF no + 2.0.1 2.0+1.6.1 2001 PSF yes + 2.1.1 2.1+2.0.1 2001 PSF yes + 2.1.2 2.1.1 2002 PSF yes + 2.1.3 2.1.2 2002 PSF yes + 2.2 and above 2.1.1 2001-now PSF yes + +Footnotes: + +(1) GPL-compatible doesn't mean that we're distributing Python under + the GPL. All Python licenses, unlike the GPL, let you distribute + a modified version without making your changes open source. The + GPL-compatible licenses make it possible to combine Python with + other software that is released under the GPL; the others don't. + +(2) According to Richard Stallman, 1.6.1 is not GPL-compatible, + because its license has a choice of law clause. According to + CNRI, however, Stallman's lawyer has told CNRI's lawyer that 1.6.1 + is "not incompatible" with the GPL. + +Thanks to the many outside volunteers who have worked under Guido's +direction to make these releases possible. + + +B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON +=============================================================== + +PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2 +-------------------------------------------- + +1. This LICENSE AGREEMENT is between the Python Software Foundation +("PSF"), and the Individual or Organization ("Licensee") accessing and +otherwise using this software ("Python") in source or binary form and +its associated documentation. + +2. Subject to the terms and conditions of this License Agreement, PSF hereby +grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, +analyze, test, perform and/or display publicly, prepare derivative works, +distribute, and otherwise use Python alone or in any derivative version, +provided, however, that PSF's License Agreement and PSF's notice of copyright, +i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, +2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Python Software Foundation; +All Rights Reserved" are retained in Python alone or in any derivative version +prepared by Licensee. + +3. In the event Licensee prepares a derivative work that is based on +or incorporates Python or any part thereof, and wants to make +the derivative work available to others as provided herein, then +Licensee hereby agrees to include in any such work a brief summary of +the changes made to Python. + +4. PSF is making Python available to Licensee on an "AS IS" +basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR +IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND +DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS +FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT +INFRINGE ANY THIRD PARTY RIGHTS. + +5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON +FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS +A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON, +OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. + +6. This License Agreement will automatically terminate upon a material +breach of its terms and conditions. + +7. Nothing in this License Agreement shall be deemed to create any +relationship of agency, partnership, or joint venture between PSF and +Licensee. This License Agreement does not grant permission to use PSF +trademarks or trade name in a trademark sense to endorse or promote +products or services of Licensee, or any third party. + +8. By copying, installing or otherwise using Python, Licensee +agrees to be bound by the terms and conditions of this License +Agreement. + + +BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0 +------------------------------------------- + +BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1 + +1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an +office at 160 Saratoga Avenue, Santa Clara, CA 95051, and the +Individual or Organization ("Licensee") accessing and otherwise using +this software in source or binary form and its associated +documentation ("the Software"). + +2. Subject to the terms and conditions of this BeOpen Python License +Agreement, BeOpen hereby grants Licensee a non-exclusive, +royalty-free, world-wide license to reproduce, analyze, test, perform +and/or display publicly, prepare derivative works, distribute, and +otherwise use the Software alone or in any derivative version, +provided, however, that the BeOpen Python License is retained in the +Software, alone or in any derivative version prepared by Licensee. + +3. BeOpen is making the Software available to Licensee on an "AS IS" +basis. BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR +IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND +DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS +FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT +INFRINGE ANY THIRD PARTY RIGHTS. + +4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE +SOFTWARE FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS +AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY +DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. + +5. This License Agreement will automatically terminate upon a material +breach of its terms and conditions. + +6. This License Agreement shall be governed by and interpreted in all +respects by the law of the State of California, excluding conflict of +law provisions. Nothing in this License Agreement shall be deemed to +create any relationship of agency, partnership, or joint venture +between BeOpen and Licensee. This License Agreement does not grant +permission to use BeOpen trademarks or trade names in a trademark +sense to endorse or promote products or services of Licensee, or any +third party. As an exception, the "BeOpen Python" logos available at +http://www.pythonlabs.com/logos.html may be used according to the +permissions granted on that web page. + +7. By copying, installing or otherwise using the software, Licensee +agrees to be bound by the terms and conditions of this License +Agreement. + + +CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1 +--------------------------------------- + +1. This LICENSE AGREEMENT is between the Corporation for National +Research Initiatives, having an office at 1895 Preston White Drive, +Reston, VA 20191 ("CNRI"), and the Individual or Organization +("Licensee") accessing and otherwise using Python 1.6.1 software in +source or binary form and its associated documentation. + +2. Subject to the terms and conditions of this License Agreement, CNRI +hereby grants Licensee a nonexclusive, royalty-free, world-wide +license to reproduce, analyze, test, perform and/or display publicly, +prepare derivative works, distribute, and otherwise use Python 1.6.1 +alone or in any derivative version, provided, however, that CNRI's +License Agreement and CNRI's notice of copyright, i.e., "Copyright (c) +1995-2001 Corporation for National Research Initiatives; All Rights +Reserved" are retained in Python 1.6.1 alone or in any derivative +version prepared by Licensee. Alternately, in lieu of CNRI's License +Agreement, Licensee may substitute the following text (omitting the +quotes): "Python 1.6.1 is made available subject to the terms and +conditions in CNRI's License Agreement. This Agreement together with +Python 1.6.1 may be located on the Internet using the following +unique, persistent identifier (known as a handle): 1895.22/1013. This +Agreement may also be obtained from a proxy server on the Internet +using the following URL: http://hdl.handle.net/1895.22/1013". + +3. In the event Licensee prepares a derivative work that is based on +or incorporates Python 1.6.1 or any part thereof, and wants to make +the derivative work available to others as provided herein, then +Licensee hereby agrees to include in any such work a brief summary of +the changes made to Python 1.6.1. + +4. CNRI is making Python 1.6.1 available to Licensee on an "AS IS" +basis. CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR +IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND +DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS +FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6.1 WILL NOT +INFRINGE ANY THIRD PARTY RIGHTS. + +5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON +1.6.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS +A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1, +OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. + +6. This License Agreement will automatically terminate upon a material +breach of its terms and conditions. + +7. This License Agreement shall be governed by the federal +intellectual property law of the United States, including without +limitation the federal copyright law, and, to the extent such +U.S. federal law does not apply, by the law of the Commonwealth of +Virginia, excluding Virginia's conflict of law provisions. +Notwithstanding the foregoing, with regard to derivative works based +on Python 1.6.1 that incorporate non-separable material that was +previously distributed under the GNU General Public License (GPL), the +law of the Commonwealth of Virginia shall govern this License +Agreement only as to issues arising under or with respect to +Paragraphs 4, 5, and 7 of this License Agreement. Nothing in this +License Agreement shall be deemed to create any relationship of +agency, partnership, or joint venture between CNRI and Licensee. This +License Agreement does not grant permission to use CNRI trademarks or +trade name in a trademark sense to endorse or promote products or +services of Licensee, or any third party. + +8. By clicking on the "ACCEPT" button where indicated, or by copying, +installing or otherwise using Python 1.6.1, Licensee agrees to be +bound by the terms and conditions of this License Agreement. + + ACCEPT + + +CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2 +-------------------------------------------------- + +Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam, +The Netherlands. All rights reserved. + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Stichting Mathematisch +Centrum or CWI not be used in advertising or publicity pertaining to +distribution of the software without specific, written prior +permission. + +STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO +THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE +FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/argparse/README.md b/node_modules/argparse/README.md new file mode 100644 index 0000000..550b5c9 --- /dev/null +++ b/node_modules/argparse/README.md @@ -0,0 +1,84 @@ +argparse +======== + +[![Build Status](https://secure.travis-ci.org/nodeca/argparse.svg?branch=master)](http://travis-ci.org/nodeca/argparse) +[![NPM version](https://img.shields.io/npm/v/argparse.svg)](https://www.npmjs.org/package/argparse) + +CLI arguments parser for node.js, with [sub-commands](https://docs.python.org/3.9/library/argparse.html#sub-commands) support. Port of python's [argparse](http://docs.python.org/dev/library/argparse.html) (version [3.9.0](https://github.com/python/cpython/blob/v3.9.0rc1/Lib/argparse.py)). + +**Difference with original.** + +- JS has no keyword arguments support. + - Pass options instead: `new ArgumentParser({ description: 'example', add_help: true })`. +- JS has no python's types `int`, `float`, ... + - Use string-typed names: `.add_argument('-b', { type: 'int', help: 'help' })`. +- `%r` format specifier uses `require('util').inspect()`. + +More details in [doc](./doc). + + +Example +------- + +`test.js` file: + +```javascript +#!/usr/bin/env node +'use strict'; + +const { ArgumentParser } = require('argparse'); +const { version } = require('./package.json'); + +const parser = new ArgumentParser({ + description: 'Argparse example' +}); + +parser.add_argument('-v', '--version', { action: 'version', version }); +parser.add_argument('-f', '--foo', { help: 'foo bar' }); +parser.add_argument('-b', '--bar', { help: 'bar foo' }); +parser.add_argument('--baz', { help: 'baz bar' }); + +console.dir(parser.parse_args()); +``` + +Display help: + +``` +$ ./test.js -h +usage: test.js [-h] [-v] [-f FOO] [-b BAR] [--baz BAZ] + +Argparse example + +optional arguments: + -h, --help show this help message and exit + -v, --version show program's version number and exit + -f FOO, --foo FOO foo bar + -b BAR, --bar BAR bar foo + --baz BAZ baz bar +``` + +Parse arguments: + +``` +$ ./test.js -f=3 --bar=4 --baz 5 +{ foo: '3', bar: '4', baz: '5' } +``` + + +API docs +-------- + +Since this is a port with minimal divergence, there's no separate documentation. +Use original one instead, with notes about difference. + +1. [Original doc](https://docs.python.org/3.9/library/argparse.html). +2. [Original tutorial](https://docs.python.org/3.9/howto/argparse.html). +3. [Difference with python](./doc). + + +argparse for enterprise +----------------------- + +Available as part of the Tidelift Subscription + +The maintainers of argparse and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-argparse?utm_source=npm-argparse&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) diff --git a/node_modules/argparse/argparse.js b/node_modules/argparse/argparse.js new file mode 100644 index 0000000..2b8c8c6 --- /dev/null +++ b/node_modules/argparse/argparse.js @@ -0,0 +1,3707 @@ +// Port of python's argparse module, version 3.9.0: +// https://github.com/python/cpython/blob/v3.9.0rc1/Lib/argparse.py + +'use strict' + +// Copyright (C) 2010-2020 Python Software Foundation. +// Copyright (C) 2020 argparse.js authors + +/* + * Command-line parsing library + * + * This module is an optparse-inspired command-line parsing library that: + * + * - handles both optional and positional arguments + * - produces highly informative usage messages + * - supports parsers that dispatch to sub-parsers + * + * The following is a simple usage example that sums integers from the + * command-line and writes the result to a file:: + * + * parser = argparse.ArgumentParser( + * description='sum the integers at the command line') + * parser.add_argument( + * 'integers', metavar='int', nargs='+', type=int, + * help='an integer to be summed') + * parser.add_argument( + * '--log', default=sys.stdout, type=argparse.FileType('w'), + * help='the file where the sum should be written') + * args = parser.parse_args() + * args.log.write('%s' % sum(args.integers)) + * args.log.close() + * + * The module contains the following public classes: + * + * - ArgumentParser -- The main entry point for command-line parsing. As the + * example above shows, the add_argument() method is used to populate + * the parser with actions for optional and positional arguments. Then + * the parse_args() method is invoked to convert the args at the + * command-line into an object with attributes. + * + * - ArgumentError -- The exception raised by ArgumentParser objects when + * there are errors with the parser's actions. Errors raised while + * parsing the command-line are caught by ArgumentParser and emitted + * as command-line messages. + * + * - FileType -- A factory for defining types of files to be created. As the + * example above shows, instances of FileType are typically passed as + * the type= argument of add_argument() calls. + * + * - Action -- The base class for parser actions. Typically actions are + * selected by passing strings like 'store_true' or 'append_const' to + * the action= argument of add_argument(). However, for greater + * customization of ArgumentParser actions, subclasses of Action may + * be defined and passed as the action= argument. + * + * - HelpFormatter, RawDescriptionHelpFormatter, RawTextHelpFormatter, + * ArgumentDefaultsHelpFormatter -- Formatter classes which + * may be passed as the formatter_class= argument to the + * ArgumentParser constructor. HelpFormatter is the default, + * RawDescriptionHelpFormatter and RawTextHelpFormatter tell the parser + * not to change the formatting for help text, and + * ArgumentDefaultsHelpFormatter adds information about argument defaults + * to the help. + * + * All other classes in this module are considered implementation details. + * (Also note that HelpFormatter and RawDescriptionHelpFormatter are only + * considered public as object names -- the API of the formatter objects is + * still considered an implementation detail.) + */ + +const SUPPRESS = '==SUPPRESS==' + +const OPTIONAL = '?' +const ZERO_OR_MORE = '*' +const ONE_OR_MORE = '+' +const PARSER = 'A...' +const REMAINDER = '...' +const _UNRECOGNIZED_ARGS_ATTR = '_unrecognized_args' + + +// ================================== +// Utility functions used for porting +// ================================== +const assert = require('assert') +const util = require('util') +const fs = require('fs') +const sub = require('./lib/sub') +const path = require('path') +const repr = util.inspect + +function get_argv() { + // omit first argument (which is assumed to be interpreter - `node`, `coffee`, `ts-node`, etc.) + return process.argv.slice(1) +} + +function get_terminal_size() { + return { + columns: +process.env.COLUMNS || process.stdout.columns || 80 + } +} + +function hasattr(object, name) { + return Object.prototype.hasOwnProperty.call(object, name) +} + +function getattr(object, name, value) { + return hasattr(object, name) ? object[name] : value +} + +function setattr(object, name, value) { + object[name] = value +} + +function setdefault(object, name, value) { + if (!hasattr(object, name)) object[name] = value + return object[name] +} + +function delattr(object, name) { + delete object[name] +} + +function range(from, to, step=1) { + // range(10) is equivalent to range(0, 10) + if (arguments.length === 1) [ to, from ] = [ from, 0 ] + if (typeof from !== 'number' || typeof to !== 'number' || typeof step !== 'number') { + throw new TypeError('argument cannot be interpreted as an integer') + } + if (step === 0) throw new TypeError('range() arg 3 must not be zero') + + let result = [] + if (step > 0) { + for (let i = from; i < to; i += step) result.push(i) + } else { + for (let i = from; i > to; i += step) result.push(i) + } + return result +} + +function splitlines(str, keepends = false) { + let result + if (!keepends) { + result = str.split(/\r\n|[\n\r\v\f\x1c\x1d\x1e\x85\u2028\u2029]/) + } else { + result = [] + let parts = str.split(/(\r\n|[\n\r\v\f\x1c\x1d\x1e\x85\u2028\u2029])/) + for (let i = 0; i < parts.length; i += 2) { + result.push(parts[i] + (i + 1 < parts.length ? parts[i + 1] : '')) + } + } + if (!result[result.length - 1]) result.pop() + return result +} + +function _string_lstrip(string, prefix_chars) { + let idx = 0 + while (idx < string.length && prefix_chars.includes(string[idx])) idx++ + return idx ? string.slice(idx) : string +} + +function _string_split(string, sep, maxsplit) { + let result = string.split(sep) + if (result.length > maxsplit) { + result = result.slice(0, maxsplit).concat([ result.slice(maxsplit).join(sep) ]) + } + return result +} + +function _array_equal(array1, array2) { + if (array1.length !== array2.length) return false + for (let i = 0; i < array1.length; i++) { + if (array1[i] !== array2[i]) return false + } + return true +} + +function _array_remove(array, item) { + let idx = array.indexOf(item) + if (idx === -1) throw new TypeError(sub('%r not in list', item)) + array.splice(idx, 1) +} + +// normalize choices to array; +// this isn't required in python because `in` and `map` operators work with anything, +// but in js dealing with multiple types here is too clunky +function _choices_to_array(choices) { + if (choices === undefined) { + return [] + } else if (Array.isArray(choices)) { + return choices + } else if (choices !== null && typeof choices[Symbol.iterator] === 'function') { + return Array.from(choices) + } else if (typeof choices === 'object' && choices !== null) { + return Object.keys(choices) + } else { + throw new Error(sub('invalid choices value: %r', choices)) + } +} + +// decorator that allows a class to be called without new +function _callable(cls) { + let result = { // object is needed for inferred class name + [cls.name]: function (...args) { + let this_class = new.target === result || !new.target + return Reflect.construct(cls, args, this_class ? cls : new.target) + } + } + result[cls.name].prototype = cls.prototype + // fix default tag for toString, e.g. [object Action] instead of [object Object] + cls.prototype[Symbol.toStringTag] = cls.name + return result[cls.name] +} + +function _alias(object, from, to) { + try { + let name = object.constructor.name + Object.defineProperty(object, from, { + value: util.deprecate(object[to], sub('%s.%s() is renamed to %s.%s()', + name, from, name, to)), + enumerable: false + }) + } catch {} +} + +// decorator that allows snake_case class methods to be called with camelCase and vice versa +function _camelcase_alias(_class) { + for (let name of Object.getOwnPropertyNames(_class.prototype)) { + let camelcase = name.replace(/\w_[a-z]/g, s => s[0] + s[2].toUpperCase()) + if (camelcase !== name) _alias(_class.prototype, camelcase, name) + } + return _class +} + +function _to_legacy_name(key) { + key = key.replace(/\w_[a-z]/g, s => s[0] + s[2].toUpperCase()) + if (key === 'default') key = 'defaultValue' + if (key === 'const') key = 'constant' + return key +} + +function _to_new_name(key) { + if (key === 'defaultValue') key = 'default' + if (key === 'constant') key = 'const' + key = key.replace(/[A-Z]/g, c => '_' + c.toLowerCase()) + return key +} + +// parse options +let no_default = Symbol('no_default_value') +function _parse_opts(args, descriptor) { + function get_name() { + let stack = new Error().stack.split('\n') + .map(x => x.match(/^ at (.*) \(.*\)$/)) + .filter(Boolean) + .map(m => m[1]) + .map(fn => fn.match(/[^ .]*$/)[0]) + + if (stack.length && stack[0] === get_name.name) stack.shift() + if (stack.length && stack[0] === _parse_opts.name) stack.shift() + return stack.length ? stack[0] : '' + } + + args = Array.from(args) + let kwargs = {} + let result = [] + let last_opt = args.length && args[args.length - 1] + + if (typeof last_opt === 'object' && last_opt !== null && !Array.isArray(last_opt) && + (!last_opt.constructor || last_opt.constructor.name === 'Object')) { + kwargs = Object.assign({}, args.pop()) + } + + // LEGACY (v1 compatibility): camelcase + let renames = [] + for (let key of Object.keys(descriptor)) { + let old_name = _to_legacy_name(key) + if (old_name !== key && (old_name in kwargs)) { + if (key in kwargs) { + // default and defaultValue specified at the same time, happens often in old tests + //throw new TypeError(sub('%s() got multiple values for argument %r', get_name(), key)) + } else { + kwargs[key] = kwargs[old_name] + } + renames.push([ old_name, key ]) + delete kwargs[old_name] + } + } + if (renames.length) { + let name = get_name() + deprecate('camelcase_' + name, sub('%s(): following options are renamed: %s', + name, renames.map(([ a, b ]) => sub('%r -> %r', a, b)))) + } + // end + + let missing_positionals = [] + let positional_count = args.length + + for (let [ key, def ] of Object.entries(descriptor)) { + if (key[0] === '*') { + if (key.length > 0 && key[1] === '*') { + // LEGACY (v1 compatibility): camelcase + let renames = [] + for (let key of Object.keys(kwargs)) { + let new_name = _to_new_name(key) + if (new_name !== key && (key in kwargs)) { + if (new_name in kwargs) { + // default and defaultValue specified at the same time, happens often in old tests + //throw new TypeError(sub('%s() got multiple values for argument %r', get_name(), new_name)) + } else { + kwargs[new_name] = kwargs[key] + } + renames.push([ key, new_name ]) + delete kwargs[key] + } + } + if (renames.length) { + let name = get_name() + deprecate('camelcase_' + name, sub('%s(): following options are renamed: %s', + name, renames.map(([ a, b ]) => sub('%r -> %r', a, b)))) + } + // end + result.push(kwargs) + kwargs = {} + } else { + result.push(args) + args = [] + } + } else if (key in kwargs && args.length > 0) { + throw new TypeError(sub('%s() got multiple values for argument %r', get_name(), key)) + } else if (key in kwargs) { + result.push(kwargs[key]) + delete kwargs[key] + } else if (args.length > 0) { + result.push(args.shift()) + } else if (def !== no_default) { + result.push(def) + } else { + missing_positionals.push(key) + } + } + + if (Object.keys(kwargs).length) { + throw new TypeError(sub('%s() got an unexpected keyword argument %r', + get_name(), Object.keys(kwargs)[0])) + } + + if (args.length) { + let from = Object.entries(descriptor).filter(([ k, v ]) => k[0] !== '*' && v !== no_default).length + let to = Object.entries(descriptor).filter(([ k ]) => k[0] !== '*').length + throw new TypeError(sub('%s() takes %s positional argument%s but %s %s given', + get_name(), + from === to ? sub('from %s to %s', from, to) : to, + from === to && to === 1 ? '' : 's', + positional_count, + positional_count === 1 ? 'was' : 'were')) + } + + if (missing_positionals.length) { + let strs = missing_positionals.map(repr) + if (strs.length > 1) strs[strs.length - 1] = 'and ' + strs[strs.length - 1] + let str_joined = strs.join(strs.length === 2 ? '' : ', ') + throw new TypeError(sub('%s() missing %i required positional argument%s: %s', + get_name(), strs.length, strs.length === 1 ? '' : 's', str_joined)) + } + + return result +} + +let _deprecations = {} +function deprecate(id, string) { + _deprecations[id] = _deprecations[id] || util.deprecate(() => {}, string) + _deprecations[id]() +} + + +// ============================= +// Utility functions and classes +// ============================= +function _AttributeHolder(cls = Object) { + /* + * Abstract base class that provides __repr__. + * + * The __repr__ method returns a string in the format:: + * ClassName(attr=name, attr=name, ...) + * The attributes are determined either by a class-level attribute, + * '_kwarg_names', or by inspecting the instance __dict__. + */ + + return class _AttributeHolder extends cls { + [util.inspect.custom]() { + let type_name = this.constructor.name + let arg_strings = [] + let star_args = {} + for (let arg of this._get_args()) { + arg_strings.push(repr(arg)) + } + for (let [ name, value ] of this._get_kwargs()) { + if (/^[a-z_][a-z0-9_$]*$/i.test(name)) { + arg_strings.push(sub('%s=%r', name, value)) + } else { + star_args[name] = value + } + } + if (Object.keys(star_args).length) { + arg_strings.push(sub('**%s', repr(star_args))) + } + return sub('%s(%s)', type_name, arg_strings.join(', ')) + } + + toString() { + return this[util.inspect.custom]() + } + + _get_kwargs() { + return Object.entries(this) + } + + _get_args() { + return [] + } + } +} + + +function _copy_items(items) { + if (items === undefined) { + return [] + } + return items.slice(0) +} + + +// =============== +// Formatting Help +// =============== +const HelpFormatter = _camelcase_alias(_callable(class HelpFormatter { + /* + * Formatter for generating usage messages and argument help strings. + * + * Only the name of this class is considered a public API. All the methods + * provided by the class are considered an implementation detail. + */ + + constructor() { + let [ + prog, + indent_increment, + max_help_position, + width + ] = _parse_opts(arguments, { + prog: no_default, + indent_increment: 2, + max_help_position: 24, + width: undefined + }) + + // default setting for width + if (width === undefined) { + width = get_terminal_size().columns + width -= 2 + } + + this._prog = prog + this._indent_increment = indent_increment + this._max_help_position = Math.min(max_help_position, + Math.max(width - 20, indent_increment * 2)) + this._width = width + + this._current_indent = 0 + this._level = 0 + this._action_max_length = 0 + + this._root_section = this._Section(this, undefined) + this._current_section = this._root_section + + this._whitespace_matcher = /[ \t\n\r\f\v]+/g // equivalent to python /\s+/ with ASCII flag + this._long_break_matcher = /\n\n\n+/g + } + + // =============================== + // Section and indentation methods + // =============================== + _indent() { + this._current_indent += this._indent_increment + this._level += 1 + } + + _dedent() { + this._current_indent -= this._indent_increment + assert(this._current_indent >= 0, 'Indent decreased below 0.') + this._level -= 1 + } + + _add_item(func, args) { + this._current_section.items.push([ func, args ]) + } + + // ======================== + // Message building methods + // ======================== + start_section(heading) { + this._indent() + let section = this._Section(this, this._current_section, heading) + this._add_item(section.format_help.bind(section), []) + this._current_section = section + } + + end_section() { + this._current_section = this._current_section.parent + this._dedent() + } + + add_text(text) { + if (text !== SUPPRESS && text !== undefined) { + this._add_item(this._format_text.bind(this), [text]) + } + } + + add_usage(usage, actions, groups, prefix = undefined) { + if (usage !== SUPPRESS) { + let args = [ usage, actions, groups, prefix ] + this._add_item(this._format_usage.bind(this), args) + } + } + + add_argument(action) { + if (action.help !== SUPPRESS) { + + // find all invocations + let invocations = [this._format_action_invocation(action)] + for (let subaction of this._iter_indented_subactions(action)) { + invocations.push(this._format_action_invocation(subaction)) + } + + // update the maximum item length + let invocation_length = Math.max(...invocations.map(invocation => invocation.length)) + let action_length = invocation_length + this._current_indent + this._action_max_length = Math.max(this._action_max_length, + action_length) + + // add the item to the list + this._add_item(this._format_action.bind(this), [action]) + } + } + + add_arguments(actions) { + for (let action of actions) { + this.add_argument(action) + } + } + + // ======================= + // Help-formatting methods + // ======================= + format_help() { + let help = this._root_section.format_help() + if (help) { + help = help.replace(this._long_break_matcher, '\n\n') + help = help.replace(/^\n+|\n+$/g, '') + '\n' + } + return help + } + + _join_parts(part_strings) { + return part_strings.filter(part => part && part !== SUPPRESS).join('') + } + + _format_usage(usage, actions, groups, prefix) { + if (prefix === undefined) { + prefix = 'usage: ' + } + + // if usage is specified, use that + if (usage !== undefined) { + usage = sub(usage, { prog: this._prog }) + + // if no optionals or positionals are available, usage is just prog + } else if (usage === undefined && !actions.length) { + usage = sub('%(prog)s', { prog: this._prog }) + + // if optionals and positionals are available, calculate usage + } else if (usage === undefined) { + let prog = sub('%(prog)s', { prog: this._prog }) + + // split optionals from positionals + let optionals = [] + let positionals = [] + for (let action of actions) { + if (action.option_strings.length) { + optionals.push(action) + } else { + positionals.push(action) + } + } + + // build full usage string + let action_usage = this._format_actions_usage([].concat(optionals).concat(positionals), groups) + usage = [ prog, action_usage ].map(String).join(' ') + + // wrap the usage parts if it's too long + let text_width = this._width - this._current_indent + if (prefix.length + usage.length > text_width) { + + // break usage into wrappable parts + let part_regexp = /\(.*?\)+(?=\s|$)|\[.*?\]+(?=\s|$)|\S+/g + let opt_usage = this._format_actions_usage(optionals, groups) + let pos_usage = this._format_actions_usage(positionals, groups) + let opt_parts = opt_usage.match(part_regexp) || [] + let pos_parts = pos_usage.match(part_regexp) || [] + assert(opt_parts.join(' ') === opt_usage) + assert(pos_parts.join(' ') === pos_usage) + + // helper for wrapping lines + let get_lines = (parts, indent, prefix = undefined) => { + let lines = [] + let line = [] + let line_len + if (prefix !== undefined) { + line_len = prefix.length - 1 + } else { + line_len = indent.length - 1 + } + for (let part of parts) { + if (line_len + 1 + part.length > text_width && line) { + lines.push(indent + line.join(' ')) + line = [] + line_len = indent.length - 1 + } + line.push(part) + line_len += part.length + 1 + } + if (line.length) { + lines.push(indent + line.join(' ')) + } + if (prefix !== undefined) { + lines[0] = lines[0].slice(indent.length) + } + return lines + } + + let lines + + // if prog is short, follow it with optionals or positionals + if (prefix.length + prog.length <= 0.75 * text_width) { + let indent = ' '.repeat(prefix.length + prog.length + 1) + if (opt_parts.length) { + lines = get_lines([prog].concat(opt_parts), indent, prefix) + lines = lines.concat(get_lines(pos_parts, indent)) + } else if (pos_parts.length) { + lines = get_lines([prog].concat(pos_parts), indent, prefix) + } else { + lines = [prog] + } + + // if prog is long, put it on its own line + } else { + let indent = ' '.repeat(prefix.length) + let parts = [].concat(opt_parts).concat(pos_parts) + lines = get_lines(parts, indent) + if (lines.length > 1) { + lines = [] + lines = lines.concat(get_lines(opt_parts, indent)) + lines = lines.concat(get_lines(pos_parts, indent)) + } + lines = [prog].concat(lines) + } + + // join lines into usage + usage = lines.join('\n') + } + } + + // prefix with 'usage:' + return sub('%s%s\n\n', prefix, usage) + } + + _format_actions_usage(actions, groups) { + // find group indices and identify actions in groups + let group_actions = new Set() + let inserts = {} + for (let group of groups) { + let start = actions.indexOf(group._group_actions[0]) + if (start === -1) { + continue + } else { + let end = start + group._group_actions.length + if (_array_equal(actions.slice(start, end), group._group_actions)) { + for (let action of group._group_actions) { + group_actions.add(action) + } + if (!group.required) { + if (start in inserts) { + inserts[start] += ' [' + } else { + inserts[start] = '[' + } + if (end in inserts) { + inserts[end] += ']' + } else { + inserts[end] = ']' + } + } else { + if (start in inserts) { + inserts[start] += ' (' + } else { + inserts[start] = '(' + } + if (end in inserts) { + inserts[end] += ')' + } else { + inserts[end] = ')' + } + } + for (let i of range(start + 1, end)) { + inserts[i] = '|' + } + } + } + } + + // collect all actions format strings + let parts = [] + for (let [ i, action ] of Object.entries(actions)) { + + // suppressed arguments are marked with None + // remove | separators for suppressed arguments + if (action.help === SUPPRESS) { + parts.push(undefined) + if (inserts[+i] === '|') { + delete inserts[+i] + } else if (inserts[+i + 1] === '|') { + delete inserts[+i + 1] + } + + // produce all arg strings + } else if (!action.option_strings.length) { + let default_value = this._get_default_metavar_for_positional(action) + let part = this._format_args(action, default_value) + + // if it's in a group, strip the outer [] + if (group_actions.has(action)) { + if (part[0] === '[' && part[part.length - 1] === ']') { + part = part.slice(1, -1) + } + } + + // add the action string to the list + parts.push(part) + + // produce the first way to invoke the option in brackets + } else { + let option_string = action.option_strings[0] + let part + + // if the Optional doesn't take a value, format is: + // -s or --long + if (action.nargs === 0) { + part = action.format_usage() + + // if the Optional takes a value, format is: + // -s ARGS or --long ARGS + } else { + let default_value = this._get_default_metavar_for_optional(action) + let args_string = this._format_args(action, default_value) + part = sub('%s %s', option_string, args_string) + } + + // make it look optional if it's not required or in a group + if (!action.required && !group_actions.has(action)) { + part = sub('[%s]', part) + } + + // add the action string to the list + parts.push(part) + } + } + + // insert things at the necessary indices + for (let i of Object.keys(inserts).map(Number).sort((a, b) => b - a)) { + parts.splice(+i, 0, inserts[+i]) + } + + // join all the action items with spaces + let text = parts.filter(Boolean).join(' ') + + // clean up separators for mutually exclusive groups + text = text.replace(/([\[(]) /g, '$1') + text = text.replace(/ ([\])])/g, '$1') + text = text.replace(/[\[(] *[\])]/g, '') + text = text.replace(/\(([^|]*)\)/g, '$1', text) + text = text.trim() + + // return the text + return text + } + + _format_text(text) { + if (text.includes('%(prog)')) { + text = sub(text, { prog: this._prog }) + } + let text_width = Math.max(this._width - this._current_indent, 11) + let indent = ' '.repeat(this._current_indent) + return this._fill_text(text, text_width, indent) + '\n\n' + } + + _format_action(action) { + // determine the required width and the entry label + let help_position = Math.min(this._action_max_length + 2, + this._max_help_position) + let help_width = Math.max(this._width - help_position, 11) + let action_width = help_position - this._current_indent - 2 + let action_header = this._format_action_invocation(action) + let indent_first + + // no help; start on same line and add a final newline + if (!action.help) { + let tup = [ this._current_indent, '', action_header ] + action_header = sub('%*s%s\n', ...tup) + + // short action name; start on the same line and pad two spaces + } else if (action_header.length <= action_width) { + let tup = [ this._current_indent, '', action_width, action_header ] + action_header = sub('%*s%-*s ', ...tup) + indent_first = 0 + + // long action name; start on the next line + } else { + let tup = [ this._current_indent, '', action_header ] + action_header = sub('%*s%s\n', ...tup) + indent_first = help_position + } + + // collect the pieces of the action help + let parts = [action_header] + + // if there was help for the action, add lines of help text + if (action.help) { + let help_text = this._expand_help(action) + let help_lines = this._split_lines(help_text, help_width) + parts.push(sub('%*s%s\n', indent_first, '', help_lines[0])) + for (let line of help_lines.slice(1)) { + parts.push(sub('%*s%s\n', help_position, '', line)) + } + + // or add a newline if the description doesn't end with one + } else if (!action_header.endsWith('\n')) { + parts.push('\n') + } + + // if there are any sub-actions, add their help as well + for (let subaction of this._iter_indented_subactions(action)) { + parts.push(this._format_action(subaction)) + } + + // return a single string + return this._join_parts(parts) + } + + _format_action_invocation(action) { + if (!action.option_strings.length) { + let default_value = this._get_default_metavar_for_positional(action) + let metavar = this._metavar_formatter(action, default_value)(1)[0] + return metavar + + } else { + let parts = [] + + // if the Optional doesn't take a value, format is: + // -s, --long + if (action.nargs === 0) { + parts = parts.concat(action.option_strings) + + // if the Optional takes a value, format is: + // -s ARGS, --long ARGS + } else { + let default_value = this._get_default_metavar_for_optional(action) + let args_string = this._format_args(action, default_value) + for (let option_string of action.option_strings) { + parts.push(sub('%s %s', option_string, args_string)) + } + } + + return parts.join(', ') + } + } + + _metavar_formatter(action, default_metavar) { + let result + if (action.metavar !== undefined) { + result = action.metavar + } else if (action.choices !== undefined) { + let choice_strs = _choices_to_array(action.choices).map(String) + result = sub('{%s}', choice_strs.join(',')) + } else { + result = default_metavar + } + + function format(tuple_size) { + if (Array.isArray(result)) { + return result + } else { + return Array(tuple_size).fill(result) + } + } + return format + } + + _format_args(action, default_metavar) { + let get_metavar = this._metavar_formatter(action, default_metavar) + let result + if (action.nargs === undefined) { + result = sub('%s', ...get_metavar(1)) + } else if (action.nargs === OPTIONAL) { + result = sub('[%s]', ...get_metavar(1)) + } else if (action.nargs === ZERO_OR_MORE) { + let metavar = get_metavar(1) + if (metavar.length === 2) { + result = sub('[%s [%s ...]]', ...metavar) + } else { + result = sub('[%s ...]', ...metavar) + } + } else if (action.nargs === ONE_OR_MORE) { + result = sub('%s [%s ...]', ...get_metavar(2)) + } else if (action.nargs === REMAINDER) { + result = '...' + } else if (action.nargs === PARSER) { + result = sub('%s ...', ...get_metavar(1)) + } else if (action.nargs === SUPPRESS) { + result = '' + } else { + let formats + try { + formats = range(action.nargs).map(() => '%s') + } catch (err) { + throw new TypeError('invalid nargs value') + } + result = sub(formats.join(' '), ...get_metavar(action.nargs)) + } + return result + } + + _expand_help(action) { + let params = Object.assign({ prog: this._prog }, action) + for (let name of Object.keys(params)) { + if (params[name] === SUPPRESS) { + delete params[name] + } + } + for (let name of Object.keys(params)) { + if (params[name] && params[name].name) { + params[name] = params[name].name + } + } + if (params.choices !== undefined) { + let choices_str = _choices_to_array(params.choices).map(String).join(', ') + params.choices = choices_str + } + // LEGACY (v1 compatibility): camelcase + for (let key of Object.keys(params)) { + let old_name = _to_legacy_name(key) + if (old_name !== key) { + params[old_name] = params[key] + } + } + // end + return sub(this._get_help_string(action), params) + } + + * _iter_indented_subactions(action) { + if (typeof action._get_subactions === 'function') { + this._indent() + yield* action._get_subactions() + this._dedent() + } + } + + _split_lines(text, width) { + text = text.replace(this._whitespace_matcher, ' ').trim() + // The textwrap module is used only for formatting help. + // Delay its import for speeding up the common usage of argparse. + let textwrap = require('./lib/textwrap') + return textwrap.wrap(text, { width }) + } + + _fill_text(text, width, indent) { + text = text.replace(this._whitespace_matcher, ' ').trim() + let textwrap = require('./lib/textwrap') + return textwrap.fill(text, { width, + initial_indent: indent, + subsequent_indent: indent }) + } + + _get_help_string(action) { + return action.help + } + + _get_default_metavar_for_optional(action) { + return action.dest.toUpperCase() + } + + _get_default_metavar_for_positional(action) { + return action.dest + } +})) + +HelpFormatter.prototype._Section = _callable(class _Section { + + constructor(formatter, parent, heading = undefined) { + this.formatter = formatter + this.parent = parent + this.heading = heading + this.items = [] + } + + format_help() { + // format the indented section + if (this.parent !== undefined) { + this.formatter._indent() + } + let item_help = this.formatter._join_parts(this.items.map(([ func, args ]) => func.apply(null, args))) + if (this.parent !== undefined) { + this.formatter._dedent() + } + + // return nothing if the section was empty + if (!item_help) { + return '' + } + + // add the heading if the section was non-empty + let heading + if (this.heading !== SUPPRESS && this.heading !== undefined) { + let current_indent = this.formatter._current_indent + heading = sub('%*s%s:\n', current_indent, '', this.heading) + } else { + heading = '' + } + + // join the section-initial newline, the heading and the help + return this.formatter._join_parts(['\n', heading, item_help, '\n']) + } +}) + + +const RawDescriptionHelpFormatter = _camelcase_alias(_callable(class RawDescriptionHelpFormatter extends HelpFormatter { + /* + * Help message formatter which retains any formatting in descriptions. + * + * Only the name of this class is considered a public API. All the methods + * provided by the class are considered an implementation detail. + */ + + _fill_text(text, width, indent) { + return splitlines(text, true).map(line => indent + line).join('') + } +})) + + +const RawTextHelpFormatter = _camelcase_alias(_callable(class RawTextHelpFormatter extends RawDescriptionHelpFormatter { + /* + * Help message formatter which retains formatting of all help text. + * + * Only the name of this class is considered a public API. All the methods + * provided by the class are considered an implementation detail. + */ + + _split_lines(text/*, width*/) { + return splitlines(text) + } +})) + + +const ArgumentDefaultsHelpFormatter = _camelcase_alias(_callable(class ArgumentDefaultsHelpFormatter extends HelpFormatter { + /* + * Help message formatter which adds default values to argument help. + * + * Only the name of this class is considered a public API. All the methods + * provided by the class are considered an implementation detail. + */ + + _get_help_string(action) { + let help = action.help + // LEGACY (v1 compatibility): additional check for defaultValue needed + if (!action.help.includes('%(default)') && !action.help.includes('%(defaultValue)')) { + if (action.default !== SUPPRESS) { + let defaulting_nargs = [OPTIONAL, ZERO_OR_MORE] + if (action.option_strings.length || defaulting_nargs.includes(action.nargs)) { + help += ' (default: %(default)s)' + } + } + } + return help + } +})) + + +const MetavarTypeHelpFormatter = _camelcase_alias(_callable(class MetavarTypeHelpFormatter extends HelpFormatter { + /* + * Help message formatter which uses the argument 'type' as the default + * metavar value (instead of the argument 'dest') + * + * Only the name of this class is considered a public API. All the methods + * provided by the class are considered an implementation detail. + */ + + _get_default_metavar_for_optional(action) { + return typeof action.type === 'function' ? action.type.name : action.type + } + + _get_default_metavar_for_positional(action) { + return typeof action.type === 'function' ? action.type.name : action.type + } +})) + + +// ===================== +// Options and Arguments +// ===================== +function _get_action_name(argument) { + if (argument === undefined) { + return undefined + } else if (argument.option_strings.length) { + return argument.option_strings.join('/') + } else if (![ undefined, SUPPRESS ].includes(argument.metavar)) { + return argument.metavar + } else if (![ undefined, SUPPRESS ].includes(argument.dest)) { + return argument.dest + } else { + return undefined + } +} + + +const ArgumentError = _callable(class ArgumentError extends Error { + /* + * An error from creating or using an argument (optional or positional). + * + * The string value of this exception is the message, augmented with + * information about the argument that caused it. + */ + + constructor(argument, message) { + super() + this.name = 'ArgumentError' + this._argument_name = _get_action_name(argument) + this._message = message + this.message = this.str() + } + + str() { + let format + if (this._argument_name === undefined) { + format = '%(message)s' + } else { + format = 'argument %(argument_name)s: %(message)s' + } + return sub(format, { message: this._message, + argument_name: this._argument_name }) + } +}) + + +const ArgumentTypeError = _callable(class ArgumentTypeError extends Error { + /* + * An error from trying to convert a command line string to a type. + */ + + constructor(message) { + super(message) + this.name = 'ArgumentTypeError' + } +}) + + +// ============== +// Action classes +// ============== +const Action = _camelcase_alias(_callable(class Action extends _AttributeHolder(Function) { + /* + * Information about how to convert command line strings to Python objects. + * + * Action objects are used by an ArgumentParser to represent the information + * needed to parse a single argument from one or more strings from the + * command line. The keyword arguments to the Action constructor are also + * all attributes of Action instances. + * + * Keyword Arguments: + * + * - option_strings -- A list of command-line option strings which + * should be associated with this action. + * + * - dest -- The name of the attribute to hold the created object(s) + * + * - nargs -- The number of command-line arguments that should be + * consumed. By default, one argument will be consumed and a single + * value will be produced. Other values include: + * - N (an integer) consumes N arguments (and produces a list) + * - '?' consumes zero or one arguments + * - '*' consumes zero or more arguments (and produces a list) + * - '+' consumes one or more arguments (and produces a list) + * Note that the difference between the default and nargs=1 is that + * with the default, a single value will be produced, while with + * nargs=1, a list containing a single value will be produced. + * + * - const -- The value to be produced if the option is specified and the + * option uses an action that takes no values. + * + * - default -- The value to be produced if the option is not specified. + * + * - type -- A callable that accepts a single string argument, and + * returns the converted value. The standard Python types str, int, + * float, and complex are useful examples of such callables. If None, + * str is used. + * + * - choices -- A container of values that should be allowed. If not None, + * after a command-line argument has been converted to the appropriate + * type, an exception will be raised if it is not a member of this + * collection. + * + * - required -- True if the action must always be specified at the + * command line. This is only meaningful for optional command-line + * arguments. + * + * - help -- The help string describing the argument. + * + * - metavar -- The name to be used for the option's argument with the + * help string. If None, the 'dest' value will be used as the name. + */ + + constructor() { + let [ + option_strings, + dest, + nargs, + const_value, + default_value, + type, + choices, + required, + help, + metavar + ] = _parse_opts(arguments, { + option_strings: no_default, + dest: no_default, + nargs: undefined, + const: undefined, + default: undefined, + type: undefined, + choices: undefined, + required: false, + help: undefined, + metavar: undefined + }) + + // when this class is called as a function, redirect it to .call() method of itself + super('return arguments.callee.call.apply(arguments.callee, arguments)') + + this.option_strings = option_strings + this.dest = dest + this.nargs = nargs + this.const = const_value + this.default = default_value + this.type = type + this.choices = choices + this.required = required + this.help = help + this.metavar = metavar + } + + _get_kwargs() { + let names = [ + 'option_strings', + 'dest', + 'nargs', + 'const', + 'default', + 'type', + 'choices', + 'help', + 'metavar' + ] + return names.map(name => [ name, getattr(this, name) ]) + } + + format_usage() { + return this.option_strings[0] + } + + call(/*parser, namespace, values, option_string = undefined*/) { + throw new Error('.call() not defined') + } +})) + + +const BooleanOptionalAction = _camelcase_alias(_callable(class BooleanOptionalAction extends Action { + + constructor() { + let [ + option_strings, + dest, + default_value, + type, + choices, + required, + help, + metavar + ] = _parse_opts(arguments, { + option_strings: no_default, + dest: no_default, + default: undefined, + type: undefined, + choices: undefined, + required: false, + help: undefined, + metavar: undefined + }) + + let _option_strings = [] + for (let option_string of option_strings) { + _option_strings.push(option_string) + + if (option_string.startsWith('--')) { + option_string = '--no-' + option_string.slice(2) + _option_strings.push(option_string) + } + } + + if (help !== undefined && default_value !== undefined) { + help += ` (default: ${default_value})` + } + + super({ + option_strings: _option_strings, + dest, + nargs: 0, + default: default_value, + type, + choices, + required, + help, + metavar + }) + } + + call(parser, namespace, values, option_string = undefined) { + if (this.option_strings.includes(option_string)) { + setattr(namespace, this.dest, !option_string.startsWith('--no-')) + } + } + + format_usage() { + return this.option_strings.join(' | ') + } +})) + + +const _StoreAction = _callable(class _StoreAction extends Action { + + constructor() { + let [ + option_strings, + dest, + nargs, + const_value, + default_value, + type, + choices, + required, + help, + metavar + ] = _parse_opts(arguments, { + option_strings: no_default, + dest: no_default, + nargs: undefined, + const: undefined, + default: undefined, + type: undefined, + choices: undefined, + required: false, + help: undefined, + metavar: undefined + }) + + if (nargs === 0) { + throw new TypeError('nargs for store actions must be != 0; if you ' + + 'have nothing to store, actions such as store ' + + 'true or store const may be more appropriate') + } + if (const_value !== undefined && nargs !== OPTIONAL) { + throw new TypeError(sub('nargs must be %r to supply const', OPTIONAL)) + } + super({ + option_strings, + dest, + nargs, + const: const_value, + default: default_value, + type, + choices, + required, + help, + metavar + }) + } + + call(parser, namespace, values/*, option_string = undefined*/) { + setattr(namespace, this.dest, values) + } +}) + + +const _StoreConstAction = _callable(class _StoreConstAction extends Action { + + constructor() { + let [ + option_strings, + dest, + const_value, + default_value, + required, + help + //, metavar + ] = _parse_opts(arguments, { + option_strings: no_default, + dest: no_default, + const: no_default, + default: undefined, + required: false, + help: undefined, + metavar: undefined + }) + + super({ + option_strings, + dest, + nargs: 0, + const: const_value, + default: default_value, + required, + help + }) + } + + call(parser, namespace/*, values, option_string = undefined*/) { + setattr(namespace, this.dest, this.const) + } +}) + + +const _StoreTrueAction = _callable(class _StoreTrueAction extends _StoreConstAction { + + constructor() { + let [ + option_strings, + dest, + default_value, + required, + help + ] = _parse_opts(arguments, { + option_strings: no_default, + dest: no_default, + default: false, + required: false, + help: undefined + }) + + super({ + option_strings, + dest, + const: true, + default: default_value, + required, + help + }) + } +}) + + +const _StoreFalseAction = _callable(class _StoreFalseAction extends _StoreConstAction { + + constructor() { + let [ + option_strings, + dest, + default_value, + required, + help + ] = _parse_opts(arguments, { + option_strings: no_default, + dest: no_default, + default: true, + required: false, + help: undefined + }) + + super({ + option_strings, + dest, + const: false, + default: default_value, + required, + help + }) + } +}) + + +const _AppendAction = _callable(class _AppendAction extends Action { + + constructor() { + let [ + option_strings, + dest, + nargs, + const_value, + default_value, + type, + choices, + required, + help, + metavar + ] = _parse_opts(arguments, { + option_strings: no_default, + dest: no_default, + nargs: undefined, + const: undefined, + default: undefined, + type: undefined, + choices: undefined, + required: false, + help: undefined, + metavar: undefined + }) + + if (nargs === 0) { + throw new TypeError('nargs for append actions must be != 0; if arg ' + + 'strings are not supplying the value to append, ' + + 'the append const action may be more appropriate') + } + if (const_value !== undefined && nargs !== OPTIONAL) { + throw new TypeError(sub('nargs must be %r to supply const', OPTIONAL)) + } + super({ + option_strings, + dest, + nargs, + const: const_value, + default: default_value, + type, + choices, + required, + help, + metavar + }) + } + + call(parser, namespace, values/*, option_string = undefined*/) { + let items = getattr(namespace, this.dest, undefined) + items = _copy_items(items) + items.push(values) + setattr(namespace, this.dest, items) + } +}) + + +const _AppendConstAction = _callable(class _AppendConstAction extends Action { + + constructor() { + let [ + option_strings, + dest, + const_value, + default_value, + required, + help, + metavar + ] = _parse_opts(arguments, { + option_strings: no_default, + dest: no_default, + const: no_default, + default: undefined, + required: false, + help: undefined, + metavar: undefined + }) + + super({ + option_strings, + dest, + nargs: 0, + const: const_value, + default: default_value, + required, + help, + metavar + }) + } + + call(parser, namespace/*, values, option_string = undefined*/) { + let items = getattr(namespace, this.dest, undefined) + items = _copy_items(items) + items.push(this.const) + setattr(namespace, this.dest, items) + } +}) + + +const _CountAction = _callable(class _CountAction extends Action { + + constructor() { + let [ + option_strings, + dest, + default_value, + required, + help + ] = _parse_opts(arguments, { + option_strings: no_default, + dest: no_default, + default: undefined, + required: false, + help: undefined + }) + + super({ + option_strings, + dest, + nargs: 0, + default: default_value, + required, + help + }) + } + + call(parser, namespace/*, values, option_string = undefined*/) { + let count = getattr(namespace, this.dest, undefined) + if (count === undefined) { + count = 0 + } + setattr(namespace, this.dest, count + 1) + } +}) + + +const _HelpAction = _callable(class _HelpAction extends Action { + + constructor() { + let [ + option_strings, + dest, + default_value, + help + ] = _parse_opts(arguments, { + option_strings: no_default, + dest: SUPPRESS, + default: SUPPRESS, + help: undefined + }) + + super({ + option_strings, + dest, + default: default_value, + nargs: 0, + help + }) + } + + call(parser/*, namespace, values, option_string = undefined*/) { + parser.print_help() + parser.exit() + } +}) + + +const _VersionAction = _callable(class _VersionAction extends Action { + + constructor() { + let [ + option_strings, + version, + dest, + default_value, + help + ] = _parse_opts(arguments, { + option_strings: no_default, + version: undefined, + dest: SUPPRESS, + default: SUPPRESS, + help: "show program's version number and exit" + }) + + super({ + option_strings, + dest, + default: default_value, + nargs: 0, + help + }) + this.version = version + } + + call(parser/*, namespace, values, option_string = undefined*/) { + let version = this.version + if (version === undefined) { + version = parser.version + } + let formatter = parser._get_formatter() + formatter.add_text(version) + parser._print_message(formatter.format_help(), process.stdout) + parser.exit() + } +}) + + +const _SubParsersAction = _camelcase_alias(_callable(class _SubParsersAction extends Action { + + constructor() { + let [ + option_strings, + prog, + parser_class, + dest, + required, + help, + metavar + ] = _parse_opts(arguments, { + option_strings: no_default, + prog: no_default, + parser_class: no_default, + dest: SUPPRESS, + required: false, + help: undefined, + metavar: undefined + }) + + let name_parser_map = {} + + super({ + option_strings, + dest, + nargs: PARSER, + choices: name_parser_map, + required, + help, + metavar + }) + + this._prog_prefix = prog + this._parser_class = parser_class + this._name_parser_map = name_parser_map + this._choices_actions = [] + } + + add_parser() { + let [ + name, + kwargs + ] = _parse_opts(arguments, { + name: no_default, + '**kwargs': no_default + }) + + // set prog from the existing prefix + if (kwargs.prog === undefined) { + kwargs.prog = sub('%s %s', this._prog_prefix, name) + } + + let aliases = getattr(kwargs, 'aliases', []) + delete kwargs.aliases + + // create a pseudo-action to hold the choice help + if ('help' in kwargs) { + let help = kwargs.help + delete kwargs.help + let choice_action = this._ChoicesPseudoAction(name, aliases, help) + this._choices_actions.push(choice_action) + } + + // create the parser and add it to the map + let parser = new this._parser_class(kwargs) + this._name_parser_map[name] = parser + + // make parser available under aliases also + for (let alias of aliases) { + this._name_parser_map[alias] = parser + } + + return parser + } + + _get_subactions() { + return this._choices_actions + } + + call(parser, namespace, values/*, option_string = undefined*/) { + let parser_name = values[0] + let arg_strings = values.slice(1) + + // set the parser name if requested + if (this.dest !== SUPPRESS) { + setattr(namespace, this.dest, parser_name) + } + + // select the parser + if (hasattr(this._name_parser_map, parser_name)) { + parser = this._name_parser_map[parser_name] + } else { + let args = {parser_name, + choices: this._name_parser_map.join(', ')} + let msg = sub('unknown parser %(parser_name)r (choices: %(choices)s)', args) + throw new ArgumentError(this, msg) + } + + // parse all the remaining options into the namespace + // store any unrecognized options on the object, so that the top + // level parser can decide what to do with them + + // In case this subparser defines new defaults, we parse them + // in a new namespace object and then update the original + // namespace for the relevant parts. + let subnamespace + [ subnamespace, arg_strings ] = parser.parse_known_args(arg_strings, undefined) + for (let [ key, value ] of Object.entries(subnamespace)) { + setattr(namespace, key, value) + } + + if (arg_strings.length) { + setdefault(namespace, _UNRECOGNIZED_ARGS_ATTR, []) + getattr(namespace, _UNRECOGNIZED_ARGS_ATTR).push(...arg_strings) + } + } +})) + + +_SubParsersAction.prototype._ChoicesPseudoAction = _callable(class _ChoicesPseudoAction extends Action { + constructor(name, aliases, help) { + let metavar = name, dest = name + if (aliases.length) { + metavar += sub(' (%s)', aliases.join(', ')) + } + super({ option_strings: [], dest, help, metavar }) + } +}) + + +const _ExtendAction = _callable(class _ExtendAction extends _AppendAction { + call(parser, namespace, values/*, option_string = undefined*/) { + let items = getattr(namespace, this.dest, undefined) + items = _copy_items(items) + items = items.concat(values) + setattr(namespace, this.dest, items) + } +}) + + +// ============== +// Type classes +// ============== +const FileType = _callable(class FileType extends Function { + /* + * Factory for creating file object types + * + * Instances of FileType are typically passed as type= arguments to the + * ArgumentParser add_argument() method. + * + * Keyword Arguments: + * - mode -- A string indicating how the file is to be opened. Accepts the + * same values as the builtin open() function. + * - bufsize -- The file's desired buffer size. Accepts the same values as + * the builtin open() function. + * - encoding -- The file's encoding. Accepts the same values as the + * builtin open() function. + * - errors -- A string indicating how encoding and decoding errors are to + * be handled. Accepts the same value as the builtin open() function. + */ + + constructor() { + let [ + flags, + encoding, + mode, + autoClose, + emitClose, + start, + end, + highWaterMark, + fs + ] = _parse_opts(arguments, { + flags: 'r', + encoding: undefined, + mode: undefined, // 0o666 + autoClose: undefined, // true + emitClose: undefined, // false + start: undefined, // 0 + end: undefined, // Infinity + highWaterMark: undefined, // 64 * 1024 + fs: undefined + }) + + // when this class is called as a function, redirect it to .call() method of itself + super('return arguments.callee.call.apply(arguments.callee, arguments)') + + Object.defineProperty(this, 'name', { + get() { + return sub('FileType(%r)', flags) + } + }) + this._flags = flags + this._options = {} + if (encoding !== undefined) this._options.encoding = encoding + if (mode !== undefined) this._options.mode = mode + if (autoClose !== undefined) this._options.autoClose = autoClose + if (emitClose !== undefined) this._options.emitClose = emitClose + if (start !== undefined) this._options.start = start + if (end !== undefined) this._options.end = end + if (highWaterMark !== undefined) this._options.highWaterMark = highWaterMark + if (fs !== undefined) this._options.fs = fs + } + + call(string) { + // the special argument "-" means sys.std{in,out} + if (string === '-') { + if (this._flags.includes('r')) { + return process.stdin + } else if (this._flags.includes('w')) { + return process.stdout + } else { + let msg = sub('argument "-" with mode %r', this._flags) + throw new TypeError(msg) + } + } + + // all other arguments are used as file names + let fd + try { + fd = fs.openSync(string, this._flags, this._options.mode) + } catch (e) { + let args = { filename: string, error: e.message } + let message = "can't open '%(filename)s': %(error)s" + throw new ArgumentTypeError(sub(message, args)) + } + + let options = Object.assign({ fd, flags: this._flags }, this._options) + if (this._flags.includes('r')) { + return fs.createReadStream(undefined, options) + } else if (this._flags.includes('w')) { + return fs.createWriteStream(undefined, options) + } else { + let msg = sub('argument "%s" with mode %r', string, this._flags) + throw new TypeError(msg) + } + } + + [util.inspect.custom]() { + let args = [ this._flags ] + let kwargs = Object.entries(this._options).map(([ k, v ]) => { + if (k === 'mode') v = { value: v, [util.inspect.custom]() { return '0o' + this.value.toString(8) } } + return [ k, v ] + }) + let args_str = [] + .concat(args.filter(arg => arg !== -1).map(repr)) + .concat(kwargs.filter(([/*kw*/, arg]) => arg !== undefined) + .map(([kw, arg]) => sub('%s=%r', kw, arg))) + .join(', ') + return sub('%s(%s)', this.constructor.name, args_str) + } + + toString() { + return this[util.inspect.custom]() + } +}) + +// =========================== +// Optional and Positional Parsing +// =========================== +const Namespace = _callable(class Namespace extends _AttributeHolder() { + /* + * Simple object for storing attributes. + * + * Implements equality by attribute names and values, and provides a simple + * string representation. + */ + + constructor(options = {}) { + super() + Object.assign(this, options) + } +}) + +// unset string tag to mimic plain object +Namespace.prototype[Symbol.toStringTag] = undefined + + +const _ActionsContainer = _camelcase_alias(_callable(class _ActionsContainer { + + constructor() { + let [ + description, + prefix_chars, + argument_default, + conflict_handler + ] = _parse_opts(arguments, { + description: no_default, + prefix_chars: no_default, + argument_default: no_default, + conflict_handler: no_default + }) + + this.description = description + this.argument_default = argument_default + this.prefix_chars = prefix_chars + this.conflict_handler = conflict_handler + + // set up registries + this._registries = {} + + // register actions + this.register('action', undefined, _StoreAction) + this.register('action', 'store', _StoreAction) + this.register('action', 'store_const', _StoreConstAction) + this.register('action', 'store_true', _StoreTrueAction) + this.register('action', 'store_false', _StoreFalseAction) + this.register('action', 'append', _AppendAction) + this.register('action', 'append_const', _AppendConstAction) + this.register('action', 'count', _CountAction) + this.register('action', 'help', _HelpAction) + this.register('action', 'version', _VersionAction) + this.register('action', 'parsers', _SubParsersAction) + this.register('action', 'extend', _ExtendAction) + // LEGACY (v1 compatibility): camelcase variants + ;[ 'storeConst', 'storeTrue', 'storeFalse', 'appendConst' ].forEach(old_name => { + let new_name = _to_new_name(old_name) + this.register('action', old_name, util.deprecate(this._registry_get('action', new_name), + sub('{action: "%s"} is renamed to {action: "%s"}', old_name, new_name))) + }) + // end + + // raise an exception if the conflict handler is invalid + this._get_handler() + + // action storage + this._actions = [] + this._option_string_actions = {} + + // groups + this._action_groups = [] + this._mutually_exclusive_groups = [] + + // defaults storage + this._defaults = {} + + // determines whether an "option" looks like a negative number + this._negative_number_matcher = /^-\d+$|^-\d*\.\d+$/ + + // whether or not there are any optionals that look like negative + // numbers -- uses a list so it can be shared and edited + this._has_negative_number_optionals = [] + } + + // ==================== + // Registration methods + // ==================== + register(registry_name, value, object) { + let registry = setdefault(this._registries, registry_name, {}) + registry[value] = object + } + + _registry_get(registry_name, value, default_value = undefined) { + return getattr(this._registries[registry_name], value, default_value) + } + + // ================================== + // Namespace default accessor methods + // ================================== + set_defaults(kwargs) { + Object.assign(this._defaults, kwargs) + + // if these defaults match any existing arguments, replace + // the previous default on the object with the new one + for (let action of this._actions) { + if (action.dest in kwargs) { + action.default = kwargs[action.dest] + } + } + } + + get_default(dest) { + for (let action of this._actions) { + if (action.dest === dest && action.default !== undefined) { + return action.default + } + } + return this._defaults[dest] + } + + + // ======================= + // Adding argument actions + // ======================= + add_argument() { + /* + * add_argument(dest, ..., name=value, ...) + * add_argument(option_string, option_string, ..., name=value, ...) + */ + let [ + args, + kwargs + ] = _parse_opts(arguments, { + '*args': no_default, + '**kwargs': no_default + }) + // LEGACY (v1 compatibility), old-style add_argument([ args ], { options }) + if (args.length === 1 && Array.isArray(args[0])) { + args = args[0] + deprecate('argument-array', + sub('use add_argument(%(args)s, {...}) instead of add_argument([ %(args)s ], { ... })', { + args: args.map(repr).join(', ') + })) + } + // end + + // if no positional args are supplied or only one is supplied and + // it doesn't look like an option string, parse a positional + // argument + let chars = this.prefix_chars + if (!args.length || args.length === 1 && !chars.includes(args[0][0])) { + if (args.length && 'dest' in kwargs) { + throw new TypeError('dest supplied twice for positional argument') + } + kwargs = this._get_positional_kwargs(...args, kwargs) + + // otherwise, we're adding an optional argument + } else { + kwargs = this._get_optional_kwargs(...args, kwargs) + } + + // if no default was supplied, use the parser-level default + if (!('default' in kwargs)) { + let dest = kwargs.dest + if (dest in this._defaults) { + kwargs.default = this._defaults[dest] + } else if (this.argument_default !== undefined) { + kwargs.default = this.argument_default + } + } + + // create the action object, and add it to the parser + let action_class = this._pop_action_class(kwargs) + if (typeof action_class !== 'function') { + throw new TypeError(sub('unknown action "%s"', action_class)) + } + // eslint-disable-next-line new-cap + let action = new action_class(kwargs) + + // raise an error if the action type is not callable + let type_func = this._registry_get('type', action.type, action.type) + if (typeof type_func !== 'function') { + throw new TypeError(sub('%r is not callable', type_func)) + } + + if (type_func === FileType) { + throw new TypeError(sub('%r is a FileType class object, instance of it' + + ' must be passed', type_func)) + } + + // raise an error if the metavar does not match the type + if ('_get_formatter' in this) { + try { + this._get_formatter()._format_args(action, undefined) + } catch (err) { + // check for 'invalid nargs value' is an artifact of TypeError and ValueError in js being the same + if (err instanceof TypeError && err.message !== 'invalid nargs value') { + throw new TypeError('length of metavar tuple does not match nargs') + } else { + throw err + } + } + } + + return this._add_action(action) + } + + add_argument_group() { + let group = _ArgumentGroup(this, ...arguments) + this._action_groups.push(group) + return group + } + + add_mutually_exclusive_group() { + // eslint-disable-next-line no-use-before-define + let group = _MutuallyExclusiveGroup(this, ...arguments) + this._mutually_exclusive_groups.push(group) + return group + } + + _add_action(action) { + // resolve any conflicts + this._check_conflict(action) + + // add to actions list + this._actions.push(action) + action.container = this + + // index the action by any option strings it has + for (let option_string of action.option_strings) { + this._option_string_actions[option_string] = action + } + + // set the flag if any option strings look like negative numbers + for (let option_string of action.option_strings) { + if (this._negative_number_matcher.test(option_string)) { + if (!this._has_negative_number_optionals.length) { + this._has_negative_number_optionals.push(true) + } + } + } + + // return the created action + return action + } + + _remove_action(action) { + _array_remove(this._actions, action) + } + + _add_container_actions(container) { + // collect groups by titles + let title_group_map = {} + for (let group of this._action_groups) { + if (group.title in title_group_map) { + let msg = 'cannot merge actions - two groups are named %r' + throw new TypeError(sub(msg, group.title)) + } + title_group_map[group.title] = group + } + + // map each action to its group + let group_map = new Map() + for (let group of container._action_groups) { + + // if a group with the title exists, use that, otherwise + // create a new group matching the container's group + if (!(group.title in title_group_map)) { + title_group_map[group.title] = this.add_argument_group({ + title: group.title, + description: group.description, + conflict_handler: group.conflict_handler + }) + } + + // map the actions to their new group + for (let action of group._group_actions) { + group_map.set(action, title_group_map[group.title]) + } + } + + // add container's mutually exclusive groups + // NOTE: if add_mutually_exclusive_group ever gains title= and + // description= then this code will need to be expanded as above + for (let group of container._mutually_exclusive_groups) { + let mutex_group = this.add_mutually_exclusive_group({ + required: group.required + }) + + // map the actions to their new mutex group + for (let action of group._group_actions) { + group_map.set(action, mutex_group) + } + } + + // add all actions to this container or their group + for (let action of container._actions) { + group_map.get(action)._add_action(action) + } + } + + _get_positional_kwargs() { + let [ + dest, + kwargs + ] = _parse_opts(arguments, { + dest: no_default, + '**kwargs': no_default + }) + + // make sure required is not specified + if ('required' in kwargs) { + let msg = "'required' is an invalid argument for positionals" + throw new TypeError(msg) + } + + // mark positional arguments as required if at least one is + // always required + if (![OPTIONAL, ZERO_OR_MORE].includes(kwargs.nargs)) { + kwargs.required = true + } + if (kwargs.nargs === ZERO_OR_MORE && !('default' in kwargs)) { + kwargs.required = true + } + + // return the keyword arguments with no option strings + return Object.assign(kwargs, { dest, option_strings: [] }) + } + + _get_optional_kwargs() { + let [ + args, + kwargs + ] = _parse_opts(arguments, { + '*args': no_default, + '**kwargs': no_default + }) + + // determine short and long option strings + let option_strings = [] + let long_option_strings = [] + let option_string + for (option_string of args) { + // error on strings that don't start with an appropriate prefix + if (!this.prefix_chars.includes(option_string[0])) { + let args = {option: option_string, + prefix_chars: this.prefix_chars} + let msg = 'invalid option string %(option)r: ' + + 'must start with a character %(prefix_chars)r' + throw new TypeError(sub(msg, args)) + } + + // strings starting with two prefix characters are long options + option_strings.push(option_string) + if (option_string.length > 1 && this.prefix_chars.includes(option_string[1])) { + long_option_strings.push(option_string) + } + } + + // infer destination, '--foo-bar' -> 'foo_bar' and '-x' -> 'x' + let dest = kwargs.dest + delete kwargs.dest + if (dest === undefined) { + let dest_option_string + if (long_option_strings.length) { + dest_option_string = long_option_strings[0] + } else { + dest_option_string = option_strings[0] + } + dest = _string_lstrip(dest_option_string, this.prefix_chars) + if (!dest) { + let msg = 'dest= is required for options like %r' + throw new TypeError(sub(msg, option_string)) + } + dest = dest.replace(/-/g, '_') + } + + // return the updated keyword arguments + return Object.assign(kwargs, { dest, option_strings }) + } + + _pop_action_class(kwargs, default_value = undefined) { + let action = getattr(kwargs, 'action', default_value) + delete kwargs.action + return this._registry_get('action', action, action) + } + + _get_handler() { + // determine function from conflict handler string + let handler_func_name = sub('_handle_conflict_%s', this.conflict_handler) + if (typeof this[handler_func_name] === 'function') { + return this[handler_func_name] + } else { + let msg = 'invalid conflict_resolution value: %r' + throw new TypeError(sub(msg, this.conflict_handler)) + } + } + + _check_conflict(action) { + + // find all options that conflict with this option + let confl_optionals = [] + for (let option_string of action.option_strings) { + if (hasattr(this._option_string_actions, option_string)) { + let confl_optional = this._option_string_actions[option_string] + confl_optionals.push([ option_string, confl_optional ]) + } + } + + // resolve any conflicts + if (confl_optionals.length) { + let conflict_handler = this._get_handler() + conflict_handler.call(this, action, confl_optionals) + } + } + + _handle_conflict_error(action, conflicting_actions) { + let message = conflicting_actions.length === 1 ? + 'conflicting option string: %s' : + 'conflicting option strings: %s' + let conflict_string = conflicting_actions.map(([ option_string/*, action*/ ]) => option_string).join(', ') + throw new ArgumentError(action, sub(message, conflict_string)) + } + + _handle_conflict_resolve(action, conflicting_actions) { + + // remove all conflicting options + for (let [ option_string, action ] of conflicting_actions) { + + // remove the conflicting option + _array_remove(action.option_strings, option_string) + delete this._option_string_actions[option_string] + + // if the option now has no option string, remove it from the + // container holding it + if (!action.option_strings.length) { + action.container._remove_action(action) + } + } + } +})) + + +const _ArgumentGroup = _callable(class _ArgumentGroup extends _ActionsContainer { + + constructor() { + let [ + container, + title, + description, + kwargs + ] = _parse_opts(arguments, { + container: no_default, + title: undefined, + description: undefined, + '**kwargs': no_default + }) + + // add any missing keyword arguments by checking the container + setdefault(kwargs, 'conflict_handler', container.conflict_handler) + setdefault(kwargs, 'prefix_chars', container.prefix_chars) + setdefault(kwargs, 'argument_default', container.argument_default) + super(Object.assign({ description }, kwargs)) + + // group attributes + this.title = title + this._group_actions = [] + + // share most attributes with the container + this._registries = container._registries + this._actions = container._actions + this._option_string_actions = container._option_string_actions + this._defaults = container._defaults + this._has_negative_number_optionals = + container._has_negative_number_optionals + this._mutually_exclusive_groups = container._mutually_exclusive_groups + } + + _add_action(action) { + action = super._add_action(action) + this._group_actions.push(action) + return action + } + + _remove_action(action) { + super._remove_action(action) + _array_remove(this._group_actions, action) + } +}) + + +const _MutuallyExclusiveGroup = _callable(class _MutuallyExclusiveGroup extends _ArgumentGroup { + + constructor() { + let [ + container, + required + ] = _parse_opts(arguments, { + container: no_default, + required: false + }) + + super(container) + this.required = required + this._container = container + } + + _add_action(action) { + if (action.required) { + let msg = 'mutually exclusive arguments must be optional' + throw new TypeError(msg) + } + action = this._container._add_action(action) + this._group_actions.push(action) + return action + } + + _remove_action(action) { + this._container._remove_action(action) + _array_remove(this._group_actions, action) + } +}) + + +const ArgumentParser = _camelcase_alias(_callable(class ArgumentParser extends _AttributeHolder(_ActionsContainer) { + /* + * Object for parsing command line strings into Python objects. + * + * Keyword Arguments: + * - prog -- The name of the program (default: sys.argv[0]) + * - usage -- A usage message (default: auto-generated from arguments) + * - description -- A description of what the program does + * - epilog -- Text following the argument descriptions + * - parents -- Parsers whose arguments should be copied into this one + * - formatter_class -- HelpFormatter class for printing help messages + * - prefix_chars -- Characters that prefix optional arguments + * - fromfile_prefix_chars -- Characters that prefix files containing + * additional arguments + * - argument_default -- The default value for all arguments + * - conflict_handler -- String indicating how to handle conflicts + * - add_help -- Add a -h/-help option + * - allow_abbrev -- Allow long options to be abbreviated unambiguously + * - exit_on_error -- Determines whether or not ArgumentParser exits with + * error info when an error occurs + */ + + constructor() { + let [ + prog, + usage, + description, + epilog, + parents, + formatter_class, + prefix_chars, + fromfile_prefix_chars, + argument_default, + conflict_handler, + add_help, + allow_abbrev, + exit_on_error, + debug, // LEGACY (v1 compatibility), debug mode + version // LEGACY (v1 compatibility), version + ] = _parse_opts(arguments, { + prog: undefined, + usage: undefined, + description: undefined, + epilog: undefined, + parents: [], + formatter_class: HelpFormatter, + prefix_chars: '-', + fromfile_prefix_chars: undefined, + argument_default: undefined, + conflict_handler: 'error', + add_help: true, + allow_abbrev: true, + exit_on_error: true, + debug: undefined, // LEGACY (v1 compatibility), debug mode + version: undefined // LEGACY (v1 compatibility), version + }) + + // LEGACY (v1 compatibility) + if (debug !== undefined) { + deprecate('debug', + 'The "debug" argument to ArgumentParser is deprecated. Please ' + + 'override ArgumentParser.exit function instead.' + ) + } + + if (version !== undefined) { + deprecate('version', + 'The "version" argument to ArgumentParser is deprecated. Please use ' + + "add_argument(..., { action: 'version', version: 'N', ... }) instead." + ) + } + // end + + super({ + description, + prefix_chars, + argument_default, + conflict_handler + }) + + // default setting for prog + if (prog === undefined) { + prog = path.basename(get_argv()[0] || '') + } + + this.prog = prog + this.usage = usage + this.epilog = epilog + this.formatter_class = formatter_class + this.fromfile_prefix_chars = fromfile_prefix_chars + this.add_help = add_help + this.allow_abbrev = allow_abbrev + this.exit_on_error = exit_on_error + // LEGACY (v1 compatibility), debug mode + this.debug = debug + // end + + this._positionals = this.add_argument_group('positional arguments') + this._optionals = this.add_argument_group('optional arguments') + this._subparsers = undefined + + // register types + function identity(string) { + return string + } + this.register('type', undefined, identity) + this.register('type', null, identity) + this.register('type', 'auto', identity) + this.register('type', 'int', function (x) { + let result = Number(x) + if (!Number.isInteger(result)) { + throw new TypeError(sub('could not convert string to int: %r', x)) + } + return result + }) + this.register('type', 'float', function (x) { + let result = Number(x) + if (isNaN(result)) { + throw new TypeError(sub('could not convert string to float: %r', x)) + } + return result + }) + this.register('type', 'str', String) + // LEGACY (v1 compatibility): custom types + this.register('type', 'string', + util.deprecate(String, 'use {type:"str"} or {type:String} instead of {type:"string"}')) + // end + + // add help argument if necessary + // (using explicit default to override global argument_default) + let default_prefix = prefix_chars.includes('-') ? '-' : prefix_chars[0] + if (this.add_help) { + this.add_argument( + default_prefix + 'h', + default_prefix.repeat(2) + 'help', + { + action: 'help', + default: SUPPRESS, + help: 'show this help message and exit' + } + ) + } + // LEGACY (v1 compatibility), version + if (version) { + this.add_argument( + default_prefix + 'v', + default_prefix.repeat(2) + 'version', + { + action: 'version', + default: SUPPRESS, + version: this.version, + help: "show program's version number and exit" + } + ) + } + // end + + // add parent arguments and defaults + for (let parent of parents) { + this._add_container_actions(parent) + Object.assign(this._defaults, parent._defaults) + } + } + + // ======================= + // Pretty __repr__ methods + // ======================= + _get_kwargs() { + let names = [ + 'prog', + 'usage', + 'description', + 'formatter_class', + 'conflict_handler', + 'add_help' + ] + return names.map(name => [ name, getattr(this, name) ]) + } + + // ================================== + // Optional/Positional adding methods + // ================================== + add_subparsers() { + let [ + kwargs + ] = _parse_opts(arguments, { + '**kwargs': no_default + }) + + if (this._subparsers !== undefined) { + this.error('cannot have multiple subparser arguments') + } + + // add the parser class to the arguments if it's not present + setdefault(kwargs, 'parser_class', this.constructor) + + if ('title' in kwargs || 'description' in kwargs) { + let title = getattr(kwargs, 'title', 'subcommands') + let description = getattr(kwargs, 'description', undefined) + delete kwargs.title + delete kwargs.description + this._subparsers = this.add_argument_group(title, description) + } else { + this._subparsers = this._positionals + } + + // prog defaults to the usage message of this parser, skipping + // optional arguments and with no "usage:" prefix + if (kwargs.prog === undefined) { + let formatter = this._get_formatter() + let positionals = this._get_positional_actions() + let groups = this._mutually_exclusive_groups + formatter.add_usage(this.usage, positionals, groups, '') + kwargs.prog = formatter.format_help().trim() + } + + // create the parsers action and add it to the positionals list + let parsers_class = this._pop_action_class(kwargs, 'parsers') + // eslint-disable-next-line new-cap + let action = new parsers_class(Object.assign({ option_strings: [] }, kwargs)) + this._subparsers._add_action(action) + + // return the created parsers action + return action + } + + _add_action(action) { + if (action.option_strings.length) { + this._optionals._add_action(action) + } else { + this._positionals._add_action(action) + } + return action + } + + _get_optional_actions() { + return this._actions.filter(action => action.option_strings.length) + } + + _get_positional_actions() { + return this._actions.filter(action => !action.option_strings.length) + } + + // ===================================== + // Command line argument parsing methods + // ===================================== + parse_args(args = undefined, namespace = undefined) { + let argv + [ args, argv ] = this.parse_known_args(args, namespace) + if (argv && argv.length > 0) { + let msg = 'unrecognized arguments: %s' + this.error(sub(msg, argv.join(' '))) + } + return args + } + + parse_known_args(args = undefined, namespace = undefined) { + if (args === undefined) { + args = get_argv().slice(1) + } + + // default Namespace built from parser defaults + if (namespace === undefined) { + namespace = new Namespace() + } + + // add any action defaults that aren't present + for (let action of this._actions) { + if (action.dest !== SUPPRESS) { + if (!hasattr(namespace, action.dest)) { + if (action.default !== SUPPRESS) { + setattr(namespace, action.dest, action.default) + } + } + } + } + + // add any parser defaults that aren't present + for (let dest of Object.keys(this._defaults)) { + if (!hasattr(namespace, dest)) { + setattr(namespace, dest, this._defaults[dest]) + } + } + + // parse the arguments and exit if there are any errors + if (this.exit_on_error) { + try { + [ namespace, args ] = this._parse_known_args(args, namespace) + } catch (err) { + if (err instanceof ArgumentError) { + this.error(err.message) + } else { + throw err + } + } + } else { + [ namespace, args ] = this._parse_known_args(args, namespace) + } + + if (hasattr(namespace, _UNRECOGNIZED_ARGS_ATTR)) { + args = args.concat(getattr(namespace, _UNRECOGNIZED_ARGS_ATTR)) + delattr(namespace, _UNRECOGNIZED_ARGS_ATTR) + } + + return [ namespace, args ] + } + + _parse_known_args(arg_strings, namespace) { + // replace arg strings that are file references + if (this.fromfile_prefix_chars !== undefined) { + arg_strings = this._read_args_from_files(arg_strings) + } + + // map all mutually exclusive arguments to the other arguments + // they can't occur with + let action_conflicts = new Map() + for (let mutex_group of this._mutually_exclusive_groups) { + let group_actions = mutex_group._group_actions + for (let [ i, mutex_action ] of Object.entries(mutex_group._group_actions)) { + let conflicts = action_conflicts.get(mutex_action) || [] + conflicts = conflicts.concat(group_actions.slice(0, +i)) + conflicts = conflicts.concat(group_actions.slice(+i + 1)) + action_conflicts.set(mutex_action, conflicts) + } + } + + // find all option indices, and determine the arg_string_pattern + // which has an 'O' if there is an option at an index, + // an 'A' if there is an argument, or a '-' if there is a '--' + let option_string_indices = {} + let arg_string_pattern_parts = [] + let arg_strings_iter = Object.entries(arg_strings)[Symbol.iterator]() + for (let [ i, arg_string ] of arg_strings_iter) { + + // all args after -- are non-options + if (arg_string === '--') { + arg_string_pattern_parts.push('-') + for ([ i, arg_string ] of arg_strings_iter) { + arg_string_pattern_parts.push('A') + } + + // otherwise, add the arg to the arg strings + // and note the index if it was an option + } else { + let option_tuple = this._parse_optional(arg_string) + let pattern + if (option_tuple === undefined) { + pattern = 'A' + } else { + option_string_indices[i] = option_tuple + pattern = 'O' + } + arg_string_pattern_parts.push(pattern) + } + } + + // join the pieces together to form the pattern + let arg_strings_pattern = arg_string_pattern_parts.join('') + + // converts arg strings to the appropriate and then takes the action + let seen_actions = new Set() + let seen_non_default_actions = new Set() + let extras + + let take_action = (action, argument_strings, option_string = undefined) => { + seen_actions.add(action) + let argument_values = this._get_values(action, argument_strings) + + // error if this argument is not allowed with other previously + // seen arguments, assuming that actions that use the default + // value don't really count as "present" + if (argument_values !== action.default) { + seen_non_default_actions.add(action) + for (let conflict_action of action_conflicts.get(action) || []) { + if (seen_non_default_actions.has(conflict_action)) { + let msg = 'not allowed with argument %s' + let action_name = _get_action_name(conflict_action) + throw new ArgumentError(action, sub(msg, action_name)) + } + } + } + + // take the action if we didn't receive a SUPPRESS value + // (e.g. from a default) + if (argument_values !== SUPPRESS) { + action(this, namespace, argument_values, option_string) + } + } + + // function to convert arg_strings into an optional action + let consume_optional = start_index => { + + // get the optional identified at this index + let option_tuple = option_string_indices[start_index] + let [ action, option_string, explicit_arg ] = option_tuple + + // identify additional optionals in the same arg string + // (e.g. -xyz is the same as -x -y -z if no args are required) + let action_tuples = [] + let stop + for (;;) { + + // if we found no optional action, skip it + if (action === undefined) { + extras.push(arg_strings[start_index]) + return start_index + 1 + } + + // if there is an explicit argument, try to match the + // optional's string arguments to only this + if (explicit_arg !== undefined) { + let arg_count = this._match_argument(action, 'A') + + // if the action is a single-dash option and takes no + // arguments, try to parse more single-dash options out + // of the tail of the option string + let chars = this.prefix_chars + if (arg_count === 0 && !chars.includes(option_string[1])) { + action_tuples.push([ action, [], option_string ]) + let char = option_string[0] + option_string = char + explicit_arg[0] + let new_explicit_arg = explicit_arg.slice(1) || undefined + let optionals_map = this._option_string_actions + if (hasattr(optionals_map, option_string)) { + action = optionals_map[option_string] + explicit_arg = new_explicit_arg + } else { + let msg = 'ignored explicit argument %r' + throw new ArgumentError(action, sub(msg, explicit_arg)) + } + + // if the action expect exactly one argument, we've + // successfully matched the option; exit the loop + } else if (arg_count === 1) { + stop = start_index + 1 + let args = [ explicit_arg ] + action_tuples.push([ action, args, option_string ]) + break + + // error if a double-dash option did not use the + // explicit argument + } else { + let msg = 'ignored explicit argument %r' + throw new ArgumentError(action, sub(msg, explicit_arg)) + } + + // if there is no explicit argument, try to match the + // optional's string arguments with the following strings + // if successful, exit the loop + } else { + let start = start_index + 1 + let selected_patterns = arg_strings_pattern.slice(start) + let arg_count = this._match_argument(action, selected_patterns) + stop = start + arg_count + let args = arg_strings.slice(start, stop) + action_tuples.push([ action, args, option_string ]) + break + } + } + + // add the Optional to the list and return the index at which + // the Optional's string args stopped + assert(action_tuples.length) + for (let [ action, args, option_string ] of action_tuples) { + take_action(action, args, option_string) + } + return stop + } + + // the list of Positionals left to be parsed; this is modified + // by consume_positionals() + let positionals = this._get_positional_actions() + + // function to convert arg_strings into positional actions + let consume_positionals = start_index => { + // match as many Positionals as possible + let selected_pattern = arg_strings_pattern.slice(start_index) + let arg_counts = this._match_arguments_partial(positionals, selected_pattern) + + // slice off the appropriate arg strings for each Positional + // and add the Positional and its args to the list + for (let i = 0; i < positionals.length && i < arg_counts.length; i++) { + let action = positionals[i] + let arg_count = arg_counts[i] + let args = arg_strings.slice(start_index, start_index + arg_count) + start_index += arg_count + take_action(action, args) + } + + // slice off the Positionals that we just parsed and return the + // index at which the Positionals' string args stopped + positionals = positionals.slice(arg_counts.length) + return start_index + } + + // consume Positionals and Optionals alternately, until we have + // passed the last option string + extras = [] + let start_index = 0 + let max_option_string_index = Math.max(-1, ...Object.keys(option_string_indices).map(Number)) + while (start_index <= max_option_string_index) { + + // consume any Positionals preceding the next option + let next_option_string_index = Math.min( + // eslint-disable-next-line no-loop-func + ...Object.keys(option_string_indices).map(Number).filter(index => index >= start_index) + ) + if (start_index !== next_option_string_index) { + let positionals_end_index = consume_positionals(start_index) + + // only try to parse the next optional if we didn't consume + // the option string during the positionals parsing + if (positionals_end_index > start_index) { + start_index = positionals_end_index + continue + } else { + start_index = positionals_end_index + } + } + + // if we consumed all the positionals we could and we're not + // at the index of an option string, there were extra arguments + if (!(start_index in option_string_indices)) { + let strings = arg_strings.slice(start_index, next_option_string_index) + extras = extras.concat(strings) + start_index = next_option_string_index + } + + // consume the next optional and any arguments for it + start_index = consume_optional(start_index) + } + + // consume any positionals following the last Optional + let stop_index = consume_positionals(start_index) + + // if we didn't consume all the argument strings, there were extras + extras = extras.concat(arg_strings.slice(stop_index)) + + // make sure all required actions were present and also convert + // action defaults which were not given as arguments + let required_actions = [] + for (let action of this._actions) { + if (!seen_actions.has(action)) { + if (action.required) { + required_actions.push(_get_action_name(action)) + } else { + // Convert action default now instead of doing it before + // parsing arguments to avoid calling convert functions + // twice (which may fail) if the argument was given, but + // only if it was defined already in the namespace + if (action.default !== undefined && + typeof action.default === 'string' && + hasattr(namespace, action.dest) && + action.default === getattr(namespace, action.dest)) { + setattr(namespace, action.dest, + this._get_value(action, action.default)) + } + } + } + } + + if (required_actions.length) { + this.error(sub('the following arguments are required: %s', + required_actions.join(', '))) + } + + // make sure all required groups had one option present + for (let group of this._mutually_exclusive_groups) { + if (group.required) { + let no_actions_used = true + for (let action of group._group_actions) { + if (seen_non_default_actions.has(action)) { + no_actions_used = false + break + } + } + + // if no actions were used, report the error + if (no_actions_used) { + let names = group._group_actions + .filter(action => action.help !== SUPPRESS) + .map(action => _get_action_name(action)) + let msg = 'one of the arguments %s is required' + this.error(sub(msg, names.join(' '))) + } + } + } + + // return the updated namespace and the extra arguments + return [ namespace, extras ] + } + + _read_args_from_files(arg_strings) { + // expand arguments referencing files + let new_arg_strings = [] + for (let arg_string of arg_strings) { + + // for regular arguments, just add them back into the list + if (!arg_string || !this.fromfile_prefix_chars.includes(arg_string[0])) { + new_arg_strings.push(arg_string) + + // replace arguments referencing files with the file content + } else { + try { + let args_file = fs.readFileSync(arg_string.slice(1), 'utf8') + let arg_strings = [] + for (let arg_line of splitlines(args_file)) { + for (let arg of this.convert_arg_line_to_args(arg_line)) { + arg_strings.push(arg) + } + } + arg_strings = this._read_args_from_files(arg_strings) + new_arg_strings = new_arg_strings.concat(arg_strings) + } catch (err) { + this.error(err.message) + } + } + } + + // return the modified argument list + return new_arg_strings + } + + convert_arg_line_to_args(arg_line) { + return [arg_line] + } + + _match_argument(action, arg_strings_pattern) { + // match the pattern for this action to the arg strings + let nargs_pattern = this._get_nargs_pattern(action) + let match = arg_strings_pattern.match(new RegExp('^' + nargs_pattern)) + + // raise an exception if we weren't able to find a match + if (match === null) { + let nargs_errors = { + undefined: 'expected one argument', + [OPTIONAL]: 'expected at most one argument', + [ONE_OR_MORE]: 'expected at least one argument' + } + let msg = nargs_errors[action.nargs] + if (msg === undefined) { + msg = sub(action.nargs === 1 ? 'expected %s argument' : 'expected %s arguments', action.nargs) + } + throw new ArgumentError(action, msg) + } + + // return the number of arguments matched + return match[1].length + } + + _match_arguments_partial(actions, arg_strings_pattern) { + // progressively shorten the actions list by slicing off the + // final actions until we find a match + let result = [] + for (let i of range(actions.length, 0, -1)) { + let actions_slice = actions.slice(0, i) + let pattern = actions_slice.map(action => this._get_nargs_pattern(action)).join('') + let match = arg_strings_pattern.match(new RegExp('^' + pattern)) + if (match !== null) { + result = result.concat(match.slice(1).map(string => string.length)) + break + } + } + + // return the list of arg string counts + return result + } + + _parse_optional(arg_string) { + // if it's an empty string, it was meant to be a positional + if (!arg_string) { + return undefined + } + + // if it doesn't start with a prefix, it was meant to be positional + if (!this.prefix_chars.includes(arg_string[0])) { + return undefined + } + + // if the option string is present in the parser, return the action + if (arg_string in this._option_string_actions) { + let action = this._option_string_actions[arg_string] + return [ action, arg_string, undefined ] + } + + // if it's just a single character, it was meant to be positional + if (arg_string.length === 1) { + return undefined + } + + // if the option string before the "=" is present, return the action + if (arg_string.includes('=')) { + let [ option_string, explicit_arg ] = _string_split(arg_string, '=', 1) + if (option_string in this._option_string_actions) { + let action = this._option_string_actions[option_string] + return [ action, option_string, explicit_arg ] + } + } + + // search through all possible prefixes of the option string + // and all actions in the parser for possible interpretations + let option_tuples = this._get_option_tuples(arg_string) + + // if multiple actions match, the option string was ambiguous + if (option_tuples.length > 1) { + let options = option_tuples.map(([ /*action*/, option_string/*, explicit_arg*/ ]) => option_string).join(', ') + let args = {option: arg_string, matches: options} + let msg = 'ambiguous option: %(option)s could match %(matches)s' + this.error(sub(msg, args)) + + // if exactly one action matched, this segmentation is good, + // so return the parsed action + } else if (option_tuples.length === 1) { + let [ option_tuple ] = option_tuples + return option_tuple + } + + // if it was not found as an option, but it looks like a negative + // number, it was meant to be positional + // unless there are negative-number-like options + if (this._negative_number_matcher.test(arg_string)) { + if (!this._has_negative_number_optionals.length) { + return undefined + } + } + + // if it contains a space, it was meant to be a positional + if (arg_string.includes(' ')) { + return undefined + } + + // it was meant to be an optional but there is no such option + // in this parser (though it might be a valid option in a subparser) + return [ undefined, arg_string, undefined ] + } + + _get_option_tuples(option_string) { + let result = [] + + // option strings starting with two prefix characters are only + // split at the '=' + let chars = this.prefix_chars + if (chars.includes(option_string[0]) && chars.includes(option_string[1])) { + if (this.allow_abbrev) { + let option_prefix, explicit_arg + if (option_string.includes('=')) { + [ option_prefix, explicit_arg ] = _string_split(option_string, '=', 1) + } else { + option_prefix = option_string + explicit_arg = undefined + } + for (let option_string of Object.keys(this._option_string_actions)) { + if (option_string.startsWith(option_prefix)) { + let action = this._option_string_actions[option_string] + let tup = [ action, option_string, explicit_arg ] + result.push(tup) + } + } + } + + // single character options can be concatenated with their arguments + // but multiple character options always have to have their argument + // separate + } else if (chars.includes(option_string[0]) && !chars.includes(option_string[1])) { + let option_prefix = option_string + let explicit_arg = undefined + let short_option_prefix = option_string.slice(0, 2) + let short_explicit_arg = option_string.slice(2) + + for (let option_string of Object.keys(this._option_string_actions)) { + if (option_string === short_option_prefix) { + let action = this._option_string_actions[option_string] + let tup = [ action, option_string, short_explicit_arg ] + result.push(tup) + } else if (option_string.startsWith(option_prefix)) { + let action = this._option_string_actions[option_string] + let tup = [ action, option_string, explicit_arg ] + result.push(tup) + } + } + + // shouldn't ever get here + } else { + this.error(sub('unexpected option string: %s', option_string)) + } + + // return the collected option tuples + return result + } + + _get_nargs_pattern(action) { + // in all examples below, we have to allow for '--' args + // which are represented as '-' in the pattern + let nargs = action.nargs + let nargs_pattern + + // the default (None) is assumed to be a single argument + if (nargs === undefined) { + nargs_pattern = '(-*A-*)' + + // allow zero or one arguments + } else if (nargs === OPTIONAL) { + nargs_pattern = '(-*A?-*)' + + // allow zero or more arguments + } else if (nargs === ZERO_OR_MORE) { + nargs_pattern = '(-*[A-]*)' + + // allow one or more arguments + } else if (nargs === ONE_OR_MORE) { + nargs_pattern = '(-*A[A-]*)' + + // allow any number of options or arguments + } else if (nargs === REMAINDER) { + nargs_pattern = '([-AO]*)' + + // allow one argument followed by any number of options or arguments + } else if (nargs === PARSER) { + nargs_pattern = '(-*A[-AO]*)' + + // suppress action, like nargs=0 + } else if (nargs === SUPPRESS) { + nargs_pattern = '(-*-*)' + + // all others should be integers + } else { + nargs_pattern = sub('(-*%s-*)', 'A'.repeat(nargs).split('').join('-*')) + } + + // if this is an optional action, -- is not allowed + if (action.option_strings.length) { + nargs_pattern = nargs_pattern.replace(/-\*/g, '') + nargs_pattern = nargs_pattern.replace(/-/g, '') + } + + // return the pattern + return nargs_pattern + } + + // ======================== + // Alt command line argument parsing, allowing free intermix + // ======================== + + parse_intermixed_args(args = undefined, namespace = undefined) { + let argv + [ args, argv ] = this.parse_known_intermixed_args(args, namespace) + if (argv.length) { + let msg = 'unrecognized arguments: %s' + this.error(sub(msg, argv.join(' '))) + } + return args + } + + parse_known_intermixed_args(args = undefined, namespace = undefined) { + // returns a namespace and list of extras + // + // positional can be freely intermixed with optionals. optionals are + // first parsed with all positional arguments deactivated. The 'extras' + // are then parsed. If the parser definition is incompatible with the + // intermixed assumptions (e.g. use of REMAINDER, subparsers) a + // TypeError is raised. + // + // positionals are 'deactivated' by setting nargs and default to + // SUPPRESS. This blocks the addition of that positional to the + // namespace + + let extras + let positionals = this._get_positional_actions() + let a = positionals.filter(action => [ PARSER, REMAINDER ].includes(action.nargs)) + if (a.length) { + throw new TypeError(sub('parse_intermixed_args: positional arg' + + ' with nargs=%s', a[0].nargs)) + } + + for (let group of this._mutually_exclusive_groups) { + for (let action of group._group_actions) { + if (positionals.includes(action)) { + throw new TypeError('parse_intermixed_args: positional in' + + ' mutuallyExclusiveGroup') + } + } + } + + let save_usage + try { + save_usage = this.usage + let remaining_args + try { + if (this.usage === undefined) { + // capture the full usage for use in error messages + this.usage = this.format_usage().slice(7) + } + for (let action of positionals) { + // deactivate positionals + action.save_nargs = action.nargs + // action.nargs = 0 + action.nargs = SUPPRESS + action.save_default = action.default + action.default = SUPPRESS + } + [ namespace, remaining_args ] = this.parse_known_args(args, + namespace) + for (let action of positionals) { + // remove the empty positional values from namespace + let attr = getattr(namespace, action.dest) + if (Array.isArray(attr) && attr.length === 0) { + // eslint-disable-next-line no-console + console.warn(sub('Do not expect %s in %s', action.dest, namespace)) + delattr(namespace, action.dest) + } + } + } finally { + // restore nargs and usage before exiting + for (let action of positionals) { + action.nargs = action.save_nargs + action.default = action.save_default + } + } + let optionals = this._get_optional_actions() + try { + // parse positionals. optionals aren't normally required, but + // they could be, so make sure they aren't. + for (let action of optionals) { + action.save_required = action.required + action.required = false + } + for (let group of this._mutually_exclusive_groups) { + group.save_required = group.required + group.required = false + } + [ namespace, extras ] = this.parse_known_args(remaining_args, + namespace) + } finally { + // restore parser values before exiting + for (let action of optionals) { + action.required = action.save_required + } + for (let group of this._mutually_exclusive_groups) { + group.required = group.save_required + } + } + } finally { + this.usage = save_usage + } + return [ namespace, extras ] + } + + // ======================== + // Value conversion methods + // ======================== + _get_values(action, arg_strings) { + // for everything but PARSER, REMAINDER args, strip out first '--' + if (![PARSER, REMAINDER].includes(action.nargs)) { + try { + _array_remove(arg_strings, '--') + } catch (err) {} + } + + let value + // optional argument produces a default when not present + if (!arg_strings.length && action.nargs === OPTIONAL) { + if (action.option_strings.length) { + value = action.const + } else { + value = action.default + } + if (typeof value === 'string') { + value = this._get_value(action, value) + this._check_value(action, value) + } + + // when nargs='*' on a positional, if there were no command-line + // args, use the default if it is anything other than None + } else if (!arg_strings.length && action.nargs === ZERO_OR_MORE && + !action.option_strings.length) { + if (action.default !== undefined) { + value = action.default + } else { + value = arg_strings + } + this._check_value(action, value) + + // single argument or optional argument produces a single value + } else if (arg_strings.length === 1 && [undefined, OPTIONAL].includes(action.nargs)) { + let arg_string = arg_strings[0] + value = this._get_value(action, arg_string) + this._check_value(action, value) + + // REMAINDER arguments convert all values, checking none + } else if (action.nargs === REMAINDER) { + value = arg_strings.map(v => this._get_value(action, v)) + + // PARSER arguments convert all values, but check only the first + } else if (action.nargs === PARSER) { + value = arg_strings.map(v => this._get_value(action, v)) + this._check_value(action, value[0]) + + // SUPPRESS argument does not put anything in the namespace + } else if (action.nargs === SUPPRESS) { + value = SUPPRESS + + // all other types of nargs produce a list + } else { + value = arg_strings.map(v => this._get_value(action, v)) + for (let v of value) { + this._check_value(action, v) + } + } + + // return the converted value + return value + } + + _get_value(action, arg_string) { + let type_func = this._registry_get('type', action.type, action.type) + if (typeof type_func !== 'function') { + let msg = '%r is not callable' + throw new ArgumentError(action, sub(msg, type_func)) + } + + // convert the value to the appropriate type + let result + try { + try { + result = type_func(arg_string) + } catch (err) { + // Dear TC39, why would you ever consider making es6 classes not callable? + // We had one universal interface, [[Call]], which worked for anything + // (with familiar this-instanceof guard for classes). Now we have two. + if (err instanceof TypeError && + /Class constructor .* cannot be invoked without 'new'/.test(err.message)) { + // eslint-disable-next-line new-cap + result = new type_func(arg_string) + } else { + throw err + } + } + + } catch (err) { + // ArgumentTypeErrors indicate errors + if (err instanceof ArgumentTypeError) { + //let name = getattr(action.type, 'name', repr(action.type)) + let msg = err.message + throw new ArgumentError(action, msg) + + // TypeErrors or ValueErrors also indicate errors + } else if (err instanceof TypeError) { + let name = getattr(action.type, 'name', repr(action.type)) + let args = {type: name, value: arg_string} + let msg = 'invalid %(type)s value: %(value)r' + throw new ArgumentError(action, sub(msg, args)) + } else { + throw err + } + } + + // return the converted value + return result + } + + _check_value(action, value) { + // converted value must be one of the choices (if specified) + if (action.choices !== undefined && !_choices_to_array(action.choices).includes(value)) { + let args = {value, + choices: _choices_to_array(action.choices).map(repr).join(', ')} + let msg = 'invalid choice: %(value)r (choose from %(choices)s)' + throw new ArgumentError(action, sub(msg, args)) + } + } + + // ======================= + // Help-formatting methods + // ======================= + format_usage() { + let formatter = this._get_formatter() + formatter.add_usage(this.usage, this._actions, + this._mutually_exclusive_groups) + return formatter.format_help() + } + + format_help() { + let formatter = this._get_formatter() + + // usage + formatter.add_usage(this.usage, this._actions, + this._mutually_exclusive_groups) + + // description + formatter.add_text(this.description) + + // positionals, optionals and user-defined groups + for (let action_group of this._action_groups) { + formatter.start_section(action_group.title) + formatter.add_text(action_group.description) + formatter.add_arguments(action_group._group_actions) + formatter.end_section() + } + + // epilog + formatter.add_text(this.epilog) + + // determine help from format above + return formatter.format_help() + } + + _get_formatter() { + // eslint-disable-next-line new-cap + return new this.formatter_class({ prog: this.prog }) + } + + // ===================== + // Help-printing methods + // ===================== + print_usage(file = undefined) { + if (file === undefined) file = process.stdout + this._print_message(this.format_usage(), file) + } + + print_help(file = undefined) { + if (file === undefined) file = process.stdout + this._print_message(this.format_help(), file) + } + + _print_message(message, file = undefined) { + if (message) { + if (file === undefined) file = process.stderr + file.write(message) + } + } + + // =============== + // Exiting methods + // =============== + exit(status = 0, message = undefined) { + if (message) { + this._print_message(message, process.stderr) + } + process.exit(status) + } + + error(message) { + /* + * error(message: string) + * + * Prints a usage message incorporating the message to stderr and + * exits. + * + * If you override this in a subclass, it should not return -- it + * should either exit or raise an exception. + */ + + // LEGACY (v1 compatibility), debug mode + if (this.debug === true) throw new Error(message) + // end + this.print_usage(process.stderr) + let args = {prog: this.prog, message: message} + this.exit(2, sub('%(prog)s: error: %(message)s\n', args)) + } +})) + + +module.exports = { + ArgumentParser, + ArgumentError, + ArgumentTypeError, + BooleanOptionalAction, + FileType, + HelpFormatter, + ArgumentDefaultsHelpFormatter, + RawDescriptionHelpFormatter, + RawTextHelpFormatter, + MetavarTypeHelpFormatter, + Namespace, + Action, + ONE_OR_MORE, + OPTIONAL, + PARSER, + REMAINDER, + SUPPRESS, + ZERO_OR_MORE +} + +// LEGACY (v1 compatibility), Const alias +Object.defineProperty(module.exports, 'Const', { + get() { + let result = {} + Object.entries({ ONE_OR_MORE, OPTIONAL, PARSER, REMAINDER, SUPPRESS, ZERO_OR_MORE }).forEach(([ n, v ]) => { + Object.defineProperty(result, n, { + get() { + deprecate(n, sub('use argparse.%s instead of argparse.Const.%s', n, n)) + return v + } + }) + }) + Object.entries({ _UNRECOGNIZED_ARGS_ATTR }).forEach(([ n, v ]) => { + Object.defineProperty(result, n, { + get() { + deprecate(n, sub('argparse.Const.%s is an internal symbol and will no longer be available', n)) + return v + } + }) + }) + return result + }, + enumerable: false +}) +// end diff --git a/node_modules/argparse/lib/sub.js b/node_modules/argparse/lib/sub.js new file mode 100644 index 0000000..e3eb321 --- /dev/null +++ b/node_modules/argparse/lib/sub.js @@ -0,0 +1,67 @@ +// Limited implementation of python % string operator, supports only %s and %r for now +// (other formats are not used here, but may appear in custom templates) + +'use strict' + +const { inspect } = require('util') + + +module.exports = function sub(pattern, ...values) { + let regex = /%(?:(%)|(-)?(\*)?(?:\((\w+)\))?([A-Za-z]))/g + + let result = pattern.replace(regex, function (_, is_literal, is_left_align, is_padded, name, format) { + if (is_literal) return '%' + + let padded_count = 0 + if (is_padded) { + if (values.length === 0) throw new TypeError('not enough arguments for format string') + padded_count = values.shift() + if (!Number.isInteger(padded_count)) throw new TypeError('* wants int') + } + + let str + if (name !== undefined) { + let dict = values[0] + if (typeof dict !== 'object' || dict === null) throw new TypeError('format requires a mapping') + if (!(name in dict)) throw new TypeError(`no such key: '${name}'`) + str = dict[name] + } else { + if (values.length === 0) throw new TypeError('not enough arguments for format string') + str = values.shift() + } + + switch (format) { + case 's': + str = String(str) + break + case 'r': + str = inspect(str) + break + case 'd': + case 'i': + if (typeof str !== 'number') { + throw new TypeError(`%${format} format: a number is required, not ${typeof str}`) + } + str = String(str.toFixed(0)) + break + default: + throw new TypeError(`unsupported format character '${format}'`) + } + + if (padded_count > 0) { + return is_left_align ? str.padEnd(padded_count) : str.padStart(padded_count) + } else { + return str + } + }) + + if (values.length) { + if (values.length === 1 && typeof values[0] === 'object' && values[0] !== null) { + // mapping + } else { + throw new TypeError('not all arguments converted during string formatting') + } + } + + return result +} diff --git a/node_modules/argparse/lib/textwrap.js b/node_modules/argparse/lib/textwrap.js new file mode 100644 index 0000000..23d51cd --- /dev/null +++ b/node_modules/argparse/lib/textwrap.js @@ -0,0 +1,440 @@ +// Partial port of python's argparse module, version 3.9.0 (only wrap and fill functions): +// https://github.com/python/cpython/blob/v3.9.0b4/Lib/textwrap.py + +'use strict' + +/* + * Text wrapping and filling. + */ + +// Copyright (C) 1999-2001 Gregory P. Ward. +// Copyright (C) 2002, 2003 Python Software Foundation. +// Copyright (C) 2020 argparse.js authors +// Originally written by Greg Ward + +// Hardcode the recognized whitespace characters to the US-ASCII +// whitespace characters. The main reason for doing this is that +// some Unicode spaces (like \u00a0) are non-breaking whitespaces. +// +// This less funky little regex just split on recognized spaces. E.g. +// "Hello there -- you goof-ball, use the -b option!" +// splits into +// Hello/ /there/ /--/ /you/ /goof-ball,/ /use/ /the/ /-b/ /option!/ +const wordsep_simple_re = /([\t\n\x0b\x0c\r ]+)/ + +class TextWrapper { + /* + * Object for wrapping/filling text. The public interface consists of + * the wrap() and fill() methods; the other methods are just there for + * subclasses to override in order to tweak the default behaviour. + * If you want to completely replace the main wrapping algorithm, + * you'll probably have to override _wrap_chunks(). + * + * Several instance attributes control various aspects of wrapping: + * width (default: 70) + * the maximum width of wrapped lines (unless break_long_words + * is false) + * initial_indent (default: "") + * string that will be prepended to the first line of wrapped + * output. Counts towards the line's width. + * subsequent_indent (default: "") + * string that will be prepended to all lines save the first + * of wrapped output; also counts towards each line's width. + * expand_tabs (default: true) + * Expand tabs in input text to spaces before further processing. + * Each tab will become 0 .. 'tabsize' spaces, depending on its position + * in its line. If false, each tab is treated as a single character. + * tabsize (default: 8) + * Expand tabs in input text to 0 .. 'tabsize' spaces, unless + * 'expand_tabs' is false. + * replace_whitespace (default: true) + * Replace all whitespace characters in the input text by spaces + * after tab expansion. Note that if expand_tabs is false and + * replace_whitespace is true, every tab will be converted to a + * single space! + * fix_sentence_endings (default: false) + * Ensure that sentence-ending punctuation is always followed + * by two spaces. Off by default because the algorithm is + * (unavoidably) imperfect. + * break_long_words (default: true) + * Break words longer than 'width'. If false, those words will not + * be broken, and some lines might be longer than 'width'. + * break_on_hyphens (default: true) + * Allow breaking hyphenated words. If true, wrapping will occur + * preferably on whitespaces and right after hyphens part of + * compound words. + * drop_whitespace (default: true) + * Drop leading and trailing whitespace from lines. + * max_lines (default: None) + * Truncate wrapped lines. + * placeholder (default: ' [...]') + * Append to the last line of truncated text. + */ + + constructor(options = {}) { + let { + width = 70, + initial_indent = '', + subsequent_indent = '', + expand_tabs = true, + replace_whitespace = true, + fix_sentence_endings = false, + break_long_words = true, + drop_whitespace = true, + break_on_hyphens = true, + tabsize = 8, + max_lines = undefined, + placeholder=' [...]' + } = options + + this.width = width + this.initial_indent = initial_indent + this.subsequent_indent = subsequent_indent + this.expand_tabs = expand_tabs + this.replace_whitespace = replace_whitespace + this.fix_sentence_endings = fix_sentence_endings + this.break_long_words = break_long_words + this.drop_whitespace = drop_whitespace + this.break_on_hyphens = break_on_hyphens + this.tabsize = tabsize + this.max_lines = max_lines + this.placeholder = placeholder + } + + + // -- Private methods ----------------------------------------------- + // (possibly useful for subclasses to override) + + _munge_whitespace(text) { + /* + * _munge_whitespace(text : string) -> string + * + * Munge whitespace in text: expand tabs and convert all other + * whitespace characters to spaces. Eg. " foo\\tbar\\n\\nbaz" + * becomes " foo bar baz". + */ + if (this.expand_tabs) { + text = text.replace(/\t/g, ' '.repeat(this.tabsize)) // not strictly correct in js + } + if (this.replace_whitespace) { + text = text.replace(/[\t\n\x0b\x0c\r]/g, ' ') + } + return text + } + + _split(text) { + /* + * _split(text : string) -> [string] + * + * Split the text to wrap into indivisible chunks. Chunks are + * not quite the same as words; see _wrap_chunks() for full + * details. As an example, the text + * Look, goof-ball -- use the -b option! + * breaks into the following chunks: + * 'Look,', ' ', 'goof-', 'ball', ' ', '--', ' ', + * 'use', ' ', 'the', ' ', '-b', ' ', 'option!' + * if break_on_hyphens is True, or in: + * 'Look,', ' ', 'goof-ball', ' ', '--', ' ', + * 'use', ' ', 'the', ' ', '-b', ' ', option!' + * otherwise. + */ + let chunks = text.split(wordsep_simple_re) + chunks = chunks.filter(Boolean) + return chunks + } + + _handle_long_word(reversed_chunks, cur_line, cur_len, width) { + /* + * _handle_long_word(chunks : [string], + * cur_line : [string], + * cur_len : int, width : int) + * + * Handle a chunk of text (most likely a word, not whitespace) that + * is too long to fit in any line. + */ + // Figure out when indent is larger than the specified width, and make + // sure at least one character is stripped off on every pass + let space_left + if (width < 1) { + space_left = 1 + } else { + space_left = width - cur_len + } + + // If we're allowed to break long words, then do so: put as much + // of the next chunk onto the current line as will fit. + if (this.break_long_words) { + cur_line.push(reversed_chunks[reversed_chunks.length - 1].slice(0, space_left)) + reversed_chunks[reversed_chunks.length - 1] = reversed_chunks[reversed_chunks.length - 1].slice(space_left) + + // Otherwise, we have to preserve the long word intact. Only add + // it to the current line if there's nothing already there -- + // that minimizes how much we violate the width constraint. + } else if (!cur_line) { + cur_line.push(...reversed_chunks.pop()) + } + + // If we're not allowed to break long words, and there's already + // text on the current line, do nothing. Next time through the + // main loop of _wrap_chunks(), we'll wind up here again, but + // cur_len will be zero, so the next line will be entirely + // devoted to the long word that we can't handle right now. + } + + _wrap_chunks(chunks) { + /* + * _wrap_chunks(chunks : [string]) -> [string] + * + * Wrap a sequence of text chunks and return a list of lines of + * length 'self.width' or less. (If 'break_long_words' is false, + * some lines may be longer than this.) Chunks correspond roughly + * to words and the whitespace between them: each chunk is + * indivisible (modulo 'break_long_words'), but a line break can + * come between any two chunks. Chunks should not have internal + * whitespace; ie. a chunk is either all whitespace or a "word". + * Whitespace chunks will be removed from the beginning and end of + * lines, but apart from that whitespace is preserved. + */ + let lines = [] + let indent + if (this.width <= 0) { + throw Error(`invalid width ${this.width} (must be > 0)`) + } + if (this.max_lines !== undefined) { + if (this.max_lines > 1) { + indent = this.subsequent_indent + } else { + indent = this.initial_indent + } + if (indent.length + this.placeholder.trimStart().length > this.width) { + throw Error('placeholder too large for max width') + } + } + + // Arrange in reverse order so items can be efficiently popped + // from a stack of chucks. + chunks = chunks.reverse() + + while (chunks.length > 0) { + + // Start the list of chunks that will make up the current line. + // cur_len is just the length of all the chunks in cur_line. + let cur_line = [] + let cur_len = 0 + + // Figure out which static string will prefix this line. + let indent + if (lines) { + indent = this.subsequent_indent + } else { + indent = this.initial_indent + } + + // Maximum width for this line. + let width = this.width - indent.length + + // First chunk on line is whitespace -- drop it, unless this + // is the very beginning of the text (ie. no lines started yet). + if (this.drop_whitespace && chunks[chunks.length - 1].trim() === '' && lines.length > 0) { + chunks.pop() + } + + while (chunks.length > 0) { + let l = chunks[chunks.length - 1].length + + // Can at least squeeze this chunk onto the current line. + if (cur_len + l <= width) { + cur_line.push(chunks.pop()) + cur_len += l + + // Nope, this line is full. + } else { + break + } + } + + // The current line is full, and the next chunk is too big to + // fit on *any* line (not just this one). + if (chunks.length && chunks[chunks.length - 1].length > width) { + this._handle_long_word(chunks, cur_line, cur_len, width) + cur_len = cur_line.map(l => l.length).reduce((a, b) => a + b, 0) + } + + // If the last chunk on this line is all whitespace, drop it. + if (this.drop_whitespace && cur_line.length > 0 && cur_line[cur_line.length - 1].trim() === '') { + cur_len -= cur_line[cur_line.length - 1].length + cur_line.pop() + } + + if (cur_line) { + if (this.max_lines === undefined || + lines.length + 1 < this.max_lines || + (chunks.length === 0 || + this.drop_whitespace && + chunks.length === 1 && + !chunks[0].trim()) && cur_len <= width) { + // Convert current line back to a string and store it in + // list of all lines (return value). + lines.push(indent + cur_line.join('')) + } else { + let had_break = false + while (cur_line) { + if (cur_line[cur_line.length - 1].trim() && + cur_len + this.placeholder.length <= width) { + cur_line.push(this.placeholder) + lines.push(indent + cur_line.join('')) + had_break = true + break + } + cur_len -= cur_line[-1].length + cur_line.pop() + } + if (!had_break) { + if (lines) { + let prev_line = lines[lines.length - 1].trimEnd() + if (prev_line.length + this.placeholder.length <= + this.width) { + lines[lines.length - 1] = prev_line + this.placeholder + break + } + } + lines.push(indent + this.placeholder.lstrip()) + } + break + } + } + } + + return lines + } + + _split_chunks(text) { + text = this._munge_whitespace(text) + return this._split(text) + } + + // -- Public interface ---------------------------------------------- + + wrap(text) { + /* + * wrap(text : string) -> [string] + * + * Reformat the single paragraph in 'text' so it fits in lines of + * no more than 'self.width' columns, and return a list of wrapped + * lines. Tabs in 'text' are expanded with string.expandtabs(), + * and all other whitespace characters (including newline) are + * converted to space. + */ + let chunks = this._split_chunks(text) + // not implemented in js + //if (this.fix_sentence_endings) { + // this._fix_sentence_endings(chunks) + //} + return this._wrap_chunks(chunks) + } + + fill(text) { + /* + * fill(text : string) -> string + * + * Reformat the single paragraph in 'text' to fit in lines of no + * more than 'self.width' columns, and return a new string + * containing the entire wrapped paragraph. + */ + return this.wrap(text).join('\n') + } +} + + +// -- Convenience interface --------------------------------------------- + +function wrap(text, options = {}) { + /* + * Wrap a single paragraph of text, returning a list of wrapped lines. + * + * Reformat the single paragraph in 'text' so it fits in lines of no + * more than 'width' columns, and return a list of wrapped lines. By + * default, tabs in 'text' are expanded with string.expandtabs(), and + * all other whitespace characters (including newline) are converted to + * space. See TextWrapper class for available keyword args to customize + * wrapping behaviour. + */ + let { width = 70, ...kwargs } = options + let w = new TextWrapper(Object.assign({ width }, kwargs)) + return w.wrap(text) +} + +function fill(text, options = {}) { + /* + * Fill a single paragraph of text, returning a new string. + * + * Reformat the single paragraph in 'text' to fit in lines of no more + * than 'width' columns, and return a new string containing the entire + * wrapped paragraph. As with wrap(), tabs are expanded and other + * whitespace characters converted to space. See TextWrapper class for + * available keyword args to customize wrapping behaviour. + */ + let { width = 70, ...kwargs } = options + let w = new TextWrapper(Object.assign({ width }, kwargs)) + return w.fill(text) +} + +// -- Loosely related functionality ------------------------------------- + +let _whitespace_only_re = /^[ \t]+$/mg +let _leading_whitespace_re = /(^[ \t]*)(?:[^ \t\n])/mg + +function dedent(text) { + /* + * Remove any common leading whitespace from every line in `text`. + * + * This can be used to make triple-quoted strings line up with the left + * edge of the display, while still presenting them in the source code + * in indented form. + * + * Note that tabs and spaces are both treated as whitespace, but they + * are not equal: the lines " hello" and "\\thello" are + * considered to have no common leading whitespace. + * + * Entirely blank lines are normalized to a newline character. + */ + // Look for the longest leading string of spaces and tabs common to + // all lines. + let margin = undefined + text = text.replace(_whitespace_only_re, '') + let indents = text.match(_leading_whitespace_re) || [] + for (let indent of indents) { + indent = indent.slice(0, -1) + + if (margin === undefined) { + margin = indent + + // Current line more deeply indented than previous winner: + // no change (previous winner is still on top). + } else if (indent.startsWith(margin)) { + // pass + + // Current line consistent with and no deeper than previous winner: + // it's the new winner. + } else if (margin.startsWith(indent)) { + margin = indent + + // Find the largest common whitespace between current line and previous + // winner. + } else { + for (let i = 0; i < margin.length && i < indent.length; i++) { + if (margin[i] !== indent[i]) { + margin = margin.slice(0, i) + break + } + } + } + } + + if (margin) { + text = text.replace(new RegExp('^' + margin, 'mg'), '') + } + return text +} + +module.exports = { wrap, fill, dedent } diff --git a/node_modules/argparse/package.json b/node_modules/argparse/package.json new file mode 100644 index 0000000..647d2af --- /dev/null +++ b/node_modules/argparse/package.json @@ -0,0 +1,31 @@ +{ + "name": "argparse", + "description": "CLI arguments parser. Native port of python's argparse.", + "version": "2.0.1", + "keywords": [ + "cli", + "parser", + "argparse", + "option", + "args" + ], + "main": "argparse.js", + "files": [ + "argparse.js", + "lib/" + ], + "license": "Python-2.0", + "repository": "nodeca/argparse", + "scripts": { + "lint": "eslint .", + "test": "npm run lint && nyc mocha", + "coverage": "npm run test && nyc report --reporter html" + }, + "devDependencies": { + "@babel/eslint-parser": "^7.11.0", + "@babel/plugin-syntax-class-properties": "^7.10.4", + "eslint": "^7.5.0", + "mocha": "^8.0.1", + "nyc": "^15.1.0" + } +} diff --git a/node_modules/js-yaml/CHANGELOG.md b/node_modules/js-yaml/CHANGELOG.md new file mode 100644 index 0000000..ff2375e --- /dev/null +++ b/node_modules/js-yaml/CHANGELOG.md @@ -0,0 +1,616 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + + +## [4.1.0] - 2021-04-15 +### Added +- Types are now exported as `yaml.types.XXX`. +- Every type now has `options` property with original arguments kept as they were + (see `yaml.types.int.options` as an example). + +### Changed +- `Schema.extend()` now keeps old type order in case of conflicts + (e.g. Schema.extend([ a, b, c ]).extend([ b, a, d ]) is now ordered as `abcd` instead of `cbad`). + + +## [4.0.0] - 2021-01-03 +### Changed +- Check [migration guide](migrate_v3_to_v4.md) to see details for all breaking changes. +- Breaking: "unsafe" tags `!!js/function`, `!!js/regexp`, `!!js/undefined` are + moved to [js-yaml-js-types](https://github.com/nodeca/js-yaml-js-types) package. +- Breaking: removed `safe*` functions. Use `load`, `loadAll`, `dump` + instead which are all now safe by default. +- `yaml.DEFAULT_SAFE_SCHEMA` and `yaml.DEFAULT_FULL_SCHEMA` are removed, use + `yaml.DEFAULT_SCHEMA` instead. +- `yaml.Schema.create(schema, tags)` is removed, use `schema.extend(tags)` instead. +- `!!binary` now always mapped to `Uint8Array` on load. +- Reduced nesting of `/lib` folder. +- Parse numbers according to YAML 1.2 instead of YAML 1.1 (`01234` is now decimal, + `0o1234` is octal, `1:23` is parsed as string instead of base60). +- `dump()` no longer quotes `:`, `[`, `]`, `(`, `)` except when necessary, #470, #557. +- Line and column in exceptions are now formatted as `(X:Y)` instead of + `at line X, column Y` (also present in compact format), #332. +- Code snippet created in exceptions now contains multiple lines with line numbers. +- `dump()` now serializes `undefined` as `null` in collections and removes keys with + `undefined` in mappings, #571. +- `dump()` with `skipInvalid=true` now serializes invalid items in collections as null. +- Custom tags starting with `!` are now dumped as `!tag` instead of `!`, #576. +- Custom tags starting with `tag:yaml.org,2002:` are now shorthanded using `!!`, #258. + +### Added +- Added `.mjs` (es modules) support. +- Added `quotingType` and `forceQuotes` options for dumper to configure + string literal style, #290, #529. +- Added `styles: { '!!null': 'empty' }` option for dumper + (serializes `{ foo: null }` as "`foo: `"), #570. +- Added `replacer` option (similar to option in JSON.stringify), #339. +- Custom `Tag` can now handle all tags or multiple tags with the same prefix, #385. + +### Fixed +- Astral characters are no longer encoded by `dump()`, #587. +- "duplicate mapping key" exception now points at the correct column, #452. +- Extra commas in flow collections (e.g. `[foo,,bar]`) now throw an exception + instead of producing null, #321. +- `__proto__` key no longer overrides object prototype, #164. +- Removed `bower.json`. +- Tags are now url-decoded in `load()` and url-encoded in `dump()` + (previously usage of custom non-ascii tags may have led to invalid YAML that can't be parsed). +- Anchors now work correctly with empty nodes, #301. +- Fix incorrect parsing of invalid block mapping syntax, #418. +- Throw an error if block sequence/mapping indent contains a tab, #80. + + +## [3.14.1] - 2020-12-07 +### Security +- Fix possible code execution in (already unsafe) `.load()` (in &anchor). + + +## [3.14.0] - 2020-05-22 +### Changed +- Support `safe/loadAll(input, options)` variant of call. +- CI: drop outdated nodejs versions. +- Dev deps bump. + +### Fixed +- Quote `=` in plain scalars #519. +- Check the node type for `!` tag in case user manually specifies it. +- Verify that there are no null-bytes in input. +- Fix wrong quote position when writing condensed flow, #526. + + +## [3.13.1] - 2019-04-05 +### Security +- Fix possible code execution in (already unsafe) `.load()`, #480. + + +## [3.13.0] - 2019-03-20 +### Security +- Security fix: `safeLoad()` can hang when arrays with nested refs + used as key. Now throws exception for nested arrays. #475. + + +## [3.12.2] - 2019-02-26 +### Fixed +- Fix `noArrayIndent` option for root level, #468. + + +## [3.12.1] - 2019-01-05 +### Added +- Added `noArrayIndent` option, #432. + + +## [3.12.0] - 2018-06-02 +### Changed +- Support arrow functions without a block statement, #421. + + +## [3.11.0] - 2018-03-05 +### Added +- Add arrow functions suport for `!!js/function`. + +### Fixed +- Fix dump in bin/octal/hex formats for negative integers, #399. + + +## [3.10.0] - 2017-09-10 +### Fixed +- Fix `condenseFlow` output (quote keys for sure, instead of spaces), #371, #370. +- Dump astrals as codepoints instead of surrogate pair, #368. + + +## [3.9.1] - 2017-07-08 +### Fixed +- Ensure stack is present for custom errors in node 7.+, #351. + + +## [3.9.0] - 2017-07-08 +### Added +- Add `condenseFlow` option (to create pretty URL query params), #346. + +### Fixed +- Support array return from safeLoadAll/loadAll, #350. + + +## [3.8.4] - 2017-05-08 +### Fixed +- Dumper: prevent space after dash for arrays that wrap, #343. + + +## [3.8.3] - 2017-04-05 +### Fixed +- Should not allow numbers to begin and end with underscore, #335. + + +## [3.8.2] - 2017-03-02 +### Fixed +- Fix `!!float 123` (integers) parse, #333. +- Don't allow leading zeros in floats (except 0, 0.xxx). +- Allow positive exponent without sign in floats. + + +## [3.8.1] - 2017-02-07 +### Changed +- Maintenance: update browserified build. + + +## [3.8.0] - 2017-02-07 +### Fixed +- Fix reported position for `duplicated mapping key` errors. + Now points to block start instead of block end. + (#243, thanks to @shockey). + + +## [3.7.0] - 2016-11-12 +### Added +- Support polymorphism for tags (#300, thanks to @monken). + +### Fixed +- Fix parsing of quotes followed by newlines (#304, thanks to @dplepage). + + +## [3.6.1] - 2016-05-11 +### Fixed +- Fix output cut on a pipe, #286. + + +## [3.6.0] - 2016-04-16 +### Fixed +- Dumper rewrite, fix multiple bugs with trailing `\n`. + Big thanks to @aepsilon! +- Loader: fix leading/trailing newlines in block scalars, @aepsilon. + + +## [3.5.5] - 2016-03-17 +### Fixed +- Date parse fix: don't allow dates with on digit in month and day, #268. + + +## [3.5.4] - 2016-03-09 +### Added +- `noCompatMode` for dumper, to disable quoting YAML 1.1 values. + + +## [3.5.3] - 2016-02-11 +### Changed +- Maintenance release. + + +## [3.5.2] - 2016-01-11 +### Changed +- Maintenance: missed comma in bower config. + + +## [3.5.1] - 2016-01-11 +### Changed +- Removed `inherit` dependency, #239. +- Better browserify workaround for esprima load. +- Demo rewrite. + + +## [3.5.0] - 2016-01-10 +### Fixed +- Dumper. Fold strings only, #217. +- Dumper. `norefs` option, to clone linked objects, #229. +- Loader. Throw a warning for duplicate keys, #166. +- Improved browserify support (mark `esprima` & `Buffer` excluded). + + +## [3.4.6] - 2015-11-26 +### Changed +- Use standalone `inherit` to keep browserified files clear. + + +## [3.4.5] - 2015-11-23 +### Added +- Added `lineWidth` option to dumper. + + +## [3.4.4] - 2015-11-21 +### Fixed +- Fixed floats dump (missed dot for scientific format), #220. +- Allow non-printable characters inside quoted scalars, #192. + + +## [3.4.3] - 2015-10-10 +### Changed +- Maintenance release - deps bump (esprima, argparse). + + +## [3.4.2] - 2015-09-09 +### Fixed +- Fixed serialization of duplicated entries in sequences, #205. + Thanks to @vogelsgesang. + + +## [3.4.1] - 2015-09-05 +### Fixed +- Fixed stacktrace handling in generated errors, for browsers (FF/IE). + + +## [3.4.0] - 2015-08-23 +### Changed +- Don't throw on warnings anymore. Use `onWarning` option to catch. +- Throw error on unknown tags (was warning before). +- Reworked internals of error class. + +### Fixed +- Fixed multiline keys dump, #197. Thanks to @tcr. +- Fixed heading line breaks in some scalars (regression). + + +## [3.3.1] - 2015-05-13 +### Added +- Added `.sortKeys` dumper option, thanks to @rjmunro. + +### Fixed +- Fixed astral characters support, #191. + + +## [3.3.0] - 2015-04-26 +### Changed +- Significantly improved long strings formatting in dumper, thanks to @isaacs. +- Strip BOM if exists. + + +## [3.2.7] - 2015-02-19 +### Changed +- Maintenance release. +- Updated dependencies. +- HISTORY.md -> CHANGELOG.md + + +## [3.2.6] - 2015-02-07 +### Fixed +- Fixed encoding of UTF-16 surrogate pairs. (e.g. "\U0001F431" CAT FACE). +- Fixed demo dates dump (#113, thanks to @Hypercubed). + + +## [3.2.5] - 2014-12-28 +### Fixed +- Fixed resolving of all built-in types on empty nodes. +- Fixed invalid warning on empty lines within quoted scalars and flow collections. +- Fixed bug: Tag on an empty node didn't resolve in some cases. + + +## [3.2.4] - 2014-12-19 +### Fixed +- Fixed resolving of !!null tag on an empty node. + + +## [3.2.3] - 2014-11-08 +### Fixed +- Implemented dumping of objects with circular and cross references. +- Partially fixed aliasing of constructed objects. (see issue #141 for details) + + +## [3.2.2] - 2014-09-07 +### Fixed +- Fixed infinite loop on unindented block scalars. +- Rewritten base64 encode/decode in binary type, to keep code licence clear. + + +## [3.2.1] - 2014-08-24 +### Fixed +- Nothig new. Just fix npm publish error. + + +## [3.2.0] - 2014-08-24 +### Added +- Added input piping support to CLI. + +### Fixed +- Fixed typo, that could cause hand on initial indent (#139). + + +## [3.1.0] - 2014-07-07 +### Changed +- 1.5x-2x speed boost. +- Removed deprecated `require('xxx.yml')` support. +- Significant code cleanup and refactoring. +- Internal API changed. If you used custom types - see updated examples. + Others are not affected. +- Even if the input string has no trailing line break character, + it will be parsed as if it has one. +- Added benchmark scripts. +- Moved bower files to /dist folder +- Bugfixes. + + +## [3.0.2] - 2014-02-27 +### Fixed +- Fixed bug: "constructor" string parsed as `null`. + + +## [3.0.1] - 2013-12-22 +### Fixed +- Fixed parsing of literal scalars. (issue #108) +- Prevented adding unnecessary spaces in object dumps. (issue #68) +- Fixed dumping of objects with very long (> 1024 in length) keys. + + +## [3.0.0] - 2013-12-16 +### Changed +- Refactored code. Changed API for custom types. +- Removed output colors in CLI, dump json by default. +- Removed big dependencies from browser version (esprima, buffer). Load `esprima` manually, if `!!js/function` needed. `!!bin` now returns Array in browser +- AMD support. +- Don't quote dumped strings because of `-` & `?` (if not first char). +- __Deprecated__ loading yaml files via `require()`, as not recommended + behaviour for node. + + +## [2.1.3] - 2013-10-16 +### Fixed +- Fix wrong loading of empty block scalars. + + +## [2.1.2] - 2013-10-07 +### Fixed +- Fix unwanted line breaks in folded scalars. + + +## [2.1.1] - 2013-10-02 +### Fixed +- Dumper now respects deprecated booleans syntax from YAML 1.0/1.1 +- Fixed reader bug in JSON-like sequences/mappings. + + +## [2.1.0] - 2013-06-05 +### Added +- Add standard YAML schemas: Failsafe (`FAILSAFE_SCHEMA`), + JSON (`JSON_SCHEMA`) and Core (`CORE_SCHEMA`). +- Add `skipInvalid` dumper option. + +### Changed +- Rename `DEFAULT_SCHEMA` to `DEFAULT_FULL_SCHEMA` + and `SAFE_SCHEMA` to `DEFAULT_SAFE_SCHEMA`. +- Use `safeLoad` for `require` extension. + +### Fixed +- Bug fix: export `NIL` constant from the public interface. + + +## [2.0.5] - 2013-04-26 +### Security +- Close security issue in !!js/function constructor. + Big thanks to @nealpoole for security audit. + + +## [2.0.4] - 2013-04-08 +### Changed +- Updated .npmignore to reduce package size + + +## [2.0.3] - 2013-02-26 +### Fixed +- Fixed dumping of empty arrays ans objects. ([] and {} instead of null) + + +## [2.0.2] - 2013-02-15 +### Fixed +- Fixed input validation: tabs are printable characters. + + +## [2.0.1] - 2013-02-09 +### Fixed +- Fixed error, when options not passed to function cass + + +## [2.0.0] - 2013-02-09 +### Changed +- Full rewrite. New architecture. Fast one-stage parsing. +- Changed custom types API. +- Added YAML dumper. + + +## [1.0.3] - 2012-11-05 +### Fixed +- Fixed utf-8 files loading. + + +## [1.0.2] - 2012-08-02 +### Fixed +- Pull out hand-written shims. Use ES5-Shims for old browsers support. See #44. +- Fix timstamps incorectly parsed in local time when no time part specified. + + +## [1.0.1] - 2012-07-07 +### Fixed +- Fixes `TypeError: 'undefined' is not an object` under Safari. Thanks Phuong. +- Fix timestamps incorrectly parsed in local time. Thanks @caolan. Closes #46. + + +## [1.0.0] - 2012-07-01 +### Changed +- `y`, `yes`, `n`, `no`, `on`, `off` are not converted to Booleans anymore. + Fixes #42. +- `require(filename)` now returns a single document and throws an Error if + file contains more than one document. +- CLI was merged back from js-yaml.bin + + +## [0.3.7] - 2012-02-28 +### Fixed +- Fix export of `addConstructor()`. Closes #39. + + +## [0.3.6] - 2012-02-22 +### Changed +- Removed AMD parts - too buggy to use. Need help to rewrite from scratch + +### Fixed +- Removed YUI compressor warning (renamed `double` variable). Closes #40. + + +## [0.3.5] - 2012-01-10 +### Fixed +- Workagound for .npmignore fuckup under windows. Thanks to airportyh. + + +## [0.3.4] - 2011-12-24 +### Fixed +- Fixes str[] for oldIEs support. +- Adds better has change support for browserified demo. +- improves compact output of Error. Closes #33. + + +## [0.3.3] - 2011-12-20 +### Added +- adds `compact` stringification of Errors. + +### Changed +- jsyaml executable moved to separate module. + + +## [0.3.2] - 2011-12-16 +### Added +- Added jsyaml executable. +- Added !!js/function support. Closes #12. + +### Fixed +- Fixes ug with block style scalars. Closes #26. +- All sources are passing JSLint now. +- Fixes bug in Safari. Closes #28. +- Fixes bug in Opers. Closes #29. +- Improves browser support. Closes #20. + + +## [0.3.1] - 2011-11-18 +### Added +- Added AMD support for browserified version. +- Added permalinks for online demo YAML snippets. Now we have YPaste service, lol. +- Added !!js/regexp and !!js/undefined types. Partially solves #12. + +### Changed +- Wrapped browserified js-yaml into closure. + +### Fixed +- Fixed the resolvement of non-specific tags. Closes #17. +- Fixed !!set mapping. +- Fixed month parse in dates. Closes #19. + + +## [0.3.0] - 2011-11-09 +### Added +- Added browserified version. Closes #13. +- Added live demo of browserified version. +- Ported some of the PyYAML tests. See #14. + +### Fixed +- Removed JS.Class dependency. Closes #3. +- Fixed timestamp bug when fraction was given. + + +## [0.2.2] - 2011-11-06 +### Fixed +- Fixed crash on docs without ---. Closes #8. +- Fixed multiline string parse +- Fixed tests/comments for using array as key + + +## [0.2.1] - 2011-11-02 +### Fixed +- Fixed short file read (<4k). Closes #9. + + +## [0.2.0] - 2011-11-02 +### Changed +- First public release + + +[4.1.0]: https://github.com/nodeca/js-yaml/compare/4.0.0...4.1.0 +[4.0.0]: https://github.com/nodeca/js-yaml/compare/3.14.0...4.0.0 +[3.14.0]: https://github.com/nodeca/js-yaml/compare/3.13.1...3.14.0 +[3.13.1]: https://github.com/nodeca/js-yaml/compare/3.13.0...3.13.1 +[3.13.0]: https://github.com/nodeca/js-yaml/compare/3.12.2...3.13.0 +[3.12.2]: https://github.com/nodeca/js-yaml/compare/3.12.1...3.12.2 +[3.12.1]: https://github.com/nodeca/js-yaml/compare/3.12.0...3.12.1 +[3.12.0]: https://github.com/nodeca/js-yaml/compare/3.11.0...3.12.0 +[3.11.0]: https://github.com/nodeca/js-yaml/compare/3.10.0...3.11.0 +[3.10.0]: https://github.com/nodeca/js-yaml/compare/3.9.1...3.10.0 +[3.9.1]: https://github.com/nodeca/js-yaml/compare/3.9.0...3.9.1 +[3.9.0]: https://github.com/nodeca/js-yaml/compare/3.8.4...3.9.0 +[3.8.4]: https://github.com/nodeca/js-yaml/compare/3.8.3...3.8.4 +[3.8.3]: https://github.com/nodeca/js-yaml/compare/3.8.2...3.8.3 +[3.8.2]: https://github.com/nodeca/js-yaml/compare/3.8.1...3.8.2 +[3.8.1]: https://github.com/nodeca/js-yaml/compare/3.8.0...3.8.1 +[3.8.0]: https://github.com/nodeca/js-yaml/compare/3.7.0...3.8.0 +[3.7.0]: https://github.com/nodeca/js-yaml/compare/3.6.1...3.7.0 +[3.6.1]: https://github.com/nodeca/js-yaml/compare/3.6.0...3.6.1 +[3.6.0]: https://github.com/nodeca/js-yaml/compare/3.5.5...3.6.0 +[3.5.5]: https://github.com/nodeca/js-yaml/compare/3.5.4...3.5.5 +[3.5.4]: https://github.com/nodeca/js-yaml/compare/3.5.3...3.5.4 +[3.5.3]: https://github.com/nodeca/js-yaml/compare/3.5.2...3.5.3 +[3.5.2]: https://github.com/nodeca/js-yaml/compare/3.5.1...3.5.2 +[3.5.1]: https://github.com/nodeca/js-yaml/compare/3.5.0...3.5.1 +[3.5.0]: https://github.com/nodeca/js-yaml/compare/3.4.6...3.5.0 +[3.4.6]: https://github.com/nodeca/js-yaml/compare/3.4.5...3.4.6 +[3.4.5]: https://github.com/nodeca/js-yaml/compare/3.4.4...3.4.5 +[3.4.4]: https://github.com/nodeca/js-yaml/compare/3.4.3...3.4.4 +[3.4.3]: https://github.com/nodeca/js-yaml/compare/3.4.2...3.4.3 +[3.4.2]: https://github.com/nodeca/js-yaml/compare/3.4.1...3.4.2 +[3.4.1]: https://github.com/nodeca/js-yaml/compare/3.4.0...3.4.1 +[3.4.0]: https://github.com/nodeca/js-yaml/compare/3.3.1...3.4.0 +[3.3.1]: https://github.com/nodeca/js-yaml/compare/3.3.0...3.3.1 +[3.3.0]: https://github.com/nodeca/js-yaml/compare/3.2.7...3.3.0 +[3.2.7]: https://github.com/nodeca/js-yaml/compare/3.2.6...3.2.7 +[3.2.6]: https://github.com/nodeca/js-yaml/compare/3.2.5...3.2.6 +[3.2.5]: https://github.com/nodeca/js-yaml/compare/3.2.4...3.2.5 +[3.2.4]: https://github.com/nodeca/js-yaml/compare/3.2.3...3.2.4 +[3.2.3]: https://github.com/nodeca/js-yaml/compare/3.2.2...3.2.3 +[3.2.2]: https://github.com/nodeca/js-yaml/compare/3.2.1...3.2.2 +[3.2.1]: https://github.com/nodeca/js-yaml/compare/3.2.0...3.2.1 +[3.2.0]: https://github.com/nodeca/js-yaml/compare/3.1.0...3.2.0 +[3.1.0]: https://github.com/nodeca/js-yaml/compare/3.0.2...3.1.0 +[3.0.2]: https://github.com/nodeca/js-yaml/compare/3.0.1...3.0.2 +[3.0.1]: https://github.com/nodeca/js-yaml/compare/3.0.0...3.0.1 +[3.0.0]: https://github.com/nodeca/js-yaml/compare/2.1.3...3.0.0 +[2.1.3]: https://github.com/nodeca/js-yaml/compare/2.1.2...2.1.3 +[2.1.2]: https://github.com/nodeca/js-yaml/compare/2.1.1...2.1.2 +[2.1.1]: https://github.com/nodeca/js-yaml/compare/2.1.0...2.1.1 +[2.1.0]: https://github.com/nodeca/js-yaml/compare/2.0.5...2.1.0 +[2.0.5]: https://github.com/nodeca/js-yaml/compare/2.0.4...2.0.5 +[2.0.4]: https://github.com/nodeca/js-yaml/compare/2.0.3...2.0.4 +[2.0.3]: https://github.com/nodeca/js-yaml/compare/2.0.2...2.0.3 +[2.0.2]: https://github.com/nodeca/js-yaml/compare/2.0.1...2.0.2 +[2.0.1]: https://github.com/nodeca/js-yaml/compare/2.0.0...2.0.1 +[2.0.0]: https://github.com/nodeca/js-yaml/compare/1.0.3...2.0.0 +[1.0.3]: https://github.com/nodeca/js-yaml/compare/1.0.2...1.0.3 +[1.0.2]: https://github.com/nodeca/js-yaml/compare/1.0.1...1.0.2 +[1.0.1]: https://github.com/nodeca/js-yaml/compare/1.0.0...1.0.1 +[1.0.0]: https://github.com/nodeca/js-yaml/compare/0.3.7...1.0.0 +[0.3.7]: https://github.com/nodeca/js-yaml/compare/0.3.6...0.3.7 +[0.3.6]: https://github.com/nodeca/js-yaml/compare/0.3.5...0.3.6 +[0.3.5]: https://github.com/nodeca/js-yaml/compare/0.3.4...0.3.5 +[0.3.4]: https://github.com/nodeca/js-yaml/compare/0.3.3...0.3.4 +[0.3.3]: https://github.com/nodeca/js-yaml/compare/0.3.2...0.3.3 +[0.3.2]: https://github.com/nodeca/js-yaml/compare/0.3.1...0.3.2 +[0.3.1]: https://github.com/nodeca/js-yaml/compare/0.3.0...0.3.1 +[0.3.0]: https://github.com/nodeca/js-yaml/compare/0.2.2...0.3.0 +[0.2.2]: https://github.com/nodeca/js-yaml/compare/0.2.1...0.2.2 +[0.2.1]: https://github.com/nodeca/js-yaml/compare/0.2.0...0.2.1 +[0.2.0]: https://github.com/nodeca/js-yaml/releases/tag/0.2.0 diff --git a/node_modules/js-yaml/LICENSE b/node_modules/js-yaml/LICENSE new file mode 100644 index 0000000..09d3a29 --- /dev/null +++ b/node_modules/js-yaml/LICENSE @@ -0,0 +1,21 @@ +(The MIT License) + +Copyright (C) 2011-2015 by Vitaly Puzrin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/js-yaml/README.md b/node_modules/js-yaml/README.md new file mode 100644 index 0000000..3cbc4bd --- /dev/null +++ b/node_modules/js-yaml/README.md @@ -0,0 +1,246 @@ +JS-YAML - YAML 1.2 parser / writer for JavaScript +================================================= + +[![CI](https://github.com/nodeca/js-yaml/workflows/CI/badge.svg?branch=master)](https://github.com/nodeca/js-yaml/actions) +[![NPM version](https://img.shields.io/npm/v/js-yaml.svg)](https://www.npmjs.org/package/js-yaml) + +__[Online Demo](http://nodeca.github.com/js-yaml/)__ + + +This is an implementation of [YAML](http://yaml.org/), a human-friendly data +serialization language. Started as [PyYAML](http://pyyaml.org/) port, it was +completely rewritten from scratch. Now it's very fast, and supports 1.2 spec. + + +Installation +------------ + +### YAML module for node.js + +``` +npm install js-yaml +``` + + +### CLI executable + +If you want to inspect your YAML files from CLI, install js-yaml globally: + +``` +npm install -g js-yaml +``` + +#### Usage + +``` +usage: js-yaml [-h] [-v] [-c] [-t] file + +Positional arguments: + file File with YAML document(s) + +Optional arguments: + -h, --help Show this help message and exit. + -v, --version Show program's version number and exit. + -c, --compact Display errors in compact mode + -t, --trace Show stack trace on error +``` + + +API +--- + +Here we cover the most 'useful' methods. If you need advanced details (creating +your own tags), see [examples](https://github.com/nodeca/js-yaml/tree/master/examples) +for more info. + +``` javascript +const yaml = require('js-yaml'); +const fs = require('fs'); + +// Get document, or throw exception on error +try { + const doc = yaml.load(fs.readFileSync('/home/ixti/example.yml', 'utf8')); + console.log(doc); +} catch (e) { + console.log(e); +} +``` + + +### load (string [ , options ]) + +Parses `string` as single YAML document. Returns either a +plain object, a string, a number, `null` or `undefined`, or throws `YAMLException` on error. By default, does +not support regexps, functions and undefined. + +options: + +- `filename` _(default: null)_ - string to be used as a file path in + error/warning messages. +- `onWarning` _(default: null)_ - function to call on warning messages. + Loader will call this function with an instance of `YAMLException` for each warning. +- `schema` _(default: `DEFAULT_SCHEMA`)_ - specifies a schema to use. + - `FAILSAFE_SCHEMA` - only strings, arrays and plain objects: + http://www.yaml.org/spec/1.2/spec.html#id2802346 + - `JSON_SCHEMA` - all JSON-supported types: + http://www.yaml.org/spec/1.2/spec.html#id2803231 + - `CORE_SCHEMA` - same as `JSON_SCHEMA`: + http://www.yaml.org/spec/1.2/spec.html#id2804923 + - `DEFAULT_SCHEMA` - all supported YAML types. +- `json` _(default: false)_ - compatibility with JSON.parse behaviour. If true, then duplicate keys in a mapping will override values rather than throwing an error. + +NOTE: This function **does not** understand multi-document sources, it throws +exception on those. + +NOTE: JS-YAML **does not** support schema-specific tag resolution restrictions. +So, the JSON schema is not as strictly defined in the YAML specification. +It allows numbers in any notation, use `Null` and `NULL` as `null`, etc. +The core schema also has no such restrictions. It allows binary notation for integers. + + +### loadAll (string [, iterator] [, options ]) + +Same as `load()`, but understands multi-document sources. Applies +`iterator` to each document if specified, or returns array of documents. + +``` javascript +const yaml = require('js-yaml'); + +yaml.loadAll(data, function (doc) { + console.log(doc); +}); +``` + + +### dump (object [ , options ]) + +Serializes `object` as a YAML document. Uses `DEFAULT_SCHEMA`, so it will +throw an exception if you try to dump regexps or functions. However, you can +disable exceptions by setting the `skipInvalid` option to `true`. + +options: + +- `indent` _(default: 2)_ - indentation width to use (in spaces). +- `noArrayIndent` _(default: false)_ - when true, will not add an indentation level to array elements +- `skipInvalid` _(default: false)_ - do not throw on invalid types (like function + in the safe schema) and skip pairs and single values with such types. +- `flowLevel` _(default: -1)_ - specifies level of nesting, when to switch from + block to flow style for collections. -1 means block style everwhere +- `styles` - "tag" => "style" map. Each tag may have own set of styles. +- `schema` _(default: `DEFAULT_SCHEMA`)_ specifies a schema to use. +- `sortKeys` _(default: `false`)_ - if `true`, sort keys when dumping YAML. If a + function, use the function to sort the keys. +- `lineWidth` _(default: `80`)_ - set max line width. Set `-1` for unlimited width. +- `noRefs` _(default: `false`)_ - if `true`, don't convert duplicate objects into references +- `noCompatMode` _(default: `false`)_ - if `true` don't try to be compatible with older + yaml versions. Currently: don't quote "yes", "no" and so on, as required for YAML 1.1 +- `condenseFlow` _(default: `false`)_ - if `true` flow sequences will be condensed, omitting the space between `a, b`. Eg. `'[a,b]'`, and omitting the space between `key: value` and quoting the key. Eg. `'{"a":b}'` Can be useful when using yaml for pretty URL query params as spaces are %-encoded. +- `quotingType` _(`'` or `"`, default: `'`)_ - strings will be quoted using this quoting style. If you specify single quotes, double quotes will still be used for non-printable characters. +- `forceQuotes` _(default: `false`)_ - if `true`, all non-key strings will be quoted even if they normally don't need to. +- `replacer` - callback `function (key, value)` called recursively on each key/value in source object (see `replacer` docs for `JSON.stringify`). + +The following table show availlable styles (e.g. "canonical", +"binary"...) available for each tag (.e.g. !!null, !!int ...). Yaml +output is shown on the right side after `=>` (default setting) or `->`: + +``` none +!!null + "canonical" -> "~" + "lowercase" => "null" + "uppercase" -> "NULL" + "camelcase" -> "Null" + +!!int + "binary" -> "0b1", "0b101010", "0b1110001111010" + "octal" -> "0o1", "0o52", "0o16172" + "decimal" => "1", "42", "7290" + "hexadecimal" -> "0x1", "0x2A", "0x1C7A" + +!!bool + "lowercase" => "true", "false" + "uppercase" -> "TRUE", "FALSE" + "camelcase" -> "True", "False" + +!!float + "lowercase" => ".nan", '.inf' + "uppercase" -> ".NAN", '.INF' + "camelcase" -> ".NaN", '.Inf' +``` + +Example: + +``` javascript +dump(object, { + 'styles': { + '!!null': 'canonical' // dump null as ~ + }, + 'sortKeys': true // sort object keys +}); +``` + +Supported YAML types +-------------------- + +The list of standard YAML tags and corresponding JavaScript types. See also +[YAML tag discussion](http://pyyaml.org/wiki/YAMLTagDiscussion) and +[YAML types repository](http://yaml.org/type/). + +``` +!!null '' # null +!!bool 'yes' # bool +!!int '3...' # number +!!float '3.14...' # number +!!binary '...base64...' # buffer +!!timestamp 'YYYY-...' # date +!!omap [ ... ] # array of key-value pairs +!!pairs [ ... ] # array or array pairs +!!set { ... } # array of objects with given keys and null values +!!str '...' # string +!!seq [ ... ] # array +!!map { ... } # object +``` + +**JavaScript-specific tags** + +See [js-yaml-js-types](https://github.com/nodeca/js-yaml-js-types) for +extra types. + + +Caveats +------- + +Note, that you use arrays or objects as key in JS-YAML. JS does not allow objects +or arrays as keys, and stringifies (by calling `toString()` method) them at the +moment of adding them. + +``` yaml +--- +? [ foo, bar ] +: - baz +? { foo: bar } +: - baz + - baz +``` + +``` javascript +{ "foo,bar": ["baz"], "[object Object]": ["baz", "baz"] } +``` + +Also, reading of properties on implicit block mapping keys is not supported yet. +So, the following YAML document cannot be loaded. + +``` yaml +&anchor foo: + foo: bar + *anchor: duplicate key + baz: bat + *anchor: duplicate key +``` + + +js-yaml for enterprise +---------------------- + +Available as part of the Tidelift Subscription + +The maintainers of js-yaml and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-js-yaml?utm_source=npm-js-yaml&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) diff --git a/node_modules/js-yaml/bin/js-yaml.js b/node_modules/js-yaml/bin/js-yaml.js new file mode 100755 index 0000000..a182f1a --- /dev/null +++ b/node_modules/js-yaml/bin/js-yaml.js @@ -0,0 +1,126 @@ +#!/usr/bin/env node + + +'use strict'; + +/*eslint-disable no-console*/ + + +var fs = require('fs'); +var argparse = require('argparse'); +var yaml = require('..'); + + +//////////////////////////////////////////////////////////////////////////////// + + +var cli = new argparse.ArgumentParser({ + prog: 'js-yaml', + add_help: true +}); + +cli.add_argument('-v', '--version', { + action: 'version', + version: require('../package.json').version +}); + +cli.add_argument('-c', '--compact', { + help: 'Display errors in compact mode', + action: 'store_true' +}); + +// deprecated (not needed after we removed output colors) +// option suppressed, but not completely removed for compatibility +cli.add_argument('-j', '--to-json', { + help: argparse.SUPPRESS, + dest: 'json', + action: 'store_true' +}); + +cli.add_argument('-t', '--trace', { + help: 'Show stack trace on error', + action: 'store_true' +}); + +cli.add_argument('file', { + help: 'File to read, utf-8 encoded without BOM', + nargs: '?', + default: '-' +}); + + +//////////////////////////////////////////////////////////////////////////////// + + +var options = cli.parse_args(); + + +//////////////////////////////////////////////////////////////////////////////// + +function readFile(filename, encoding, callback) { + if (options.file === '-') { + // read from stdin + + var chunks = []; + + process.stdin.on('data', function (chunk) { + chunks.push(chunk); + }); + + process.stdin.on('end', function () { + return callback(null, Buffer.concat(chunks).toString(encoding)); + }); + } else { + fs.readFile(filename, encoding, callback); + } +} + +readFile(options.file, 'utf8', function (error, input) { + var output, isYaml; + + if (error) { + if (error.code === 'ENOENT') { + console.error('File not found: ' + options.file); + process.exit(2); + } + + console.error( + options.trace && error.stack || + error.message || + String(error)); + + process.exit(1); + } + + try { + output = JSON.parse(input); + isYaml = false; + } catch (err) { + if (err instanceof SyntaxError) { + try { + output = []; + yaml.loadAll(input, function (doc) { output.push(doc); }, {}); + isYaml = true; + + if (output.length === 0) output = null; + else if (output.length === 1) output = output[0]; + + } catch (e) { + if (options.trace && err.stack) console.error(e.stack); + else console.error(e.toString(options.compact)); + + process.exit(1); + } + } else { + console.error( + options.trace && err.stack || + err.message || + String(err)); + + process.exit(1); + } + } + + if (isYaml) console.log(JSON.stringify(output, null, ' ')); + else console.log(yaml.dump(output)); +}); diff --git a/node_modules/js-yaml/dist/js-yaml.js b/node_modules/js-yaml/dist/js-yaml.js new file mode 100644 index 0000000..4cc0ddf --- /dev/null +++ b/node_modules/js-yaml/dist/js-yaml.js @@ -0,0 +1,3874 @@ + +/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.jsyaml = {})); +}(this, (function (exports) { 'use strict'; + + function isNothing(subject) { + return (typeof subject === 'undefined') || (subject === null); + } + + + function isObject(subject) { + return (typeof subject === 'object') && (subject !== null); + } + + + function toArray(sequence) { + if (Array.isArray(sequence)) return sequence; + else if (isNothing(sequence)) return []; + + return [ sequence ]; + } + + + function extend(target, source) { + var index, length, key, sourceKeys; + + if (source) { + sourceKeys = Object.keys(source); + + for (index = 0, length = sourceKeys.length; index < length; index += 1) { + key = sourceKeys[index]; + target[key] = source[key]; + } + } + + return target; + } + + + function repeat(string, count) { + var result = '', cycle; + + for (cycle = 0; cycle < count; cycle += 1) { + result += string; + } + + return result; + } + + + function isNegativeZero(number) { + return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number); + } + + + var isNothing_1 = isNothing; + var isObject_1 = isObject; + var toArray_1 = toArray; + var repeat_1 = repeat; + var isNegativeZero_1 = isNegativeZero; + var extend_1 = extend; + + var common = { + isNothing: isNothing_1, + isObject: isObject_1, + toArray: toArray_1, + repeat: repeat_1, + isNegativeZero: isNegativeZero_1, + extend: extend_1 + }; + + // YAML error class. http://stackoverflow.com/questions/8458984 + + + function formatError(exception, compact) { + var where = '', message = exception.reason || '(unknown reason)'; + + if (!exception.mark) return message; + + if (exception.mark.name) { + where += 'in "' + exception.mark.name + '" '; + } + + where += '(' + (exception.mark.line + 1) + ':' + (exception.mark.column + 1) + ')'; + + if (!compact && exception.mark.snippet) { + where += '\n\n' + exception.mark.snippet; + } + + return message + ' ' + where; + } + + + function YAMLException$1(reason, mark) { + // Super constructor + Error.call(this); + + this.name = 'YAMLException'; + this.reason = reason; + this.mark = mark; + this.message = formatError(this, false); + + // Include stack trace in error object + if (Error.captureStackTrace) { + // Chrome and NodeJS + Error.captureStackTrace(this, this.constructor); + } else { + // FF, IE 10+ and Safari 6+. Fallback for others + this.stack = (new Error()).stack || ''; + } + } + + + // Inherit from Error + YAMLException$1.prototype = Object.create(Error.prototype); + YAMLException$1.prototype.constructor = YAMLException$1; + + + YAMLException$1.prototype.toString = function toString(compact) { + return this.name + ': ' + formatError(this, compact); + }; + + + var exception = YAMLException$1; + + // get snippet for a single line, respecting maxLength + function getLine(buffer, lineStart, lineEnd, position, maxLineLength) { + var head = ''; + var tail = ''; + var maxHalfLength = Math.floor(maxLineLength / 2) - 1; + + if (position - lineStart > maxHalfLength) { + head = ' ... '; + lineStart = position - maxHalfLength + head.length; + } + + if (lineEnd - position > maxHalfLength) { + tail = ' ...'; + lineEnd = position + maxHalfLength - tail.length; + } + + return { + str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, '→') + tail, + pos: position - lineStart + head.length // relative position + }; + } + + + function padStart(string, max) { + return common.repeat(' ', max - string.length) + string; + } + + + function makeSnippet(mark, options) { + options = Object.create(options || null); + + if (!mark.buffer) return null; + + if (!options.maxLength) options.maxLength = 79; + if (typeof options.indent !== 'number') options.indent = 1; + if (typeof options.linesBefore !== 'number') options.linesBefore = 3; + if (typeof options.linesAfter !== 'number') options.linesAfter = 2; + + var re = /\r?\n|\r|\0/g; + var lineStarts = [ 0 ]; + var lineEnds = []; + var match; + var foundLineNo = -1; + + while ((match = re.exec(mark.buffer))) { + lineEnds.push(match.index); + lineStarts.push(match.index + match[0].length); + + if (mark.position <= match.index && foundLineNo < 0) { + foundLineNo = lineStarts.length - 2; + } + } + + if (foundLineNo < 0) foundLineNo = lineStarts.length - 1; + + var result = '', i, line; + var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length; + var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3); + + for (i = 1; i <= options.linesBefore; i++) { + if (foundLineNo - i < 0) break; + line = getLine( + mark.buffer, + lineStarts[foundLineNo - i], + lineEnds[foundLineNo - i], + mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]), + maxLineLength + ); + result = common.repeat(' ', options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + + ' | ' + line.str + '\n' + result; + } + + line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength); + result += common.repeat(' ', options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + + ' | ' + line.str + '\n'; + result += common.repeat('-', options.indent + lineNoLength + 3 + line.pos) + '^' + '\n'; + + for (i = 1; i <= options.linesAfter; i++) { + if (foundLineNo + i >= lineEnds.length) break; + line = getLine( + mark.buffer, + lineStarts[foundLineNo + i], + lineEnds[foundLineNo + i], + mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]), + maxLineLength + ); + result += common.repeat(' ', options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + + ' | ' + line.str + '\n'; + } + + return result.replace(/\n$/, ''); + } + + + var snippet = makeSnippet; + + var TYPE_CONSTRUCTOR_OPTIONS = [ + 'kind', + 'multi', + 'resolve', + 'construct', + 'instanceOf', + 'predicate', + 'represent', + 'representName', + 'defaultStyle', + 'styleAliases' + ]; + + var YAML_NODE_KINDS = [ + 'scalar', + 'sequence', + 'mapping' + ]; + + function compileStyleAliases(map) { + var result = {}; + + if (map !== null) { + Object.keys(map).forEach(function (style) { + map[style].forEach(function (alias) { + result[String(alias)] = style; + }); + }); + } + + return result; + } + + function Type$1(tag, options) { + options = options || {}; + + Object.keys(options).forEach(function (name) { + if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) { + throw new exception('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.'); + } + }); + + // TODO: Add tag format check. + this.options = options; // keep original options in case user wants to extend this type later + this.tag = tag; + this.kind = options['kind'] || null; + this.resolve = options['resolve'] || function () { return true; }; + this.construct = options['construct'] || function (data) { return data; }; + this.instanceOf = options['instanceOf'] || null; + this.predicate = options['predicate'] || null; + this.represent = options['represent'] || null; + this.representName = options['representName'] || null; + this.defaultStyle = options['defaultStyle'] || null; + this.multi = options['multi'] || false; + this.styleAliases = compileStyleAliases(options['styleAliases'] || null); + + if (YAML_NODE_KINDS.indexOf(this.kind) === -1) { + throw new exception('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.'); + } + } + + var type = Type$1; + + /*eslint-disable max-len*/ + + + + + + function compileList(schema, name) { + var result = []; + + schema[name].forEach(function (currentType) { + var newIndex = result.length; + + result.forEach(function (previousType, previousIndex) { + if (previousType.tag === currentType.tag && + previousType.kind === currentType.kind && + previousType.multi === currentType.multi) { + + newIndex = previousIndex; + } + }); + + result[newIndex] = currentType; + }); + + return result; + } + + + function compileMap(/* lists... */) { + var result = { + scalar: {}, + sequence: {}, + mapping: {}, + fallback: {}, + multi: { + scalar: [], + sequence: [], + mapping: [], + fallback: [] + } + }, index, length; + + function collectType(type) { + if (type.multi) { + result.multi[type.kind].push(type); + result.multi['fallback'].push(type); + } else { + result[type.kind][type.tag] = result['fallback'][type.tag] = type; + } + } + + for (index = 0, length = arguments.length; index < length; index += 1) { + arguments[index].forEach(collectType); + } + return result; + } + + + function Schema$1(definition) { + return this.extend(definition); + } + + + Schema$1.prototype.extend = function extend(definition) { + var implicit = []; + var explicit = []; + + if (definition instanceof type) { + // Schema.extend(type) + explicit.push(definition); + + } else if (Array.isArray(definition)) { + // Schema.extend([ type1, type2, ... ]) + explicit = explicit.concat(definition); + + } else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) { + // Schema.extend({ explicit: [ type1, type2, ... ], implicit: [ type1, type2, ... ] }) + if (definition.implicit) implicit = implicit.concat(definition.implicit); + if (definition.explicit) explicit = explicit.concat(definition.explicit); + + } else { + throw new exception('Schema.extend argument should be a Type, [ Type ], ' + + 'or a schema definition ({ implicit: [...], explicit: [...] })'); + } + + implicit.forEach(function (type$1) { + if (!(type$1 instanceof type)) { + throw new exception('Specified list of YAML types (or a single Type object) contains a non-Type object.'); + } + + if (type$1.loadKind && type$1.loadKind !== 'scalar') { + throw new exception('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.'); + } + + if (type$1.multi) { + throw new exception('There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.'); + } + }); + + explicit.forEach(function (type$1) { + if (!(type$1 instanceof type)) { + throw new exception('Specified list of YAML types (or a single Type object) contains a non-Type object.'); + } + }); + + var result = Object.create(Schema$1.prototype); + + result.implicit = (this.implicit || []).concat(implicit); + result.explicit = (this.explicit || []).concat(explicit); + + result.compiledImplicit = compileList(result, 'implicit'); + result.compiledExplicit = compileList(result, 'explicit'); + result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit); + + return result; + }; + + + var schema = Schema$1; + + var str = new type('tag:yaml.org,2002:str', { + kind: 'scalar', + construct: function (data) { return data !== null ? data : ''; } + }); + + var seq = new type('tag:yaml.org,2002:seq', { + kind: 'sequence', + construct: function (data) { return data !== null ? data : []; } + }); + + var map = new type('tag:yaml.org,2002:map', { + kind: 'mapping', + construct: function (data) { return data !== null ? data : {}; } + }); + + var failsafe = new schema({ + explicit: [ + str, + seq, + map + ] + }); + + function resolveYamlNull(data) { + if (data === null) return true; + + var max = data.length; + + return (max === 1 && data === '~') || + (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL')); + } + + function constructYamlNull() { + return null; + } + + function isNull(object) { + return object === null; + } + + var _null = new type('tag:yaml.org,2002:null', { + kind: 'scalar', + resolve: resolveYamlNull, + construct: constructYamlNull, + predicate: isNull, + represent: { + canonical: function () { return '~'; }, + lowercase: function () { return 'null'; }, + uppercase: function () { return 'NULL'; }, + camelcase: function () { return 'Null'; }, + empty: function () { return ''; } + }, + defaultStyle: 'lowercase' + }); + + function resolveYamlBoolean(data) { + if (data === null) return false; + + var max = data.length; + + return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) || + (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE')); + } + + function constructYamlBoolean(data) { + return data === 'true' || + data === 'True' || + data === 'TRUE'; + } + + function isBoolean(object) { + return Object.prototype.toString.call(object) === '[object Boolean]'; + } + + var bool = new type('tag:yaml.org,2002:bool', { + kind: 'scalar', + resolve: resolveYamlBoolean, + construct: constructYamlBoolean, + predicate: isBoolean, + represent: { + lowercase: function (object) { return object ? 'true' : 'false'; }, + uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; }, + camelcase: function (object) { return object ? 'True' : 'False'; } + }, + defaultStyle: 'lowercase' + }); + + function isHexCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) || + ((0x41/* A */ <= c) && (c <= 0x46/* F */)) || + ((0x61/* a */ <= c) && (c <= 0x66/* f */)); + } + + function isOctCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */)); + } + + function isDecCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)); + } + + function resolveYamlInteger(data) { + if (data === null) return false; + + var max = data.length, + index = 0, + hasDigits = false, + ch; + + if (!max) return false; + + ch = data[index]; + + // sign + if (ch === '-' || ch === '+') { + ch = data[++index]; + } + + if (ch === '0') { + // 0 + if (index + 1 === max) return true; + ch = data[++index]; + + // base 2, base 8, base 16 + + if (ch === 'b') { + // base 2 + index++; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (ch !== '0' && ch !== '1') return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; + } + + + if (ch === 'x') { + // base 16 + index++; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (!isHexCode(data.charCodeAt(index))) return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; + } + + + if (ch === 'o') { + // base 8 + index++; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (!isOctCode(data.charCodeAt(index))) return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; + } + } + + // base 10 (except 0) + + // value should not start with `_`; + if (ch === '_') return false; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (!isDecCode(data.charCodeAt(index))) { + return false; + } + hasDigits = true; + } + + // Should have digits and should not end with `_` + if (!hasDigits || ch === '_') return false; + + return true; + } + + function constructYamlInteger(data) { + var value = data, sign = 1, ch; + + if (value.indexOf('_') !== -1) { + value = value.replace(/_/g, ''); + } + + ch = value[0]; + + if (ch === '-' || ch === '+') { + if (ch === '-') sign = -1; + value = value.slice(1); + ch = value[0]; + } + + if (value === '0') return 0; + + if (ch === '0') { + if (value[1] === 'b') return sign * parseInt(value.slice(2), 2); + if (value[1] === 'x') return sign * parseInt(value.slice(2), 16); + if (value[1] === 'o') return sign * parseInt(value.slice(2), 8); + } + + return sign * parseInt(value, 10); + } + + function isInteger(object) { + return (Object.prototype.toString.call(object)) === '[object Number]' && + (object % 1 === 0 && !common.isNegativeZero(object)); + } + + var int = new type('tag:yaml.org,2002:int', { + kind: 'scalar', + resolve: resolveYamlInteger, + construct: constructYamlInteger, + predicate: isInteger, + represent: { + binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); }, + octal: function (obj) { return obj >= 0 ? '0o' + obj.toString(8) : '-0o' + obj.toString(8).slice(1); }, + decimal: function (obj) { return obj.toString(10); }, + /* eslint-disable max-len */ + hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); } + }, + defaultStyle: 'decimal', + styleAliases: { + binary: [ 2, 'bin' ], + octal: [ 8, 'oct' ], + decimal: [ 10, 'dec' ], + hexadecimal: [ 16, 'hex' ] + } + }); + + var YAML_FLOAT_PATTERN = new RegExp( + // 2.5e4, 2.5 and integers + '^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' + + // .2e4, .2 + // special case, seems not from spec + '|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' + + // .inf + '|[-+]?\\.(?:inf|Inf|INF)' + + // .nan + '|\\.(?:nan|NaN|NAN))$'); + + function resolveYamlFloat(data) { + if (data === null) return false; + + if (!YAML_FLOAT_PATTERN.test(data) || + // Quick hack to not allow integers end with `_` + // Probably should update regexp & check speed + data[data.length - 1] === '_') { + return false; + } + + return true; + } + + function constructYamlFloat(data) { + var value, sign; + + value = data.replace(/_/g, '').toLowerCase(); + sign = value[0] === '-' ? -1 : 1; + + if ('+-'.indexOf(value[0]) >= 0) { + value = value.slice(1); + } + + if (value === '.inf') { + return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY; + + } else if (value === '.nan') { + return NaN; + } + return sign * parseFloat(value, 10); + } + + + var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/; + + function representYamlFloat(object, style) { + var res; + + if (isNaN(object)) { + switch (style) { + case 'lowercase': return '.nan'; + case 'uppercase': return '.NAN'; + case 'camelcase': return '.NaN'; + } + } else if (Number.POSITIVE_INFINITY === object) { + switch (style) { + case 'lowercase': return '.inf'; + case 'uppercase': return '.INF'; + case 'camelcase': return '.Inf'; + } + } else if (Number.NEGATIVE_INFINITY === object) { + switch (style) { + case 'lowercase': return '-.inf'; + case 'uppercase': return '-.INF'; + case 'camelcase': return '-.Inf'; + } + } else if (common.isNegativeZero(object)) { + return '-0.0'; + } + + res = object.toString(10); + + // JS stringifier can build scientific format without dots: 5e-100, + // while YAML requres dot: 5.e-100. Fix it with simple hack + + return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res; + } + + function isFloat(object) { + return (Object.prototype.toString.call(object) === '[object Number]') && + (object % 1 !== 0 || common.isNegativeZero(object)); + } + + var float = new type('tag:yaml.org,2002:float', { + kind: 'scalar', + resolve: resolveYamlFloat, + construct: constructYamlFloat, + predicate: isFloat, + represent: representYamlFloat, + defaultStyle: 'lowercase' + }); + + var json = failsafe.extend({ + implicit: [ + _null, + bool, + int, + float + ] + }); + + var core = json; + + var YAML_DATE_REGEXP = new RegExp( + '^([0-9][0-9][0-9][0-9])' + // [1] year + '-([0-9][0-9])' + // [2] month + '-([0-9][0-9])$'); // [3] day + + var YAML_TIMESTAMP_REGEXP = new RegExp( + '^([0-9][0-9][0-9][0-9])' + // [1] year + '-([0-9][0-9]?)' + // [2] month + '-([0-9][0-9]?)' + // [3] day + '(?:[Tt]|[ \\t]+)' + // ... + '([0-9][0-9]?)' + // [4] hour + ':([0-9][0-9])' + // [5] minute + ':([0-9][0-9])' + // [6] second + '(?:\\.([0-9]*))?' + // [7] fraction + '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour + '(?::([0-9][0-9]))?))?$'); // [11] tz_minute + + function resolveYamlTimestamp(data) { + if (data === null) return false; + if (YAML_DATE_REGEXP.exec(data) !== null) return true; + if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true; + return false; + } + + function constructYamlTimestamp(data) { + var match, year, month, day, hour, minute, second, fraction = 0, + delta = null, tz_hour, tz_minute, date; + + match = YAML_DATE_REGEXP.exec(data); + if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data); + + if (match === null) throw new Error('Date resolve error'); + + // match: [1] year [2] month [3] day + + year = +(match[1]); + month = +(match[2]) - 1; // JS month starts with 0 + day = +(match[3]); + + if (!match[4]) { // no hour + return new Date(Date.UTC(year, month, day)); + } + + // match: [4] hour [5] minute [6] second [7] fraction + + hour = +(match[4]); + minute = +(match[5]); + second = +(match[6]); + + if (match[7]) { + fraction = match[7].slice(0, 3); + while (fraction.length < 3) { // milli-seconds + fraction += '0'; + } + fraction = +fraction; + } + + // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute + + if (match[9]) { + tz_hour = +(match[10]); + tz_minute = +(match[11] || 0); + delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds + if (match[9] === '-') delta = -delta; + } + + date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction)); + + if (delta) date.setTime(date.getTime() - delta); + + return date; + } + + function representYamlTimestamp(object /*, style*/) { + return object.toISOString(); + } + + var timestamp = new type('tag:yaml.org,2002:timestamp', { + kind: 'scalar', + resolve: resolveYamlTimestamp, + construct: constructYamlTimestamp, + instanceOf: Date, + represent: representYamlTimestamp + }); + + function resolveYamlMerge(data) { + return data === '<<' || data === null; + } + + var merge = new type('tag:yaml.org,2002:merge', { + kind: 'scalar', + resolve: resolveYamlMerge + }); + + /*eslint-disable no-bitwise*/ + + + + + + // [ 64, 65, 66 ] -> [ padding, CR, LF ] + var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r'; + + + function resolveYamlBinary(data) { + if (data === null) return false; + + var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP; + + // Convert one by one. + for (idx = 0; idx < max; idx++) { + code = map.indexOf(data.charAt(idx)); + + // Skip CR/LF + if (code > 64) continue; + + // Fail on illegal characters + if (code < 0) return false; + + bitlen += 6; + } + + // If there are any bits left, source was corrupted + return (bitlen % 8) === 0; + } + + function constructYamlBinary(data) { + var idx, tailbits, + input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan + max = input.length, + map = BASE64_MAP, + bits = 0, + result = []; + + // Collect by 6*4 bits (3 bytes) + + for (idx = 0; idx < max; idx++) { + if ((idx % 4 === 0) && idx) { + result.push((bits >> 16) & 0xFF); + result.push((bits >> 8) & 0xFF); + result.push(bits & 0xFF); + } + + bits = (bits << 6) | map.indexOf(input.charAt(idx)); + } + + // Dump tail + + tailbits = (max % 4) * 6; + + if (tailbits === 0) { + result.push((bits >> 16) & 0xFF); + result.push((bits >> 8) & 0xFF); + result.push(bits & 0xFF); + } else if (tailbits === 18) { + result.push((bits >> 10) & 0xFF); + result.push((bits >> 2) & 0xFF); + } else if (tailbits === 12) { + result.push((bits >> 4) & 0xFF); + } + + return new Uint8Array(result); + } + + function representYamlBinary(object /*, style*/) { + var result = '', bits = 0, idx, tail, + max = object.length, + map = BASE64_MAP; + + // Convert every three bytes to 4 ASCII characters. + + for (idx = 0; idx < max; idx++) { + if ((idx % 3 === 0) && idx) { + result += map[(bits >> 18) & 0x3F]; + result += map[(bits >> 12) & 0x3F]; + result += map[(bits >> 6) & 0x3F]; + result += map[bits & 0x3F]; + } + + bits = (bits << 8) + object[idx]; + } + + // Dump tail + + tail = max % 3; + + if (tail === 0) { + result += map[(bits >> 18) & 0x3F]; + result += map[(bits >> 12) & 0x3F]; + result += map[(bits >> 6) & 0x3F]; + result += map[bits & 0x3F]; + } else if (tail === 2) { + result += map[(bits >> 10) & 0x3F]; + result += map[(bits >> 4) & 0x3F]; + result += map[(bits << 2) & 0x3F]; + result += map[64]; + } else if (tail === 1) { + result += map[(bits >> 2) & 0x3F]; + result += map[(bits << 4) & 0x3F]; + result += map[64]; + result += map[64]; + } + + return result; + } + + function isBinary(obj) { + return Object.prototype.toString.call(obj) === '[object Uint8Array]'; + } + + var binary = new type('tag:yaml.org,2002:binary', { + kind: 'scalar', + resolve: resolveYamlBinary, + construct: constructYamlBinary, + predicate: isBinary, + represent: representYamlBinary + }); + + var _hasOwnProperty$3 = Object.prototype.hasOwnProperty; + var _toString$2 = Object.prototype.toString; + + function resolveYamlOmap(data) { + if (data === null) return true; + + var objectKeys = [], index, length, pair, pairKey, pairHasKey, + object = data; + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + pairHasKey = false; + + if (_toString$2.call(pair) !== '[object Object]') return false; + + for (pairKey in pair) { + if (_hasOwnProperty$3.call(pair, pairKey)) { + if (!pairHasKey) pairHasKey = true; + else return false; + } + } + + if (!pairHasKey) return false; + + if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey); + else return false; + } + + return true; + } + + function constructYamlOmap(data) { + return data !== null ? data : []; + } + + var omap = new type('tag:yaml.org,2002:omap', { + kind: 'sequence', + resolve: resolveYamlOmap, + construct: constructYamlOmap + }); + + var _toString$1 = Object.prototype.toString; + + function resolveYamlPairs(data) { + if (data === null) return true; + + var index, length, pair, keys, result, + object = data; + + result = new Array(object.length); + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + + if (_toString$1.call(pair) !== '[object Object]') return false; + + keys = Object.keys(pair); + + if (keys.length !== 1) return false; + + result[index] = [ keys[0], pair[keys[0]] ]; + } + + return true; + } + + function constructYamlPairs(data) { + if (data === null) return []; + + var index, length, pair, keys, result, + object = data; + + result = new Array(object.length); + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + + keys = Object.keys(pair); + + result[index] = [ keys[0], pair[keys[0]] ]; + } + + return result; + } + + var pairs = new type('tag:yaml.org,2002:pairs', { + kind: 'sequence', + resolve: resolveYamlPairs, + construct: constructYamlPairs + }); + + var _hasOwnProperty$2 = Object.prototype.hasOwnProperty; + + function resolveYamlSet(data) { + if (data === null) return true; + + var key, object = data; + + for (key in object) { + if (_hasOwnProperty$2.call(object, key)) { + if (object[key] !== null) return false; + } + } + + return true; + } + + function constructYamlSet(data) { + return data !== null ? data : {}; + } + + var set = new type('tag:yaml.org,2002:set', { + kind: 'mapping', + resolve: resolveYamlSet, + construct: constructYamlSet + }); + + var _default = core.extend({ + implicit: [ + timestamp, + merge + ], + explicit: [ + binary, + omap, + pairs, + set + ] + }); + + /*eslint-disable max-len,no-use-before-define*/ + + + + + + + + var _hasOwnProperty$1 = Object.prototype.hasOwnProperty; + + + var CONTEXT_FLOW_IN = 1; + var CONTEXT_FLOW_OUT = 2; + var CONTEXT_BLOCK_IN = 3; + var CONTEXT_BLOCK_OUT = 4; + + + var CHOMPING_CLIP = 1; + var CHOMPING_STRIP = 2; + var CHOMPING_KEEP = 3; + + + var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; + var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/; + var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/; + var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i; + var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i; + + + function _class(obj) { return Object.prototype.toString.call(obj); } + + function is_EOL(c) { + return (c === 0x0A/* LF */) || (c === 0x0D/* CR */); + } + + function is_WHITE_SPACE(c) { + return (c === 0x09/* Tab */) || (c === 0x20/* Space */); + } + + function is_WS_OR_EOL(c) { + return (c === 0x09/* Tab */) || + (c === 0x20/* Space */) || + (c === 0x0A/* LF */) || + (c === 0x0D/* CR */); + } + + function is_FLOW_INDICATOR(c) { + return c === 0x2C/* , */ || + c === 0x5B/* [ */ || + c === 0x5D/* ] */ || + c === 0x7B/* { */ || + c === 0x7D/* } */; + } + + function fromHexCode(c) { + var lc; + + if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { + return c - 0x30; + } + + /*eslint-disable no-bitwise*/ + lc = c | 0x20; + + if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) { + return lc - 0x61 + 10; + } + + return -1; + } + + function escapedHexLen(c) { + if (c === 0x78/* x */) { return 2; } + if (c === 0x75/* u */) { return 4; } + if (c === 0x55/* U */) { return 8; } + return 0; + } + + function fromDecimalCode(c) { + if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { + return c - 0x30; + } + + return -1; + } + + function simpleEscapeSequence(c) { + /* eslint-disable indent */ + return (c === 0x30/* 0 */) ? '\x00' : + (c === 0x61/* a */) ? '\x07' : + (c === 0x62/* b */) ? '\x08' : + (c === 0x74/* t */) ? '\x09' : + (c === 0x09/* Tab */) ? '\x09' : + (c === 0x6E/* n */) ? '\x0A' : + (c === 0x76/* v */) ? '\x0B' : + (c === 0x66/* f */) ? '\x0C' : + (c === 0x72/* r */) ? '\x0D' : + (c === 0x65/* e */) ? '\x1B' : + (c === 0x20/* Space */) ? ' ' : + (c === 0x22/* " */) ? '\x22' : + (c === 0x2F/* / */) ? '/' : + (c === 0x5C/* \ */) ? '\x5C' : + (c === 0x4E/* N */) ? '\x85' : + (c === 0x5F/* _ */) ? '\xA0' : + (c === 0x4C/* L */) ? '\u2028' : + (c === 0x50/* P */) ? '\u2029' : ''; + } + + function charFromCodepoint(c) { + if (c <= 0xFFFF) { + return String.fromCharCode(c); + } + // Encode UTF-16 surrogate pair + // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF + return String.fromCharCode( + ((c - 0x010000) >> 10) + 0xD800, + ((c - 0x010000) & 0x03FF) + 0xDC00 + ); + } + + var simpleEscapeCheck = new Array(256); // integer, for fast access + var simpleEscapeMap = new Array(256); + for (var i = 0; i < 256; i++) { + simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0; + simpleEscapeMap[i] = simpleEscapeSequence(i); + } + + + function State$1(input, options) { + this.input = input; + + this.filename = options['filename'] || null; + this.schema = options['schema'] || _default; + this.onWarning = options['onWarning'] || null; + // (Hidden) Remove? makes the loader to expect YAML 1.1 documents + // if such documents have no explicit %YAML directive + this.legacy = options['legacy'] || false; + + this.json = options['json'] || false; + this.listener = options['listener'] || null; + + this.implicitTypes = this.schema.compiledImplicit; + this.typeMap = this.schema.compiledTypeMap; + + this.length = input.length; + this.position = 0; + this.line = 0; + this.lineStart = 0; + this.lineIndent = 0; + + // position of first leading tab in the current line, + // used to make sure there are no tabs in the indentation + this.firstTabInLine = -1; + + this.documents = []; + + /* + this.version; + this.checkLineBreaks; + this.tagMap; + this.anchorMap; + this.tag; + this.anchor; + this.kind; + this.result;*/ + + } + + + function generateError(state, message) { + var mark = { + name: state.filename, + buffer: state.input.slice(0, -1), // omit trailing \0 + position: state.position, + line: state.line, + column: state.position - state.lineStart + }; + + mark.snippet = snippet(mark); + + return new exception(message, mark); + } + + function throwError(state, message) { + throw generateError(state, message); + } + + function throwWarning(state, message) { + if (state.onWarning) { + state.onWarning.call(null, generateError(state, message)); + } + } + + + var directiveHandlers = { + + YAML: function handleYamlDirective(state, name, args) { + + var match, major, minor; + + if (state.version !== null) { + throwError(state, 'duplication of %YAML directive'); + } + + if (args.length !== 1) { + throwError(state, 'YAML directive accepts exactly one argument'); + } + + match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]); + + if (match === null) { + throwError(state, 'ill-formed argument of the YAML directive'); + } + + major = parseInt(match[1], 10); + minor = parseInt(match[2], 10); + + if (major !== 1) { + throwError(state, 'unacceptable YAML version of the document'); + } + + state.version = args[0]; + state.checkLineBreaks = (minor < 2); + + if (minor !== 1 && minor !== 2) { + throwWarning(state, 'unsupported YAML version of the document'); + } + }, + + TAG: function handleTagDirective(state, name, args) { + + var handle, prefix; + + if (args.length !== 2) { + throwError(state, 'TAG directive accepts exactly two arguments'); + } + + handle = args[0]; + prefix = args[1]; + + if (!PATTERN_TAG_HANDLE.test(handle)) { + throwError(state, 'ill-formed tag handle (first argument) of the TAG directive'); + } + + if (_hasOwnProperty$1.call(state.tagMap, handle)) { + throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle'); + } + + if (!PATTERN_TAG_URI.test(prefix)) { + throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive'); + } + + try { + prefix = decodeURIComponent(prefix); + } catch (err) { + throwError(state, 'tag prefix is malformed: ' + prefix); + } + + state.tagMap[handle] = prefix; + } + }; + + + function captureSegment(state, start, end, checkJson) { + var _position, _length, _character, _result; + + if (start < end) { + _result = state.input.slice(start, end); + + if (checkJson) { + for (_position = 0, _length = _result.length; _position < _length; _position += 1) { + _character = _result.charCodeAt(_position); + if (!(_character === 0x09 || + (0x20 <= _character && _character <= 0x10FFFF))) { + throwError(state, 'expected valid JSON character'); + } + } + } else if (PATTERN_NON_PRINTABLE.test(_result)) { + throwError(state, 'the stream contains non-printable characters'); + } + + state.result += _result; + } + } + + function mergeMappings(state, destination, source, overridableKeys) { + var sourceKeys, key, index, quantity; + + if (!common.isObject(source)) { + throwError(state, 'cannot merge mappings; the provided source object is unacceptable'); + } + + sourceKeys = Object.keys(source); + + for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) { + key = sourceKeys[index]; + + if (!_hasOwnProperty$1.call(destination, key)) { + destination[key] = source[key]; + overridableKeys[key] = true; + } + } + } + + function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, + startLine, startLineStart, startPos) { + + var index, quantity; + + // The output is a plain object here, so keys can only be strings. + // We need to convert keyNode to a string, but doing so can hang the process + // (deeply nested arrays that explode exponentially using aliases). + if (Array.isArray(keyNode)) { + keyNode = Array.prototype.slice.call(keyNode); + + for (index = 0, quantity = keyNode.length; index < quantity; index += 1) { + if (Array.isArray(keyNode[index])) { + throwError(state, 'nested arrays are not supported inside keys'); + } + + if (typeof keyNode === 'object' && _class(keyNode[index]) === '[object Object]') { + keyNode[index] = '[object Object]'; + } + } + } + + // Avoid code execution in load() via toString property + // (still use its own toString for arrays, timestamps, + // and whatever user schema extensions happen to have @@toStringTag) + if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') { + keyNode = '[object Object]'; + } + + + keyNode = String(keyNode); + + if (_result === null) { + _result = {}; + } + + if (keyTag === 'tag:yaml.org,2002:merge') { + if (Array.isArray(valueNode)) { + for (index = 0, quantity = valueNode.length; index < quantity; index += 1) { + mergeMappings(state, _result, valueNode[index], overridableKeys); + } + } else { + mergeMappings(state, _result, valueNode, overridableKeys); + } + } else { + if (!state.json && + !_hasOwnProperty$1.call(overridableKeys, keyNode) && + _hasOwnProperty$1.call(_result, keyNode)) { + state.line = startLine || state.line; + state.lineStart = startLineStart || state.lineStart; + state.position = startPos || state.position; + throwError(state, 'duplicated mapping key'); + } + + // used for this specific key only because Object.defineProperty is slow + if (keyNode === '__proto__') { + Object.defineProperty(_result, keyNode, { + configurable: true, + enumerable: true, + writable: true, + value: valueNode + }); + } else { + _result[keyNode] = valueNode; + } + delete overridableKeys[keyNode]; + } + + return _result; + } + + function readLineBreak(state) { + var ch; + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x0A/* LF */) { + state.position++; + } else if (ch === 0x0D/* CR */) { + state.position++; + if (state.input.charCodeAt(state.position) === 0x0A/* LF */) { + state.position++; + } + } else { + throwError(state, 'a line break is expected'); + } + + state.line += 1; + state.lineStart = state.position; + state.firstTabInLine = -1; + } + + function skipSeparationSpace(state, allowComments, checkIndent) { + var lineBreaks = 0, + ch = state.input.charCodeAt(state.position); + + while (ch !== 0) { + while (is_WHITE_SPACE(ch)) { + if (ch === 0x09/* Tab */ && state.firstTabInLine === -1) { + state.firstTabInLine = state.position; + } + ch = state.input.charCodeAt(++state.position); + } + + if (allowComments && ch === 0x23/* # */) { + do { + ch = state.input.charCodeAt(++state.position); + } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0); + } + + if (is_EOL(ch)) { + readLineBreak(state); + + ch = state.input.charCodeAt(state.position); + lineBreaks++; + state.lineIndent = 0; + + while (ch === 0x20/* Space */) { + state.lineIndent++; + ch = state.input.charCodeAt(++state.position); + } + } else { + break; + } + } + + if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) { + throwWarning(state, 'deficient indentation'); + } + + return lineBreaks; + } + + function testDocumentSeparator(state) { + var _position = state.position, + ch; + + ch = state.input.charCodeAt(_position); + + // Condition state.position === state.lineStart is tested + // in parent on each call, for efficiency. No needs to test here again. + if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) && + ch === state.input.charCodeAt(_position + 1) && + ch === state.input.charCodeAt(_position + 2)) { + + _position += 3; + + ch = state.input.charCodeAt(_position); + + if (ch === 0 || is_WS_OR_EOL(ch)) { + return true; + } + } + + return false; + } + + function writeFoldedLines(state, count) { + if (count === 1) { + state.result += ' '; + } else if (count > 1) { + state.result += common.repeat('\n', count - 1); + } + } + + + function readPlainScalar(state, nodeIndent, withinFlowCollection) { + var preceding, + following, + captureStart, + captureEnd, + hasPendingContent, + _line, + _lineStart, + _lineIndent, + _kind = state.kind, + _result = state.result, + ch; + + ch = state.input.charCodeAt(state.position); + + if (is_WS_OR_EOL(ch) || + is_FLOW_INDICATOR(ch) || + ch === 0x23/* # */ || + ch === 0x26/* & */ || + ch === 0x2A/* * */ || + ch === 0x21/* ! */ || + ch === 0x7C/* | */ || + ch === 0x3E/* > */ || + ch === 0x27/* ' */ || + ch === 0x22/* " */ || + ch === 0x25/* % */ || + ch === 0x40/* @ */ || + ch === 0x60/* ` */) { + return false; + } + + if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) { + following = state.input.charCodeAt(state.position + 1); + + if (is_WS_OR_EOL(following) || + withinFlowCollection && is_FLOW_INDICATOR(following)) { + return false; + } + } + + state.kind = 'scalar'; + state.result = ''; + captureStart = captureEnd = state.position; + hasPendingContent = false; + + while (ch !== 0) { + if (ch === 0x3A/* : */) { + following = state.input.charCodeAt(state.position + 1); + + if (is_WS_OR_EOL(following) || + withinFlowCollection && is_FLOW_INDICATOR(following)) { + break; + } + + } else if (ch === 0x23/* # */) { + preceding = state.input.charCodeAt(state.position - 1); + + if (is_WS_OR_EOL(preceding)) { + break; + } + + } else if ((state.position === state.lineStart && testDocumentSeparator(state)) || + withinFlowCollection && is_FLOW_INDICATOR(ch)) { + break; + + } else if (is_EOL(ch)) { + _line = state.line; + _lineStart = state.lineStart; + _lineIndent = state.lineIndent; + skipSeparationSpace(state, false, -1); + + if (state.lineIndent >= nodeIndent) { + hasPendingContent = true; + ch = state.input.charCodeAt(state.position); + continue; + } else { + state.position = captureEnd; + state.line = _line; + state.lineStart = _lineStart; + state.lineIndent = _lineIndent; + break; + } + } + + if (hasPendingContent) { + captureSegment(state, captureStart, captureEnd, false); + writeFoldedLines(state, state.line - _line); + captureStart = captureEnd = state.position; + hasPendingContent = false; + } + + if (!is_WHITE_SPACE(ch)) { + captureEnd = state.position + 1; + } + + ch = state.input.charCodeAt(++state.position); + } + + captureSegment(state, captureStart, captureEnd, false); + + if (state.result) { + return true; + } + + state.kind = _kind; + state.result = _result; + return false; + } + + function readSingleQuotedScalar(state, nodeIndent) { + var ch, + captureStart, captureEnd; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x27/* ' */) { + return false; + } + + state.kind = 'scalar'; + state.result = ''; + state.position++; + captureStart = captureEnd = state.position; + + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + if (ch === 0x27/* ' */) { + captureSegment(state, captureStart, state.position, true); + ch = state.input.charCodeAt(++state.position); + + if (ch === 0x27/* ' */) { + captureStart = state.position; + state.position++; + captureEnd = state.position; + } else { + return true; + } + + } else if (is_EOL(ch)) { + captureSegment(state, captureStart, captureEnd, true); + writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); + captureStart = captureEnd = state.position; + + } else if (state.position === state.lineStart && testDocumentSeparator(state)) { + throwError(state, 'unexpected end of the document within a single quoted scalar'); + + } else { + state.position++; + captureEnd = state.position; + } + } + + throwError(state, 'unexpected end of the stream within a single quoted scalar'); + } + + function readDoubleQuotedScalar(state, nodeIndent) { + var captureStart, + captureEnd, + hexLength, + hexResult, + tmp, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x22/* " */) { + return false; + } + + state.kind = 'scalar'; + state.result = ''; + state.position++; + captureStart = captureEnd = state.position; + + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + if (ch === 0x22/* " */) { + captureSegment(state, captureStart, state.position, true); + state.position++; + return true; + + } else if (ch === 0x5C/* \ */) { + captureSegment(state, captureStart, state.position, true); + ch = state.input.charCodeAt(++state.position); + + if (is_EOL(ch)) { + skipSeparationSpace(state, false, nodeIndent); + + // TODO: rework to inline fn with no type cast? + } else if (ch < 256 && simpleEscapeCheck[ch]) { + state.result += simpleEscapeMap[ch]; + state.position++; + + } else if ((tmp = escapedHexLen(ch)) > 0) { + hexLength = tmp; + hexResult = 0; + + for (; hexLength > 0; hexLength--) { + ch = state.input.charCodeAt(++state.position); + + if ((tmp = fromHexCode(ch)) >= 0) { + hexResult = (hexResult << 4) + tmp; + + } else { + throwError(state, 'expected hexadecimal character'); + } + } + + state.result += charFromCodepoint(hexResult); + + state.position++; + + } else { + throwError(state, 'unknown escape sequence'); + } + + captureStart = captureEnd = state.position; + + } else if (is_EOL(ch)) { + captureSegment(state, captureStart, captureEnd, true); + writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); + captureStart = captureEnd = state.position; + + } else if (state.position === state.lineStart && testDocumentSeparator(state)) { + throwError(state, 'unexpected end of the document within a double quoted scalar'); + + } else { + state.position++; + captureEnd = state.position; + } + } + + throwError(state, 'unexpected end of the stream within a double quoted scalar'); + } + + function readFlowCollection(state, nodeIndent) { + var readNext = true, + _line, + _lineStart, + _pos, + _tag = state.tag, + _result, + _anchor = state.anchor, + following, + terminator, + isPair, + isExplicitPair, + isMapping, + overridableKeys = Object.create(null), + keyNode, + keyTag, + valueNode, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x5B/* [ */) { + terminator = 0x5D;/* ] */ + isMapping = false; + _result = []; + } else if (ch === 0x7B/* { */) { + terminator = 0x7D;/* } */ + isMapping = true; + _result = {}; + } else { + return false; + } + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } + + ch = state.input.charCodeAt(++state.position); + + while (ch !== 0) { + skipSeparationSpace(state, true, nodeIndent); + + ch = state.input.charCodeAt(state.position); + + if (ch === terminator) { + state.position++; + state.tag = _tag; + state.anchor = _anchor; + state.kind = isMapping ? 'mapping' : 'sequence'; + state.result = _result; + return true; + } else if (!readNext) { + throwError(state, 'missed comma between flow collection entries'); + } else if (ch === 0x2C/* , */) { + // "flow collection entries can never be completely empty", as per YAML 1.2, section 7.4 + throwError(state, "expected the node content, but found ','"); + } + + keyTag = keyNode = valueNode = null; + isPair = isExplicitPair = false; + + if (ch === 0x3F/* ? */) { + following = state.input.charCodeAt(state.position + 1); + + if (is_WS_OR_EOL(following)) { + isPair = isExplicitPair = true; + state.position++; + skipSeparationSpace(state, true, nodeIndent); + } + } + + _line = state.line; // Save the current line. + _lineStart = state.lineStart; + _pos = state.position; + composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); + keyTag = state.tag; + keyNode = state.result; + skipSeparationSpace(state, true, nodeIndent); + + ch = state.input.charCodeAt(state.position); + + if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) { + isPair = true; + ch = state.input.charCodeAt(++state.position); + skipSeparationSpace(state, true, nodeIndent); + composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); + valueNode = state.result; + } + + if (isMapping) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos); + } else if (isPair) { + _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos)); + } else { + _result.push(keyNode); + } + + skipSeparationSpace(state, true, nodeIndent); + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x2C/* , */) { + readNext = true; + ch = state.input.charCodeAt(++state.position); + } else { + readNext = false; + } + } + + throwError(state, 'unexpected end of the stream within a flow collection'); + } + + function readBlockScalar(state, nodeIndent) { + var captureStart, + folding, + chomping = CHOMPING_CLIP, + didReadContent = false, + detectedIndent = false, + textIndent = nodeIndent, + emptyLines = 0, + atMoreIndented = false, + tmp, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x7C/* | */) { + folding = false; + } else if (ch === 0x3E/* > */) { + folding = true; + } else { + return false; + } + + state.kind = 'scalar'; + state.result = ''; + + while (ch !== 0) { + ch = state.input.charCodeAt(++state.position); + + if (ch === 0x2B/* + */ || ch === 0x2D/* - */) { + if (CHOMPING_CLIP === chomping) { + chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP; + } else { + throwError(state, 'repeat of a chomping mode identifier'); + } + + } else if ((tmp = fromDecimalCode(ch)) >= 0) { + if (tmp === 0) { + throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one'); + } else if (!detectedIndent) { + textIndent = nodeIndent + tmp - 1; + detectedIndent = true; + } else { + throwError(state, 'repeat of an indentation width identifier'); + } + + } else { + break; + } + } + + if (is_WHITE_SPACE(ch)) { + do { ch = state.input.charCodeAt(++state.position); } + while (is_WHITE_SPACE(ch)); + + if (ch === 0x23/* # */) { + do { ch = state.input.charCodeAt(++state.position); } + while (!is_EOL(ch) && (ch !== 0)); + } + } + + while (ch !== 0) { + readLineBreak(state); + state.lineIndent = 0; + + ch = state.input.charCodeAt(state.position); + + while ((!detectedIndent || state.lineIndent < textIndent) && + (ch === 0x20/* Space */)) { + state.lineIndent++; + ch = state.input.charCodeAt(++state.position); + } + + if (!detectedIndent && state.lineIndent > textIndent) { + textIndent = state.lineIndent; + } + + if (is_EOL(ch)) { + emptyLines++; + continue; + } + + // End of the scalar. + if (state.lineIndent < textIndent) { + + // Perform the chomping. + if (chomping === CHOMPING_KEEP) { + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + } else if (chomping === CHOMPING_CLIP) { + if (didReadContent) { // i.e. only if the scalar is not empty. + state.result += '\n'; + } + } + + // Break this `while` cycle and go to the funciton's epilogue. + break; + } + + // Folded style: use fancy rules to handle line breaks. + if (folding) { + + // Lines starting with white space characters (more-indented lines) are not folded. + if (is_WHITE_SPACE(ch)) { + atMoreIndented = true; + // except for the first content line (cf. Example 8.1) + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + + // End of more-indented block. + } else if (atMoreIndented) { + atMoreIndented = false; + state.result += common.repeat('\n', emptyLines + 1); + + // Just one line break - perceive as the same line. + } else if (emptyLines === 0) { + if (didReadContent) { // i.e. only if we have already read some scalar content. + state.result += ' '; + } + + // Several line breaks - perceive as different lines. + } else { + state.result += common.repeat('\n', emptyLines); + } + + // Literal style: just add exact number of line breaks between content lines. + } else { + // Keep all line breaks except the header line break. + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + } + + didReadContent = true; + detectedIndent = true; + emptyLines = 0; + captureStart = state.position; + + while (!is_EOL(ch) && (ch !== 0)) { + ch = state.input.charCodeAt(++state.position); + } + + captureSegment(state, captureStart, state.position, false); + } + + return true; + } + + function readBlockSequence(state, nodeIndent) { + var _line, + _tag = state.tag, + _anchor = state.anchor, + _result = [], + following, + detected = false, + ch; + + // there is a leading tab before this token, so it can't be a block sequence/mapping; + // it can still be flow sequence/mapping or a scalar + if (state.firstTabInLine !== -1) return false; + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } + + ch = state.input.charCodeAt(state.position); + + while (ch !== 0) { + if (state.firstTabInLine !== -1) { + state.position = state.firstTabInLine; + throwError(state, 'tab characters must not be used in indentation'); + } + + if (ch !== 0x2D/* - */) { + break; + } + + following = state.input.charCodeAt(state.position + 1); + + if (!is_WS_OR_EOL(following)) { + break; + } + + detected = true; + state.position++; + + if (skipSeparationSpace(state, true, -1)) { + if (state.lineIndent <= nodeIndent) { + _result.push(null); + ch = state.input.charCodeAt(state.position); + continue; + } + } + + _line = state.line; + composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true); + _result.push(state.result); + skipSeparationSpace(state, true, -1); + + ch = state.input.charCodeAt(state.position); + + if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { + throwError(state, 'bad indentation of a sequence entry'); + } else if (state.lineIndent < nodeIndent) { + break; + } + } + + if (detected) { + state.tag = _tag; + state.anchor = _anchor; + state.kind = 'sequence'; + state.result = _result; + return true; + } + return false; + } + + function readBlockMapping(state, nodeIndent, flowIndent) { + var following, + allowCompact, + _line, + _keyLine, + _keyLineStart, + _keyPos, + _tag = state.tag, + _anchor = state.anchor, + _result = {}, + overridableKeys = Object.create(null), + keyTag = null, + keyNode = null, + valueNode = null, + atExplicitKey = false, + detected = false, + ch; + + // there is a leading tab before this token, so it can't be a block sequence/mapping; + // it can still be flow sequence/mapping or a scalar + if (state.firstTabInLine !== -1) return false; + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } + + ch = state.input.charCodeAt(state.position); + + while (ch !== 0) { + if (!atExplicitKey && state.firstTabInLine !== -1) { + state.position = state.firstTabInLine; + throwError(state, 'tab characters must not be used in indentation'); + } + + following = state.input.charCodeAt(state.position + 1); + _line = state.line; // Save the current line. + + // + // Explicit notation case. There are two separate blocks: + // first for the key (denoted by "?") and second for the value (denoted by ":") + // + if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) { + + if (ch === 0x3F/* ? */) { + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); + keyTag = keyNode = valueNode = null; + } + + detected = true; + atExplicitKey = true; + allowCompact = true; + + } else if (atExplicitKey) { + // i.e. 0x3A/* : */ === character after the explicit key. + atExplicitKey = false; + allowCompact = true; + + } else { + throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line'); + } + + state.position += 1; + ch = following; + + // + // Implicit notation case. Flow-style node as the key first, then ":", and the value. + // + } else { + _keyLine = state.line; + _keyLineStart = state.lineStart; + _keyPos = state.position; + + if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) { + // Neither implicit nor explicit notation. + // Reading is done. Go to the epilogue. + break; + } + + if (state.line === _line) { + ch = state.input.charCodeAt(state.position); + + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (ch === 0x3A/* : */) { + ch = state.input.charCodeAt(++state.position); + + if (!is_WS_OR_EOL(ch)) { + throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping'); + } + + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); + keyTag = keyNode = valueNode = null; + } + + detected = true; + atExplicitKey = false; + allowCompact = false; + keyTag = state.tag; + keyNode = state.result; + + } else if (detected) { + throwError(state, 'can not read an implicit mapping pair; a colon is missed'); + + } else { + state.tag = _tag; + state.anchor = _anchor; + return true; // Keep the result of `composeNode`. + } + + } else if (detected) { + throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key'); + + } else { + state.tag = _tag; + state.anchor = _anchor; + return true; // Keep the result of `composeNode`. + } + } + + // + // Common reading code for both explicit and implicit notations. + // + if (state.line === _line || state.lineIndent > nodeIndent) { + if (atExplicitKey) { + _keyLine = state.line; + _keyLineStart = state.lineStart; + _keyPos = state.position; + } + + if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) { + if (atExplicitKey) { + keyNode = state.result; + } else { + valueNode = state.result; + } + } + + if (!atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos); + keyTag = keyNode = valueNode = null; + } + + skipSeparationSpace(state, true, -1); + ch = state.input.charCodeAt(state.position); + } + + if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { + throwError(state, 'bad indentation of a mapping entry'); + } else if (state.lineIndent < nodeIndent) { + break; + } + } + + // + // Epilogue. + // + + // Special case: last mapping's node contains only the key in explicit notation. + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); + } + + // Expose the resulting mapping. + if (detected) { + state.tag = _tag; + state.anchor = _anchor; + state.kind = 'mapping'; + state.result = _result; + } + + return detected; + } + + function readTagProperty(state) { + var _position, + isVerbatim = false, + isNamed = false, + tagHandle, + tagName, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x21/* ! */) return false; + + if (state.tag !== null) { + throwError(state, 'duplication of a tag property'); + } + + ch = state.input.charCodeAt(++state.position); + + if (ch === 0x3C/* < */) { + isVerbatim = true; + ch = state.input.charCodeAt(++state.position); + + } else if (ch === 0x21/* ! */) { + isNamed = true; + tagHandle = '!!'; + ch = state.input.charCodeAt(++state.position); + + } else { + tagHandle = '!'; + } + + _position = state.position; + + if (isVerbatim) { + do { ch = state.input.charCodeAt(++state.position); } + while (ch !== 0 && ch !== 0x3E/* > */); + + if (state.position < state.length) { + tagName = state.input.slice(_position, state.position); + ch = state.input.charCodeAt(++state.position); + } else { + throwError(state, 'unexpected end of the stream within a verbatim tag'); + } + } else { + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + + if (ch === 0x21/* ! */) { + if (!isNamed) { + tagHandle = state.input.slice(_position - 1, state.position + 1); + + if (!PATTERN_TAG_HANDLE.test(tagHandle)) { + throwError(state, 'named tag handle cannot contain such characters'); + } + + isNamed = true; + _position = state.position + 1; + } else { + throwError(state, 'tag suffix cannot contain exclamation marks'); + } + } + + ch = state.input.charCodeAt(++state.position); + } + + tagName = state.input.slice(_position, state.position); + + if (PATTERN_FLOW_INDICATORS.test(tagName)) { + throwError(state, 'tag suffix cannot contain flow indicator characters'); + } + } + + if (tagName && !PATTERN_TAG_URI.test(tagName)) { + throwError(state, 'tag name cannot contain such characters: ' + tagName); + } + + try { + tagName = decodeURIComponent(tagName); + } catch (err) { + throwError(state, 'tag name is malformed: ' + tagName); + } + + if (isVerbatim) { + state.tag = tagName; + + } else if (_hasOwnProperty$1.call(state.tagMap, tagHandle)) { + state.tag = state.tagMap[tagHandle] + tagName; + + } else if (tagHandle === '!') { + state.tag = '!' + tagName; + + } else if (tagHandle === '!!') { + state.tag = 'tag:yaml.org,2002:' + tagName; + + } else { + throwError(state, 'undeclared tag handle "' + tagHandle + '"'); + } + + return true; + } + + function readAnchorProperty(state) { + var _position, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x26/* & */) return false; + + if (state.anchor !== null) { + throwError(state, 'duplication of an anchor property'); + } + + ch = state.input.charCodeAt(++state.position); + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (state.position === _position) { + throwError(state, 'name of an anchor node must contain at least one character'); + } + + state.anchor = state.input.slice(_position, state.position); + return true; + } + + function readAlias(state) { + var _position, alias, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x2A/* * */) return false; + + ch = state.input.charCodeAt(++state.position); + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (state.position === _position) { + throwError(state, 'name of an alias node must contain at least one character'); + } + + alias = state.input.slice(_position, state.position); + + if (!_hasOwnProperty$1.call(state.anchorMap, alias)) { + throwError(state, 'unidentified alias "' + alias + '"'); + } + + state.result = state.anchorMap[alias]; + skipSeparationSpace(state, true, -1); + return true; + } + + function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) { + var allowBlockStyles, + allowBlockScalars, + allowBlockCollections, + indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this parentIndent) { + indentStatus = 1; + } else if (state.lineIndent === parentIndent) { + indentStatus = 0; + } else if (state.lineIndent < parentIndent) { + indentStatus = -1; + } + } + } + + if (indentStatus === 1) { + while (readTagProperty(state) || readAnchorProperty(state)) { + if (skipSeparationSpace(state, true, -1)) { + atNewLine = true; + allowBlockCollections = allowBlockStyles; + + if (state.lineIndent > parentIndent) { + indentStatus = 1; + } else if (state.lineIndent === parentIndent) { + indentStatus = 0; + } else if (state.lineIndent < parentIndent) { + indentStatus = -1; + } + } else { + allowBlockCollections = false; + } + } + } + + if (allowBlockCollections) { + allowBlockCollections = atNewLine || allowCompact; + } + + if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) { + if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) { + flowIndent = parentIndent; + } else { + flowIndent = parentIndent + 1; + } + + blockIndent = state.position - state.lineStart; + + if (indentStatus === 1) { + if (allowBlockCollections && + (readBlockSequence(state, blockIndent) || + readBlockMapping(state, blockIndent, flowIndent)) || + readFlowCollection(state, flowIndent)) { + hasContent = true; + } else { + if ((allowBlockScalars && readBlockScalar(state, flowIndent)) || + readSingleQuotedScalar(state, flowIndent) || + readDoubleQuotedScalar(state, flowIndent)) { + hasContent = true; + + } else if (readAlias(state)) { + hasContent = true; + + if (state.tag !== null || state.anchor !== null) { + throwError(state, 'alias node should not have any properties'); + } + + } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) { + hasContent = true; + + if (state.tag === null) { + state.tag = '?'; + } + } + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + } + } else if (indentStatus === 0) { + // Special case: block sequences are allowed to have same indentation level as the parent. + // http://www.yaml.org/spec/1.2/spec.html#id2799784 + hasContent = allowBlockCollections && readBlockSequence(state, blockIndent); + } + } + + if (state.tag === null) { + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + + } else if (state.tag === '?') { + // Implicit resolving is not allowed for non-scalar types, and '?' + // non-specific tag is only automatically assigned to plain scalars. + // + // We only need to check kind conformity in case user explicitly assigns '?' + // tag, for example like this: "! [0]" + // + if (state.result !== null && state.kind !== 'scalar') { + throwError(state, 'unacceptable node kind for ! tag; it should be "scalar", not "' + state.kind + '"'); + } + + for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) { + type = state.implicitTypes[typeIndex]; + + if (type.resolve(state.result)) { // `state.result` updated in resolver if matched + state.result = type.construct(state.result); + state.tag = type.tag; + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + break; + } + } + } else if (state.tag !== '!') { + if (_hasOwnProperty$1.call(state.typeMap[state.kind || 'fallback'], state.tag)) { + type = state.typeMap[state.kind || 'fallback'][state.tag]; + } else { + // looking for multi type + type = null; + typeList = state.typeMap.multi[state.kind || 'fallback']; + + for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) { + if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) { + type = typeList[typeIndex]; + break; + } + } + } + + if (!type) { + throwError(state, 'unknown tag !<' + state.tag + '>'); + } + + if (state.result !== null && type.kind !== state.kind) { + throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"'); + } + + if (!type.resolve(state.result, state.tag)) { // `state.result` updated in resolver if matched + throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag'); + } else { + state.result = type.construct(state.result, state.tag); + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + } + } + + if (state.listener !== null) { + state.listener('close', state); + } + return state.tag !== null || state.anchor !== null || hasContent; + } + + function readDocument(state) { + var documentStart = state.position, + _position, + directiveName, + directiveArgs, + hasDirectives = false, + ch; + + state.version = null; + state.checkLineBreaks = state.legacy; + state.tagMap = Object.create(null); + state.anchorMap = Object.create(null); + + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + skipSeparationSpace(state, true, -1); + + ch = state.input.charCodeAt(state.position); + + if (state.lineIndent > 0 || ch !== 0x25/* % */) { + break; + } + + hasDirectives = true; + ch = state.input.charCodeAt(++state.position); + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + directiveName = state.input.slice(_position, state.position); + directiveArgs = []; + + if (directiveName.length < 1) { + throwError(state, 'directive name must not be less than one character in length'); + } + + while (ch !== 0) { + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (ch === 0x23/* # */) { + do { ch = state.input.charCodeAt(++state.position); } + while (ch !== 0 && !is_EOL(ch)); + break; + } + + if (is_EOL(ch)) break; + + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + directiveArgs.push(state.input.slice(_position, state.position)); + } + + if (ch !== 0) readLineBreak(state); + + if (_hasOwnProperty$1.call(directiveHandlers, directiveName)) { + directiveHandlers[directiveName](state, directiveName, directiveArgs); + } else { + throwWarning(state, 'unknown document directive "' + directiveName + '"'); + } + } + + skipSeparationSpace(state, true, -1); + + if (state.lineIndent === 0 && + state.input.charCodeAt(state.position) === 0x2D/* - */ && + state.input.charCodeAt(state.position + 1) === 0x2D/* - */ && + state.input.charCodeAt(state.position + 2) === 0x2D/* - */) { + state.position += 3; + skipSeparationSpace(state, true, -1); + + } else if (hasDirectives) { + throwError(state, 'directives end mark is expected'); + } + + composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true); + skipSeparationSpace(state, true, -1); + + if (state.checkLineBreaks && + PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) { + throwWarning(state, 'non-ASCII line breaks are interpreted as content'); + } + + state.documents.push(state.result); + + if (state.position === state.lineStart && testDocumentSeparator(state)) { + + if (state.input.charCodeAt(state.position) === 0x2E/* . */) { + state.position += 3; + skipSeparationSpace(state, true, -1); + } + return; + } + + if (state.position < (state.length - 1)) { + throwError(state, 'end of the stream or a document separator is expected'); + } else { + return; + } + } + + + function loadDocuments(input, options) { + input = String(input); + options = options || {}; + + if (input.length !== 0) { + + // Add tailing `\n` if not exists + if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ && + input.charCodeAt(input.length - 1) !== 0x0D/* CR */) { + input += '\n'; + } + + // Strip BOM + if (input.charCodeAt(0) === 0xFEFF) { + input = input.slice(1); + } + } + + var state = new State$1(input, options); + + var nullpos = input.indexOf('\0'); + + if (nullpos !== -1) { + state.position = nullpos; + throwError(state, 'null byte is not allowed in input'); + } + + // Use 0 as string terminator. That significantly simplifies bounds check. + state.input += '\0'; + + while (state.input.charCodeAt(state.position) === 0x20/* Space */) { + state.lineIndent += 1; + state.position += 1; + } + + while (state.position < (state.length - 1)) { + readDocument(state); + } + + return state.documents; + } + + + function loadAll$1(input, iterator, options) { + if (iterator !== null && typeof iterator === 'object' && typeof options === 'undefined') { + options = iterator; + iterator = null; + } + + var documents = loadDocuments(input, options); + + if (typeof iterator !== 'function') { + return documents; + } + + for (var index = 0, length = documents.length; index < length; index += 1) { + iterator(documents[index]); + } + } + + + function load$1(input, options) { + var documents = loadDocuments(input, options); + + if (documents.length === 0) { + /*eslint-disable no-undefined*/ + return undefined; + } else if (documents.length === 1) { + return documents[0]; + } + throw new exception('expected a single document in the stream, but found more'); + } + + + var loadAll_1 = loadAll$1; + var load_1 = load$1; + + var loader = { + loadAll: loadAll_1, + load: load_1 + }; + + /*eslint-disable no-use-before-define*/ + + + + + + var _toString = Object.prototype.toString; + var _hasOwnProperty = Object.prototype.hasOwnProperty; + + var CHAR_BOM = 0xFEFF; + var CHAR_TAB = 0x09; /* Tab */ + var CHAR_LINE_FEED = 0x0A; /* LF */ + var CHAR_CARRIAGE_RETURN = 0x0D; /* CR */ + var CHAR_SPACE = 0x20; /* Space */ + var CHAR_EXCLAMATION = 0x21; /* ! */ + var CHAR_DOUBLE_QUOTE = 0x22; /* " */ + var CHAR_SHARP = 0x23; /* # */ + var CHAR_PERCENT = 0x25; /* % */ + var CHAR_AMPERSAND = 0x26; /* & */ + var CHAR_SINGLE_QUOTE = 0x27; /* ' */ + var CHAR_ASTERISK = 0x2A; /* * */ + var CHAR_COMMA = 0x2C; /* , */ + var CHAR_MINUS = 0x2D; /* - */ + var CHAR_COLON = 0x3A; /* : */ + var CHAR_EQUALS = 0x3D; /* = */ + var CHAR_GREATER_THAN = 0x3E; /* > */ + var CHAR_QUESTION = 0x3F; /* ? */ + var CHAR_COMMERCIAL_AT = 0x40; /* @ */ + var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */ + var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */ + var CHAR_GRAVE_ACCENT = 0x60; /* ` */ + var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */ + var CHAR_VERTICAL_LINE = 0x7C; /* | */ + var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */ + + var ESCAPE_SEQUENCES = {}; + + ESCAPE_SEQUENCES[0x00] = '\\0'; + ESCAPE_SEQUENCES[0x07] = '\\a'; + ESCAPE_SEQUENCES[0x08] = '\\b'; + ESCAPE_SEQUENCES[0x09] = '\\t'; + ESCAPE_SEQUENCES[0x0A] = '\\n'; + ESCAPE_SEQUENCES[0x0B] = '\\v'; + ESCAPE_SEQUENCES[0x0C] = '\\f'; + ESCAPE_SEQUENCES[0x0D] = '\\r'; + ESCAPE_SEQUENCES[0x1B] = '\\e'; + ESCAPE_SEQUENCES[0x22] = '\\"'; + ESCAPE_SEQUENCES[0x5C] = '\\\\'; + ESCAPE_SEQUENCES[0x85] = '\\N'; + ESCAPE_SEQUENCES[0xA0] = '\\_'; + ESCAPE_SEQUENCES[0x2028] = '\\L'; + ESCAPE_SEQUENCES[0x2029] = '\\P'; + + var DEPRECATED_BOOLEANS_SYNTAX = [ + 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON', + 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF' + ]; + + var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/; + + function compileStyleMap(schema, map) { + var result, keys, index, length, tag, style, type; + + if (map === null) return {}; + + result = {}; + keys = Object.keys(map); + + for (index = 0, length = keys.length; index < length; index += 1) { + tag = keys[index]; + style = String(map[tag]); + + if (tag.slice(0, 2) === '!!') { + tag = 'tag:yaml.org,2002:' + tag.slice(2); + } + type = schema.compiledTypeMap['fallback'][tag]; + + if (type && _hasOwnProperty.call(type.styleAliases, style)) { + style = type.styleAliases[style]; + } + + result[tag] = style; + } + + return result; + } + + function encodeHex(character) { + var string, handle, length; + + string = character.toString(16).toUpperCase(); + + if (character <= 0xFF) { + handle = 'x'; + length = 2; + } else if (character <= 0xFFFF) { + handle = 'u'; + length = 4; + } else if (character <= 0xFFFFFFFF) { + handle = 'U'; + length = 8; + } else { + throw new exception('code point within a string may not be greater than 0xFFFFFFFF'); + } + + return '\\' + handle + common.repeat('0', length - string.length) + string; + } + + + var QUOTING_TYPE_SINGLE = 1, + QUOTING_TYPE_DOUBLE = 2; + + function State(options) { + this.schema = options['schema'] || _default; + this.indent = Math.max(1, (options['indent'] || 2)); + this.noArrayIndent = options['noArrayIndent'] || false; + this.skipInvalid = options['skipInvalid'] || false; + this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']); + this.styleMap = compileStyleMap(this.schema, options['styles'] || null); + this.sortKeys = options['sortKeys'] || false; + this.lineWidth = options['lineWidth'] || 80; + this.noRefs = options['noRefs'] || false; + this.noCompatMode = options['noCompatMode'] || false; + this.condenseFlow = options['condenseFlow'] || false; + this.quotingType = options['quotingType'] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE; + this.forceQuotes = options['forceQuotes'] || false; + this.replacer = typeof options['replacer'] === 'function' ? options['replacer'] : null; + + this.implicitTypes = this.schema.compiledImplicit; + this.explicitTypes = this.schema.compiledExplicit; + + this.tag = null; + this.result = ''; + + this.duplicates = []; + this.usedDuplicates = null; + } + + // Indents every line in a string. Empty lines (\n only) are not indented. + function indentString(string, spaces) { + var ind = common.repeat(' ', spaces), + position = 0, + next = -1, + result = '', + line, + length = string.length; + + while (position < length) { + next = string.indexOf('\n', position); + if (next === -1) { + line = string.slice(position); + position = length; + } else { + line = string.slice(position, next + 1); + position = next + 1; + } + + if (line.length && line !== '\n') result += ind; + + result += line; + } + + return result; + } + + function generateNextLine(state, level) { + return '\n' + common.repeat(' ', state.indent * level); + } + + function testImplicitResolving(state, str) { + var index, length, type; + + for (index = 0, length = state.implicitTypes.length; index < length; index += 1) { + type = state.implicitTypes[index]; + + if (type.resolve(str)) { + return true; + } + } + + return false; + } + + // [33] s-white ::= s-space | s-tab + function isWhitespace(c) { + return c === CHAR_SPACE || c === CHAR_TAB; + } + + // Returns true if the character can be printed without escaping. + // From YAML 1.2: "any allowed characters known to be non-printable + // should also be escaped. [However,] This isn’t mandatory" + // Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029. + function isPrintable(c) { + return (0x00020 <= c && c <= 0x00007E) + || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029) + || ((0x0E000 <= c && c <= 0x00FFFD) && c !== CHAR_BOM) + || (0x10000 <= c && c <= 0x10FFFF); + } + + // [34] ns-char ::= nb-char - s-white + // [27] nb-char ::= c-printable - b-char - c-byte-order-mark + // [26] b-char ::= b-line-feed | b-carriage-return + // Including s-white (for some reason, examples doesn't match specs in this aspect) + // ns-char ::= c-printable - b-line-feed - b-carriage-return - c-byte-order-mark + function isNsCharOrWhitespace(c) { + return isPrintable(c) + && c !== CHAR_BOM + // - b-char + && c !== CHAR_CARRIAGE_RETURN + && c !== CHAR_LINE_FEED; + } + + // [127] ns-plain-safe(c) ::= c = flow-out ⇒ ns-plain-safe-out + // c = flow-in ⇒ ns-plain-safe-in + // c = block-key ⇒ ns-plain-safe-out + // c = flow-key ⇒ ns-plain-safe-in + // [128] ns-plain-safe-out ::= ns-char + // [129] ns-plain-safe-in ::= ns-char - c-flow-indicator + // [130] ns-plain-char(c) ::= ( ns-plain-safe(c) - “:” - “#” ) + // | ( /* An ns-char preceding */ “#” ) + // | ( “:” /* Followed by an ns-plain-safe(c) */ ) + function isPlainSafe(c, prev, inblock) { + var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c); + var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c); + return ( + // ns-plain-safe + inblock ? // c = flow-in + cIsNsCharOrWhitespace + : cIsNsCharOrWhitespace + // - c-flow-indicator + && c !== CHAR_COMMA + && c !== CHAR_LEFT_SQUARE_BRACKET + && c !== CHAR_RIGHT_SQUARE_BRACKET + && c !== CHAR_LEFT_CURLY_BRACKET + && c !== CHAR_RIGHT_CURLY_BRACKET + ) + // ns-plain-char + && c !== CHAR_SHARP // false on '#' + && !(prev === CHAR_COLON && !cIsNsChar) // false on ': ' + || (isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP) // change to true on '[^ ]#' + || (prev === CHAR_COLON && cIsNsChar); // change to true on ':[^ ]' + } + + // Simplified test for values allowed as the first character in plain style. + function isPlainSafeFirst(c) { + // Uses a subset of ns-char - c-indicator + // where ns-char = nb-char - s-white. + // No support of ( ( “?” | “:” | “-” ) /* Followed by an ns-plain-safe(c)) */ ) part + return isPrintable(c) && c !== CHAR_BOM + && !isWhitespace(c) // - s-white + // - (c-indicator ::= + // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}” + && c !== CHAR_MINUS + && c !== CHAR_QUESTION + && c !== CHAR_COLON + && c !== CHAR_COMMA + && c !== CHAR_LEFT_SQUARE_BRACKET + && c !== CHAR_RIGHT_SQUARE_BRACKET + && c !== CHAR_LEFT_CURLY_BRACKET + && c !== CHAR_RIGHT_CURLY_BRACKET + // | “#” | “&” | “*” | “!” | “|” | “=” | “>” | “'” | “"” + && c !== CHAR_SHARP + && c !== CHAR_AMPERSAND + && c !== CHAR_ASTERISK + && c !== CHAR_EXCLAMATION + && c !== CHAR_VERTICAL_LINE + && c !== CHAR_EQUALS + && c !== CHAR_GREATER_THAN + && c !== CHAR_SINGLE_QUOTE + && c !== CHAR_DOUBLE_QUOTE + // | “%” | “@” | “`”) + && c !== CHAR_PERCENT + && c !== CHAR_COMMERCIAL_AT + && c !== CHAR_GRAVE_ACCENT; + } + + // Simplified test for values allowed as the last character in plain style. + function isPlainSafeLast(c) { + // just not whitespace or colon, it will be checked to be plain character later + return !isWhitespace(c) && c !== CHAR_COLON; + } + + // Same as 'string'.codePointAt(pos), but works in older browsers. + function codePointAt(string, pos) { + var first = string.charCodeAt(pos), second; + if (first >= 0xD800 && first <= 0xDBFF && pos + 1 < string.length) { + second = string.charCodeAt(pos + 1); + if (second >= 0xDC00 && second <= 0xDFFF) { + // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae + return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000; + } + } + return first; + } + + // Determines whether block indentation indicator is required. + function needIndentIndicator(string) { + var leadingSpaceRe = /^\n* /; + return leadingSpaceRe.test(string); + } + + var STYLE_PLAIN = 1, + STYLE_SINGLE = 2, + STYLE_LITERAL = 3, + STYLE_FOLDED = 4, + STYLE_DOUBLE = 5; + + // Determines which scalar styles are possible and returns the preferred style. + // lineWidth = -1 => no limit. + // Pre-conditions: str.length > 0. + // Post-conditions: + // STYLE_PLAIN or STYLE_SINGLE => no \n are in the string. + // STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1). + // STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1). + function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, + testAmbiguousType, quotingType, forceQuotes, inblock) { + + var i; + var char = 0; + var prevChar = null; + var hasLineBreak = false; + var hasFoldableLine = false; // only checked if shouldTrackWidth + var shouldTrackWidth = lineWidth !== -1; + var previousLineBreak = -1; // count the first line correctly + var plain = isPlainSafeFirst(codePointAt(string, 0)) + && isPlainSafeLast(codePointAt(string, string.length - 1)); + + if (singleLineOnly || forceQuotes) { + // Case: no block styles. + // Check for disallowed characters to rule out plain and single. + for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { + char = codePointAt(string, i); + if (!isPrintable(char)) { + return STYLE_DOUBLE; + } + plain = plain && isPlainSafe(char, prevChar, inblock); + prevChar = char; + } + } else { + // Case: block styles permitted. + for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { + char = codePointAt(string, i); + if (char === CHAR_LINE_FEED) { + hasLineBreak = true; + // Check if any line can be folded. + if (shouldTrackWidth) { + hasFoldableLine = hasFoldableLine || + // Foldable line = too long, and not more-indented. + (i - previousLineBreak - 1 > lineWidth && + string[previousLineBreak + 1] !== ' '); + previousLineBreak = i; + } + } else if (!isPrintable(char)) { + return STYLE_DOUBLE; + } + plain = plain && isPlainSafe(char, prevChar, inblock); + prevChar = char; + } + // in case the end is missing a \n + hasFoldableLine = hasFoldableLine || (shouldTrackWidth && + (i - previousLineBreak - 1 > lineWidth && + string[previousLineBreak + 1] !== ' ')); + } + // Although every style can represent \n without escaping, prefer block styles + // for multiline, since they're more readable and they don't add empty lines. + // Also prefer folding a super-long line. + if (!hasLineBreak && !hasFoldableLine) { + // Strings interpretable as another type have to be quoted; + // e.g. the string 'true' vs. the boolean true. + if (plain && !forceQuotes && !testAmbiguousType(string)) { + return STYLE_PLAIN; + } + return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE; + } + // Edge case: block indentation indicator can only have one digit. + if (indentPerLevel > 9 && needIndentIndicator(string)) { + return STYLE_DOUBLE; + } + // At this point we know block styles are valid. + // Prefer literal style unless we want to fold. + if (!forceQuotes) { + return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL; + } + return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE; + } + + // Note: line breaking/folding is implemented for only the folded style. + // NB. We drop the last trailing newline (if any) of a returned block scalar + // since the dumper adds its own newline. This always works: + // • No ending newline => unaffected; already using strip "-" chomping. + // • Ending newline => removed then restored. + // Importantly, this keeps the "+" chomp indicator from gaining an extra line. + function writeScalar(state, string, level, iskey, inblock) { + state.dump = (function () { + if (string.length === 0) { + return state.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''"; + } + if (!state.noCompatMode) { + if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) { + return state.quotingType === QUOTING_TYPE_DOUBLE ? ('"' + string + '"') : ("'" + string + "'"); + } + } + + var indent = state.indent * Math.max(1, level); // no 0-indent scalars + // As indentation gets deeper, let the width decrease monotonically + // to the lower bound min(state.lineWidth, 40). + // Note that this implies + // state.lineWidth ≤ 40 + state.indent: width is fixed at the lower bound. + // state.lineWidth > 40 + state.indent: width decreases until the lower bound. + // This behaves better than a constant minimum width which disallows narrower options, + // or an indent threshold which causes the width to suddenly increase. + var lineWidth = state.lineWidth === -1 + ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent); + + // Without knowing if keys are implicit/explicit, assume implicit for safety. + var singleLineOnly = iskey + // No block styles in flow mode. + || (state.flowLevel > -1 && level >= state.flowLevel); + function testAmbiguity(string) { + return testImplicitResolving(state, string); + } + + switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, + testAmbiguity, state.quotingType, state.forceQuotes && !iskey, inblock)) { + + case STYLE_PLAIN: + return string; + case STYLE_SINGLE: + return "'" + string.replace(/'/g, "''") + "'"; + case STYLE_LITERAL: + return '|' + blockHeader(string, state.indent) + + dropEndingNewline(indentString(string, indent)); + case STYLE_FOLDED: + return '>' + blockHeader(string, state.indent) + + dropEndingNewline(indentString(foldString(string, lineWidth), indent)); + case STYLE_DOUBLE: + return '"' + escapeString(string) + '"'; + default: + throw new exception('impossible error: invalid scalar style'); + } + }()); + } + + // Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9. + function blockHeader(string, indentPerLevel) { + var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : ''; + + // note the special case: the string '\n' counts as a "trailing" empty line. + var clip = string[string.length - 1] === '\n'; + var keep = clip && (string[string.length - 2] === '\n' || string === '\n'); + var chomp = keep ? '+' : (clip ? '' : '-'); + + return indentIndicator + chomp + '\n'; + } + + // (See the note for writeScalar.) + function dropEndingNewline(string) { + return string[string.length - 1] === '\n' ? string.slice(0, -1) : string; + } + + // Note: a long line without a suitable break point will exceed the width limit. + // Pre-conditions: every char in str isPrintable, str.length > 0, width > 0. + function foldString(string, width) { + // In folded style, $k$ consecutive newlines output as $k+1$ newlines— + // unless they're before or after a more-indented line, or at the very + // beginning or end, in which case $k$ maps to $k$. + // Therefore, parse each chunk as newline(s) followed by a content line. + var lineRe = /(\n+)([^\n]*)/g; + + // first line (possibly an empty line) + var result = (function () { + var nextLF = string.indexOf('\n'); + nextLF = nextLF !== -1 ? nextLF : string.length; + lineRe.lastIndex = nextLF; + return foldLine(string.slice(0, nextLF), width); + }()); + // If we haven't reached the first content line yet, don't add an extra \n. + var prevMoreIndented = string[0] === '\n' || string[0] === ' '; + var moreIndented; + + // rest of the lines + var match; + while ((match = lineRe.exec(string))) { + var prefix = match[1], line = match[2]; + moreIndented = (line[0] === ' '); + result += prefix + + (!prevMoreIndented && !moreIndented && line !== '' + ? '\n' : '') + + foldLine(line, width); + prevMoreIndented = moreIndented; + } + + return result; + } + + // Greedy line breaking. + // Picks the longest line under the limit each time, + // otherwise settles for the shortest line over the limit. + // NB. More-indented lines *cannot* be folded, as that would add an extra \n. + function foldLine(line, width) { + if (line === '' || line[0] === ' ') return line; + + // Since a more-indented line adds a \n, breaks can't be followed by a space. + var breakRe = / [^ ]/g; // note: the match index will always be <= length-2. + var match; + // start is an inclusive index. end, curr, and next are exclusive. + var start = 0, end, curr = 0, next = 0; + var result = ''; + + // Invariants: 0 <= start <= length-1. + // 0 <= curr <= next <= max(0, length-2). curr - start <= width. + // Inside the loop: + // A match implies length >= 2, so curr and next are <= length-2. + while ((match = breakRe.exec(line))) { + next = match.index; + // maintain invariant: curr - start <= width + if (next - start > width) { + end = (curr > start) ? curr : next; // derive end <= length-2 + result += '\n' + line.slice(start, end); + // skip the space that was output as \n + start = end + 1; // derive start <= length-1 + } + curr = next; + } + + // By the invariants, start <= length-1, so there is something left over. + // It is either the whole string or a part starting from non-whitespace. + result += '\n'; + // Insert a break if the remainder is too long and there is a break available. + if (line.length - start > width && curr > start) { + result += line.slice(start, curr) + '\n' + line.slice(curr + 1); + } else { + result += line.slice(start); + } + + return result.slice(1); // drop extra \n joiner + } + + // Escapes a double-quoted string. + function escapeString(string) { + var result = ''; + var char = 0; + var escapeSeq; + + for (var i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { + char = codePointAt(string, i); + escapeSeq = ESCAPE_SEQUENCES[char]; + + if (!escapeSeq && isPrintable(char)) { + result += string[i]; + if (char >= 0x10000) result += string[i + 1]; + } else { + result += escapeSeq || encodeHex(char); + } + } + + return result; + } + + function writeFlowSequence(state, level, object) { + var _result = '', + _tag = state.tag, + index, + length, + value; + + for (index = 0, length = object.length; index < length; index += 1) { + value = object[index]; + + if (state.replacer) { + value = state.replacer.call(object, String(index), value); + } + + // Write only valid elements, put null instead of invalid elements. + if (writeNode(state, level, value, false, false) || + (typeof value === 'undefined' && + writeNode(state, level, null, false, false))) { + + if (_result !== '') _result += ',' + (!state.condenseFlow ? ' ' : ''); + _result += state.dump; + } + } + + state.tag = _tag; + state.dump = '[' + _result + ']'; + } + + function writeBlockSequence(state, level, object, compact) { + var _result = '', + _tag = state.tag, + index, + length, + value; + + for (index = 0, length = object.length; index < length; index += 1) { + value = object[index]; + + if (state.replacer) { + value = state.replacer.call(object, String(index), value); + } + + // Write only valid elements, put null instead of invalid elements. + if (writeNode(state, level + 1, value, true, true, false, true) || + (typeof value === 'undefined' && + writeNode(state, level + 1, null, true, true, false, true))) { + + if (!compact || _result !== '') { + _result += generateNextLine(state, level); + } + + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + _result += '-'; + } else { + _result += '- '; + } + + _result += state.dump; + } + } + + state.tag = _tag; + state.dump = _result || '[]'; // Empty sequence if no valid values. + } + + function writeFlowMapping(state, level, object) { + var _result = '', + _tag = state.tag, + objectKeyList = Object.keys(object), + index, + length, + objectKey, + objectValue, + pairBuffer; + + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + + pairBuffer = ''; + if (_result !== '') pairBuffer += ', '; + + if (state.condenseFlow) pairBuffer += '"'; + + objectKey = objectKeyList[index]; + objectValue = object[objectKey]; + + if (state.replacer) { + objectValue = state.replacer.call(object, objectKey, objectValue); + } + + if (!writeNode(state, level, objectKey, false, false)) { + continue; // Skip this pair because of invalid key; + } + + if (state.dump.length > 1024) pairBuffer += '? '; + + pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' '); + + if (!writeNode(state, level, objectValue, false, false)) { + continue; // Skip this pair because of invalid value. + } + + pairBuffer += state.dump; + + // Both key and value are valid. + _result += pairBuffer; + } + + state.tag = _tag; + state.dump = '{' + _result + '}'; + } + + function writeBlockMapping(state, level, object, compact) { + var _result = '', + _tag = state.tag, + objectKeyList = Object.keys(object), + index, + length, + objectKey, + objectValue, + explicitPair, + pairBuffer; + + // Allow sorting keys so that the output file is deterministic + if (state.sortKeys === true) { + // Default sorting + objectKeyList.sort(); + } else if (typeof state.sortKeys === 'function') { + // Custom sort function + objectKeyList.sort(state.sortKeys); + } else if (state.sortKeys) { + // Something is wrong + throw new exception('sortKeys must be a boolean or a function'); + } + + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + pairBuffer = ''; + + if (!compact || _result !== '') { + pairBuffer += generateNextLine(state, level); + } + + objectKey = objectKeyList[index]; + objectValue = object[objectKey]; + + if (state.replacer) { + objectValue = state.replacer.call(object, objectKey, objectValue); + } + + if (!writeNode(state, level + 1, objectKey, true, true, true)) { + continue; // Skip this pair because of invalid key. + } + + explicitPair = (state.tag !== null && state.tag !== '?') || + (state.dump && state.dump.length > 1024); + + if (explicitPair) { + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + pairBuffer += '?'; + } else { + pairBuffer += '? '; + } + } + + pairBuffer += state.dump; + + if (explicitPair) { + pairBuffer += generateNextLine(state, level); + } + + if (!writeNode(state, level + 1, objectValue, true, explicitPair)) { + continue; // Skip this pair because of invalid value. + } + + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + pairBuffer += ':'; + } else { + pairBuffer += ': '; + } + + pairBuffer += state.dump; + + // Both key and value are valid. + _result += pairBuffer; + } + + state.tag = _tag; + state.dump = _result || '{}'; // Empty mapping if no valid pairs. + } + + function detectType(state, object, explicit) { + var _result, typeList, index, length, type, style; + + typeList = explicit ? state.explicitTypes : state.implicitTypes; + + for (index = 0, length = typeList.length; index < length; index += 1) { + type = typeList[index]; + + if ((type.instanceOf || type.predicate) && + (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) && + (!type.predicate || type.predicate(object))) { + + if (explicit) { + if (type.multi && type.representName) { + state.tag = type.representName(object); + } else { + state.tag = type.tag; + } + } else { + state.tag = '?'; + } + + if (type.represent) { + style = state.styleMap[type.tag] || type.defaultStyle; + + if (_toString.call(type.represent) === '[object Function]') { + _result = type.represent(object, style); + } else if (_hasOwnProperty.call(type.represent, style)) { + _result = type.represent[style](object, style); + } else { + throw new exception('!<' + type.tag + '> tag resolver accepts not "' + style + '" style'); + } + + state.dump = _result; + } + + return true; + } + } + + return false; + } + + // Serializes `object` and writes it to global `result`. + // Returns true on success, or false on invalid object. + // + function writeNode(state, level, object, block, compact, iskey, isblockseq) { + state.tag = null; + state.dump = object; + + if (!detectType(state, object, false)) { + detectType(state, object, true); + } + + var type = _toString.call(state.dump); + var inblock = block; + var tagStr; + + if (block) { + block = (state.flowLevel < 0 || state.flowLevel > level); + } + + var objectOrArray = type === '[object Object]' || type === '[object Array]', + duplicateIndex, + duplicate; + + if (objectOrArray) { + duplicateIndex = state.duplicates.indexOf(object); + duplicate = duplicateIndex !== -1; + } + + if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) { + compact = false; + } + + if (duplicate && state.usedDuplicates[duplicateIndex]) { + state.dump = '*ref_' + duplicateIndex; + } else { + if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) { + state.usedDuplicates[duplicateIndex] = true; + } + if (type === '[object Object]') { + if (block && (Object.keys(state.dump).length !== 0)) { + writeBlockMapping(state, level, state.dump, compact); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + state.dump; + } + } else { + writeFlowMapping(state, level, state.dump); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; + } + } + } else if (type === '[object Array]') { + if (block && (state.dump.length !== 0)) { + if (state.noArrayIndent && !isblockseq && level > 0) { + writeBlockSequence(state, level - 1, state.dump, compact); + } else { + writeBlockSequence(state, level, state.dump, compact); + } + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + state.dump; + } + } else { + writeFlowSequence(state, level, state.dump); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; + } + } + } else if (type === '[object String]') { + if (state.tag !== '?') { + writeScalar(state, state.dump, level, iskey, inblock); + } + } else if (type === '[object Undefined]') { + return false; + } else { + if (state.skipInvalid) return false; + throw new exception('unacceptable kind of an object to dump ' + type); + } + + if (state.tag !== null && state.tag !== '?') { + // Need to encode all characters except those allowed by the spec: + // + // [35] ns-dec-digit ::= [#x30-#x39] /* 0-9 */ + // [36] ns-hex-digit ::= ns-dec-digit + // | [#x41-#x46] /* A-F */ | [#x61-#x66] /* a-f */ + // [37] ns-ascii-letter ::= [#x41-#x5A] /* A-Z */ | [#x61-#x7A] /* a-z */ + // [38] ns-word-char ::= ns-dec-digit | ns-ascii-letter | “-” + // [39] ns-uri-char ::= “%” ns-hex-digit ns-hex-digit | ns-word-char | “#” + // | “;” | “/” | “?” | “:” | “@” | “&” | “=” | “+” | “$” | “,” + // | “_” | “.” | “!” | “~” | “*” | “'” | “(” | “)” | “[” | “]” + // + // Also need to encode '!' because it has special meaning (end of tag prefix). + // + tagStr = encodeURI( + state.tag[0] === '!' ? state.tag.slice(1) : state.tag + ).replace(/!/g, '%21'); + + if (state.tag[0] === '!') { + tagStr = '!' + tagStr; + } else if (tagStr.slice(0, 18) === 'tag:yaml.org,2002:') { + tagStr = '!!' + tagStr.slice(18); + } else { + tagStr = '!<' + tagStr + '>'; + } + + state.dump = tagStr + ' ' + state.dump; + } + } + + return true; + } + + function getDuplicateReferences(object, state) { + var objects = [], + duplicatesIndexes = [], + index, + length; + + inspectNode(object, objects, duplicatesIndexes); + + for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) { + state.duplicates.push(objects[duplicatesIndexes[index]]); + } + state.usedDuplicates = new Array(length); + } + + function inspectNode(object, objects, duplicatesIndexes) { + var objectKeyList, + index, + length; + + if (object !== null && typeof object === 'object') { + index = objects.indexOf(object); + if (index !== -1) { + if (duplicatesIndexes.indexOf(index) === -1) { + duplicatesIndexes.push(index); + } + } else { + objects.push(object); + + if (Array.isArray(object)) { + for (index = 0, length = object.length; index < length; index += 1) { + inspectNode(object[index], objects, duplicatesIndexes); + } + } else { + objectKeyList = Object.keys(object); + + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes); + } + } + } + } + } + + function dump$1(input, options) { + options = options || {}; + + var state = new State(options); + + if (!state.noRefs) getDuplicateReferences(input, state); + + var value = input; + + if (state.replacer) { + value = state.replacer.call({ '': value }, '', value); + } + + if (writeNode(state, 0, value, true, true)) return state.dump + '\n'; + + return ''; + } + + var dump_1 = dump$1; + + var dumper = { + dump: dump_1 + }; + + function renamed(from, to) { + return function () { + throw new Error('Function yaml.' + from + ' is removed in js-yaml 4. ' + + 'Use yaml.' + to + ' instead, which is now safe by default.'); + }; + } + + + var Type = type; + var Schema = schema; + var FAILSAFE_SCHEMA = failsafe; + var JSON_SCHEMA = json; + var CORE_SCHEMA = core; + var DEFAULT_SCHEMA = _default; + var load = loader.load; + var loadAll = loader.loadAll; + var dump = dumper.dump; + var YAMLException = exception; + + // Re-export all types in case user wants to create custom schema + var types = { + binary: binary, + float: float, + map: map, + null: _null, + pairs: pairs, + set: set, + timestamp: timestamp, + bool: bool, + int: int, + merge: merge, + omap: omap, + seq: seq, + str: str + }; + + // Removed functions from JS-YAML 3.0.x + var safeLoad = renamed('safeLoad', 'load'); + var safeLoadAll = renamed('safeLoadAll', 'loadAll'); + var safeDump = renamed('safeDump', 'dump'); + + var jsYaml = { + Type: Type, + Schema: Schema, + FAILSAFE_SCHEMA: FAILSAFE_SCHEMA, + JSON_SCHEMA: JSON_SCHEMA, + CORE_SCHEMA: CORE_SCHEMA, + DEFAULT_SCHEMA: DEFAULT_SCHEMA, + load: load, + loadAll: loadAll, + dump: dump, + YAMLException: YAMLException, + types: types, + safeLoad: safeLoad, + safeLoadAll: safeLoadAll, + safeDump: safeDump + }; + + exports.CORE_SCHEMA = CORE_SCHEMA; + exports.DEFAULT_SCHEMA = DEFAULT_SCHEMA; + exports.FAILSAFE_SCHEMA = FAILSAFE_SCHEMA; + exports.JSON_SCHEMA = JSON_SCHEMA; + exports.Schema = Schema; + exports.Type = Type; + exports.YAMLException = YAMLException; + exports.default = jsYaml; + exports.dump = dump; + exports.load = load; + exports.loadAll = loadAll; + exports.safeDump = safeDump; + exports.safeLoad = safeLoad; + exports.safeLoadAll = safeLoadAll; + exports.types = types; + + Object.defineProperty(exports, '__esModule', { value: true }); + +}))); diff --git a/node_modules/js-yaml/dist/js-yaml.min.js b/node_modules/js-yaml/dist/js-yaml.min.js new file mode 100644 index 0000000..bdd8eef --- /dev/null +++ b/node_modules/js-yaml/dist/js-yaml.min.js @@ -0,0 +1,2 @@ +/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).jsyaml={})}(this,(function(e){"use strict";function t(e){return null==e}var n={isNothing:t,isObject:function(e){return"object"==typeof e&&null!==e},toArray:function(e){return Array.isArray(e)?e:t(e)?[]:[e]},repeat:function(e,t){var n,i="";for(n=0;nl&&(t=i-l+(o=" ... ").length),n-i>l&&(n=i+l-(a=" ...").length),{str:o+e.slice(t,n).replace(/\t/g,"→")+a,pos:i-t+o.length}}function l(e,t){return n.repeat(" ",t-e.length)+e}var c=function(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),"number"!=typeof t.indent&&(t.indent=1),"number"!=typeof t.linesBefore&&(t.linesBefore=3),"number"!=typeof t.linesAfter&&(t.linesAfter=2);for(var i,r=/\r?\n|\r|\0/g,o=[0],c=[],s=-1;i=r.exec(e.buffer);)c.push(i.index),o.push(i.index+i[0].length),e.position<=i.index&&s<0&&(s=o.length-2);s<0&&(s=o.length-1);var u,p,f="",d=Math.min(e.line+t.linesAfter,c.length).toString().length,h=t.maxLength-(t.indent+d+3);for(u=1;u<=t.linesBefore&&!(s-u<0);u++)p=a(e.buffer,o[s-u],c[s-u],e.position-(o[s]-o[s-u]),h),f=n.repeat(" ",t.indent)+l((e.line-u+1).toString(),d)+" | "+p.str+"\n"+f;for(p=a(e.buffer,o[s],c[s],e.position,h),f+=n.repeat(" ",t.indent)+l((e.line+1).toString(),d)+" | "+p.str+"\n",f+=n.repeat("-",t.indent+d+3+p.pos)+"^\n",u=1;u<=t.linesAfter&&!(s+u>=c.length);u++)p=a(e.buffer,o[s+u],c[s+u],e.position-(o[s]-o[s+u]),h),f+=n.repeat(" ",t.indent)+l((e.line+u+1).toString(),d)+" | "+p.str+"\n";return f.replace(/\n$/,"")},s=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],u=["scalar","sequence","mapping"];var p=function(e,t){if(t=t||{},Object.keys(t).forEach((function(t){if(-1===s.indexOf(t))throw new o('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')})),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=function(e){var t={};return null!==e&&Object.keys(e).forEach((function(n){e[n].forEach((function(e){t[String(e)]=n}))})),t}(t.styleAliases||null),-1===u.indexOf(this.kind))throw new o('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')};function f(e,t){var n=[];return e[t].forEach((function(e){var t=n.length;n.forEach((function(n,i){n.tag===e.tag&&n.kind===e.kind&&n.multi===e.multi&&(t=i)})),n[t]=e})),n}function d(e){return this.extend(e)}d.prototype.extend=function(e){var t=[],n=[];if(e instanceof p)n.push(e);else if(Array.isArray(e))n=n.concat(e);else{if(!e||!Array.isArray(e.implicit)&&!Array.isArray(e.explicit))throw new o("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit))}t.forEach((function(e){if(!(e instanceof p))throw new o("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(e.loadKind&&"scalar"!==e.loadKind)throw new o("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(e.multi)throw new o("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")})),n.forEach((function(e){if(!(e instanceof p))throw new o("Specified list of YAML types (or a single Type object) contains a non-Type object.")}));var i=Object.create(d.prototype);return i.implicit=(this.implicit||[]).concat(t),i.explicit=(this.explicit||[]).concat(n),i.compiledImplicit=f(i,"implicit"),i.compiledExplicit=f(i,"explicit"),i.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function i(e){e.multi?(n.multi[e.kind].push(e),n.multi.fallback.push(e)):n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),x=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var I=/^[-+]?[0-9]+e/;var S=new p("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!x.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||n.isNegativeZero(e))},represent:function(e,t){var i;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(n.isNegativeZero(e))return"-0.0";return i=e.toString(10),I.test(i)?i.replace("e",".e"):i},defaultStyle:"lowercase"}),O=b.extend({implicit:[A,v,C,S]}),j=O,T=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),N=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");var F=new p("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==T.exec(e)||null!==N.exec(e))},construct:function(e){var t,n,i,r,o,a,l,c,s=0,u=null;if(null===(t=T.exec(e))&&(t=N.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],i=+t[2]-1,r=+t[3],!t[4])return new Date(Date.UTC(n,i,r));if(o=+t[4],a=+t[5],l=+t[6],t[7]){for(s=t[7].slice(0,3);s.length<3;)s+="0";s=+s}return t[9]&&(u=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(u=-u)),c=new Date(Date.UTC(n,i,r,o,a,l,s)),u&&c.setTime(c.getTime()-u),c},instanceOf:Date,represent:function(e){return e.toISOString()}});var E=new p("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}}),M="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";var L=new p("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,i=0,r=e.length,o=M;for(n=0;n64)){if(t<0)return!1;i+=6}return i%8==0},construct:function(e){var t,n,i=e.replace(/[\r\n=]/g,""),r=i.length,o=M,a=0,l=[];for(t=0;t>16&255),l.push(a>>8&255),l.push(255&a)),a=a<<6|o.indexOf(i.charAt(t));return 0===(n=r%4*6)?(l.push(a>>16&255),l.push(a>>8&255),l.push(255&a)):18===n?(l.push(a>>10&255),l.push(a>>2&255)):12===n&&l.push(a>>4&255),new Uint8Array(l)},predicate:function(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)},represent:function(e){var t,n,i="",r=0,o=e.length,a=M;for(t=0;t>18&63],i+=a[r>>12&63],i+=a[r>>6&63],i+=a[63&r]),r=(r<<8)+e[t];return 0===(n=o%3)?(i+=a[r>>18&63],i+=a[r>>12&63],i+=a[r>>6&63],i+=a[63&r]):2===n?(i+=a[r>>10&63],i+=a[r>>4&63],i+=a[r<<2&63],i+=a[64]):1===n&&(i+=a[r>>2&63],i+=a[r<<4&63],i+=a[64],i+=a[64]),i}}),_=Object.prototype.hasOwnProperty,D=Object.prototype.toString;var U=new p("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,i,r,o,a=[],l=e;for(t=0,n=l.length;t>10),56320+(e-65536&1023))}for(var ie=new Array(256),re=new Array(256),oe=0;oe<256;oe++)ie[oe]=te(oe)?1:0,re[oe]=te(oe);function ae(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||K,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function le(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=c(n),new o(t,n)}function ce(e,t){throw le(e,t)}function se(e,t){e.onWarning&&e.onWarning.call(null,le(e,t))}var ue={YAML:function(e,t,n){var i,r,o;null!==e.version&&ce(e,"duplication of %YAML directive"),1!==n.length&&ce(e,"YAML directive accepts exactly one argument"),null===(i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&ce(e,"ill-formed argument of the YAML directive"),r=parseInt(i[1],10),o=parseInt(i[2],10),1!==r&&ce(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=o<2,1!==o&&2!==o&&se(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var i,r;2!==n.length&&ce(e,"TAG directive accepts exactly two arguments"),i=n[0],r=n[1],G.test(i)||ce(e,"ill-formed tag handle (first argument) of the TAG directive"),P.call(e.tagMap,i)&&ce(e,'there is a previously declared suffix for "'+i+'" tag handle'),V.test(r)||ce(e,"ill-formed tag prefix (second argument) of the TAG directive");try{r=decodeURIComponent(r)}catch(t){ce(e,"tag prefix is malformed: "+r)}e.tagMap[i]=r}};function pe(e,t,n,i){var r,o,a,l;if(t1&&(e.result+=n.repeat("\n",t-1))}function be(e,t){var n,i,r=e.tag,o=e.anchor,a=[],l=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=a),i=e.input.charCodeAt(e.position);0!==i&&(-1!==e.firstTabInLine&&(e.position=e.firstTabInLine,ce(e,"tab characters must not be used in indentation")),45===i)&&z(e.input.charCodeAt(e.position+1));)if(l=!0,e.position++,ge(e,!0,-1)&&e.lineIndent<=t)a.push(null),i=e.input.charCodeAt(e.position);else if(n=e.line,we(e,t,3,!1,!0),a.push(e.result),ge(e,!0,-1),i=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==i)ce(e,"bad indentation of a sequence entry");else if(e.lineIndentt?g=1:e.lineIndent===t?g=0:e.lineIndentt?g=1:e.lineIndent===t?g=0:e.lineIndentt)&&(y&&(a=e.line,l=e.lineStart,c=e.position),we(e,t,4,!0,r)&&(y?g=e.result:m=e.result),y||(de(e,f,d,h,g,m,a,l,c),h=g=m=null),ge(e,!0,-1),s=e.input.charCodeAt(e.position)),(e.line===o||e.lineIndent>t)&&0!==s)ce(e,"bad indentation of a mapping entry");else if(e.lineIndent=0))break;0===o?ce(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):u?ce(e,"repeat of an indentation width identifier"):(p=t+o-1,u=!0)}if(Q(a)){do{a=e.input.charCodeAt(++e.position)}while(Q(a));if(35===a)do{a=e.input.charCodeAt(++e.position)}while(!J(a)&&0!==a)}for(;0!==a;){for(he(e),e.lineIndent=0,a=e.input.charCodeAt(e.position);(!u||e.lineIndentp&&(p=e.lineIndent),J(a))f++;else{if(e.lineIndent0){for(r=a,o=0;r>0;r--)(a=ee(l=e.input.charCodeAt(++e.position)))>=0?o=(o<<4)+a:ce(e,"expected hexadecimal character");e.result+=ne(o),e.position++}else ce(e,"unknown escape sequence");n=i=e.position}else J(l)?(pe(e,n,i,!0),ye(e,ge(e,!1,t)),n=i=e.position):e.position===e.lineStart&&me(e)?ce(e,"unexpected end of the document within a double quoted scalar"):(e.position++,i=e.position)}ce(e,"unexpected end of the stream within a double quoted scalar")}(e,d)?y=!0:!function(e){var t,n,i;if(42!==(i=e.input.charCodeAt(e.position)))return!1;for(i=e.input.charCodeAt(++e.position),t=e.position;0!==i&&!z(i)&&!X(i);)i=e.input.charCodeAt(++e.position);return e.position===t&&ce(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),P.call(e.anchorMap,n)||ce(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],ge(e,!0,-1),!0}(e)?function(e,t,n){var i,r,o,a,l,c,s,u,p=e.kind,f=e.result;if(z(u=e.input.charCodeAt(e.position))||X(u)||35===u||38===u||42===u||33===u||124===u||62===u||39===u||34===u||37===u||64===u||96===u)return!1;if((63===u||45===u)&&(z(i=e.input.charCodeAt(e.position+1))||n&&X(i)))return!1;for(e.kind="scalar",e.result="",r=o=e.position,a=!1;0!==u;){if(58===u){if(z(i=e.input.charCodeAt(e.position+1))||n&&X(i))break}else if(35===u){if(z(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&me(e)||n&&X(u))break;if(J(u)){if(l=e.line,c=e.lineStart,s=e.lineIndent,ge(e,!1,-1),e.lineIndent>=t){a=!0,u=e.input.charCodeAt(e.position);continue}e.position=o,e.line=l,e.lineStart=c,e.lineIndent=s;break}}a&&(pe(e,r,o,!1),ye(e,e.line-l),r=o=e.position,a=!1),Q(u)||(o=e.position+1),u=e.input.charCodeAt(++e.position)}return pe(e,r,o,!1),!!e.result||(e.kind=p,e.result=f,!1)}(e,d,1===i)&&(y=!0,null===e.tag&&(e.tag="?")):(y=!0,null===e.tag&&null===e.anchor||ce(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===g&&(y=c&&be(e,h))),null===e.tag)null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);else if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&ce(e,'unacceptable node kind for ! tag; it should be "scalar", not "'+e.kind+'"'),s=0,u=e.implicitTypes.length;s"),null!==e.result&&f.kind!==e.kind&&ce(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+f.kind+'", not "'+e.kind+'"'),f.resolve(e.result,e.tag)?(e.result=f.construct(e.result,e.tag),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):ce(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||y}function ke(e){var t,n,i,r,o=e.position,a=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);0!==(r=e.input.charCodeAt(e.position))&&(ge(e,!0,-1),r=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==r));){for(a=!0,r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!z(r);)r=e.input.charCodeAt(++e.position);for(i=[],(n=e.input.slice(t,e.position)).length<1&&ce(e,"directive name must not be less than one character in length");0!==r;){for(;Q(r);)r=e.input.charCodeAt(++e.position);if(35===r){do{r=e.input.charCodeAt(++e.position)}while(0!==r&&!J(r));break}if(J(r))break;for(t=e.position;0!==r&&!z(r);)r=e.input.charCodeAt(++e.position);i.push(e.input.slice(t,e.position))}0!==r&&he(e),P.call(ue,n)?ue[n](e,n,i):se(e,'unknown document directive "'+n+'"')}ge(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,ge(e,!0,-1)):a&&ce(e,"directives end mark is expected"),we(e,e.lineIndent-1,4,!1,!0),ge(e,!0,-1),e.checkLineBreaks&&H.test(e.input.slice(o,e.position))&&se(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&me(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,ge(e,!0,-1)):e.position=55296&&i<=56319&&t+1=56320&&n<=57343?1024*(i-55296)+n-56320+65536:i}function Re(e){return/^\n* /.test(e)}function Be(e,t,n,i,r,o,a,l){var c,s,u=0,p=null,f=!1,d=!1,h=-1!==i,g=-1,m=De(s=Ye(e,0))&&s!==Oe&&!_e(s)&&45!==s&&63!==s&&58!==s&&44!==s&&91!==s&&93!==s&&123!==s&&125!==s&&35!==s&&38!==s&&42!==s&&33!==s&&124!==s&&61!==s&&62!==s&&39!==s&&34!==s&&37!==s&&64!==s&&96!==s&&function(e){return!_e(e)&&58!==e}(Ye(e,e.length-1));if(t||a)for(c=0;c=65536?c+=2:c++){if(!De(u=Ye(e,c)))return 5;m=m&&qe(u,p,l),p=u}else{for(c=0;c=65536?c+=2:c++){if(10===(u=Ye(e,c)))f=!0,h&&(d=d||c-g-1>i&&" "!==e[g+1],g=c);else if(!De(u))return 5;m=m&&qe(u,p,l),p=u}d=d||h&&c-g-1>i&&" "!==e[g+1]}return f||d?n>9&&Re(e)?5:a?2===o?5:2:d?4:3:!m||a||r(e)?2===o?5:2:1}function Ke(e,t,n,i,r){e.dump=function(){if(0===t.length)return 2===e.quotingType?'""':"''";if(!e.noCompatMode&&(-1!==Te.indexOf(t)||Ne.test(t)))return 2===e.quotingType?'"'+t+'"':"'"+t+"'";var a=e.indent*Math.max(1,n),l=-1===e.lineWidth?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-a),c=i||e.flowLevel>-1&&n>=e.flowLevel;switch(Be(t,c,e.indent,l,(function(t){return function(e,t){var n,i;for(n=0,i=e.implicitTypes.length;n"+Pe(t,e.indent)+We(Me(function(e,t){var n,i,r=/(\n+)([^\n]*)/g,o=(l=e.indexOf("\n"),l=-1!==l?l:e.length,r.lastIndex=l,He(e.slice(0,l),t)),a="\n"===e[0]||" "===e[0];var l;for(;i=r.exec(e);){var c=i[1],s=i[2];n=" "===s[0],o+=c+(a||n||""===s?"":"\n")+He(s,t),a=n}return o}(t,l),a));case 5:return'"'+function(e){for(var t,n="",i=0,r=0;r=65536?r+=2:r++)i=Ye(e,r),!(t=je[i])&&De(i)?(n+=e[r],i>=65536&&(n+=e[r+1])):n+=t||Fe(i);return n}(t)+'"';default:throw new o("impossible error: invalid scalar style")}}()}function Pe(e,t){var n=Re(e)?String(t):"",i="\n"===e[e.length-1];return n+(i&&("\n"===e[e.length-2]||"\n"===e)?"+":i?"":"-")+"\n"}function We(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function He(e,t){if(""===e||" "===e[0])return e;for(var n,i,r=/ [^ ]/g,o=0,a=0,l=0,c="";n=r.exec(e);)(l=n.index)-o>t&&(i=a>o?a:l,c+="\n"+e.slice(o,i),o=i+1),a=l;return c+="\n",e.length-o>t&&a>o?c+=e.slice(o,a)+"\n"+e.slice(a+1):c+=e.slice(o),c.slice(1)}function $e(e,t,n,i){var r,o,a,l="",c=e.tag;for(r=0,o=n.length;r tag resolver accepts not "'+s+'" style');i=c.represent[s](t,s)}e.dump=i}return!0}return!1}function Ve(e,t,n,i,r,a,l){e.tag=null,e.dump=n,Ge(e,n,!1)||Ge(e,n,!0);var c,s=Ie.call(e.dump),u=i;i&&(i=e.flowLevel<0||e.flowLevel>t);var p,f,d="[object Object]"===s||"[object Array]"===s;if(d&&(f=-1!==(p=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||f||2!==e.indent&&t>0)&&(r=!1),f&&e.usedDuplicates[p])e.dump="*ref_"+p;else{if(d&&f&&!e.usedDuplicates[p]&&(e.usedDuplicates[p]=!0),"[object Object]"===s)i&&0!==Object.keys(e.dump).length?(!function(e,t,n,i){var r,a,l,c,s,u,p="",f=e.tag,d=Object.keys(n);if(!0===e.sortKeys)d.sort();else if("function"==typeof e.sortKeys)d.sort(e.sortKeys);else if(e.sortKeys)throw new o("sortKeys must be a boolean or a function");for(r=0,a=d.length;r1024)&&(e.dump&&10===e.dump.charCodeAt(0)?u+="?":u+="? "),u+=e.dump,s&&(u+=Le(e,t)),Ve(e,t+1,c,!0,s)&&(e.dump&&10===e.dump.charCodeAt(0)?u+=":":u+=": ",p+=u+=e.dump));e.tag=f,e.dump=p||"{}"}(e,t,e.dump,r),f&&(e.dump="&ref_"+p+e.dump)):(!function(e,t,n){var i,r,o,a,l,c="",s=e.tag,u=Object.keys(n);for(i=0,r=u.length;i1024&&(l+="? "),l+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),Ve(e,t,a,!1,!1)&&(c+=l+=e.dump));e.tag=s,e.dump="{"+c+"}"}(e,t,e.dump),f&&(e.dump="&ref_"+p+" "+e.dump));else if("[object Array]"===s)i&&0!==e.dump.length?(e.noArrayIndent&&!l&&t>0?$e(e,t-1,e.dump,r):$e(e,t,e.dump,r),f&&(e.dump="&ref_"+p+e.dump)):(!function(e,t,n){var i,r,o,a="",l=e.tag;for(i=0,r=n.length;i",e.dump=c+" "+e.dump)}return!0}function Ze(e,t){var n,i,r=[],o=[];for(Je(e,r,o),n=0,i=o.length;n maxHalfLength) { + head = ' ... '; + lineStart = position - maxHalfLength + head.length; + } + + if (lineEnd - position > maxHalfLength) { + tail = ' ...'; + lineEnd = position + maxHalfLength - tail.length; + } + + return { + str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, '→') + tail, + pos: position - lineStart + head.length // relative position + }; +} + + +function padStart(string, max) { + return common.repeat(' ', max - string.length) + string; +} + + +function makeSnippet(mark, options) { + options = Object.create(options || null); + + if (!mark.buffer) return null; + + if (!options.maxLength) options.maxLength = 79; + if (typeof options.indent !== 'number') options.indent = 1; + if (typeof options.linesBefore !== 'number') options.linesBefore = 3; + if (typeof options.linesAfter !== 'number') options.linesAfter = 2; + + var re = /\r?\n|\r|\0/g; + var lineStarts = [ 0 ]; + var lineEnds = []; + var match; + var foundLineNo = -1; + + while ((match = re.exec(mark.buffer))) { + lineEnds.push(match.index); + lineStarts.push(match.index + match[0].length); + + if (mark.position <= match.index && foundLineNo < 0) { + foundLineNo = lineStarts.length - 2; + } + } + + if (foundLineNo < 0) foundLineNo = lineStarts.length - 1; + + var result = '', i, line; + var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length; + var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3); + + for (i = 1; i <= options.linesBefore; i++) { + if (foundLineNo - i < 0) break; + line = getLine( + mark.buffer, + lineStarts[foundLineNo - i], + lineEnds[foundLineNo - i], + mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]), + maxLineLength + ); + result = common.repeat(' ', options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + + ' | ' + line.str + '\n' + result; + } + + line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength); + result += common.repeat(' ', options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + + ' | ' + line.str + '\n'; + result += common.repeat('-', options.indent + lineNoLength + 3 + line.pos) + '^' + '\n'; + + for (i = 1; i <= options.linesAfter; i++) { + if (foundLineNo + i >= lineEnds.length) break; + line = getLine( + mark.buffer, + lineStarts[foundLineNo + i], + lineEnds[foundLineNo + i], + mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]), + maxLineLength + ); + result += common.repeat(' ', options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + + ' | ' + line.str + '\n'; + } + + return result.replace(/\n$/, ''); +} + + +var snippet = makeSnippet; + +var TYPE_CONSTRUCTOR_OPTIONS = [ + 'kind', + 'multi', + 'resolve', + 'construct', + 'instanceOf', + 'predicate', + 'represent', + 'representName', + 'defaultStyle', + 'styleAliases' +]; + +var YAML_NODE_KINDS = [ + 'scalar', + 'sequence', + 'mapping' +]; + +function compileStyleAliases(map) { + var result = {}; + + if (map !== null) { + Object.keys(map).forEach(function (style) { + map[style].forEach(function (alias) { + result[String(alias)] = style; + }); + }); + } + + return result; +} + +function Type$1(tag, options) { + options = options || {}; + + Object.keys(options).forEach(function (name) { + if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) { + throw new exception('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.'); + } + }); + + // TODO: Add tag format check. + this.options = options; // keep original options in case user wants to extend this type later + this.tag = tag; + this.kind = options['kind'] || null; + this.resolve = options['resolve'] || function () { return true; }; + this.construct = options['construct'] || function (data) { return data; }; + this.instanceOf = options['instanceOf'] || null; + this.predicate = options['predicate'] || null; + this.represent = options['represent'] || null; + this.representName = options['representName'] || null; + this.defaultStyle = options['defaultStyle'] || null; + this.multi = options['multi'] || false; + this.styleAliases = compileStyleAliases(options['styleAliases'] || null); + + if (YAML_NODE_KINDS.indexOf(this.kind) === -1) { + throw new exception('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.'); + } +} + +var type = Type$1; + +/*eslint-disable max-len*/ + + + + + +function compileList(schema, name) { + var result = []; + + schema[name].forEach(function (currentType) { + var newIndex = result.length; + + result.forEach(function (previousType, previousIndex) { + if (previousType.tag === currentType.tag && + previousType.kind === currentType.kind && + previousType.multi === currentType.multi) { + + newIndex = previousIndex; + } + }); + + result[newIndex] = currentType; + }); + + return result; +} + + +function compileMap(/* lists... */) { + var result = { + scalar: {}, + sequence: {}, + mapping: {}, + fallback: {}, + multi: { + scalar: [], + sequence: [], + mapping: [], + fallback: [] + } + }, index, length; + + function collectType(type) { + if (type.multi) { + result.multi[type.kind].push(type); + result.multi['fallback'].push(type); + } else { + result[type.kind][type.tag] = result['fallback'][type.tag] = type; + } + } + + for (index = 0, length = arguments.length; index < length; index += 1) { + arguments[index].forEach(collectType); + } + return result; +} + + +function Schema$1(definition) { + return this.extend(definition); +} + + +Schema$1.prototype.extend = function extend(definition) { + var implicit = []; + var explicit = []; + + if (definition instanceof type) { + // Schema.extend(type) + explicit.push(definition); + + } else if (Array.isArray(definition)) { + // Schema.extend([ type1, type2, ... ]) + explicit = explicit.concat(definition); + + } else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) { + // Schema.extend({ explicit: [ type1, type2, ... ], implicit: [ type1, type2, ... ] }) + if (definition.implicit) implicit = implicit.concat(definition.implicit); + if (definition.explicit) explicit = explicit.concat(definition.explicit); + + } else { + throw new exception('Schema.extend argument should be a Type, [ Type ], ' + + 'or a schema definition ({ implicit: [...], explicit: [...] })'); + } + + implicit.forEach(function (type$1) { + if (!(type$1 instanceof type)) { + throw new exception('Specified list of YAML types (or a single Type object) contains a non-Type object.'); + } + + if (type$1.loadKind && type$1.loadKind !== 'scalar') { + throw new exception('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.'); + } + + if (type$1.multi) { + throw new exception('There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.'); + } + }); + + explicit.forEach(function (type$1) { + if (!(type$1 instanceof type)) { + throw new exception('Specified list of YAML types (or a single Type object) contains a non-Type object.'); + } + }); + + var result = Object.create(Schema$1.prototype); + + result.implicit = (this.implicit || []).concat(implicit); + result.explicit = (this.explicit || []).concat(explicit); + + result.compiledImplicit = compileList(result, 'implicit'); + result.compiledExplicit = compileList(result, 'explicit'); + result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit); + + return result; +}; + + +var schema = Schema$1; + +var str = new type('tag:yaml.org,2002:str', { + kind: 'scalar', + construct: function (data) { return data !== null ? data : ''; } +}); + +var seq = new type('tag:yaml.org,2002:seq', { + kind: 'sequence', + construct: function (data) { return data !== null ? data : []; } +}); + +var map = new type('tag:yaml.org,2002:map', { + kind: 'mapping', + construct: function (data) { return data !== null ? data : {}; } +}); + +var failsafe = new schema({ + explicit: [ + str, + seq, + map + ] +}); + +function resolveYamlNull(data) { + if (data === null) return true; + + var max = data.length; + + return (max === 1 && data === '~') || + (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL')); +} + +function constructYamlNull() { + return null; +} + +function isNull(object) { + return object === null; +} + +var _null = new type('tag:yaml.org,2002:null', { + kind: 'scalar', + resolve: resolveYamlNull, + construct: constructYamlNull, + predicate: isNull, + represent: { + canonical: function () { return '~'; }, + lowercase: function () { return 'null'; }, + uppercase: function () { return 'NULL'; }, + camelcase: function () { return 'Null'; }, + empty: function () { return ''; } + }, + defaultStyle: 'lowercase' +}); + +function resolveYamlBoolean(data) { + if (data === null) return false; + + var max = data.length; + + return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) || + (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE')); +} + +function constructYamlBoolean(data) { + return data === 'true' || + data === 'True' || + data === 'TRUE'; +} + +function isBoolean(object) { + return Object.prototype.toString.call(object) === '[object Boolean]'; +} + +var bool = new type('tag:yaml.org,2002:bool', { + kind: 'scalar', + resolve: resolveYamlBoolean, + construct: constructYamlBoolean, + predicate: isBoolean, + represent: { + lowercase: function (object) { return object ? 'true' : 'false'; }, + uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; }, + camelcase: function (object) { return object ? 'True' : 'False'; } + }, + defaultStyle: 'lowercase' +}); + +function isHexCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) || + ((0x41/* A */ <= c) && (c <= 0x46/* F */)) || + ((0x61/* a */ <= c) && (c <= 0x66/* f */)); +} + +function isOctCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */)); +} + +function isDecCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)); +} + +function resolveYamlInteger(data) { + if (data === null) return false; + + var max = data.length, + index = 0, + hasDigits = false, + ch; + + if (!max) return false; + + ch = data[index]; + + // sign + if (ch === '-' || ch === '+') { + ch = data[++index]; + } + + if (ch === '0') { + // 0 + if (index + 1 === max) return true; + ch = data[++index]; + + // base 2, base 8, base 16 + + if (ch === 'b') { + // base 2 + index++; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (ch !== '0' && ch !== '1') return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; + } + + + if (ch === 'x') { + // base 16 + index++; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (!isHexCode(data.charCodeAt(index))) return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; + } + + + if (ch === 'o') { + // base 8 + index++; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (!isOctCode(data.charCodeAt(index))) return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; + } + } + + // base 10 (except 0) + + // value should not start with `_`; + if (ch === '_') return false; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (!isDecCode(data.charCodeAt(index))) { + return false; + } + hasDigits = true; + } + + // Should have digits and should not end with `_` + if (!hasDigits || ch === '_') return false; + + return true; +} + +function constructYamlInteger(data) { + var value = data, sign = 1, ch; + + if (value.indexOf('_') !== -1) { + value = value.replace(/_/g, ''); + } + + ch = value[0]; + + if (ch === '-' || ch === '+') { + if (ch === '-') sign = -1; + value = value.slice(1); + ch = value[0]; + } + + if (value === '0') return 0; + + if (ch === '0') { + if (value[1] === 'b') return sign * parseInt(value.slice(2), 2); + if (value[1] === 'x') return sign * parseInt(value.slice(2), 16); + if (value[1] === 'o') return sign * parseInt(value.slice(2), 8); + } + + return sign * parseInt(value, 10); +} + +function isInteger(object) { + return (Object.prototype.toString.call(object)) === '[object Number]' && + (object % 1 === 0 && !common.isNegativeZero(object)); +} + +var int = new type('tag:yaml.org,2002:int', { + kind: 'scalar', + resolve: resolveYamlInteger, + construct: constructYamlInteger, + predicate: isInteger, + represent: { + binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); }, + octal: function (obj) { return obj >= 0 ? '0o' + obj.toString(8) : '-0o' + obj.toString(8).slice(1); }, + decimal: function (obj) { return obj.toString(10); }, + /* eslint-disable max-len */ + hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); } + }, + defaultStyle: 'decimal', + styleAliases: { + binary: [ 2, 'bin' ], + octal: [ 8, 'oct' ], + decimal: [ 10, 'dec' ], + hexadecimal: [ 16, 'hex' ] + } +}); + +var YAML_FLOAT_PATTERN = new RegExp( + // 2.5e4, 2.5 and integers + '^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' + + // .2e4, .2 + // special case, seems not from spec + '|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' + + // .inf + '|[-+]?\\.(?:inf|Inf|INF)' + + // .nan + '|\\.(?:nan|NaN|NAN))$'); + +function resolveYamlFloat(data) { + if (data === null) return false; + + if (!YAML_FLOAT_PATTERN.test(data) || + // Quick hack to not allow integers end with `_` + // Probably should update regexp & check speed + data[data.length - 1] === '_') { + return false; + } + + return true; +} + +function constructYamlFloat(data) { + var value, sign; + + value = data.replace(/_/g, '').toLowerCase(); + sign = value[0] === '-' ? -1 : 1; + + if ('+-'.indexOf(value[0]) >= 0) { + value = value.slice(1); + } + + if (value === '.inf') { + return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY; + + } else if (value === '.nan') { + return NaN; + } + return sign * parseFloat(value, 10); +} + + +var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/; + +function representYamlFloat(object, style) { + var res; + + if (isNaN(object)) { + switch (style) { + case 'lowercase': return '.nan'; + case 'uppercase': return '.NAN'; + case 'camelcase': return '.NaN'; + } + } else if (Number.POSITIVE_INFINITY === object) { + switch (style) { + case 'lowercase': return '.inf'; + case 'uppercase': return '.INF'; + case 'camelcase': return '.Inf'; + } + } else if (Number.NEGATIVE_INFINITY === object) { + switch (style) { + case 'lowercase': return '-.inf'; + case 'uppercase': return '-.INF'; + case 'camelcase': return '-.Inf'; + } + } else if (common.isNegativeZero(object)) { + return '-0.0'; + } + + res = object.toString(10); + + // JS stringifier can build scientific format without dots: 5e-100, + // while YAML requres dot: 5.e-100. Fix it with simple hack + + return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res; +} + +function isFloat(object) { + return (Object.prototype.toString.call(object) === '[object Number]') && + (object % 1 !== 0 || common.isNegativeZero(object)); +} + +var float = new type('tag:yaml.org,2002:float', { + kind: 'scalar', + resolve: resolveYamlFloat, + construct: constructYamlFloat, + predicate: isFloat, + represent: representYamlFloat, + defaultStyle: 'lowercase' +}); + +var json = failsafe.extend({ + implicit: [ + _null, + bool, + int, + float + ] +}); + +var core = json; + +var YAML_DATE_REGEXP = new RegExp( + '^([0-9][0-9][0-9][0-9])' + // [1] year + '-([0-9][0-9])' + // [2] month + '-([0-9][0-9])$'); // [3] day + +var YAML_TIMESTAMP_REGEXP = new RegExp( + '^([0-9][0-9][0-9][0-9])' + // [1] year + '-([0-9][0-9]?)' + // [2] month + '-([0-9][0-9]?)' + // [3] day + '(?:[Tt]|[ \\t]+)' + // ... + '([0-9][0-9]?)' + // [4] hour + ':([0-9][0-9])' + // [5] minute + ':([0-9][0-9])' + // [6] second + '(?:\\.([0-9]*))?' + // [7] fraction + '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour + '(?::([0-9][0-9]))?))?$'); // [11] tz_minute + +function resolveYamlTimestamp(data) { + if (data === null) return false; + if (YAML_DATE_REGEXP.exec(data) !== null) return true; + if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true; + return false; +} + +function constructYamlTimestamp(data) { + var match, year, month, day, hour, minute, second, fraction = 0, + delta = null, tz_hour, tz_minute, date; + + match = YAML_DATE_REGEXP.exec(data); + if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data); + + if (match === null) throw new Error('Date resolve error'); + + // match: [1] year [2] month [3] day + + year = +(match[1]); + month = +(match[2]) - 1; // JS month starts with 0 + day = +(match[3]); + + if (!match[4]) { // no hour + return new Date(Date.UTC(year, month, day)); + } + + // match: [4] hour [5] minute [6] second [7] fraction + + hour = +(match[4]); + minute = +(match[5]); + second = +(match[6]); + + if (match[7]) { + fraction = match[7].slice(0, 3); + while (fraction.length < 3) { // milli-seconds + fraction += '0'; + } + fraction = +fraction; + } + + // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute + + if (match[9]) { + tz_hour = +(match[10]); + tz_minute = +(match[11] || 0); + delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds + if (match[9] === '-') delta = -delta; + } + + date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction)); + + if (delta) date.setTime(date.getTime() - delta); + + return date; +} + +function representYamlTimestamp(object /*, style*/) { + return object.toISOString(); +} + +var timestamp = new type('tag:yaml.org,2002:timestamp', { + kind: 'scalar', + resolve: resolveYamlTimestamp, + construct: constructYamlTimestamp, + instanceOf: Date, + represent: representYamlTimestamp +}); + +function resolveYamlMerge(data) { + return data === '<<' || data === null; +} + +var merge = new type('tag:yaml.org,2002:merge', { + kind: 'scalar', + resolve: resolveYamlMerge +}); + +/*eslint-disable no-bitwise*/ + + + + + +// [ 64, 65, 66 ] -> [ padding, CR, LF ] +var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r'; + + +function resolveYamlBinary(data) { + if (data === null) return false; + + var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP; + + // Convert one by one. + for (idx = 0; idx < max; idx++) { + code = map.indexOf(data.charAt(idx)); + + // Skip CR/LF + if (code > 64) continue; + + // Fail on illegal characters + if (code < 0) return false; + + bitlen += 6; + } + + // If there are any bits left, source was corrupted + return (bitlen % 8) === 0; +} + +function constructYamlBinary(data) { + var idx, tailbits, + input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan + max = input.length, + map = BASE64_MAP, + bits = 0, + result = []; + + // Collect by 6*4 bits (3 bytes) + + for (idx = 0; idx < max; idx++) { + if ((idx % 4 === 0) && idx) { + result.push((bits >> 16) & 0xFF); + result.push((bits >> 8) & 0xFF); + result.push(bits & 0xFF); + } + + bits = (bits << 6) | map.indexOf(input.charAt(idx)); + } + + // Dump tail + + tailbits = (max % 4) * 6; + + if (tailbits === 0) { + result.push((bits >> 16) & 0xFF); + result.push((bits >> 8) & 0xFF); + result.push(bits & 0xFF); + } else if (tailbits === 18) { + result.push((bits >> 10) & 0xFF); + result.push((bits >> 2) & 0xFF); + } else if (tailbits === 12) { + result.push((bits >> 4) & 0xFF); + } + + return new Uint8Array(result); +} + +function representYamlBinary(object /*, style*/) { + var result = '', bits = 0, idx, tail, + max = object.length, + map = BASE64_MAP; + + // Convert every three bytes to 4 ASCII characters. + + for (idx = 0; idx < max; idx++) { + if ((idx % 3 === 0) && idx) { + result += map[(bits >> 18) & 0x3F]; + result += map[(bits >> 12) & 0x3F]; + result += map[(bits >> 6) & 0x3F]; + result += map[bits & 0x3F]; + } + + bits = (bits << 8) + object[idx]; + } + + // Dump tail + + tail = max % 3; + + if (tail === 0) { + result += map[(bits >> 18) & 0x3F]; + result += map[(bits >> 12) & 0x3F]; + result += map[(bits >> 6) & 0x3F]; + result += map[bits & 0x3F]; + } else if (tail === 2) { + result += map[(bits >> 10) & 0x3F]; + result += map[(bits >> 4) & 0x3F]; + result += map[(bits << 2) & 0x3F]; + result += map[64]; + } else if (tail === 1) { + result += map[(bits >> 2) & 0x3F]; + result += map[(bits << 4) & 0x3F]; + result += map[64]; + result += map[64]; + } + + return result; +} + +function isBinary(obj) { + return Object.prototype.toString.call(obj) === '[object Uint8Array]'; +} + +var binary = new type('tag:yaml.org,2002:binary', { + kind: 'scalar', + resolve: resolveYamlBinary, + construct: constructYamlBinary, + predicate: isBinary, + represent: representYamlBinary +}); + +var _hasOwnProperty$3 = Object.prototype.hasOwnProperty; +var _toString$2 = Object.prototype.toString; + +function resolveYamlOmap(data) { + if (data === null) return true; + + var objectKeys = [], index, length, pair, pairKey, pairHasKey, + object = data; + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + pairHasKey = false; + + if (_toString$2.call(pair) !== '[object Object]') return false; + + for (pairKey in pair) { + if (_hasOwnProperty$3.call(pair, pairKey)) { + if (!pairHasKey) pairHasKey = true; + else return false; + } + } + + if (!pairHasKey) return false; + + if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey); + else return false; + } + + return true; +} + +function constructYamlOmap(data) { + return data !== null ? data : []; +} + +var omap = new type('tag:yaml.org,2002:omap', { + kind: 'sequence', + resolve: resolveYamlOmap, + construct: constructYamlOmap +}); + +var _toString$1 = Object.prototype.toString; + +function resolveYamlPairs(data) { + if (data === null) return true; + + var index, length, pair, keys, result, + object = data; + + result = new Array(object.length); + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + + if (_toString$1.call(pair) !== '[object Object]') return false; + + keys = Object.keys(pair); + + if (keys.length !== 1) return false; + + result[index] = [ keys[0], pair[keys[0]] ]; + } + + return true; +} + +function constructYamlPairs(data) { + if (data === null) return []; + + var index, length, pair, keys, result, + object = data; + + result = new Array(object.length); + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + + keys = Object.keys(pair); + + result[index] = [ keys[0], pair[keys[0]] ]; + } + + return result; +} + +var pairs = new type('tag:yaml.org,2002:pairs', { + kind: 'sequence', + resolve: resolveYamlPairs, + construct: constructYamlPairs +}); + +var _hasOwnProperty$2 = Object.prototype.hasOwnProperty; + +function resolveYamlSet(data) { + if (data === null) return true; + + var key, object = data; + + for (key in object) { + if (_hasOwnProperty$2.call(object, key)) { + if (object[key] !== null) return false; + } + } + + return true; +} + +function constructYamlSet(data) { + return data !== null ? data : {}; +} + +var set = new type('tag:yaml.org,2002:set', { + kind: 'mapping', + resolve: resolveYamlSet, + construct: constructYamlSet +}); + +var _default = core.extend({ + implicit: [ + timestamp, + merge + ], + explicit: [ + binary, + omap, + pairs, + set + ] +}); + +/*eslint-disable max-len,no-use-before-define*/ + + + + + + + +var _hasOwnProperty$1 = Object.prototype.hasOwnProperty; + + +var CONTEXT_FLOW_IN = 1; +var CONTEXT_FLOW_OUT = 2; +var CONTEXT_BLOCK_IN = 3; +var CONTEXT_BLOCK_OUT = 4; + + +var CHOMPING_CLIP = 1; +var CHOMPING_STRIP = 2; +var CHOMPING_KEEP = 3; + + +var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; +var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/; +var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/; +var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i; +var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i; + + +function _class(obj) { return Object.prototype.toString.call(obj); } + +function is_EOL(c) { + return (c === 0x0A/* LF */) || (c === 0x0D/* CR */); +} + +function is_WHITE_SPACE(c) { + return (c === 0x09/* Tab */) || (c === 0x20/* Space */); +} + +function is_WS_OR_EOL(c) { + return (c === 0x09/* Tab */) || + (c === 0x20/* Space */) || + (c === 0x0A/* LF */) || + (c === 0x0D/* CR */); +} + +function is_FLOW_INDICATOR(c) { + return c === 0x2C/* , */ || + c === 0x5B/* [ */ || + c === 0x5D/* ] */ || + c === 0x7B/* { */ || + c === 0x7D/* } */; +} + +function fromHexCode(c) { + var lc; + + if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { + return c - 0x30; + } + + /*eslint-disable no-bitwise*/ + lc = c | 0x20; + + if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) { + return lc - 0x61 + 10; + } + + return -1; +} + +function escapedHexLen(c) { + if (c === 0x78/* x */) { return 2; } + if (c === 0x75/* u */) { return 4; } + if (c === 0x55/* U */) { return 8; } + return 0; +} + +function fromDecimalCode(c) { + if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { + return c - 0x30; + } + + return -1; +} + +function simpleEscapeSequence(c) { + /* eslint-disable indent */ + return (c === 0x30/* 0 */) ? '\x00' : + (c === 0x61/* a */) ? '\x07' : + (c === 0x62/* b */) ? '\x08' : + (c === 0x74/* t */) ? '\x09' : + (c === 0x09/* Tab */) ? '\x09' : + (c === 0x6E/* n */) ? '\x0A' : + (c === 0x76/* v */) ? '\x0B' : + (c === 0x66/* f */) ? '\x0C' : + (c === 0x72/* r */) ? '\x0D' : + (c === 0x65/* e */) ? '\x1B' : + (c === 0x20/* Space */) ? ' ' : + (c === 0x22/* " */) ? '\x22' : + (c === 0x2F/* / */) ? '/' : + (c === 0x5C/* \ */) ? '\x5C' : + (c === 0x4E/* N */) ? '\x85' : + (c === 0x5F/* _ */) ? '\xA0' : + (c === 0x4C/* L */) ? '\u2028' : + (c === 0x50/* P */) ? '\u2029' : ''; +} + +function charFromCodepoint(c) { + if (c <= 0xFFFF) { + return String.fromCharCode(c); + } + // Encode UTF-16 surrogate pair + // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF + return String.fromCharCode( + ((c - 0x010000) >> 10) + 0xD800, + ((c - 0x010000) & 0x03FF) + 0xDC00 + ); +} + +var simpleEscapeCheck = new Array(256); // integer, for fast access +var simpleEscapeMap = new Array(256); +for (var i = 0; i < 256; i++) { + simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0; + simpleEscapeMap[i] = simpleEscapeSequence(i); +} + + +function State$1(input, options) { + this.input = input; + + this.filename = options['filename'] || null; + this.schema = options['schema'] || _default; + this.onWarning = options['onWarning'] || null; + // (Hidden) Remove? makes the loader to expect YAML 1.1 documents + // if such documents have no explicit %YAML directive + this.legacy = options['legacy'] || false; + + this.json = options['json'] || false; + this.listener = options['listener'] || null; + + this.implicitTypes = this.schema.compiledImplicit; + this.typeMap = this.schema.compiledTypeMap; + + this.length = input.length; + this.position = 0; + this.line = 0; + this.lineStart = 0; + this.lineIndent = 0; + + // position of first leading tab in the current line, + // used to make sure there are no tabs in the indentation + this.firstTabInLine = -1; + + this.documents = []; + + /* + this.version; + this.checkLineBreaks; + this.tagMap; + this.anchorMap; + this.tag; + this.anchor; + this.kind; + this.result;*/ + +} + + +function generateError(state, message) { + var mark = { + name: state.filename, + buffer: state.input.slice(0, -1), // omit trailing \0 + position: state.position, + line: state.line, + column: state.position - state.lineStart + }; + + mark.snippet = snippet(mark); + + return new exception(message, mark); +} + +function throwError(state, message) { + throw generateError(state, message); +} + +function throwWarning(state, message) { + if (state.onWarning) { + state.onWarning.call(null, generateError(state, message)); + } +} + + +var directiveHandlers = { + + YAML: function handleYamlDirective(state, name, args) { + + var match, major, minor; + + if (state.version !== null) { + throwError(state, 'duplication of %YAML directive'); + } + + if (args.length !== 1) { + throwError(state, 'YAML directive accepts exactly one argument'); + } + + match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]); + + if (match === null) { + throwError(state, 'ill-formed argument of the YAML directive'); + } + + major = parseInt(match[1], 10); + minor = parseInt(match[2], 10); + + if (major !== 1) { + throwError(state, 'unacceptable YAML version of the document'); + } + + state.version = args[0]; + state.checkLineBreaks = (minor < 2); + + if (minor !== 1 && minor !== 2) { + throwWarning(state, 'unsupported YAML version of the document'); + } + }, + + TAG: function handleTagDirective(state, name, args) { + + var handle, prefix; + + if (args.length !== 2) { + throwError(state, 'TAG directive accepts exactly two arguments'); + } + + handle = args[0]; + prefix = args[1]; + + if (!PATTERN_TAG_HANDLE.test(handle)) { + throwError(state, 'ill-formed tag handle (first argument) of the TAG directive'); + } + + if (_hasOwnProperty$1.call(state.tagMap, handle)) { + throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle'); + } + + if (!PATTERN_TAG_URI.test(prefix)) { + throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive'); + } + + try { + prefix = decodeURIComponent(prefix); + } catch (err) { + throwError(state, 'tag prefix is malformed: ' + prefix); + } + + state.tagMap[handle] = prefix; + } +}; + + +function captureSegment(state, start, end, checkJson) { + var _position, _length, _character, _result; + + if (start < end) { + _result = state.input.slice(start, end); + + if (checkJson) { + for (_position = 0, _length = _result.length; _position < _length; _position += 1) { + _character = _result.charCodeAt(_position); + if (!(_character === 0x09 || + (0x20 <= _character && _character <= 0x10FFFF))) { + throwError(state, 'expected valid JSON character'); + } + } + } else if (PATTERN_NON_PRINTABLE.test(_result)) { + throwError(state, 'the stream contains non-printable characters'); + } + + state.result += _result; + } +} + +function mergeMappings(state, destination, source, overridableKeys) { + var sourceKeys, key, index, quantity; + + if (!common.isObject(source)) { + throwError(state, 'cannot merge mappings; the provided source object is unacceptable'); + } + + sourceKeys = Object.keys(source); + + for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) { + key = sourceKeys[index]; + + if (!_hasOwnProperty$1.call(destination, key)) { + destination[key] = source[key]; + overridableKeys[key] = true; + } + } +} + +function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, + startLine, startLineStart, startPos) { + + var index, quantity; + + // The output is a plain object here, so keys can only be strings. + // We need to convert keyNode to a string, but doing so can hang the process + // (deeply nested arrays that explode exponentially using aliases). + if (Array.isArray(keyNode)) { + keyNode = Array.prototype.slice.call(keyNode); + + for (index = 0, quantity = keyNode.length; index < quantity; index += 1) { + if (Array.isArray(keyNode[index])) { + throwError(state, 'nested arrays are not supported inside keys'); + } + + if (typeof keyNode === 'object' && _class(keyNode[index]) === '[object Object]') { + keyNode[index] = '[object Object]'; + } + } + } + + // Avoid code execution in load() via toString property + // (still use its own toString for arrays, timestamps, + // and whatever user schema extensions happen to have @@toStringTag) + if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') { + keyNode = '[object Object]'; + } + + + keyNode = String(keyNode); + + if (_result === null) { + _result = {}; + } + + if (keyTag === 'tag:yaml.org,2002:merge') { + if (Array.isArray(valueNode)) { + for (index = 0, quantity = valueNode.length; index < quantity; index += 1) { + mergeMappings(state, _result, valueNode[index], overridableKeys); + } + } else { + mergeMappings(state, _result, valueNode, overridableKeys); + } + } else { + if (!state.json && + !_hasOwnProperty$1.call(overridableKeys, keyNode) && + _hasOwnProperty$1.call(_result, keyNode)) { + state.line = startLine || state.line; + state.lineStart = startLineStart || state.lineStart; + state.position = startPos || state.position; + throwError(state, 'duplicated mapping key'); + } + + // used for this specific key only because Object.defineProperty is slow + if (keyNode === '__proto__') { + Object.defineProperty(_result, keyNode, { + configurable: true, + enumerable: true, + writable: true, + value: valueNode + }); + } else { + _result[keyNode] = valueNode; + } + delete overridableKeys[keyNode]; + } + + return _result; +} + +function readLineBreak(state) { + var ch; + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x0A/* LF */) { + state.position++; + } else if (ch === 0x0D/* CR */) { + state.position++; + if (state.input.charCodeAt(state.position) === 0x0A/* LF */) { + state.position++; + } + } else { + throwError(state, 'a line break is expected'); + } + + state.line += 1; + state.lineStart = state.position; + state.firstTabInLine = -1; +} + +function skipSeparationSpace(state, allowComments, checkIndent) { + var lineBreaks = 0, + ch = state.input.charCodeAt(state.position); + + while (ch !== 0) { + while (is_WHITE_SPACE(ch)) { + if (ch === 0x09/* Tab */ && state.firstTabInLine === -1) { + state.firstTabInLine = state.position; + } + ch = state.input.charCodeAt(++state.position); + } + + if (allowComments && ch === 0x23/* # */) { + do { + ch = state.input.charCodeAt(++state.position); + } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0); + } + + if (is_EOL(ch)) { + readLineBreak(state); + + ch = state.input.charCodeAt(state.position); + lineBreaks++; + state.lineIndent = 0; + + while (ch === 0x20/* Space */) { + state.lineIndent++; + ch = state.input.charCodeAt(++state.position); + } + } else { + break; + } + } + + if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) { + throwWarning(state, 'deficient indentation'); + } + + return lineBreaks; +} + +function testDocumentSeparator(state) { + var _position = state.position, + ch; + + ch = state.input.charCodeAt(_position); + + // Condition state.position === state.lineStart is tested + // in parent on each call, for efficiency. No needs to test here again. + if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) && + ch === state.input.charCodeAt(_position + 1) && + ch === state.input.charCodeAt(_position + 2)) { + + _position += 3; + + ch = state.input.charCodeAt(_position); + + if (ch === 0 || is_WS_OR_EOL(ch)) { + return true; + } + } + + return false; +} + +function writeFoldedLines(state, count) { + if (count === 1) { + state.result += ' '; + } else if (count > 1) { + state.result += common.repeat('\n', count - 1); + } +} + + +function readPlainScalar(state, nodeIndent, withinFlowCollection) { + var preceding, + following, + captureStart, + captureEnd, + hasPendingContent, + _line, + _lineStart, + _lineIndent, + _kind = state.kind, + _result = state.result, + ch; + + ch = state.input.charCodeAt(state.position); + + if (is_WS_OR_EOL(ch) || + is_FLOW_INDICATOR(ch) || + ch === 0x23/* # */ || + ch === 0x26/* & */ || + ch === 0x2A/* * */ || + ch === 0x21/* ! */ || + ch === 0x7C/* | */ || + ch === 0x3E/* > */ || + ch === 0x27/* ' */ || + ch === 0x22/* " */ || + ch === 0x25/* % */ || + ch === 0x40/* @ */ || + ch === 0x60/* ` */) { + return false; + } + + if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) { + following = state.input.charCodeAt(state.position + 1); + + if (is_WS_OR_EOL(following) || + withinFlowCollection && is_FLOW_INDICATOR(following)) { + return false; + } + } + + state.kind = 'scalar'; + state.result = ''; + captureStart = captureEnd = state.position; + hasPendingContent = false; + + while (ch !== 0) { + if (ch === 0x3A/* : */) { + following = state.input.charCodeAt(state.position + 1); + + if (is_WS_OR_EOL(following) || + withinFlowCollection && is_FLOW_INDICATOR(following)) { + break; + } + + } else if (ch === 0x23/* # */) { + preceding = state.input.charCodeAt(state.position - 1); + + if (is_WS_OR_EOL(preceding)) { + break; + } + + } else if ((state.position === state.lineStart && testDocumentSeparator(state)) || + withinFlowCollection && is_FLOW_INDICATOR(ch)) { + break; + + } else if (is_EOL(ch)) { + _line = state.line; + _lineStart = state.lineStart; + _lineIndent = state.lineIndent; + skipSeparationSpace(state, false, -1); + + if (state.lineIndent >= nodeIndent) { + hasPendingContent = true; + ch = state.input.charCodeAt(state.position); + continue; + } else { + state.position = captureEnd; + state.line = _line; + state.lineStart = _lineStart; + state.lineIndent = _lineIndent; + break; + } + } + + if (hasPendingContent) { + captureSegment(state, captureStart, captureEnd, false); + writeFoldedLines(state, state.line - _line); + captureStart = captureEnd = state.position; + hasPendingContent = false; + } + + if (!is_WHITE_SPACE(ch)) { + captureEnd = state.position + 1; + } + + ch = state.input.charCodeAt(++state.position); + } + + captureSegment(state, captureStart, captureEnd, false); + + if (state.result) { + return true; + } + + state.kind = _kind; + state.result = _result; + return false; +} + +function readSingleQuotedScalar(state, nodeIndent) { + var ch, + captureStart, captureEnd; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x27/* ' */) { + return false; + } + + state.kind = 'scalar'; + state.result = ''; + state.position++; + captureStart = captureEnd = state.position; + + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + if (ch === 0x27/* ' */) { + captureSegment(state, captureStart, state.position, true); + ch = state.input.charCodeAt(++state.position); + + if (ch === 0x27/* ' */) { + captureStart = state.position; + state.position++; + captureEnd = state.position; + } else { + return true; + } + + } else if (is_EOL(ch)) { + captureSegment(state, captureStart, captureEnd, true); + writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); + captureStart = captureEnd = state.position; + + } else if (state.position === state.lineStart && testDocumentSeparator(state)) { + throwError(state, 'unexpected end of the document within a single quoted scalar'); + + } else { + state.position++; + captureEnd = state.position; + } + } + + throwError(state, 'unexpected end of the stream within a single quoted scalar'); +} + +function readDoubleQuotedScalar(state, nodeIndent) { + var captureStart, + captureEnd, + hexLength, + hexResult, + tmp, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x22/* " */) { + return false; + } + + state.kind = 'scalar'; + state.result = ''; + state.position++; + captureStart = captureEnd = state.position; + + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + if (ch === 0x22/* " */) { + captureSegment(state, captureStart, state.position, true); + state.position++; + return true; + + } else if (ch === 0x5C/* \ */) { + captureSegment(state, captureStart, state.position, true); + ch = state.input.charCodeAt(++state.position); + + if (is_EOL(ch)) { + skipSeparationSpace(state, false, nodeIndent); + + // TODO: rework to inline fn with no type cast? + } else if (ch < 256 && simpleEscapeCheck[ch]) { + state.result += simpleEscapeMap[ch]; + state.position++; + + } else if ((tmp = escapedHexLen(ch)) > 0) { + hexLength = tmp; + hexResult = 0; + + for (; hexLength > 0; hexLength--) { + ch = state.input.charCodeAt(++state.position); + + if ((tmp = fromHexCode(ch)) >= 0) { + hexResult = (hexResult << 4) + tmp; + + } else { + throwError(state, 'expected hexadecimal character'); + } + } + + state.result += charFromCodepoint(hexResult); + + state.position++; + + } else { + throwError(state, 'unknown escape sequence'); + } + + captureStart = captureEnd = state.position; + + } else if (is_EOL(ch)) { + captureSegment(state, captureStart, captureEnd, true); + writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); + captureStart = captureEnd = state.position; + + } else if (state.position === state.lineStart && testDocumentSeparator(state)) { + throwError(state, 'unexpected end of the document within a double quoted scalar'); + + } else { + state.position++; + captureEnd = state.position; + } + } + + throwError(state, 'unexpected end of the stream within a double quoted scalar'); +} + +function readFlowCollection(state, nodeIndent) { + var readNext = true, + _line, + _lineStart, + _pos, + _tag = state.tag, + _result, + _anchor = state.anchor, + following, + terminator, + isPair, + isExplicitPair, + isMapping, + overridableKeys = Object.create(null), + keyNode, + keyTag, + valueNode, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x5B/* [ */) { + terminator = 0x5D;/* ] */ + isMapping = false; + _result = []; + } else if (ch === 0x7B/* { */) { + terminator = 0x7D;/* } */ + isMapping = true; + _result = {}; + } else { + return false; + } + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } + + ch = state.input.charCodeAt(++state.position); + + while (ch !== 0) { + skipSeparationSpace(state, true, nodeIndent); + + ch = state.input.charCodeAt(state.position); + + if (ch === terminator) { + state.position++; + state.tag = _tag; + state.anchor = _anchor; + state.kind = isMapping ? 'mapping' : 'sequence'; + state.result = _result; + return true; + } else if (!readNext) { + throwError(state, 'missed comma between flow collection entries'); + } else if (ch === 0x2C/* , */) { + // "flow collection entries can never be completely empty", as per YAML 1.2, section 7.4 + throwError(state, "expected the node content, but found ','"); + } + + keyTag = keyNode = valueNode = null; + isPair = isExplicitPair = false; + + if (ch === 0x3F/* ? */) { + following = state.input.charCodeAt(state.position + 1); + + if (is_WS_OR_EOL(following)) { + isPair = isExplicitPair = true; + state.position++; + skipSeparationSpace(state, true, nodeIndent); + } + } + + _line = state.line; // Save the current line. + _lineStart = state.lineStart; + _pos = state.position; + composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); + keyTag = state.tag; + keyNode = state.result; + skipSeparationSpace(state, true, nodeIndent); + + ch = state.input.charCodeAt(state.position); + + if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) { + isPair = true; + ch = state.input.charCodeAt(++state.position); + skipSeparationSpace(state, true, nodeIndent); + composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); + valueNode = state.result; + } + + if (isMapping) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos); + } else if (isPair) { + _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos)); + } else { + _result.push(keyNode); + } + + skipSeparationSpace(state, true, nodeIndent); + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x2C/* , */) { + readNext = true; + ch = state.input.charCodeAt(++state.position); + } else { + readNext = false; + } + } + + throwError(state, 'unexpected end of the stream within a flow collection'); +} + +function readBlockScalar(state, nodeIndent) { + var captureStart, + folding, + chomping = CHOMPING_CLIP, + didReadContent = false, + detectedIndent = false, + textIndent = nodeIndent, + emptyLines = 0, + atMoreIndented = false, + tmp, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x7C/* | */) { + folding = false; + } else if (ch === 0x3E/* > */) { + folding = true; + } else { + return false; + } + + state.kind = 'scalar'; + state.result = ''; + + while (ch !== 0) { + ch = state.input.charCodeAt(++state.position); + + if (ch === 0x2B/* + */ || ch === 0x2D/* - */) { + if (CHOMPING_CLIP === chomping) { + chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP; + } else { + throwError(state, 'repeat of a chomping mode identifier'); + } + + } else if ((tmp = fromDecimalCode(ch)) >= 0) { + if (tmp === 0) { + throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one'); + } else if (!detectedIndent) { + textIndent = nodeIndent + tmp - 1; + detectedIndent = true; + } else { + throwError(state, 'repeat of an indentation width identifier'); + } + + } else { + break; + } + } + + if (is_WHITE_SPACE(ch)) { + do { ch = state.input.charCodeAt(++state.position); } + while (is_WHITE_SPACE(ch)); + + if (ch === 0x23/* # */) { + do { ch = state.input.charCodeAt(++state.position); } + while (!is_EOL(ch) && (ch !== 0)); + } + } + + while (ch !== 0) { + readLineBreak(state); + state.lineIndent = 0; + + ch = state.input.charCodeAt(state.position); + + while ((!detectedIndent || state.lineIndent < textIndent) && + (ch === 0x20/* Space */)) { + state.lineIndent++; + ch = state.input.charCodeAt(++state.position); + } + + if (!detectedIndent && state.lineIndent > textIndent) { + textIndent = state.lineIndent; + } + + if (is_EOL(ch)) { + emptyLines++; + continue; + } + + // End of the scalar. + if (state.lineIndent < textIndent) { + + // Perform the chomping. + if (chomping === CHOMPING_KEEP) { + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + } else if (chomping === CHOMPING_CLIP) { + if (didReadContent) { // i.e. only if the scalar is not empty. + state.result += '\n'; + } + } + + // Break this `while` cycle and go to the funciton's epilogue. + break; + } + + // Folded style: use fancy rules to handle line breaks. + if (folding) { + + // Lines starting with white space characters (more-indented lines) are not folded. + if (is_WHITE_SPACE(ch)) { + atMoreIndented = true; + // except for the first content line (cf. Example 8.1) + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + + // End of more-indented block. + } else if (atMoreIndented) { + atMoreIndented = false; + state.result += common.repeat('\n', emptyLines + 1); + + // Just one line break - perceive as the same line. + } else if (emptyLines === 0) { + if (didReadContent) { // i.e. only if we have already read some scalar content. + state.result += ' '; + } + + // Several line breaks - perceive as different lines. + } else { + state.result += common.repeat('\n', emptyLines); + } + + // Literal style: just add exact number of line breaks between content lines. + } else { + // Keep all line breaks except the header line break. + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + } + + didReadContent = true; + detectedIndent = true; + emptyLines = 0; + captureStart = state.position; + + while (!is_EOL(ch) && (ch !== 0)) { + ch = state.input.charCodeAt(++state.position); + } + + captureSegment(state, captureStart, state.position, false); + } + + return true; +} + +function readBlockSequence(state, nodeIndent) { + var _line, + _tag = state.tag, + _anchor = state.anchor, + _result = [], + following, + detected = false, + ch; + + // there is a leading tab before this token, so it can't be a block sequence/mapping; + // it can still be flow sequence/mapping or a scalar + if (state.firstTabInLine !== -1) return false; + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } + + ch = state.input.charCodeAt(state.position); + + while (ch !== 0) { + if (state.firstTabInLine !== -1) { + state.position = state.firstTabInLine; + throwError(state, 'tab characters must not be used in indentation'); + } + + if (ch !== 0x2D/* - */) { + break; + } + + following = state.input.charCodeAt(state.position + 1); + + if (!is_WS_OR_EOL(following)) { + break; + } + + detected = true; + state.position++; + + if (skipSeparationSpace(state, true, -1)) { + if (state.lineIndent <= nodeIndent) { + _result.push(null); + ch = state.input.charCodeAt(state.position); + continue; + } + } + + _line = state.line; + composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true); + _result.push(state.result); + skipSeparationSpace(state, true, -1); + + ch = state.input.charCodeAt(state.position); + + if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { + throwError(state, 'bad indentation of a sequence entry'); + } else if (state.lineIndent < nodeIndent) { + break; + } + } + + if (detected) { + state.tag = _tag; + state.anchor = _anchor; + state.kind = 'sequence'; + state.result = _result; + return true; + } + return false; +} + +function readBlockMapping(state, nodeIndent, flowIndent) { + var following, + allowCompact, + _line, + _keyLine, + _keyLineStart, + _keyPos, + _tag = state.tag, + _anchor = state.anchor, + _result = {}, + overridableKeys = Object.create(null), + keyTag = null, + keyNode = null, + valueNode = null, + atExplicitKey = false, + detected = false, + ch; + + // there is a leading tab before this token, so it can't be a block sequence/mapping; + // it can still be flow sequence/mapping or a scalar + if (state.firstTabInLine !== -1) return false; + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } + + ch = state.input.charCodeAt(state.position); + + while (ch !== 0) { + if (!atExplicitKey && state.firstTabInLine !== -1) { + state.position = state.firstTabInLine; + throwError(state, 'tab characters must not be used in indentation'); + } + + following = state.input.charCodeAt(state.position + 1); + _line = state.line; // Save the current line. + + // + // Explicit notation case. There are two separate blocks: + // first for the key (denoted by "?") and second for the value (denoted by ":") + // + if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) { + + if (ch === 0x3F/* ? */) { + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); + keyTag = keyNode = valueNode = null; + } + + detected = true; + atExplicitKey = true; + allowCompact = true; + + } else if (atExplicitKey) { + // i.e. 0x3A/* : */ === character after the explicit key. + atExplicitKey = false; + allowCompact = true; + + } else { + throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line'); + } + + state.position += 1; + ch = following; + + // + // Implicit notation case. Flow-style node as the key first, then ":", and the value. + // + } else { + _keyLine = state.line; + _keyLineStart = state.lineStart; + _keyPos = state.position; + + if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) { + // Neither implicit nor explicit notation. + // Reading is done. Go to the epilogue. + break; + } + + if (state.line === _line) { + ch = state.input.charCodeAt(state.position); + + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (ch === 0x3A/* : */) { + ch = state.input.charCodeAt(++state.position); + + if (!is_WS_OR_EOL(ch)) { + throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping'); + } + + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); + keyTag = keyNode = valueNode = null; + } + + detected = true; + atExplicitKey = false; + allowCompact = false; + keyTag = state.tag; + keyNode = state.result; + + } else if (detected) { + throwError(state, 'can not read an implicit mapping pair; a colon is missed'); + + } else { + state.tag = _tag; + state.anchor = _anchor; + return true; // Keep the result of `composeNode`. + } + + } else if (detected) { + throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key'); + + } else { + state.tag = _tag; + state.anchor = _anchor; + return true; // Keep the result of `composeNode`. + } + } + + // + // Common reading code for both explicit and implicit notations. + // + if (state.line === _line || state.lineIndent > nodeIndent) { + if (atExplicitKey) { + _keyLine = state.line; + _keyLineStart = state.lineStart; + _keyPos = state.position; + } + + if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) { + if (atExplicitKey) { + keyNode = state.result; + } else { + valueNode = state.result; + } + } + + if (!atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos); + keyTag = keyNode = valueNode = null; + } + + skipSeparationSpace(state, true, -1); + ch = state.input.charCodeAt(state.position); + } + + if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { + throwError(state, 'bad indentation of a mapping entry'); + } else if (state.lineIndent < nodeIndent) { + break; + } + } + + // + // Epilogue. + // + + // Special case: last mapping's node contains only the key in explicit notation. + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); + } + + // Expose the resulting mapping. + if (detected) { + state.tag = _tag; + state.anchor = _anchor; + state.kind = 'mapping'; + state.result = _result; + } + + return detected; +} + +function readTagProperty(state) { + var _position, + isVerbatim = false, + isNamed = false, + tagHandle, + tagName, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x21/* ! */) return false; + + if (state.tag !== null) { + throwError(state, 'duplication of a tag property'); + } + + ch = state.input.charCodeAt(++state.position); + + if (ch === 0x3C/* < */) { + isVerbatim = true; + ch = state.input.charCodeAt(++state.position); + + } else if (ch === 0x21/* ! */) { + isNamed = true; + tagHandle = '!!'; + ch = state.input.charCodeAt(++state.position); + + } else { + tagHandle = '!'; + } + + _position = state.position; + + if (isVerbatim) { + do { ch = state.input.charCodeAt(++state.position); } + while (ch !== 0 && ch !== 0x3E/* > */); + + if (state.position < state.length) { + tagName = state.input.slice(_position, state.position); + ch = state.input.charCodeAt(++state.position); + } else { + throwError(state, 'unexpected end of the stream within a verbatim tag'); + } + } else { + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + + if (ch === 0x21/* ! */) { + if (!isNamed) { + tagHandle = state.input.slice(_position - 1, state.position + 1); + + if (!PATTERN_TAG_HANDLE.test(tagHandle)) { + throwError(state, 'named tag handle cannot contain such characters'); + } + + isNamed = true; + _position = state.position + 1; + } else { + throwError(state, 'tag suffix cannot contain exclamation marks'); + } + } + + ch = state.input.charCodeAt(++state.position); + } + + tagName = state.input.slice(_position, state.position); + + if (PATTERN_FLOW_INDICATORS.test(tagName)) { + throwError(state, 'tag suffix cannot contain flow indicator characters'); + } + } + + if (tagName && !PATTERN_TAG_URI.test(tagName)) { + throwError(state, 'tag name cannot contain such characters: ' + tagName); + } + + try { + tagName = decodeURIComponent(tagName); + } catch (err) { + throwError(state, 'tag name is malformed: ' + tagName); + } + + if (isVerbatim) { + state.tag = tagName; + + } else if (_hasOwnProperty$1.call(state.tagMap, tagHandle)) { + state.tag = state.tagMap[tagHandle] + tagName; + + } else if (tagHandle === '!') { + state.tag = '!' + tagName; + + } else if (tagHandle === '!!') { + state.tag = 'tag:yaml.org,2002:' + tagName; + + } else { + throwError(state, 'undeclared tag handle "' + tagHandle + '"'); + } + + return true; +} + +function readAnchorProperty(state) { + var _position, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x26/* & */) return false; + + if (state.anchor !== null) { + throwError(state, 'duplication of an anchor property'); + } + + ch = state.input.charCodeAt(++state.position); + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (state.position === _position) { + throwError(state, 'name of an anchor node must contain at least one character'); + } + + state.anchor = state.input.slice(_position, state.position); + return true; +} + +function readAlias(state) { + var _position, alias, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x2A/* * */) return false; + + ch = state.input.charCodeAt(++state.position); + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (state.position === _position) { + throwError(state, 'name of an alias node must contain at least one character'); + } + + alias = state.input.slice(_position, state.position); + + if (!_hasOwnProperty$1.call(state.anchorMap, alias)) { + throwError(state, 'unidentified alias "' + alias + '"'); + } + + state.result = state.anchorMap[alias]; + skipSeparationSpace(state, true, -1); + return true; +} + +function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) { + var allowBlockStyles, + allowBlockScalars, + allowBlockCollections, + indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this parentIndent) { + indentStatus = 1; + } else if (state.lineIndent === parentIndent) { + indentStatus = 0; + } else if (state.lineIndent < parentIndent) { + indentStatus = -1; + } + } + } + + if (indentStatus === 1) { + while (readTagProperty(state) || readAnchorProperty(state)) { + if (skipSeparationSpace(state, true, -1)) { + atNewLine = true; + allowBlockCollections = allowBlockStyles; + + if (state.lineIndent > parentIndent) { + indentStatus = 1; + } else if (state.lineIndent === parentIndent) { + indentStatus = 0; + } else if (state.lineIndent < parentIndent) { + indentStatus = -1; + } + } else { + allowBlockCollections = false; + } + } + } + + if (allowBlockCollections) { + allowBlockCollections = atNewLine || allowCompact; + } + + if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) { + if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) { + flowIndent = parentIndent; + } else { + flowIndent = parentIndent + 1; + } + + blockIndent = state.position - state.lineStart; + + if (indentStatus === 1) { + if (allowBlockCollections && + (readBlockSequence(state, blockIndent) || + readBlockMapping(state, blockIndent, flowIndent)) || + readFlowCollection(state, flowIndent)) { + hasContent = true; + } else { + if ((allowBlockScalars && readBlockScalar(state, flowIndent)) || + readSingleQuotedScalar(state, flowIndent) || + readDoubleQuotedScalar(state, flowIndent)) { + hasContent = true; + + } else if (readAlias(state)) { + hasContent = true; + + if (state.tag !== null || state.anchor !== null) { + throwError(state, 'alias node should not have any properties'); + } + + } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) { + hasContent = true; + + if (state.tag === null) { + state.tag = '?'; + } + } + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + } + } else if (indentStatus === 0) { + // Special case: block sequences are allowed to have same indentation level as the parent. + // http://www.yaml.org/spec/1.2/spec.html#id2799784 + hasContent = allowBlockCollections && readBlockSequence(state, blockIndent); + } + } + + if (state.tag === null) { + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + + } else if (state.tag === '?') { + // Implicit resolving is not allowed for non-scalar types, and '?' + // non-specific tag is only automatically assigned to plain scalars. + // + // We only need to check kind conformity in case user explicitly assigns '?' + // tag, for example like this: "! [0]" + // + if (state.result !== null && state.kind !== 'scalar') { + throwError(state, 'unacceptable node kind for ! tag; it should be "scalar", not "' + state.kind + '"'); + } + + for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) { + type = state.implicitTypes[typeIndex]; + + if (type.resolve(state.result)) { // `state.result` updated in resolver if matched + state.result = type.construct(state.result); + state.tag = type.tag; + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + break; + } + } + } else if (state.tag !== '!') { + if (_hasOwnProperty$1.call(state.typeMap[state.kind || 'fallback'], state.tag)) { + type = state.typeMap[state.kind || 'fallback'][state.tag]; + } else { + // looking for multi type + type = null; + typeList = state.typeMap.multi[state.kind || 'fallback']; + + for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) { + if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) { + type = typeList[typeIndex]; + break; + } + } + } + + if (!type) { + throwError(state, 'unknown tag !<' + state.tag + '>'); + } + + if (state.result !== null && type.kind !== state.kind) { + throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"'); + } + + if (!type.resolve(state.result, state.tag)) { // `state.result` updated in resolver if matched + throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag'); + } else { + state.result = type.construct(state.result, state.tag); + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + } + } + + if (state.listener !== null) { + state.listener('close', state); + } + return state.tag !== null || state.anchor !== null || hasContent; +} + +function readDocument(state) { + var documentStart = state.position, + _position, + directiveName, + directiveArgs, + hasDirectives = false, + ch; + + state.version = null; + state.checkLineBreaks = state.legacy; + state.tagMap = Object.create(null); + state.anchorMap = Object.create(null); + + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + skipSeparationSpace(state, true, -1); + + ch = state.input.charCodeAt(state.position); + + if (state.lineIndent > 0 || ch !== 0x25/* % */) { + break; + } + + hasDirectives = true; + ch = state.input.charCodeAt(++state.position); + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + directiveName = state.input.slice(_position, state.position); + directiveArgs = []; + + if (directiveName.length < 1) { + throwError(state, 'directive name must not be less than one character in length'); + } + + while (ch !== 0) { + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (ch === 0x23/* # */) { + do { ch = state.input.charCodeAt(++state.position); } + while (ch !== 0 && !is_EOL(ch)); + break; + } + + if (is_EOL(ch)) break; + + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + directiveArgs.push(state.input.slice(_position, state.position)); + } + + if (ch !== 0) readLineBreak(state); + + if (_hasOwnProperty$1.call(directiveHandlers, directiveName)) { + directiveHandlers[directiveName](state, directiveName, directiveArgs); + } else { + throwWarning(state, 'unknown document directive "' + directiveName + '"'); + } + } + + skipSeparationSpace(state, true, -1); + + if (state.lineIndent === 0 && + state.input.charCodeAt(state.position) === 0x2D/* - */ && + state.input.charCodeAt(state.position + 1) === 0x2D/* - */ && + state.input.charCodeAt(state.position + 2) === 0x2D/* - */) { + state.position += 3; + skipSeparationSpace(state, true, -1); + + } else if (hasDirectives) { + throwError(state, 'directives end mark is expected'); + } + + composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true); + skipSeparationSpace(state, true, -1); + + if (state.checkLineBreaks && + PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) { + throwWarning(state, 'non-ASCII line breaks are interpreted as content'); + } + + state.documents.push(state.result); + + if (state.position === state.lineStart && testDocumentSeparator(state)) { + + if (state.input.charCodeAt(state.position) === 0x2E/* . */) { + state.position += 3; + skipSeparationSpace(state, true, -1); + } + return; + } + + if (state.position < (state.length - 1)) { + throwError(state, 'end of the stream or a document separator is expected'); + } else { + return; + } +} + + +function loadDocuments(input, options) { + input = String(input); + options = options || {}; + + if (input.length !== 0) { + + // Add tailing `\n` if not exists + if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ && + input.charCodeAt(input.length - 1) !== 0x0D/* CR */) { + input += '\n'; + } + + // Strip BOM + if (input.charCodeAt(0) === 0xFEFF) { + input = input.slice(1); + } + } + + var state = new State$1(input, options); + + var nullpos = input.indexOf('\0'); + + if (nullpos !== -1) { + state.position = nullpos; + throwError(state, 'null byte is not allowed in input'); + } + + // Use 0 as string terminator. That significantly simplifies bounds check. + state.input += '\0'; + + while (state.input.charCodeAt(state.position) === 0x20/* Space */) { + state.lineIndent += 1; + state.position += 1; + } + + while (state.position < (state.length - 1)) { + readDocument(state); + } + + return state.documents; +} + + +function loadAll$1(input, iterator, options) { + if (iterator !== null && typeof iterator === 'object' && typeof options === 'undefined') { + options = iterator; + iterator = null; + } + + var documents = loadDocuments(input, options); + + if (typeof iterator !== 'function') { + return documents; + } + + for (var index = 0, length = documents.length; index < length; index += 1) { + iterator(documents[index]); + } +} + + +function load$1(input, options) { + var documents = loadDocuments(input, options); + + if (documents.length === 0) { + /*eslint-disable no-undefined*/ + return undefined; + } else if (documents.length === 1) { + return documents[0]; + } + throw new exception('expected a single document in the stream, but found more'); +} + + +var loadAll_1 = loadAll$1; +var load_1 = load$1; + +var loader = { + loadAll: loadAll_1, + load: load_1 +}; + +/*eslint-disable no-use-before-define*/ + + + + + +var _toString = Object.prototype.toString; +var _hasOwnProperty = Object.prototype.hasOwnProperty; + +var CHAR_BOM = 0xFEFF; +var CHAR_TAB = 0x09; /* Tab */ +var CHAR_LINE_FEED = 0x0A; /* LF */ +var CHAR_CARRIAGE_RETURN = 0x0D; /* CR */ +var CHAR_SPACE = 0x20; /* Space */ +var CHAR_EXCLAMATION = 0x21; /* ! */ +var CHAR_DOUBLE_QUOTE = 0x22; /* " */ +var CHAR_SHARP = 0x23; /* # */ +var CHAR_PERCENT = 0x25; /* % */ +var CHAR_AMPERSAND = 0x26; /* & */ +var CHAR_SINGLE_QUOTE = 0x27; /* ' */ +var CHAR_ASTERISK = 0x2A; /* * */ +var CHAR_COMMA = 0x2C; /* , */ +var CHAR_MINUS = 0x2D; /* - */ +var CHAR_COLON = 0x3A; /* : */ +var CHAR_EQUALS = 0x3D; /* = */ +var CHAR_GREATER_THAN = 0x3E; /* > */ +var CHAR_QUESTION = 0x3F; /* ? */ +var CHAR_COMMERCIAL_AT = 0x40; /* @ */ +var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */ +var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */ +var CHAR_GRAVE_ACCENT = 0x60; /* ` */ +var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */ +var CHAR_VERTICAL_LINE = 0x7C; /* | */ +var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */ + +var ESCAPE_SEQUENCES = {}; + +ESCAPE_SEQUENCES[0x00] = '\\0'; +ESCAPE_SEQUENCES[0x07] = '\\a'; +ESCAPE_SEQUENCES[0x08] = '\\b'; +ESCAPE_SEQUENCES[0x09] = '\\t'; +ESCAPE_SEQUENCES[0x0A] = '\\n'; +ESCAPE_SEQUENCES[0x0B] = '\\v'; +ESCAPE_SEQUENCES[0x0C] = '\\f'; +ESCAPE_SEQUENCES[0x0D] = '\\r'; +ESCAPE_SEQUENCES[0x1B] = '\\e'; +ESCAPE_SEQUENCES[0x22] = '\\"'; +ESCAPE_SEQUENCES[0x5C] = '\\\\'; +ESCAPE_SEQUENCES[0x85] = '\\N'; +ESCAPE_SEQUENCES[0xA0] = '\\_'; +ESCAPE_SEQUENCES[0x2028] = '\\L'; +ESCAPE_SEQUENCES[0x2029] = '\\P'; + +var DEPRECATED_BOOLEANS_SYNTAX = [ + 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON', + 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF' +]; + +var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/; + +function compileStyleMap(schema, map) { + var result, keys, index, length, tag, style, type; + + if (map === null) return {}; + + result = {}; + keys = Object.keys(map); + + for (index = 0, length = keys.length; index < length; index += 1) { + tag = keys[index]; + style = String(map[tag]); + + if (tag.slice(0, 2) === '!!') { + tag = 'tag:yaml.org,2002:' + tag.slice(2); + } + type = schema.compiledTypeMap['fallback'][tag]; + + if (type && _hasOwnProperty.call(type.styleAliases, style)) { + style = type.styleAliases[style]; + } + + result[tag] = style; + } + + return result; +} + +function encodeHex(character) { + var string, handle, length; + + string = character.toString(16).toUpperCase(); + + if (character <= 0xFF) { + handle = 'x'; + length = 2; + } else if (character <= 0xFFFF) { + handle = 'u'; + length = 4; + } else if (character <= 0xFFFFFFFF) { + handle = 'U'; + length = 8; + } else { + throw new exception('code point within a string may not be greater than 0xFFFFFFFF'); + } + + return '\\' + handle + common.repeat('0', length - string.length) + string; +} + + +var QUOTING_TYPE_SINGLE = 1, + QUOTING_TYPE_DOUBLE = 2; + +function State(options) { + this.schema = options['schema'] || _default; + this.indent = Math.max(1, (options['indent'] || 2)); + this.noArrayIndent = options['noArrayIndent'] || false; + this.skipInvalid = options['skipInvalid'] || false; + this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']); + this.styleMap = compileStyleMap(this.schema, options['styles'] || null); + this.sortKeys = options['sortKeys'] || false; + this.lineWidth = options['lineWidth'] || 80; + this.noRefs = options['noRefs'] || false; + this.noCompatMode = options['noCompatMode'] || false; + this.condenseFlow = options['condenseFlow'] || false; + this.quotingType = options['quotingType'] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE; + this.forceQuotes = options['forceQuotes'] || false; + this.replacer = typeof options['replacer'] === 'function' ? options['replacer'] : null; + + this.implicitTypes = this.schema.compiledImplicit; + this.explicitTypes = this.schema.compiledExplicit; + + this.tag = null; + this.result = ''; + + this.duplicates = []; + this.usedDuplicates = null; +} + +// Indents every line in a string. Empty lines (\n only) are not indented. +function indentString(string, spaces) { + var ind = common.repeat(' ', spaces), + position = 0, + next = -1, + result = '', + line, + length = string.length; + + while (position < length) { + next = string.indexOf('\n', position); + if (next === -1) { + line = string.slice(position); + position = length; + } else { + line = string.slice(position, next + 1); + position = next + 1; + } + + if (line.length && line !== '\n') result += ind; + + result += line; + } + + return result; +} + +function generateNextLine(state, level) { + return '\n' + common.repeat(' ', state.indent * level); +} + +function testImplicitResolving(state, str) { + var index, length, type; + + for (index = 0, length = state.implicitTypes.length; index < length; index += 1) { + type = state.implicitTypes[index]; + + if (type.resolve(str)) { + return true; + } + } + + return false; +} + +// [33] s-white ::= s-space | s-tab +function isWhitespace(c) { + return c === CHAR_SPACE || c === CHAR_TAB; +} + +// Returns true if the character can be printed without escaping. +// From YAML 1.2: "any allowed characters known to be non-printable +// should also be escaped. [However,] This isn’t mandatory" +// Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029. +function isPrintable(c) { + return (0x00020 <= c && c <= 0x00007E) + || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029) + || ((0x0E000 <= c && c <= 0x00FFFD) && c !== CHAR_BOM) + || (0x10000 <= c && c <= 0x10FFFF); +} + +// [34] ns-char ::= nb-char - s-white +// [27] nb-char ::= c-printable - b-char - c-byte-order-mark +// [26] b-char ::= b-line-feed | b-carriage-return +// Including s-white (for some reason, examples doesn't match specs in this aspect) +// ns-char ::= c-printable - b-line-feed - b-carriage-return - c-byte-order-mark +function isNsCharOrWhitespace(c) { + return isPrintable(c) + && c !== CHAR_BOM + // - b-char + && c !== CHAR_CARRIAGE_RETURN + && c !== CHAR_LINE_FEED; +} + +// [127] ns-plain-safe(c) ::= c = flow-out ⇒ ns-plain-safe-out +// c = flow-in ⇒ ns-plain-safe-in +// c = block-key ⇒ ns-plain-safe-out +// c = flow-key ⇒ ns-plain-safe-in +// [128] ns-plain-safe-out ::= ns-char +// [129] ns-plain-safe-in ::= ns-char - c-flow-indicator +// [130] ns-plain-char(c) ::= ( ns-plain-safe(c) - “:” - “#” ) +// | ( /* An ns-char preceding */ “#” ) +// | ( “:” /* Followed by an ns-plain-safe(c) */ ) +function isPlainSafe(c, prev, inblock) { + var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c); + var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c); + return ( + // ns-plain-safe + inblock ? // c = flow-in + cIsNsCharOrWhitespace + : cIsNsCharOrWhitespace + // - c-flow-indicator + && c !== CHAR_COMMA + && c !== CHAR_LEFT_SQUARE_BRACKET + && c !== CHAR_RIGHT_SQUARE_BRACKET + && c !== CHAR_LEFT_CURLY_BRACKET + && c !== CHAR_RIGHT_CURLY_BRACKET + ) + // ns-plain-char + && c !== CHAR_SHARP // false on '#' + && !(prev === CHAR_COLON && !cIsNsChar) // false on ': ' + || (isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP) // change to true on '[^ ]#' + || (prev === CHAR_COLON && cIsNsChar); // change to true on ':[^ ]' +} + +// Simplified test for values allowed as the first character in plain style. +function isPlainSafeFirst(c) { + // Uses a subset of ns-char - c-indicator + // where ns-char = nb-char - s-white. + // No support of ( ( “?” | “:” | “-” ) /* Followed by an ns-plain-safe(c)) */ ) part + return isPrintable(c) && c !== CHAR_BOM + && !isWhitespace(c) // - s-white + // - (c-indicator ::= + // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}” + && c !== CHAR_MINUS + && c !== CHAR_QUESTION + && c !== CHAR_COLON + && c !== CHAR_COMMA + && c !== CHAR_LEFT_SQUARE_BRACKET + && c !== CHAR_RIGHT_SQUARE_BRACKET + && c !== CHAR_LEFT_CURLY_BRACKET + && c !== CHAR_RIGHT_CURLY_BRACKET + // | “#” | “&” | “*” | “!” | “|” | “=” | “>” | “'” | “"” + && c !== CHAR_SHARP + && c !== CHAR_AMPERSAND + && c !== CHAR_ASTERISK + && c !== CHAR_EXCLAMATION + && c !== CHAR_VERTICAL_LINE + && c !== CHAR_EQUALS + && c !== CHAR_GREATER_THAN + && c !== CHAR_SINGLE_QUOTE + && c !== CHAR_DOUBLE_QUOTE + // | “%” | “@” | “`”) + && c !== CHAR_PERCENT + && c !== CHAR_COMMERCIAL_AT + && c !== CHAR_GRAVE_ACCENT; +} + +// Simplified test for values allowed as the last character in plain style. +function isPlainSafeLast(c) { + // just not whitespace or colon, it will be checked to be plain character later + return !isWhitespace(c) && c !== CHAR_COLON; +} + +// Same as 'string'.codePointAt(pos), but works in older browsers. +function codePointAt(string, pos) { + var first = string.charCodeAt(pos), second; + if (first >= 0xD800 && first <= 0xDBFF && pos + 1 < string.length) { + second = string.charCodeAt(pos + 1); + if (second >= 0xDC00 && second <= 0xDFFF) { + // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae + return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000; + } + } + return first; +} + +// Determines whether block indentation indicator is required. +function needIndentIndicator(string) { + var leadingSpaceRe = /^\n* /; + return leadingSpaceRe.test(string); +} + +var STYLE_PLAIN = 1, + STYLE_SINGLE = 2, + STYLE_LITERAL = 3, + STYLE_FOLDED = 4, + STYLE_DOUBLE = 5; + +// Determines which scalar styles are possible and returns the preferred style. +// lineWidth = -1 => no limit. +// Pre-conditions: str.length > 0. +// Post-conditions: +// STYLE_PLAIN or STYLE_SINGLE => no \n are in the string. +// STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1). +// STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1). +function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, + testAmbiguousType, quotingType, forceQuotes, inblock) { + + var i; + var char = 0; + var prevChar = null; + var hasLineBreak = false; + var hasFoldableLine = false; // only checked if shouldTrackWidth + var shouldTrackWidth = lineWidth !== -1; + var previousLineBreak = -1; // count the first line correctly + var plain = isPlainSafeFirst(codePointAt(string, 0)) + && isPlainSafeLast(codePointAt(string, string.length - 1)); + + if (singleLineOnly || forceQuotes) { + // Case: no block styles. + // Check for disallowed characters to rule out plain and single. + for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { + char = codePointAt(string, i); + if (!isPrintable(char)) { + return STYLE_DOUBLE; + } + plain = plain && isPlainSafe(char, prevChar, inblock); + prevChar = char; + } + } else { + // Case: block styles permitted. + for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { + char = codePointAt(string, i); + if (char === CHAR_LINE_FEED) { + hasLineBreak = true; + // Check if any line can be folded. + if (shouldTrackWidth) { + hasFoldableLine = hasFoldableLine || + // Foldable line = too long, and not more-indented. + (i - previousLineBreak - 1 > lineWidth && + string[previousLineBreak + 1] !== ' '); + previousLineBreak = i; + } + } else if (!isPrintable(char)) { + return STYLE_DOUBLE; + } + plain = plain && isPlainSafe(char, prevChar, inblock); + prevChar = char; + } + // in case the end is missing a \n + hasFoldableLine = hasFoldableLine || (shouldTrackWidth && + (i - previousLineBreak - 1 > lineWidth && + string[previousLineBreak + 1] !== ' ')); + } + // Although every style can represent \n without escaping, prefer block styles + // for multiline, since they're more readable and they don't add empty lines. + // Also prefer folding a super-long line. + if (!hasLineBreak && !hasFoldableLine) { + // Strings interpretable as another type have to be quoted; + // e.g. the string 'true' vs. the boolean true. + if (plain && !forceQuotes && !testAmbiguousType(string)) { + return STYLE_PLAIN; + } + return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE; + } + // Edge case: block indentation indicator can only have one digit. + if (indentPerLevel > 9 && needIndentIndicator(string)) { + return STYLE_DOUBLE; + } + // At this point we know block styles are valid. + // Prefer literal style unless we want to fold. + if (!forceQuotes) { + return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL; + } + return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE; +} + +// Note: line breaking/folding is implemented for only the folded style. +// NB. We drop the last trailing newline (if any) of a returned block scalar +// since the dumper adds its own newline. This always works: +// • No ending newline => unaffected; already using strip "-" chomping. +// • Ending newline => removed then restored. +// Importantly, this keeps the "+" chomp indicator from gaining an extra line. +function writeScalar(state, string, level, iskey, inblock) { + state.dump = (function () { + if (string.length === 0) { + return state.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''"; + } + if (!state.noCompatMode) { + if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) { + return state.quotingType === QUOTING_TYPE_DOUBLE ? ('"' + string + '"') : ("'" + string + "'"); + } + } + + var indent = state.indent * Math.max(1, level); // no 0-indent scalars + // As indentation gets deeper, let the width decrease monotonically + // to the lower bound min(state.lineWidth, 40). + // Note that this implies + // state.lineWidth ≤ 40 + state.indent: width is fixed at the lower bound. + // state.lineWidth > 40 + state.indent: width decreases until the lower bound. + // This behaves better than a constant minimum width which disallows narrower options, + // or an indent threshold which causes the width to suddenly increase. + var lineWidth = state.lineWidth === -1 + ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent); + + // Without knowing if keys are implicit/explicit, assume implicit for safety. + var singleLineOnly = iskey + // No block styles in flow mode. + || (state.flowLevel > -1 && level >= state.flowLevel); + function testAmbiguity(string) { + return testImplicitResolving(state, string); + } + + switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, + testAmbiguity, state.quotingType, state.forceQuotes && !iskey, inblock)) { + + case STYLE_PLAIN: + return string; + case STYLE_SINGLE: + return "'" + string.replace(/'/g, "''") + "'"; + case STYLE_LITERAL: + return '|' + blockHeader(string, state.indent) + + dropEndingNewline(indentString(string, indent)); + case STYLE_FOLDED: + return '>' + blockHeader(string, state.indent) + + dropEndingNewline(indentString(foldString(string, lineWidth), indent)); + case STYLE_DOUBLE: + return '"' + escapeString(string) + '"'; + default: + throw new exception('impossible error: invalid scalar style'); + } + }()); +} + +// Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9. +function blockHeader(string, indentPerLevel) { + var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : ''; + + // note the special case: the string '\n' counts as a "trailing" empty line. + var clip = string[string.length - 1] === '\n'; + var keep = clip && (string[string.length - 2] === '\n' || string === '\n'); + var chomp = keep ? '+' : (clip ? '' : '-'); + + return indentIndicator + chomp + '\n'; +} + +// (See the note for writeScalar.) +function dropEndingNewline(string) { + return string[string.length - 1] === '\n' ? string.slice(0, -1) : string; +} + +// Note: a long line without a suitable break point will exceed the width limit. +// Pre-conditions: every char in str isPrintable, str.length > 0, width > 0. +function foldString(string, width) { + // In folded style, $k$ consecutive newlines output as $k+1$ newlines— + // unless they're before or after a more-indented line, or at the very + // beginning or end, in which case $k$ maps to $k$. + // Therefore, parse each chunk as newline(s) followed by a content line. + var lineRe = /(\n+)([^\n]*)/g; + + // first line (possibly an empty line) + var result = (function () { + var nextLF = string.indexOf('\n'); + nextLF = nextLF !== -1 ? nextLF : string.length; + lineRe.lastIndex = nextLF; + return foldLine(string.slice(0, nextLF), width); + }()); + // If we haven't reached the first content line yet, don't add an extra \n. + var prevMoreIndented = string[0] === '\n' || string[0] === ' '; + var moreIndented; + + // rest of the lines + var match; + while ((match = lineRe.exec(string))) { + var prefix = match[1], line = match[2]; + moreIndented = (line[0] === ' '); + result += prefix + + (!prevMoreIndented && !moreIndented && line !== '' + ? '\n' : '') + + foldLine(line, width); + prevMoreIndented = moreIndented; + } + + return result; +} + +// Greedy line breaking. +// Picks the longest line under the limit each time, +// otherwise settles for the shortest line over the limit. +// NB. More-indented lines *cannot* be folded, as that would add an extra \n. +function foldLine(line, width) { + if (line === '' || line[0] === ' ') return line; + + // Since a more-indented line adds a \n, breaks can't be followed by a space. + var breakRe = / [^ ]/g; // note: the match index will always be <= length-2. + var match; + // start is an inclusive index. end, curr, and next are exclusive. + var start = 0, end, curr = 0, next = 0; + var result = ''; + + // Invariants: 0 <= start <= length-1. + // 0 <= curr <= next <= max(0, length-2). curr - start <= width. + // Inside the loop: + // A match implies length >= 2, so curr and next are <= length-2. + while ((match = breakRe.exec(line))) { + next = match.index; + // maintain invariant: curr - start <= width + if (next - start > width) { + end = (curr > start) ? curr : next; // derive end <= length-2 + result += '\n' + line.slice(start, end); + // skip the space that was output as \n + start = end + 1; // derive start <= length-1 + } + curr = next; + } + + // By the invariants, start <= length-1, so there is something left over. + // It is either the whole string or a part starting from non-whitespace. + result += '\n'; + // Insert a break if the remainder is too long and there is a break available. + if (line.length - start > width && curr > start) { + result += line.slice(start, curr) + '\n' + line.slice(curr + 1); + } else { + result += line.slice(start); + } + + return result.slice(1); // drop extra \n joiner +} + +// Escapes a double-quoted string. +function escapeString(string) { + var result = ''; + var char = 0; + var escapeSeq; + + for (var i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { + char = codePointAt(string, i); + escapeSeq = ESCAPE_SEQUENCES[char]; + + if (!escapeSeq && isPrintable(char)) { + result += string[i]; + if (char >= 0x10000) result += string[i + 1]; + } else { + result += escapeSeq || encodeHex(char); + } + } + + return result; +} + +function writeFlowSequence(state, level, object) { + var _result = '', + _tag = state.tag, + index, + length, + value; + + for (index = 0, length = object.length; index < length; index += 1) { + value = object[index]; + + if (state.replacer) { + value = state.replacer.call(object, String(index), value); + } + + // Write only valid elements, put null instead of invalid elements. + if (writeNode(state, level, value, false, false) || + (typeof value === 'undefined' && + writeNode(state, level, null, false, false))) { + + if (_result !== '') _result += ',' + (!state.condenseFlow ? ' ' : ''); + _result += state.dump; + } + } + + state.tag = _tag; + state.dump = '[' + _result + ']'; +} + +function writeBlockSequence(state, level, object, compact) { + var _result = '', + _tag = state.tag, + index, + length, + value; + + for (index = 0, length = object.length; index < length; index += 1) { + value = object[index]; + + if (state.replacer) { + value = state.replacer.call(object, String(index), value); + } + + // Write only valid elements, put null instead of invalid elements. + if (writeNode(state, level + 1, value, true, true, false, true) || + (typeof value === 'undefined' && + writeNode(state, level + 1, null, true, true, false, true))) { + + if (!compact || _result !== '') { + _result += generateNextLine(state, level); + } + + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + _result += '-'; + } else { + _result += '- '; + } + + _result += state.dump; + } + } + + state.tag = _tag; + state.dump = _result || '[]'; // Empty sequence if no valid values. +} + +function writeFlowMapping(state, level, object) { + var _result = '', + _tag = state.tag, + objectKeyList = Object.keys(object), + index, + length, + objectKey, + objectValue, + pairBuffer; + + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + + pairBuffer = ''; + if (_result !== '') pairBuffer += ', '; + + if (state.condenseFlow) pairBuffer += '"'; + + objectKey = objectKeyList[index]; + objectValue = object[objectKey]; + + if (state.replacer) { + objectValue = state.replacer.call(object, objectKey, objectValue); + } + + if (!writeNode(state, level, objectKey, false, false)) { + continue; // Skip this pair because of invalid key; + } + + if (state.dump.length > 1024) pairBuffer += '? '; + + pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' '); + + if (!writeNode(state, level, objectValue, false, false)) { + continue; // Skip this pair because of invalid value. + } + + pairBuffer += state.dump; + + // Both key and value are valid. + _result += pairBuffer; + } + + state.tag = _tag; + state.dump = '{' + _result + '}'; +} + +function writeBlockMapping(state, level, object, compact) { + var _result = '', + _tag = state.tag, + objectKeyList = Object.keys(object), + index, + length, + objectKey, + objectValue, + explicitPair, + pairBuffer; + + // Allow sorting keys so that the output file is deterministic + if (state.sortKeys === true) { + // Default sorting + objectKeyList.sort(); + } else if (typeof state.sortKeys === 'function') { + // Custom sort function + objectKeyList.sort(state.sortKeys); + } else if (state.sortKeys) { + // Something is wrong + throw new exception('sortKeys must be a boolean or a function'); + } + + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + pairBuffer = ''; + + if (!compact || _result !== '') { + pairBuffer += generateNextLine(state, level); + } + + objectKey = objectKeyList[index]; + objectValue = object[objectKey]; + + if (state.replacer) { + objectValue = state.replacer.call(object, objectKey, objectValue); + } + + if (!writeNode(state, level + 1, objectKey, true, true, true)) { + continue; // Skip this pair because of invalid key. + } + + explicitPair = (state.tag !== null && state.tag !== '?') || + (state.dump && state.dump.length > 1024); + + if (explicitPair) { + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + pairBuffer += '?'; + } else { + pairBuffer += '? '; + } + } + + pairBuffer += state.dump; + + if (explicitPair) { + pairBuffer += generateNextLine(state, level); + } + + if (!writeNode(state, level + 1, objectValue, true, explicitPair)) { + continue; // Skip this pair because of invalid value. + } + + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + pairBuffer += ':'; + } else { + pairBuffer += ': '; + } + + pairBuffer += state.dump; + + // Both key and value are valid. + _result += pairBuffer; + } + + state.tag = _tag; + state.dump = _result || '{}'; // Empty mapping if no valid pairs. +} + +function detectType(state, object, explicit) { + var _result, typeList, index, length, type, style; + + typeList = explicit ? state.explicitTypes : state.implicitTypes; + + for (index = 0, length = typeList.length; index < length; index += 1) { + type = typeList[index]; + + if ((type.instanceOf || type.predicate) && + (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) && + (!type.predicate || type.predicate(object))) { + + if (explicit) { + if (type.multi && type.representName) { + state.tag = type.representName(object); + } else { + state.tag = type.tag; + } + } else { + state.tag = '?'; + } + + if (type.represent) { + style = state.styleMap[type.tag] || type.defaultStyle; + + if (_toString.call(type.represent) === '[object Function]') { + _result = type.represent(object, style); + } else if (_hasOwnProperty.call(type.represent, style)) { + _result = type.represent[style](object, style); + } else { + throw new exception('!<' + type.tag + '> tag resolver accepts not "' + style + '" style'); + } + + state.dump = _result; + } + + return true; + } + } + + return false; +} + +// Serializes `object` and writes it to global `result`. +// Returns true on success, or false on invalid object. +// +function writeNode(state, level, object, block, compact, iskey, isblockseq) { + state.tag = null; + state.dump = object; + + if (!detectType(state, object, false)) { + detectType(state, object, true); + } + + var type = _toString.call(state.dump); + var inblock = block; + var tagStr; + + if (block) { + block = (state.flowLevel < 0 || state.flowLevel > level); + } + + var objectOrArray = type === '[object Object]' || type === '[object Array]', + duplicateIndex, + duplicate; + + if (objectOrArray) { + duplicateIndex = state.duplicates.indexOf(object); + duplicate = duplicateIndex !== -1; + } + + if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) { + compact = false; + } + + if (duplicate && state.usedDuplicates[duplicateIndex]) { + state.dump = '*ref_' + duplicateIndex; + } else { + if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) { + state.usedDuplicates[duplicateIndex] = true; + } + if (type === '[object Object]') { + if (block && (Object.keys(state.dump).length !== 0)) { + writeBlockMapping(state, level, state.dump, compact); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + state.dump; + } + } else { + writeFlowMapping(state, level, state.dump); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; + } + } + } else if (type === '[object Array]') { + if (block && (state.dump.length !== 0)) { + if (state.noArrayIndent && !isblockseq && level > 0) { + writeBlockSequence(state, level - 1, state.dump, compact); + } else { + writeBlockSequence(state, level, state.dump, compact); + } + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + state.dump; + } + } else { + writeFlowSequence(state, level, state.dump); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; + } + } + } else if (type === '[object String]') { + if (state.tag !== '?') { + writeScalar(state, state.dump, level, iskey, inblock); + } + } else if (type === '[object Undefined]') { + return false; + } else { + if (state.skipInvalid) return false; + throw new exception('unacceptable kind of an object to dump ' + type); + } + + if (state.tag !== null && state.tag !== '?') { + // Need to encode all characters except those allowed by the spec: + // + // [35] ns-dec-digit ::= [#x30-#x39] /* 0-9 */ + // [36] ns-hex-digit ::= ns-dec-digit + // | [#x41-#x46] /* A-F */ | [#x61-#x66] /* a-f */ + // [37] ns-ascii-letter ::= [#x41-#x5A] /* A-Z */ | [#x61-#x7A] /* a-z */ + // [38] ns-word-char ::= ns-dec-digit | ns-ascii-letter | “-” + // [39] ns-uri-char ::= “%” ns-hex-digit ns-hex-digit | ns-word-char | “#” + // | “;” | “/” | “?” | “:” | “@” | “&” | “=” | “+” | “$” | “,” + // | “_” | “.” | “!” | “~” | “*” | “'” | “(” | “)” | “[” | “]” + // + // Also need to encode '!' because it has special meaning (end of tag prefix). + // + tagStr = encodeURI( + state.tag[0] === '!' ? state.tag.slice(1) : state.tag + ).replace(/!/g, '%21'); + + if (state.tag[0] === '!') { + tagStr = '!' + tagStr; + } else if (tagStr.slice(0, 18) === 'tag:yaml.org,2002:') { + tagStr = '!!' + tagStr.slice(18); + } else { + tagStr = '!<' + tagStr + '>'; + } + + state.dump = tagStr + ' ' + state.dump; + } + } + + return true; +} + +function getDuplicateReferences(object, state) { + var objects = [], + duplicatesIndexes = [], + index, + length; + + inspectNode(object, objects, duplicatesIndexes); + + for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) { + state.duplicates.push(objects[duplicatesIndexes[index]]); + } + state.usedDuplicates = new Array(length); +} + +function inspectNode(object, objects, duplicatesIndexes) { + var objectKeyList, + index, + length; + + if (object !== null && typeof object === 'object') { + index = objects.indexOf(object); + if (index !== -1) { + if (duplicatesIndexes.indexOf(index) === -1) { + duplicatesIndexes.push(index); + } + } else { + objects.push(object); + + if (Array.isArray(object)) { + for (index = 0, length = object.length; index < length; index += 1) { + inspectNode(object[index], objects, duplicatesIndexes); + } + } else { + objectKeyList = Object.keys(object); + + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes); + } + } + } + } +} + +function dump$1(input, options) { + options = options || {}; + + var state = new State(options); + + if (!state.noRefs) getDuplicateReferences(input, state); + + var value = input; + + if (state.replacer) { + value = state.replacer.call({ '': value }, '', value); + } + + if (writeNode(state, 0, value, true, true)) return state.dump + '\n'; + + return ''; +} + +var dump_1 = dump$1; + +var dumper = { + dump: dump_1 +}; + +function renamed(from, to) { + return function () { + throw new Error('Function yaml.' + from + ' is removed in js-yaml 4. ' + + 'Use yaml.' + to + ' instead, which is now safe by default.'); + }; +} + + +var Type = type; +var Schema = schema; +var FAILSAFE_SCHEMA = failsafe; +var JSON_SCHEMA = json; +var CORE_SCHEMA = core; +var DEFAULT_SCHEMA = _default; +var load = loader.load; +var loadAll = loader.loadAll; +var dump = dumper.dump; +var YAMLException = exception; + +// Re-export all types in case user wants to create custom schema +var types = { + binary: binary, + float: float, + map: map, + null: _null, + pairs: pairs, + set: set, + timestamp: timestamp, + bool: bool, + int: int, + merge: merge, + omap: omap, + seq: seq, + str: str +}; + +// Removed functions from JS-YAML 3.0.x +var safeLoad = renamed('safeLoad', 'load'); +var safeLoadAll = renamed('safeLoadAll', 'loadAll'); +var safeDump = renamed('safeDump', 'dump'); + +var jsYaml = { + Type: Type, + Schema: Schema, + FAILSAFE_SCHEMA: FAILSAFE_SCHEMA, + JSON_SCHEMA: JSON_SCHEMA, + CORE_SCHEMA: CORE_SCHEMA, + DEFAULT_SCHEMA: DEFAULT_SCHEMA, + load: load, + loadAll: loadAll, + dump: dump, + YAMLException: YAMLException, + types: types, + safeLoad: safeLoad, + safeLoadAll: safeLoadAll, + safeDump: safeDump +}; + +export default jsYaml; +export { CORE_SCHEMA, DEFAULT_SCHEMA, FAILSAFE_SCHEMA, JSON_SCHEMA, Schema, Type, YAMLException, dump, load, loadAll, safeDump, safeLoad, safeLoadAll, types }; diff --git a/node_modules/js-yaml/index.js b/node_modules/js-yaml/index.js new file mode 100644 index 0000000..bcb7eba --- /dev/null +++ b/node_modules/js-yaml/index.js @@ -0,0 +1,47 @@ +'use strict'; + + +var loader = require('./lib/loader'); +var dumper = require('./lib/dumper'); + + +function renamed(from, to) { + return function () { + throw new Error('Function yaml.' + from + ' is removed in js-yaml 4. ' + + 'Use yaml.' + to + ' instead, which is now safe by default.'); + }; +} + + +module.exports.Type = require('./lib/type'); +module.exports.Schema = require('./lib/schema'); +module.exports.FAILSAFE_SCHEMA = require('./lib/schema/failsafe'); +module.exports.JSON_SCHEMA = require('./lib/schema/json'); +module.exports.CORE_SCHEMA = require('./lib/schema/core'); +module.exports.DEFAULT_SCHEMA = require('./lib/schema/default'); +module.exports.load = loader.load; +module.exports.loadAll = loader.loadAll; +module.exports.dump = dumper.dump; +module.exports.YAMLException = require('./lib/exception'); + +// Re-export all types in case user wants to create custom schema +module.exports.types = { + binary: require('./lib/type/binary'), + float: require('./lib/type/float'), + map: require('./lib/type/map'), + null: require('./lib/type/null'), + pairs: require('./lib/type/pairs'), + set: require('./lib/type/set'), + timestamp: require('./lib/type/timestamp'), + bool: require('./lib/type/bool'), + int: require('./lib/type/int'), + merge: require('./lib/type/merge'), + omap: require('./lib/type/omap'), + seq: require('./lib/type/seq'), + str: require('./lib/type/str') +}; + +// Removed functions from JS-YAML 3.0.x +module.exports.safeLoad = renamed('safeLoad', 'load'); +module.exports.safeLoadAll = renamed('safeLoadAll', 'loadAll'); +module.exports.safeDump = renamed('safeDump', 'dump'); diff --git a/node_modules/js-yaml/lib/common.js b/node_modules/js-yaml/lib/common.js new file mode 100644 index 0000000..25ef7d8 --- /dev/null +++ b/node_modules/js-yaml/lib/common.js @@ -0,0 +1,59 @@ +'use strict'; + + +function isNothing(subject) { + return (typeof subject === 'undefined') || (subject === null); +} + + +function isObject(subject) { + return (typeof subject === 'object') && (subject !== null); +} + + +function toArray(sequence) { + if (Array.isArray(sequence)) return sequence; + else if (isNothing(sequence)) return []; + + return [ sequence ]; +} + + +function extend(target, source) { + var index, length, key, sourceKeys; + + if (source) { + sourceKeys = Object.keys(source); + + for (index = 0, length = sourceKeys.length; index < length; index += 1) { + key = sourceKeys[index]; + target[key] = source[key]; + } + } + + return target; +} + + +function repeat(string, count) { + var result = '', cycle; + + for (cycle = 0; cycle < count; cycle += 1) { + result += string; + } + + return result; +} + + +function isNegativeZero(number) { + return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number); +} + + +module.exports.isNothing = isNothing; +module.exports.isObject = isObject; +module.exports.toArray = toArray; +module.exports.repeat = repeat; +module.exports.isNegativeZero = isNegativeZero; +module.exports.extend = extend; diff --git a/node_modules/js-yaml/lib/dumper.js b/node_modules/js-yaml/lib/dumper.js new file mode 100644 index 0000000..f357a6a --- /dev/null +++ b/node_modules/js-yaml/lib/dumper.js @@ -0,0 +1,965 @@ +'use strict'; + +/*eslint-disable no-use-before-define*/ + +var common = require('./common'); +var YAMLException = require('./exception'); +var DEFAULT_SCHEMA = require('./schema/default'); + +var _toString = Object.prototype.toString; +var _hasOwnProperty = Object.prototype.hasOwnProperty; + +var CHAR_BOM = 0xFEFF; +var CHAR_TAB = 0x09; /* Tab */ +var CHAR_LINE_FEED = 0x0A; /* LF */ +var CHAR_CARRIAGE_RETURN = 0x0D; /* CR */ +var CHAR_SPACE = 0x20; /* Space */ +var CHAR_EXCLAMATION = 0x21; /* ! */ +var CHAR_DOUBLE_QUOTE = 0x22; /* " */ +var CHAR_SHARP = 0x23; /* # */ +var CHAR_PERCENT = 0x25; /* % */ +var CHAR_AMPERSAND = 0x26; /* & */ +var CHAR_SINGLE_QUOTE = 0x27; /* ' */ +var CHAR_ASTERISK = 0x2A; /* * */ +var CHAR_COMMA = 0x2C; /* , */ +var CHAR_MINUS = 0x2D; /* - */ +var CHAR_COLON = 0x3A; /* : */ +var CHAR_EQUALS = 0x3D; /* = */ +var CHAR_GREATER_THAN = 0x3E; /* > */ +var CHAR_QUESTION = 0x3F; /* ? */ +var CHAR_COMMERCIAL_AT = 0x40; /* @ */ +var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */ +var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */ +var CHAR_GRAVE_ACCENT = 0x60; /* ` */ +var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */ +var CHAR_VERTICAL_LINE = 0x7C; /* | */ +var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */ + +var ESCAPE_SEQUENCES = {}; + +ESCAPE_SEQUENCES[0x00] = '\\0'; +ESCAPE_SEQUENCES[0x07] = '\\a'; +ESCAPE_SEQUENCES[0x08] = '\\b'; +ESCAPE_SEQUENCES[0x09] = '\\t'; +ESCAPE_SEQUENCES[0x0A] = '\\n'; +ESCAPE_SEQUENCES[0x0B] = '\\v'; +ESCAPE_SEQUENCES[0x0C] = '\\f'; +ESCAPE_SEQUENCES[0x0D] = '\\r'; +ESCAPE_SEQUENCES[0x1B] = '\\e'; +ESCAPE_SEQUENCES[0x22] = '\\"'; +ESCAPE_SEQUENCES[0x5C] = '\\\\'; +ESCAPE_SEQUENCES[0x85] = '\\N'; +ESCAPE_SEQUENCES[0xA0] = '\\_'; +ESCAPE_SEQUENCES[0x2028] = '\\L'; +ESCAPE_SEQUENCES[0x2029] = '\\P'; + +var DEPRECATED_BOOLEANS_SYNTAX = [ + 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON', + 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF' +]; + +var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/; + +function compileStyleMap(schema, map) { + var result, keys, index, length, tag, style, type; + + if (map === null) return {}; + + result = {}; + keys = Object.keys(map); + + for (index = 0, length = keys.length; index < length; index += 1) { + tag = keys[index]; + style = String(map[tag]); + + if (tag.slice(0, 2) === '!!') { + tag = 'tag:yaml.org,2002:' + tag.slice(2); + } + type = schema.compiledTypeMap['fallback'][tag]; + + if (type && _hasOwnProperty.call(type.styleAliases, style)) { + style = type.styleAliases[style]; + } + + result[tag] = style; + } + + return result; +} + +function encodeHex(character) { + var string, handle, length; + + string = character.toString(16).toUpperCase(); + + if (character <= 0xFF) { + handle = 'x'; + length = 2; + } else if (character <= 0xFFFF) { + handle = 'u'; + length = 4; + } else if (character <= 0xFFFFFFFF) { + handle = 'U'; + length = 8; + } else { + throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF'); + } + + return '\\' + handle + common.repeat('0', length - string.length) + string; +} + + +var QUOTING_TYPE_SINGLE = 1, + QUOTING_TYPE_DOUBLE = 2; + +function State(options) { + this.schema = options['schema'] || DEFAULT_SCHEMA; + this.indent = Math.max(1, (options['indent'] || 2)); + this.noArrayIndent = options['noArrayIndent'] || false; + this.skipInvalid = options['skipInvalid'] || false; + this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']); + this.styleMap = compileStyleMap(this.schema, options['styles'] || null); + this.sortKeys = options['sortKeys'] || false; + this.lineWidth = options['lineWidth'] || 80; + this.noRefs = options['noRefs'] || false; + this.noCompatMode = options['noCompatMode'] || false; + this.condenseFlow = options['condenseFlow'] || false; + this.quotingType = options['quotingType'] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE; + this.forceQuotes = options['forceQuotes'] || false; + this.replacer = typeof options['replacer'] === 'function' ? options['replacer'] : null; + + this.implicitTypes = this.schema.compiledImplicit; + this.explicitTypes = this.schema.compiledExplicit; + + this.tag = null; + this.result = ''; + + this.duplicates = []; + this.usedDuplicates = null; +} + +// Indents every line in a string. Empty lines (\n only) are not indented. +function indentString(string, spaces) { + var ind = common.repeat(' ', spaces), + position = 0, + next = -1, + result = '', + line, + length = string.length; + + while (position < length) { + next = string.indexOf('\n', position); + if (next === -1) { + line = string.slice(position); + position = length; + } else { + line = string.slice(position, next + 1); + position = next + 1; + } + + if (line.length && line !== '\n') result += ind; + + result += line; + } + + return result; +} + +function generateNextLine(state, level) { + return '\n' + common.repeat(' ', state.indent * level); +} + +function testImplicitResolving(state, str) { + var index, length, type; + + for (index = 0, length = state.implicitTypes.length; index < length; index += 1) { + type = state.implicitTypes[index]; + + if (type.resolve(str)) { + return true; + } + } + + return false; +} + +// [33] s-white ::= s-space | s-tab +function isWhitespace(c) { + return c === CHAR_SPACE || c === CHAR_TAB; +} + +// Returns true if the character can be printed without escaping. +// From YAML 1.2: "any allowed characters known to be non-printable +// should also be escaped. [However,] This isn’t mandatory" +// Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029. +function isPrintable(c) { + return (0x00020 <= c && c <= 0x00007E) + || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029) + || ((0x0E000 <= c && c <= 0x00FFFD) && c !== CHAR_BOM) + || (0x10000 <= c && c <= 0x10FFFF); +} + +// [34] ns-char ::= nb-char - s-white +// [27] nb-char ::= c-printable - b-char - c-byte-order-mark +// [26] b-char ::= b-line-feed | b-carriage-return +// Including s-white (for some reason, examples doesn't match specs in this aspect) +// ns-char ::= c-printable - b-line-feed - b-carriage-return - c-byte-order-mark +function isNsCharOrWhitespace(c) { + return isPrintable(c) + && c !== CHAR_BOM + // - b-char + && c !== CHAR_CARRIAGE_RETURN + && c !== CHAR_LINE_FEED; +} + +// [127] ns-plain-safe(c) ::= c = flow-out ⇒ ns-plain-safe-out +// c = flow-in ⇒ ns-plain-safe-in +// c = block-key ⇒ ns-plain-safe-out +// c = flow-key ⇒ ns-plain-safe-in +// [128] ns-plain-safe-out ::= ns-char +// [129] ns-plain-safe-in ::= ns-char - c-flow-indicator +// [130] ns-plain-char(c) ::= ( ns-plain-safe(c) - “:” - “#” ) +// | ( /* An ns-char preceding */ “#” ) +// | ( “:” /* Followed by an ns-plain-safe(c) */ ) +function isPlainSafe(c, prev, inblock) { + var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c); + var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c); + return ( + // ns-plain-safe + inblock ? // c = flow-in + cIsNsCharOrWhitespace + : cIsNsCharOrWhitespace + // - c-flow-indicator + && c !== CHAR_COMMA + && c !== CHAR_LEFT_SQUARE_BRACKET + && c !== CHAR_RIGHT_SQUARE_BRACKET + && c !== CHAR_LEFT_CURLY_BRACKET + && c !== CHAR_RIGHT_CURLY_BRACKET + ) + // ns-plain-char + && c !== CHAR_SHARP // false on '#' + && !(prev === CHAR_COLON && !cIsNsChar) // false on ': ' + || (isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP) // change to true on '[^ ]#' + || (prev === CHAR_COLON && cIsNsChar); // change to true on ':[^ ]' +} + +// Simplified test for values allowed as the first character in plain style. +function isPlainSafeFirst(c) { + // Uses a subset of ns-char - c-indicator + // where ns-char = nb-char - s-white. + // No support of ( ( “?” | “:” | “-” ) /* Followed by an ns-plain-safe(c)) */ ) part + return isPrintable(c) && c !== CHAR_BOM + && !isWhitespace(c) // - s-white + // - (c-indicator ::= + // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}” + && c !== CHAR_MINUS + && c !== CHAR_QUESTION + && c !== CHAR_COLON + && c !== CHAR_COMMA + && c !== CHAR_LEFT_SQUARE_BRACKET + && c !== CHAR_RIGHT_SQUARE_BRACKET + && c !== CHAR_LEFT_CURLY_BRACKET + && c !== CHAR_RIGHT_CURLY_BRACKET + // | “#” | “&” | “*” | “!” | “|” | “=” | “>” | “'” | “"” + && c !== CHAR_SHARP + && c !== CHAR_AMPERSAND + && c !== CHAR_ASTERISK + && c !== CHAR_EXCLAMATION + && c !== CHAR_VERTICAL_LINE + && c !== CHAR_EQUALS + && c !== CHAR_GREATER_THAN + && c !== CHAR_SINGLE_QUOTE + && c !== CHAR_DOUBLE_QUOTE + // | “%” | “@” | “`”) + && c !== CHAR_PERCENT + && c !== CHAR_COMMERCIAL_AT + && c !== CHAR_GRAVE_ACCENT; +} + +// Simplified test for values allowed as the last character in plain style. +function isPlainSafeLast(c) { + // just not whitespace or colon, it will be checked to be plain character later + return !isWhitespace(c) && c !== CHAR_COLON; +} + +// Same as 'string'.codePointAt(pos), but works in older browsers. +function codePointAt(string, pos) { + var first = string.charCodeAt(pos), second; + if (first >= 0xD800 && first <= 0xDBFF && pos + 1 < string.length) { + second = string.charCodeAt(pos + 1); + if (second >= 0xDC00 && second <= 0xDFFF) { + // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae + return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000; + } + } + return first; +} + +// Determines whether block indentation indicator is required. +function needIndentIndicator(string) { + var leadingSpaceRe = /^\n* /; + return leadingSpaceRe.test(string); +} + +var STYLE_PLAIN = 1, + STYLE_SINGLE = 2, + STYLE_LITERAL = 3, + STYLE_FOLDED = 4, + STYLE_DOUBLE = 5; + +// Determines which scalar styles are possible and returns the preferred style. +// lineWidth = -1 => no limit. +// Pre-conditions: str.length > 0. +// Post-conditions: +// STYLE_PLAIN or STYLE_SINGLE => no \n are in the string. +// STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1). +// STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1). +function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, + testAmbiguousType, quotingType, forceQuotes, inblock) { + + var i; + var char = 0; + var prevChar = null; + var hasLineBreak = false; + var hasFoldableLine = false; // only checked if shouldTrackWidth + var shouldTrackWidth = lineWidth !== -1; + var previousLineBreak = -1; // count the first line correctly + var plain = isPlainSafeFirst(codePointAt(string, 0)) + && isPlainSafeLast(codePointAt(string, string.length - 1)); + + if (singleLineOnly || forceQuotes) { + // Case: no block styles. + // Check for disallowed characters to rule out plain and single. + for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { + char = codePointAt(string, i); + if (!isPrintable(char)) { + return STYLE_DOUBLE; + } + plain = plain && isPlainSafe(char, prevChar, inblock); + prevChar = char; + } + } else { + // Case: block styles permitted. + for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { + char = codePointAt(string, i); + if (char === CHAR_LINE_FEED) { + hasLineBreak = true; + // Check if any line can be folded. + if (shouldTrackWidth) { + hasFoldableLine = hasFoldableLine || + // Foldable line = too long, and not more-indented. + (i - previousLineBreak - 1 > lineWidth && + string[previousLineBreak + 1] !== ' '); + previousLineBreak = i; + } + } else if (!isPrintable(char)) { + return STYLE_DOUBLE; + } + plain = plain && isPlainSafe(char, prevChar, inblock); + prevChar = char; + } + // in case the end is missing a \n + hasFoldableLine = hasFoldableLine || (shouldTrackWidth && + (i - previousLineBreak - 1 > lineWidth && + string[previousLineBreak + 1] !== ' ')); + } + // Although every style can represent \n without escaping, prefer block styles + // for multiline, since they're more readable and they don't add empty lines. + // Also prefer folding a super-long line. + if (!hasLineBreak && !hasFoldableLine) { + // Strings interpretable as another type have to be quoted; + // e.g. the string 'true' vs. the boolean true. + if (plain && !forceQuotes && !testAmbiguousType(string)) { + return STYLE_PLAIN; + } + return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE; + } + // Edge case: block indentation indicator can only have one digit. + if (indentPerLevel > 9 && needIndentIndicator(string)) { + return STYLE_DOUBLE; + } + // At this point we know block styles are valid. + // Prefer literal style unless we want to fold. + if (!forceQuotes) { + return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL; + } + return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE; +} + +// Note: line breaking/folding is implemented for only the folded style. +// NB. We drop the last trailing newline (if any) of a returned block scalar +// since the dumper adds its own newline. This always works: +// • No ending newline => unaffected; already using strip "-" chomping. +// • Ending newline => removed then restored. +// Importantly, this keeps the "+" chomp indicator from gaining an extra line. +function writeScalar(state, string, level, iskey, inblock) { + state.dump = (function () { + if (string.length === 0) { + return state.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''"; + } + if (!state.noCompatMode) { + if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) { + return state.quotingType === QUOTING_TYPE_DOUBLE ? ('"' + string + '"') : ("'" + string + "'"); + } + } + + var indent = state.indent * Math.max(1, level); // no 0-indent scalars + // As indentation gets deeper, let the width decrease monotonically + // to the lower bound min(state.lineWidth, 40). + // Note that this implies + // state.lineWidth ≤ 40 + state.indent: width is fixed at the lower bound. + // state.lineWidth > 40 + state.indent: width decreases until the lower bound. + // This behaves better than a constant minimum width which disallows narrower options, + // or an indent threshold which causes the width to suddenly increase. + var lineWidth = state.lineWidth === -1 + ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent); + + // Without knowing if keys are implicit/explicit, assume implicit for safety. + var singleLineOnly = iskey + // No block styles in flow mode. + || (state.flowLevel > -1 && level >= state.flowLevel); + function testAmbiguity(string) { + return testImplicitResolving(state, string); + } + + switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, + testAmbiguity, state.quotingType, state.forceQuotes && !iskey, inblock)) { + + case STYLE_PLAIN: + return string; + case STYLE_SINGLE: + return "'" + string.replace(/'/g, "''") + "'"; + case STYLE_LITERAL: + return '|' + blockHeader(string, state.indent) + + dropEndingNewline(indentString(string, indent)); + case STYLE_FOLDED: + return '>' + blockHeader(string, state.indent) + + dropEndingNewline(indentString(foldString(string, lineWidth), indent)); + case STYLE_DOUBLE: + return '"' + escapeString(string, lineWidth) + '"'; + default: + throw new YAMLException('impossible error: invalid scalar style'); + } + }()); +} + +// Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9. +function blockHeader(string, indentPerLevel) { + var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : ''; + + // note the special case: the string '\n' counts as a "trailing" empty line. + var clip = string[string.length - 1] === '\n'; + var keep = clip && (string[string.length - 2] === '\n' || string === '\n'); + var chomp = keep ? '+' : (clip ? '' : '-'); + + return indentIndicator + chomp + '\n'; +} + +// (See the note for writeScalar.) +function dropEndingNewline(string) { + return string[string.length - 1] === '\n' ? string.slice(0, -1) : string; +} + +// Note: a long line without a suitable break point will exceed the width limit. +// Pre-conditions: every char in str isPrintable, str.length > 0, width > 0. +function foldString(string, width) { + // In folded style, $k$ consecutive newlines output as $k+1$ newlines— + // unless they're before or after a more-indented line, or at the very + // beginning or end, in which case $k$ maps to $k$. + // Therefore, parse each chunk as newline(s) followed by a content line. + var lineRe = /(\n+)([^\n]*)/g; + + // first line (possibly an empty line) + var result = (function () { + var nextLF = string.indexOf('\n'); + nextLF = nextLF !== -1 ? nextLF : string.length; + lineRe.lastIndex = nextLF; + return foldLine(string.slice(0, nextLF), width); + }()); + // If we haven't reached the first content line yet, don't add an extra \n. + var prevMoreIndented = string[0] === '\n' || string[0] === ' '; + var moreIndented; + + // rest of the lines + var match; + while ((match = lineRe.exec(string))) { + var prefix = match[1], line = match[2]; + moreIndented = (line[0] === ' '); + result += prefix + + (!prevMoreIndented && !moreIndented && line !== '' + ? '\n' : '') + + foldLine(line, width); + prevMoreIndented = moreIndented; + } + + return result; +} + +// Greedy line breaking. +// Picks the longest line under the limit each time, +// otherwise settles for the shortest line over the limit. +// NB. More-indented lines *cannot* be folded, as that would add an extra \n. +function foldLine(line, width) { + if (line === '' || line[0] === ' ') return line; + + // Since a more-indented line adds a \n, breaks can't be followed by a space. + var breakRe = / [^ ]/g; // note: the match index will always be <= length-2. + var match; + // start is an inclusive index. end, curr, and next are exclusive. + var start = 0, end, curr = 0, next = 0; + var result = ''; + + // Invariants: 0 <= start <= length-1. + // 0 <= curr <= next <= max(0, length-2). curr - start <= width. + // Inside the loop: + // A match implies length >= 2, so curr and next are <= length-2. + while ((match = breakRe.exec(line))) { + next = match.index; + // maintain invariant: curr - start <= width + if (next - start > width) { + end = (curr > start) ? curr : next; // derive end <= length-2 + result += '\n' + line.slice(start, end); + // skip the space that was output as \n + start = end + 1; // derive start <= length-1 + } + curr = next; + } + + // By the invariants, start <= length-1, so there is something left over. + // It is either the whole string or a part starting from non-whitespace. + result += '\n'; + // Insert a break if the remainder is too long and there is a break available. + if (line.length - start > width && curr > start) { + result += line.slice(start, curr) + '\n' + line.slice(curr + 1); + } else { + result += line.slice(start); + } + + return result.slice(1); // drop extra \n joiner +} + +// Escapes a double-quoted string. +function escapeString(string) { + var result = ''; + var char = 0; + var escapeSeq; + + for (var i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { + char = codePointAt(string, i); + escapeSeq = ESCAPE_SEQUENCES[char]; + + if (!escapeSeq && isPrintable(char)) { + result += string[i]; + if (char >= 0x10000) result += string[i + 1]; + } else { + result += escapeSeq || encodeHex(char); + } + } + + return result; +} + +function writeFlowSequence(state, level, object) { + var _result = '', + _tag = state.tag, + index, + length, + value; + + for (index = 0, length = object.length; index < length; index += 1) { + value = object[index]; + + if (state.replacer) { + value = state.replacer.call(object, String(index), value); + } + + // Write only valid elements, put null instead of invalid elements. + if (writeNode(state, level, value, false, false) || + (typeof value === 'undefined' && + writeNode(state, level, null, false, false))) { + + if (_result !== '') _result += ',' + (!state.condenseFlow ? ' ' : ''); + _result += state.dump; + } + } + + state.tag = _tag; + state.dump = '[' + _result + ']'; +} + +function writeBlockSequence(state, level, object, compact) { + var _result = '', + _tag = state.tag, + index, + length, + value; + + for (index = 0, length = object.length; index < length; index += 1) { + value = object[index]; + + if (state.replacer) { + value = state.replacer.call(object, String(index), value); + } + + // Write only valid elements, put null instead of invalid elements. + if (writeNode(state, level + 1, value, true, true, false, true) || + (typeof value === 'undefined' && + writeNode(state, level + 1, null, true, true, false, true))) { + + if (!compact || _result !== '') { + _result += generateNextLine(state, level); + } + + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + _result += '-'; + } else { + _result += '- '; + } + + _result += state.dump; + } + } + + state.tag = _tag; + state.dump = _result || '[]'; // Empty sequence if no valid values. +} + +function writeFlowMapping(state, level, object) { + var _result = '', + _tag = state.tag, + objectKeyList = Object.keys(object), + index, + length, + objectKey, + objectValue, + pairBuffer; + + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + + pairBuffer = ''; + if (_result !== '') pairBuffer += ', '; + + if (state.condenseFlow) pairBuffer += '"'; + + objectKey = objectKeyList[index]; + objectValue = object[objectKey]; + + if (state.replacer) { + objectValue = state.replacer.call(object, objectKey, objectValue); + } + + if (!writeNode(state, level, objectKey, false, false)) { + continue; // Skip this pair because of invalid key; + } + + if (state.dump.length > 1024) pairBuffer += '? '; + + pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' '); + + if (!writeNode(state, level, objectValue, false, false)) { + continue; // Skip this pair because of invalid value. + } + + pairBuffer += state.dump; + + // Both key and value are valid. + _result += pairBuffer; + } + + state.tag = _tag; + state.dump = '{' + _result + '}'; +} + +function writeBlockMapping(state, level, object, compact) { + var _result = '', + _tag = state.tag, + objectKeyList = Object.keys(object), + index, + length, + objectKey, + objectValue, + explicitPair, + pairBuffer; + + // Allow sorting keys so that the output file is deterministic + if (state.sortKeys === true) { + // Default sorting + objectKeyList.sort(); + } else if (typeof state.sortKeys === 'function') { + // Custom sort function + objectKeyList.sort(state.sortKeys); + } else if (state.sortKeys) { + // Something is wrong + throw new YAMLException('sortKeys must be a boolean or a function'); + } + + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + pairBuffer = ''; + + if (!compact || _result !== '') { + pairBuffer += generateNextLine(state, level); + } + + objectKey = objectKeyList[index]; + objectValue = object[objectKey]; + + if (state.replacer) { + objectValue = state.replacer.call(object, objectKey, objectValue); + } + + if (!writeNode(state, level + 1, objectKey, true, true, true)) { + continue; // Skip this pair because of invalid key. + } + + explicitPair = (state.tag !== null && state.tag !== '?') || + (state.dump && state.dump.length > 1024); + + if (explicitPair) { + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + pairBuffer += '?'; + } else { + pairBuffer += '? '; + } + } + + pairBuffer += state.dump; + + if (explicitPair) { + pairBuffer += generateNextLine(state, level); + } + + if (!writeNode(state, level + 1, objectValue, true, explicitPair)) { + continue; // Skip this pair because of invalid value. + } + + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + pairBuffer += ':'; + } else { + pairBuffer += ': '; + } + + pairBuffer += state.dump; + + // Both key and value are valid. + _result += pairBuffer; + } + + state.tag = _tag; + state.dump = _result || '{}'; // Empty mapping if no valid pairs. +} + +function detectType(state, object, explicit) { + var _result, typeList, index, length, type, style; + + typeList = explicit ? state.explicitTypes : state.implicitTypes; + + for (index = 0, length = typeList.length; index < length; index += 1) { + type = typeList[index]; + + if ((type.instanceOf || type.predicate) && + (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) && + (!type.predicate || type.predicate(object))) { + + if (explicit) { + if (type.multi && type.representName) { + state.tag = type.representName(object); + } else { + state.tag = type.tag; + } + } else { + state.tag = '?'; + } + + if (type.represent) { + style = state.styleMap[type.tag] || type.defaultStyle; + + if (_toString.call(type.represent) === '[object Function]') { + _result = type.represent(object, style); + } else if (_hasOwnProperty.call(type.represent, style)) { + _result = type.represent[style](object, style); + } else { + throw new YAMLException('!<' + type.tag + '> tag resolver accepts not "' + style + '" style'); + } + + state.dump = _result; + } + + return true; + } + } + + return false; +} + +// Serializes `object` and writes it to global `result`. +// Returns true on success, or false on invalid object. +// +function writeNode(state, level, object, block, compact, iskey, isblockseq) { + state.tag = null; + state.dump = object; + + if (!detectType(state, object, false)) { + detectType(state, object, true); + } + + var type = _toString.call(state.dump); + var inblock = block; + var tagStr; + + if (block) { + block = (state.flowLevel < 0 || state.flowLevel > level); + } + + var objectOrArray = type === '[object Object]' || type === '[object Array]', + duplicateIndex, + duplicate; + + if (objectOrArray) { + duplicateIndex = state.duplicates.indexOf(object); + duplicate = duplicateIndex !== -1; + } + + if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) { + compact = false; + } + + if (duplicate && state.usedDuplicates[duplicateIndex]) { + state.dump = '*ref_' + duplicateIndex; + } else { + if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) { + state.usedDuplicates[duplicateIndex] = true; + } + if (type === '[object Object]') { + if (block && (Object.keys(state.dump).length !== 0)) { + writeBlockMapping(state, level, state.dump, compact); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + state.dump; + } + } else { + writeFlowMapping(state, level, state.dump); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; + } + } + } else if (type === '[object Array]') { + if (block && (state.dump.length !== 0)) { + if (state.noArrayIndent && !isblockseq && level > 0) { + writeBlockSequence(state, level - 1, state.dump, compact); + } else { + writeBlockSequence(state, level, state.dump, compact); + } + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + state.dump; + } + } else { + writeFlowSequence(state, level, state.dump); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; + } + } + } else if (type === '[object String]') { + if (state.tag !== '?') { + writeScalar(state, state.dump, level, iskey, inblock); + } + } else if (type === '[object Undefined]') { + return false; + } else { + if (state.skipInvalid) return false; + throw new YAMLException('unacceptable kind of an object to dump ' + type); + } + + if (state.tag !== null && state.tag !== '?') { + // Need to encode all characters except those allowed by the spec: + // + // [35] ns-dec-digit ::= [#x30-#x39] /* 0-9 */ + // [36] ns-hex-digit ::= ns-dec-digit + // | [#x41-#x46] /* A-F */ | [#x61-#x66] /* a-f */ + // [37] ns-ascii-letter ::= [#x41-#x5A] /* A-Z */ | [#x61-#x7A] /* a-z */ + // [38] ns-word-char ::= ns-dec-digit | ns-ascii-letter | “-” + // [39] ns-uri-char ::= “%” ns-hex-digit ns-hex-digit | ns-word-char | “#” + // | “;” | “/” | “?” | “:” | “@” | “&” | “=” | “+” | “$” | “,” + // | “_” | “.” | “!” | “~” | “*” | “'” | “(” | “)” | “[” | “]” + // + // Also need to encode '!' because it has special meaning (end of tag prefix). + // + tagStr = encodeURI( + state.tag[0] === '!' ? state.tag.slice(1) : state.tag + ).replace(/!/g, '%21'); + + if (state.tag[0] === '!') { + tagStr = '!' + tagStr; + } else if (tagStr.slice(0, 18) === 'tag:yaml.org,2002:') { + tagStr = '!!' + tagStr.slice(18); + } else { + tagStr = '!<' + tagStr + '>'; + } + + state.dump = tagStr + ' ' + state.dump; + } + } + + return true; +} + +function getDuplicateReferences(object, state) { + var objects = [], + duplicatesIndexes = [], + index, + length; + + inspectNode(object, objects, duplicatesIndexes); + + for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) { + state.duplicates.push(objects[duplicatesIndexes[index]]); + } + state.usedDuplicates = new Array(length); +} + +function inspectNode(object, objects, duplicatesIndexes) { + var objectKeyList, + index, + length; + + if (object !== null && typeof object === 'object') { + index = objects.indexOf(object); + if (index !== -1) { + if (duplicatesIndexes.indexOf(index) === -1) { + duplicatesIndexes.push(index); + } + } else { + objects.push(object); + + if (Array.isArray(object)) { + for (index = 0, length = object.length; index < length; index += 1) { + inspectNode(object[index], objects, duplicatesIndexes); + } + } else { + objectKeyList = Object.keys(object); + + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes); + } + } + } + } +} + +function dump(input, options) { + options = options || {}; + + var state = new State(options); + + if (!state.noRefs) getDuplicateReferences(input, state); + + var value = input; + + if (state.replacer) { + value = state.replacer.call({ '': value }, '', value); + } + + if (writeNode(state, 0, value, true, true)) return state.dump + '\n'; + + return ''; +} + +module.exports.dump = dump; diff --git a/node_modules/js-yaml/lib/exception.js b/node_modules/js-yaml/lib/exception.js new file mode 100644 index 0000000..7f62daa --- /dev/null +++ b/node_modules/js-yaml/lib/exception.js @@ -0,0 +1,55 @@ +// YAML error class. http://stackoverflow.com/questions/8458984 +// +'use strict'; + + +function formatError(exception, compact) { + var where = '', message = exception.reason || '(unknown reason)'; + + if (!exception.mark) return message; + + if (exception.mark.name) { + where += 'in "' + exception.mark.name + '" '; + } + + where += '(' + (exception.mark.line + 1) + ':' + (exception.mark.column + 1) + ')'; + + if (!compact && exception.mark.snippet) { + where += '\n\n' + exception.mark.snippet; + } + + return message + ' ' + where; +} + + +function YAMLException(reason, mark) { + // Super constructor + Error.call(this); + + this.name = 'YAMLException'; + this.reason = reason; + this.mark = mark; + this.message = formatError(this, false); + + // Include stack trace in error object + if (Error.captureStackTrace) { + // Chrome and NodeJS + Error.captureStackTrace(this, this.constructor); + } else { + // FF, IE 10+ and Safari 6+. Fallback for others + this.stack = (new Error()).stack || ''; + } +} + + +// Inherit from Error +YAMLException.prototype = Object.create(Error.prototype); +YAMLException.prototype.constructor = YAMLException; + + +YAMLException.prototype.toString = function toString(compact) { + return this.name + ': ' + formatError(this, compact); +}; + + +module.exports = YAMLException; diff --git a/node_modules/js-yaml/lib/loader.js b/node_modules/js-yaml/lib/loader.js new file mode 100644 index 0000000..39f13f5 --- /dev/null +++ b/node_modules/js-yaml/lib/loader.js @@ -0,0 +1,1727 @@ +'use strict'; + +/*eslint-disable max-len,no-use-before-define*/ + +var common = require('./common'); +var YAMLException = require('./exception'); +var makeSnippet = require('./snippet'); +var DEFAULT_SCHEMA = require('./schema/default'); + + +var _hasOwnProperty = Object.prototype.hasOwnProperty; + + +var CONTEXT_FLOW_IN = 1; +var CONTEXT_FLOW_OUT = 2; +var CONTEXT_BLOCK_IN = 3; +var CONTEXT_BLOCK_OUT = 4; + + +var CHOMPING_CLIP = 1; +var CHOMPING_STRIP = 2; +var CHOMPING_KEEP = 3; + + +var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; +var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/; +var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/; +var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i; +var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i; + + +function _class(obj) { return Object.prototype.toString.call(obj); } + +function is_EOL(c) { + return (c === 0x0A/* LF */) || (c === 0x0D/* CR */); +} + +function is_WHITE_SPACE(c) { + return (c === 0x09/* Tab */) || (c === 0x20/* Space */); +} + +function is_WS_OR_EOL(c) { + return (c === 0x09/* Tab */) || + (c === 0x20/* Space */) || + (c === 0x0A/* LF */) || + (c === 0x0D/* CR */); +} + +function is_FLOW_INDICATOR(c) { + return c === 0x2C/* , */ || + c === 0x5B/* [ */ || + c === 0x5D/* ] */ || + c === 0x7B/* { */ || + c === 0x7D/* } */; +} + +function fromHexCode(c) { + var lc; + + if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { + return c - 0x30; + } + + /*eslint-disable no-bitwise*/ + lc = c | 0x20; + + if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) { + return lc - 0x61 + 10; + } + + return -1; +} + +function escapedHexLen(c) { + if (c === 0x78/* x */) { return 2; } + if (c === 0x75/* u */) { return 4; } + if (c === 0x55/* U */) { return 8; } + return 0; +} + +function fromDecimalCode(c) { + if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { + return c - 0x30; + } + + return -1; +} + +function simpleEscapeSequence(c) { + /* eslint-disable indent */ + return (c === 0x30/* 0 */) ? '\x00' : + (c === 0x61/* a */) ? '\x07' : + (c === 0x62/* b */) ? '\x08' : + (c === 0x74/* t */) ? '\x09' : + (c === 0x09/* Tab */) ? '\x09' : + (c === 0x6E/* n */) ? '\x0A' : + (c === 0x76/* v */) ? '\x0B' : + (c === 0x66/* f */) ? '\x0C' : + (c === 0x72/* r */) ? '\x0D' : + (c === 0x65/* e */) ? '\x1B' : + (c === 0x20/* Space */) ? ' ' : + (c === 0x22/* " */) ? '\x22' : + (c === 0x2F/* / */) ? '/' : + (c === 0x5C/* \ */) ? '\x5C' : + (c === 0x4E/* N */) ? '\x85' : + (c === 0x5F/* _ */) ? '\xA0' : + (c === 0x4C/* L */) ? '\u2028' : + (c === 0x50/* P */) ? '\u2029' : ''; +} + +function charFromCodepoint(c) { + if (c <= 0xFFFF) { + return String.fromCharCode(c); + } + // Encode UTF-16 surrogate pair + // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF + return String.fromCharCode( + ((c - 0x010000) >> 10) + 0xD800, + ((c - 0x010000) & 0x03FF) + 0xDC00 + ); +} + +var simpleEscapeCheck = new Array(256); // integer, for fast access +var simpleEscapeMap = new Array(256); +for (var i = 0; i < 256; i++) { + simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0; + simpleEscapeMap[i] = simpleEscapeSequence(i); +} + + +function State(input, options) { + this.input = input; + + this.filename = options['filename'] || null; + this.schema = options['schema'] || DEFAULT_SCHEMA; + this.onWarning = options['onWarning'] || null; + // (Hidden) Remove? makes the loader to expect YAML 1.1 documents + // if such documents have no explicit %YAML directive + this.legacy = options['legacy'] || false; + + this.json = options['json'] || false; + this.listener = options['listener'] || null; + + this.implicitTypes = this.schema.compiledImplicit; + this.typeMap = this.schema.compiledTypeMap; + + this.length = input.length; + this.position = 0; + this.line = 0; + this.lineStart = 0; + this.lineIndent = 0; + + // position of first leading tab in the current line, + // used to make sure there are no tabs in the indentation + this.firstTabInLine = -1; + + this.documents = []; + + /* + this.version; + this.checkLineBreaks; + this.tagMap; + this.anchorMap; + this.tag; + this.anchor; + this.kind; + this.result;*/ + +} + + +function generateError(state, message) { + var mark = { + name: state.filename, + buffer: state.input.slice(0, -1), // omit trailing \0 + position: state.position, + line: state.line, + column: state.position - state.lineStart + }; + + mark.snippet = makeSnippet(mark); + + return new YAMLException(message, mark); +} + +function throwError(state, message) { + throw generateError(state, message); +} + +function throwWarning(state, message) { + if (state.onWarning) { + state.onWarning.call(null, generateError(state, message)); + } +} + + +var directiveHandlers = { + + YAML: function handleYamlDirective(state, name, args) { + + var match, major, minor; + + if (state.version !== null) { + throwError(state, 'duplication of %YAML directive'); + } + + if (args.length !== 1) { + throwError(state, 'YAML directive accepts exactly one argument'); + } + + match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]); + + if (match === null) { + throwError(state, 'ill-formed argument of the YAML directive'); + } + + major = parseInt(match[1], 10); + minor = parseInt(match[2], 10); + + if (major !== 1) { + throwError(state, 'unacceptable YAML version of the document'); + } + + state.version = args[0]; + state.checkLineBreaks = (minor < 2); + + if (minor !== 1 && minor !== 2) { + throwWarning(state, 'unsupported YAML version of the document'); + } + }, + + TAG: function handleTagDirective(state, name, args) { + + var handle, prefix; + + if (args.length !== 2) { + throwError(state, 'TAG directive accepts exactly two arguments'); + } + + handle = args[0]; + prefix = args[1]; + + if (!PATTERN_TAG_HANDLE.test(handle)) { + throwError(state, 'ill-formed tag handle (first argument) of the TAG directive'); + } + + if (_hasOwnProperty.call(state.tagMap, handle)) { + throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle'); + } + + if (!PATTERN_TAG_URI.test(prefix)) { + throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive'); + } + + try { + prefix = decodeURIComponent(prefix); + } catch (err) { + throwError(state, 'tag prefix is malformed: ' + prefix); + } + + state.tagMap[handle] = prefix; + } +}; + + +function captureSegment(state, start, end, checkJson) { + var _position, _length, _character, _result; + + if (start < end) { + _result = state.input.slice(start, end); + + if (checkJson) { + for (_position = 0, _length = _result.length; _position < _length; _position += 1) { + _character = _result.charCodeAt(_position); + if (!(_character === 0x09 || + (0x20 <= _character && _character <= 0x10FFFF))) { + throwError(state, 'expected valid JSON character'); + } + } + } else if (PATTERN_NON_PRINTABLE.test(_result)) { + throwError(state, 'the stream contains non-printable characters'); + } + + state.result += _result; + } +} + +function mergeMappings(state, destination, source, overridableKeys) { + var sourceKeys, key, index, quantity; + + if (!common.isObject(source)) { + throwError(state, 'cannot merge mappings; the provided source object is unacceptable'); + } + + sourceKeys = Object.keys(source); + + for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) { + key = sourceKeys[index]; + + if (!_hasOwnProperty.call(destination, key)) { + destination[key] = source[key]; + overridableKeys[key] = true; + } + } +} + +function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, + startLine, startLineStart, startPos) { + + var index, quantity; + + // The output is a plain object here, so keys can only be strings. + // We need to convert keyNode to a string, but doing so can hang the process + // (deeply nested arrays that explode exponentially using aliases). + if (Array.isArray(keyNode)) { + keyNode = Array.prototype.slice.call(keyNode); + + for (index = 0, quantity = keyNode.length; index < quantity; index += 1) { + if (Array.isArray(keyNode[index])) { + throwError(state, 'nested arrays are not supported inside keys'); + } + + if (typeof keyNode === 'object' && _class(keyNode[index]) === '[object Object]') { + keyNode[index] = '[object Object]'; + } + } + } + + // Avoid code execution in load() via toString property + // (still use its own toString for arrays, timestamps, + // and whatever user schema extensions happen to have @@toStringTag) + if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') { + keyNode = '[object Object]'; + } + + + keyNode = String(keyNode); + + if (_result === null) { + _result = {}; + } + + if (keyTag === 'tag:yaml.org,2002:merge') { + if (Array.isArray(valueNode)) { + for (index = 0, quantity = valueNode.length; index < quantity; index += 1) { + mergeMappings(state, _result, valueNode[index], overridableKeys); + } + } else { + mergeMappings(state, _result, valueNode, overridableKeys); + } + } else { + if (!state.json && + !_hasOwnProperty.call(overridableKeys, keyNode) && + _hasOwnProperty.call(_result, keyNode)) { + state.line = startLine || state.line; + state.lineStart = startLineStart || state.lineStart; + state.position = startPos || state.position; + throwError(state, 'duplicated mapping key'); + } + + // used for this specific key only because Object.defineProperty is slow + if (keyNode === '__proto__') { + Object.defineProperty(_result, keyNode, { + configurable: true, + enumerable: true, + writable: true, + value: valueNode + }); + } else { + _result[keyNode] = valueNode; + } + delete overridableKeys[keyNode]; + } + + return _result; +} + +function readLineBreak(state) { + var ch; + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x0A/* LF */) { + state.position++; + } else if (ch === 0x0D/* CR */) { + state.position++; + if (state.input.charCodeAt(state.position) === 0x0A/* LF */) { + state.position++; + } + } else { + throwError(state, 'a line break is expected'); + } + + state.line += 1; + state.lineStart = state.position; + state.firstTabInLine = -1; +} + +function skipSeparationSpace(state, allowComments, checkIndent) { + var lineBreaks = 0, + ch = state.input.charCodeAt(state.position); + + while (ch !== 0) { + while (is_WHITE_SPACE(ch)) { + if (ch === 0x09/* Tab */ && state.firstTabInLine === -1) { + state.firstTabInLine = state.position; + } + ch = state.input.charCodeAt(++state.position); + } + + if (allowComments && ch === 0x23/* # */) { + do { + ch = state.input.charCodeAt(++state.position); + } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0); + } + + if (is_EOL(ch)) { + readLineBreak(state); + + ch = state.input.charCodeAt(state.position); + lineBreaks++; + state.lineIndent = 0; + + while (ch === 0x20/* Space */) { + state.lineIndent++; + ch = state.input.charCodeAt(++state.position); + } + } else { + break; + } + } + + if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) { + throwWarning(state, 'deficient indentation'); + } + + return lineBreaks; +} + +function testDocumentSeparator(state) { + var _position = state.position, + ch; + + ch = state.input.charCodeAt(_position); + + // Condition state.position === state.lineStart is tested + // in parent on each call, for efficiency. No needs to test here again. + if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) && + ch === state.input.charCodeAt(_position + 1) && + ch === state.input.charCodeAt(_position + 2)) { + + _position += 3; + + ch = state.input.charCodeAt(_position); + + if (ch === 0 || is_WS_OR_EOL(ch)) { + return true; + } + } + + return false; +} + +function writeFoldedLines(state, count) { + if (count === 1) { + state.result += ' '; + } else if (count > 1) { + state.result += common.repeat('\n', count - 1); + } +} + + +function readPlainScalar(state, nodeIndent, withinFlowCollection) { + var preceding, + following, + captureStart, + captureEnd, + hasPendingContent, + _line, + _lineStart, + _lineIndent, + _kind = state.kind, + _result = state.result, + ch; + + ch = state.input.charCodeAt(state.position); + + if (is_WS_OR_EOL(ch) || + is_FLOW_INDICATOR(ch) || + ch === 0x23/* # */ || + ch === 0x26/* & */ || + ch === 0x2A/* * */ || + ch === 0x21/* ! */ || + ch === 0x7C/* | */ || + ch === 0x3E/* > */ || + ch === 0x27/* ' */ || + ch === 0x22/* " */ || + ch === 0x25/* % */ || + ch === 0x40/* @ */ || + ch === 0x60/* ` */) { + return false; + } + + if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) { + following = state.input.charCodeAt(state.position + 1); + + if (is_WS_OR_EOL(following) || + withinFlowCollection && is_FLOW_INDICATOR(following)) { + return false; + } + } + + state.kind = 'scalar'; + state.result = ''; + captureStart = captureEnd = state.position; + hasPendingContent = false; + + while (ch !== 0) { + if (ch === 0x3A/* : */) { + following = state.input.charCodeAt(state.position + 1); + + if (is_WS_OR_EOL(following) || + withinFlowCollection && is_FLOW_INDICATOR(following)) { + break; + } + + } else if (ch === 0x23/* # */) { + preceding = state.input.charCodeAt(state.position - 1); + + if (is_WS_OR_EOL(preceding)) { + break; + } + + } else if ((state.position === state.lineStart && testDocumentSeparator(state)) || + withinFlowCollection && is_FLOW_INDICATOR(ch)) { + break; + + } else if (is_EOL(ch)) { + _line = state.line; + _lineStart = state.lineStart; + _lineIndent = state.lineIndent; + skipSeparationSpace(state, false, -1); + + if (state.lineIndent >= nodeIndent) { + hasPendingContent = true; + ch = state.input.charCodeAt(state.position); + continue; + } else { + state.position = captureEnd; + state.line = _line; + state.lineStart = _lineStart; + state.lineIndent = _lineIndent; + break; + } + } + + if (hasPendingContent) { + captureSegment(state, captureStart, captureEnd, false); + writeFoldedLines(state, state.line - _line); + captureStart = captureEnd = state.position; + hasPendingContent = false; + } + + if (!is_WHITE_SPACE(ch)) { + captureEnd = state.position + 1; + } + + ch = state.input.charCodeAt(++state.position); + } + + captureSegment(state, captureStart, captureEnd, false); + + if (state.result) { + return true; + } + + state.kind = _kind; + state.result = _result; + return false; +} + +function readSingleQuotedScalar(state, nodeIndent) { + var ch, + captureStart, captureEnd; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x27/* ' */) { + return false; + } + + state.kind = 'scalar'; + state.result = ''; + state.position++; + captureStart = captureEnd = state.position; + + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + if (ch === 0x27/* ' */) { + captureSegment(state, captureStart, state.position, true); + ch = state.input.charCodeAt(++state.position); + + if (ch === 0x27/* ' */) { + captureStart = state.position; + state.position++; + captureEnd = state.position; + } else { + return true; + } + + } else if (is_EOL(ch)) { + captureSegment(state, captureStart, captureEnd, true); + writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); + captureStart = captureEnd = state.position; + + } else if (state.position === state.lineStart && testDocumentSeparator(state)) { + throwError(state, 'unexpected end of the document within a single quoted scalar'); + + } else { + state.position++; + captureEnd = state.position; + } + } + + throwError(state, 'unexpected end of the stream within a single quoted scalar'); +} + +function readDoubleQuotedScalar(state, nodeIndent) { + var captureStart, + captureEnd, + hexLength, + hexResult, + tmp, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x22/* " */) { + return false; + } + + state.kind = 'scalar'; + state.result = ''; + state.position++; + captureStart = captureEnd = state.position; + + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + if (ch === 0x22/* " */) { + captureSegment(state, captureStart, state.position, true); + state.position++; + return true; + + } else if (ch === 0x5C/* \ */) { + captureSegment(state, captureStart, state.position, true); + ch = state.input.charCodeAt(++state.position); + + if (is_EOL(ch)) { + skipSeparationSpace(state, false, nodeIndent); + + // TODO: rework to inline fn with no type cast? + } else if (ch < 256 && simpleEscapeCheck[ch]) { + state.result += simpleEscapeMap[ch]; + state.position++; + + } else if ((tmp = escapedHexLen(ch)) > 0) { + hexLength = tmp; + hexResult = 0; + + for (; hexLength > 0; hexLength--) { + ch = state.input.charCodeAt(++state.position); + + if ((tmp = fromHexCode(ch)) >= 0) { + hexResult = (hexResult << 4) + tmp; + + } else { + throwError(state, 'expected hexadecimal character'); + } + } + + state.result += charFromCodepoint(hexResult); + + state.position++; + + } else { + throwError(state, 'unknown escape sequence'); + } + + captureStart = captureEnd = state.position; + + } else if (is_EOL(ch)) { + captureSegment(state, captureStart, captureEnd, true); + writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); + captureStart = captureEnd = state.position; + + } else if (state.position === state.lineStart && testDocumentSeparator(state)) { + throwError(state, 'unexpected end of the document within a double quoted scalar'); + + } else { + state.position++; + captureEnd = state.position; + } + } + + throwError(state, 'unexpected end of the stream within a double quoted scalar'); +} + +function readFlowCollection(state, nodeIndent) { + var readNext = true, + _line, + _lineStart, + _pos, + _tag = state.tag, + _result, + _anchor = state.anchor, + following, + terminator, + isPair, + isExplicitPair, + isMapping, + overridableKeys = Object.create(null), + keyNode, + keyTag, + valueNode, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x5B/* [ */) { + terminator = 0x5D;/* ] */ + isMapping = false; + _result = []; + } else if (ch === 0x7B/* { */) { + terminator = 0x7D;/* } */ + isMapping = true; + _result = {}; + } else { + return false; + } + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } + + ch = state.input.charCodeAt(++state.position); + + while (ch !== 0) { + skipSeparationSpace(state, true, nodeIndent); + + ch = state.input.charCodeAt(state.position); + + if (ch === terminator) { + state.position++; + state.tag = _tag; + state.anchor = _anchor; + state.kind = isMapping ? 'mapping' : 'sequence'; + state.result = _result; + return true; + } else if (!readNext) { + throwError(state, 'missed comma between flow collection entries'); + } else if (ch === 0x2C/* , */) { + // "flow collection entries can never be completely empty", as per YAML 1.2, section 7.4 + throwError(state, "expected the node content, but found ','"); + } + + keyTag = keyNode = valueNode = null; + isPair = isExplicitPair = false; + + if (ch === 0x3F/* ? */) { + following = state.input.charCodeAt(state.position + 1); + + if (is_WS_OR_EOL(following)) { + isPair = isExplicitPair = true; + state.position++; + skipSeparationSpace(state, true, nodeIndent); + } + } + + _line = state.line; // Save the current line. + _lineStart = state.lineStart; + _pos = state.position; + composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); + keyTag = state.tag; + keyNode = state.result; + skipSeparationSpace(state, true, nodeIndent); + + ch = state.input.charCodeAt(state.position); + + if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) { + isPair = true; + ch = state.input.charCodeAt(++state.position); + skipSeparationSpace(state, true, nodeIndent); + composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); + valueNode = state.result; + } + + if (isMapping) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos); + } else if (isPair) { + _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos)); + } else { + _result.push(keyNode); + } + + skipSeparationSpace(state, true, nodeIndent); + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x2C/* , */) { + readNext = true; + ch = state.input.charCodeAt(++state.position); + } else { + readNext = false; + } + } + + throwError(state, 'unexpected end of the stream within a flow collection'); +} + +function readBlockScalar(state, nodeIndent) { + var captureStart, + folding, + chomping = CHOMPING_CLIP, + didReadContent = false, + detectedIndent = false, + textIndent = nodeIndent, + emptyLines = 0, + atMoreIndented = false, + tmp, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x7C/* | */) { + folding = false; + } else if (ch === 0x3E/* > */) { + folding = true; + } else { + return false; + } + + state.kind = 'scalar'; + state.result = ''; + + while (ch !== 0) { + ch = state.input.charCodeAt(++state.position); + + if (ch === 0x2B/* + */ || ch === 0x2D/* - */) { + if (CHOMPING_CLIP === chomping) { + chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP; + } else { + throwError(state, 'repeat of a chomping mode identifier'); + } + + } else if ((tmp = fromDecimalCode(ch)) >= 0) { + if (tmp === 0) { + throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one'); + } else if (!detectedIndent) { + textIndent = nodeIndent + tmp - 1; + detectedIndent = true; + } else { + throwError(state, 'repeat of an indentation width identifier'); + } + + } else { + break; + } + } + + if (is_WHITE_SPACE(ch)) { + do { ch = state.input.charCodeAt(++state.position); } + while (is_WHITE_SPACE(ch)); + + if (ch === 0x23/* # */) { + do { ch = state.input.charCodeAt(++state.position); } + while (!is_EOL(ch) && (ch !== 0)); + } + } + + while (ch !== 0) { + readLineBreak(state); + state.lineIndent = 0; + + ch = state.input.charCodeAt(state.position); + + while ((!detectedIndent || state.lineIndent < textIndent) && + (ch === 0x20/* Space */)) { + state.lineIndent++; + ch = state.input.charCodeAt(++state.position); + } + + if (!detectedIndent && state.lineIndent > textIndent) { + textIndent = state.lineIndent; + } + + if (is_EOL(ch)) { + emptyLines++; + continue; + } + + // End of the scalar. + if (state.lineIndent < textIndent) { + + // Perform the chomping. + if (chomping === CHOMPING_KEEP) { + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + } else if (chomping === CHOMPING_CLIP) { + if (didReadContent) { // i.e. only if the scalar is not empty. + state.result += '\n'; + } + } + + // Break this `while` cycle and go to the funciton's epilogue. + break; + } + + // Folded style: use fancy rules to handle line breaks. + if (folding) { + + // Lines starting with white space characters (more-indented lines) are not folded. + if (is_WHITE_SPACE(ch)) { + atMoreIndented = true; + // except for the first content line (cf. Example 8.1) + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + + // End of more-indented block. + } else if (atMoreIndented) { + atMoreIndented = false; + state.result += common.repeat('\n', emptyLines + 1); + + // Just one line break - perceive as the same line. + } else if (emptyLines === 0) { + if (didReadContent) { // i.e. only if we have already read some scalar content. + state.result += ' '; + } + + // Several line breaks - perceive as different lines. + } else { + state.result += common.repeat('\n', emptyLines); + } + + // Literal style: just add exact number of line breaks between content lines. + } else { + // Keep all line breaks except the header line break. + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + } + + didReadContent = true; + detectedIndent = true; + emptyLines = 0; + captureStart = state.position; + + while (!is_EOL(ch) && (ch !== 0)) { + ch = state.input.charCodeAt(++state.position); + } + + captureSegment(state, captureStart, state.position, false); + } + + return true; +} + +function readBlockSequence(state, nodeIndent) { + var _line, + _tag = state.tag, + _anchor = state.anchor, + _result = [], + following, + detected = false, + ch; + + // there is a leading tab before this token, so it can't be a block sequence/mapping; + // it can still be flow sequence/mapping or a scalar + if (state.firstTabInLine !== -1) return false; + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } + + ch = state.input.charCodeAt(state.position); + + while (ch !== 0) { + if (state.firstTabInLine !== -1) { + state.position = state.firstTabInLine; + throwError(state, 'tab characters must not be used in indentation'); + } + + if (ch !== 0x2D/* - */) { + break; + } + + following = state.input.charCodeAt(state.position + 1); + + if (!is_WS_OR_EOL(following)) { + break; + } + + detected = true; + state.position++; + + if (skipSeparationSpace(state, true, -1)) { + if (state.lineIndent <= nodeIndent) { + _result.push(null); + ch = state.input.charCodeAt(state.position); + continue; + } + } + + _line = state.line; + composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true); + _result.push(state.result); + skipSeparationSpace(state, true, -1); + + ch = state.input.charCodeAt(state.position); + + if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { + throwError(state, 'bad indentation of a sequence entry'); + } else if (state.lineIndent < nodeIndent) { + break; + } + } + + if (detected) { + state.tag = _tag; + state.anchor = _anchor; + state.kind = 'sequence'; + state.result = _result; + return true; + } + return false; +} + +function readBlockMapping(state, nodeIndent, flowIndent) { + var following, + allowCompact, + _line, + _keyLine, + _keyLineStart, + _keyPos, + _tag = state.tag, + _anchor = state.anchor, + _result = {}, + overridableKeys = Object.create(null), + keyTag = null, + keyNode = null, + valueNode = null, + atExplicitKey = false, + detected = false, + ch; + + // there is a leading tab before this token, so it can't be a block sequence/mapping; + // it can still be flow sequence/mapping or a scalar + if (state.firstTabInLine !== -1) return false; + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } + + ch = state.input.charCodeAt(state.position); + + while (ch !== 0) { + if (!atExplicitKey && state.firstTabInLine !== -1) { + state.position = state.firstTabInLine; + throwError(state, 'tab characters must not be used in indentation'); + } + + following = state.input.charCodeAt(state.position + 1); + _line = state.line; // Save the current line. + + // + // Explicit notation case. There are two separate blocks: + // first for the key (denoted by "?") and second for the value (denoted by ":") + // + if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) { + + if (ch === 0x3F/* ? */) { + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); + keyTag = keyNode = valueNode = null; + } + + detected = true; + atExplicitKey = true; + allowCompact = true; + + } else if (atExplicitKey) { + // i.e. 0x3A/* : */ === character after the explicit key. + atExplicitKey = false; + allowCompact = true; + + } else { + throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line'); + } + + state.position += 1; + ch = following; + + // + // Implicit notation case. Flow-style node as the key first, then ":", and the value. + // + } else { + _keyLine = state.line; + _keyLineStart = state.lineStart; + _keyPos = state.position; + + if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) { + // Neither implicit nor explicit notation. + // Reading is done. Go to the epilogue. + break; + } + + if (state.line === _line) { + ch = state.input.charCodeAt(state.position); + + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (ch === 0x3A/* : */) { + ch = state.input.charCodeAt(++state.position); + + if (!is_WS_OR_EOL(ch)) { + throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping'); + } + + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); + keyTag = keyNode = valueNode = null; + } + + detected = true; + atExplicitKey = false; + allowCompact = false; + keyTag = state.tag; + keyNode = state.result; + + } else if (detected) { + throwError(state, 'can not read an implicit mapping pair; a colon is missed'); + + } else { + state.tag = _tag; + state.anchor = _anchor; + return true; // Keep the result of `composeNode`. + } + + } else if (detected) { + throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key'); + + } else { + state.tag = _tag; + state.anchor = _anchor; + return true; // Keep the result of `composeNode`. + } + } + + // + // Common reading code for both explicit and implicit notations. + // + if (state.line === _line || state.lineIndent > nodeIndent) { + if (atExplicitKey) { + _keyLine = state.line; + _keyLineStart = state.lineStart; + _keyPos = state.position; + } + + if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) { + if (atExplicitKey) { + keyNode = state.result; + } else { + valueNode = state.result; + } + } + + if (!atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos); + keyTag = keyNode = valueNode = null; + } + + skipSeparationSpace(state, true, -1); + ch = state.input.charCodeAt(state.position); + } + + if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { + throwError(state, 'bad indentation of a mapping entry'); + } else if (state.lineIndent < nodeIndent) { + break; + } + } + + // + // Epilogue. + // + + // Special case: last mapping's node contains only the key in explicit notation. + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); + } + + // Expose the resulting mapping. + if (detected) { + state.tag = _tag; + state.anchor = _anchor; + state.kind = 'mapping'; + state.result = _result; + } + + return detected; +} + +function readTagProperty(state) { + var _position, + isVerbatim = false, + isNamed = false, + tagHandle, + tagName, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x21/* ! */) return false; + + if (state.tag !== null) { + throwError(state, 'duplication of a tag property'); + } + + ch = state.input.charCodeAt(++state.position); + + if (ch === 0x3C/* < */) { + isVerbatim = true; + ch = state.input.charCodeAt(++state.position); + + } else if (ch === 0x21/* ! */) { + isNamed = true; + tagHandle = '!!'; + ch = state.input.charCodeAt(++state.position); + + } else { + tagHandle = '!'; + } + + _position = state.position; + + if (isVerbatim) { + do { ch = state.input.charCodeAt(++state.position); } + while (ch !== 0 && ch !== 0x3E/* > */); + + if (state.position < state.length) { + tagName = state.input.slice(_position, state.position); + ch = state.input.charCodeAt(++state.position); + } else { + throwError(state, 'unexpected end of the stream within a verbatim tag'); + } + } else { + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + + if (ch === 0x21/* ! */) { + if (!isNamed) { + tagHandle = state.input.slice(_position - 1, state.position + 1); + + if (!PATTERN_TAG_HANDLE.test(tagHandle)) { + throwError(state, 'named tag handle cannot contain such characters'); + } + + isNamed = true; + _position = state.position + 1; + } else { + throwError(state, 'tag suffix cannot contain exclamation marks'); + } + } + + ch = state.input.charCodeAt(++state.position); + } + + tagName = state.input.slice(_position, state.position); + + if (PATTERN_FLOW_INDICATORS.test(tagName)) { + throwError(state, 'tag suffix cannot contain flow indicator characters'); + } + } + + if (tagName && !PATTERN_TAG_URI.test(tagName)) { + throwError(state, 'tag name cannot contain such characters: ' + tagName); + } + + try { + tagName = decodeURIComponent(tagName); + } catch (err) { + throwError(state, 'tag name is malformed: ' + tagName); + } + + if (isVerbatim) { + state.tag = tagName; + + } else if (_hasOwnProperty.call(state.tagMap, tagHandle)) { + state.tag = state.tagMap[tagHandle] + tagName; + + } else if (tagHandle === '!') { + state.tag = '!' + tagName; + + } else if (tagHandle === '!!') { + state.tag = 'tag:yaml.org,2002:' + tagName; + + } else { + throwError(state, 'undeclared tag handle "' + tagHandle + '"'); + } + + return true; +} + +function readAnchorProperty(state) { + var _position, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x26/* & */) return false; + + if (state.anchor !== null) { + throwError(state, 'duplication of an anchor property'); + } + + ch = state.input.charCodeAt(++state.position); + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (state.position === _position) { + throwError(state, 'name of an anchor node must contain at least one character'); + } + + state.anchor = state.input.slice(_position, state.position); + return true; +} + +function readAlias(state) { + var _position, alias, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x2A/* * */) return false; + + ch = state.input.charCodeAt(++state.position); + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (state.position === _position) { + throwError(state, 'name of an alias node must contain at least one character'); + } + + alias = state.input.slice(_position, state.position); + + if (!_hasOwnProperty.call(state.anchorMap, alias)) { + throwError(state, 'unidentified alias "' + alias + '"'); + } + + state.result = state.anchorMap[alias]; + skipSeparationSpace(state, true, -1); + return true; +} + +function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) { + var allowBlockStyles, + allowBlockScalars, + allowBlockCollections, + indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this parentIndent) { + indentStatus = 1; + } else if (state.lineIndent === parentIndent) { + indentStatus = 0; + } else if (state.lineIndent < parentIndent) { + indentStatus = -1; + } + } + } + + if (indentStatus === 1) { + while (readTagProperty(state) || readAnchorProperty(state)) { + if (skipSeparationSpace(state, true, -1)) { + atNewLine = true; + allowBlockCollections = allowBlockStyles; + + if (state.lineIndent > parentIndent) { + indentStatus = 1; + } else if (state.lineIndent === parentIndent) { + indentStatus = 0; + } else if (state.lineIndent < parentIndent) { + indentStatus = -1; + } + } else { + allowBlockCollections = false; + } + } + } + + if (allowBlockCollections) { + allowBlockCollections = atNewLine || allowCompact; + } + + if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) { + if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) { + flowIndent = parentIndent; + } else { + flowIndent = parentIndent + 1; + } + + blockIndent = state.position - state.lineStart; + + if (indentStatus === 1) { + if (allowBlockCollections && + (readBlockSequence(state, blockIndent) || + readBlockMapping(state, blockIndent, flowIndent)) || + readFlowCollection(state, flowIndent)) { + hasContent = true; + } else { + if ((allowBlockScalars && readBlockScalar(state, flowIndent)) || + readSingleQuotedScalar(state, flowIndent) || + readDoubleQuotedScalar(state, flowIndent)) { + hasContent = true; + + } else if (readAlias(state)) { + hasContent = true; + + if (state.tag !== null || state.anchor !== null) { + throwError(state, 'alias node should not have any properties'); + } + + } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) { + hasContent = true; + + if (state.tag === null) { + state.tag = '?'; + } + } + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + } + } else if (indentStatus === 0) { + // Special case: block sequences are allowed to have same indentation level as the parent. + // http://www.yaml.org/spec/1.2/spec.html#id2799784 + hasContent = allowBlockCollections && readBlockSequence(state, blockIndent); + } + } + + if (state.tag === null) { + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + + } else if (state.tag === '?') { + // Implicit resolving is not allowed for non-scalar types, and '?' + // non-specific tag is only automatically assigned to plain scalars. + // + // We only need to check kind conformity in case user explicitly assigns '?' + // tag, for example like this: "! [0]" + // + if (state.result !== null && state.kind !== 'scalar') { + throwError(state, 'unacceptable node kind for ! tag; it should be "scalar", not "' + state.kind + '"'); + } + + for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) { + type = state.implicitTypes[typeIndex]; + + if (type.resolve(state.result)) { // `state.result` updated in resolver if matched + state.result = type.construct(state.result); + state.tag = type.tag; + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + break; + } + } + } else if (state.tag !== '!') { + if (_hasOwnProperty.call(state.typeMap[state.kind || 'fallback'], state.tag)) { + type = state.typeMap[state.kind || 'fallback'][state.tag]; + } else { + // looking for multi type + type = null; + typeList = state.typeMap.multi[state.kind || 'fallback']; + + for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) { + if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) { + type = typeList[typeIndex]; + break; + } + } + } + + if (!type) { + throwError(state, 'unknown tag !<' + state.tag + '>'); + } + + if (state.result !== null && type.kind !== state.kind) { + throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"'); + } + + if (!type.resolve(state.result, state.tag)) { // `state.result` updated in resolver if matched + throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag'); + } else { + state.result = type.construct(state.result, state.tag); + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + } + } + + if (state.listener !== null) { + state.listener('close', state); + } + return state.tag !== null || state.anchor !== null || hasContent; +} + +function readDocument(state) { + var documentStart = state.position, + _position, + directiveName, + directiveArgs, + hasDirectives = false, + ch; + + state.version = null; + state.checkLineBreaks = state.legacy; + state.tagMap = Object.create(null); + state.anchorMap = Object.create(null); + + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + skipSeparationSpace(state, true, -1); + + ch = state.input.charCodeAt(state.position); + + if (state.lineIndent > 0 || ch !== 0x25/* % */) { + break; + } + + hasDirectives = true; + ch = state.input.charCodeAt(++state.position); + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + directiveName = state.input.slice(_position, state.position); + directiveArgs = []; + + if (directiveName.length < 1) { + throwError(state, 'directive name must not be less than one character in length'); + } + + while (ch !== 0) { + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (ch === 0x23/* # */) { + do { ch = state.input.charCodeAt(++state.position); } + while (ch !== 0 && !is_EOL(ch)); + break; + } + + if (is_EOL(ch)) break; + + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + directiveArgs.push(state.input.slice(_position, state.position)); + } + + if (ch !== 0) readLineBreak(state); + + if (_hasOwnProperty.call(directiveHandlers, directiveName)) { + directiveHandlers[directiveName](state, directiveName, directiveArgs); + } else { + throwWarning(state, 'unknown document directive "' + directiveName + '"'); + } + } + + skipSeparationSpace(state, true, -1); + + if (state.lineIndent === 0 && + state.input.charCodeAt(state.position) === 0x2D/* - */ && + state.input.charCodeAt(state.position + 1) === 0x2D/* - */ && + state.input.charCodeAt(state.position + 2) === 0x2D/* - */) { + state.position += 3; + skipSeparationSpace(state, true, -1); + + } else if (hasDirectives) { + throwError(state, 'directives end mark is expected'); + } + + composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true); + skipSeparationSpace(state, true, -1); + + if (state.checkLineBreaks && + PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) { + throwWarning(state, 'non-ASCII line breaks are interpreted as content'); + } + + state.documents.push(state.result); + + if (state.position === state.lineStart && testDocumentSeparator(state)) { + + if (state.input.charCodeAt(state.position) === 0x2E/* . */) { + state.position += 3; + skipSeparationSpace(state, true, -1); + } + return; + } + + if (state.position < (state.length - 1)) { + throwError(state, 'end of the stream or a document separator is expected'); + } else { + return; + } +} + + +function loadDocuments(input, options) { + input = String(input); + options = options || {}; + + if (input.length !== 0) { + + // Add tailing `\n` if not exists + if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ && + input.charCodeAt(input.length - 1) !== 0x0D/* CR */) { + input += '\n'; + } + + // Strip BOM + if (input.charCodeAt(0) === 0xFEFF) { + input = input.slice(1); + } + } + + var state = new State(input, options); + + var nullpos = input.indexOf('\0'); + + if (nullpos !== -1) { + state.position = nullpos; + throwError(state, 'null byte is not allowed in input'); + } + + // Use 0 as string terminator. That significantly simplifies bounds check. + state.input += '\0'; + + while (state.input.charCodeAt(state.position) === 0x20/* Space */) { + state.lineIndent += 1; + state.position += 1; + } + + while (state.position < (state.length - 1)) { + readDocument(state); + } + + return state.documents; +} + + +function loadAll(input, iterator, options) { + if (iterator !== null && typeof iterator === 'object' && typeof options === 'undefined') { + options = iterator; + iterator = null; + } + + var documents = loadDocuments(input, options); + + if (typeof iterator !== 'function') { + return documents; + } + + for (var index = 0, length = documents.length; index < length; index += 1) { + iterator(documents[index]); + } +} + + +function load(input, options) { + var documents = loadDocuments(input, options); + + if (documents.length === 0) { + /*eslint-disable no-undefined*/ + return undefined; + } else if (documents.length === 1) { + return documents[0]; + } + throw new YAMLException('expected a single document in the stream, but found more'); +} + + +module.exports.loadAll = loadAll; +module.exports.load = load; diff --git a/node_modules/js-yaml/lib/schema.js b/node_modules/js-yaml/lib/schema.js new file mode 100644 index 0000000..65b41f4 --- /dev/null +++ b/node_modules/js-yaml/lib/schema.js @@ -0,0 +1,121 @@ +'use strict'; + +/*eslint-disable max-len*/ + +var YAMLException = require('./exception'); +var Type = require('./type'); + + +function compileList(schema, name) { + var result = []; + + schema[name].forEach(function (currentType) { + var newIndex = result.length; + + result.forEach(function (previousType, previousIndex) { + if (previousType.tag === currentType.tag && + previousType.kind === currentType.kind && + previousType.multi === currentType.multi) { + + newIndex = previousIndex; + } + }); + + result[newIndex] = currentType; + }); + + return result; +} + + +function compileMap(/* lists... */) { + var result = { + scalar: {}, + sequence: {}, + mapping: {}, + fallback: {}, + multi: { + scalar: [], + sequence: [], + mapping: [], + fallback: [] + } + }, index, length; + + function collectType(type) { + if (type.multi) { + result.multi[type.kind].push(type); + result.multi['fallback'].push(type); + } else { + result[type.kind][type.tag] = result['fallback'][type.tag] = type; + } + } + + for (index = 0, length = arguments.length; index < length; index += 1) { + arguments[index].forEach(collectType); + } + return result; +} + + +function Schema(definition) { + return this.extend(definition); +} + + +Schema.prototype.extend = function extend(definition) { + var implicit = []; + var explicit = []; + + if (definition instanceof Type) { + // Schema.extend(type) + explicit.push(definition); + + } else if (Array.isArray(definition)) { + // Schema.extend([ type1, type2, ... ]) + explicit = explicit.concat(definition); + + } else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) { + // Schema.extend({ explicit: [ type1, type2, ... ], implicit: [ type1, type2, ... ] }) + if (definition.implicit) implicit = implicit.concat(definition.implicit); + if (definition.explicit) explicit = explicit.concat(definition.explicit); + + } else { + throw new YAMLException('Schema.extend argument should be a Type, [ Type ], ' + + 'or a schema definition ({ implicit: [...], explicit: [...] })'); + } + + implicit.forEach(function (type) { + if (!(type instanceof Type)) { + throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.'); + } + + if (type.loadKind && type.loadKind !== 'scalar') { + throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.'); + } + + if (type.multi) { + throw new YAMLException('There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.'); + } + }); + + explicit.forEach(function (type) { + if (!(type instanceof Type)) { + throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.'); + } + }); + + var result = Object.create(Schema.prototype); + + result.implicit = (this.implicit || []).concat(implicit); + result.explicit = (this.explicit || []).concat(explicit); + + result.compiledImplicit = compileList(result, 'implicit'); + result.compiledExplicit = compileList(result, 'explicit'); + result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit); + + return result; +}; + + +module.exports = Schema; diff --git a/node_modules/js-yaml/lib/schema/core.js b/node_modules/js-yaml/lib/schema/core.js new file mode 100644 index 0000000..608b26d --- /dev/null +++ b/node_modules/js-yaml/lib/schema/core.js @@ -0,0 +1,11 @@ +// Standard YAML's Core schema. +// http://www.yaml.org/spec/1.2/spec.html#id2804923 +// +// NOTE: JS-YAML does not support schema-specific tag resolution restrictions. +// So, Core schema has no distinctions from JSON schema is JS-YAML. + + +'use strict'; + + +module.exports = require('./json'); diff --git a/node_modules/js-yaml/lib/schema/default.js b/node_modules/js-yaml/lib/schema/default.js new file mode 100644 index 0000000..3af0520 --- /dev/null +++ b/node_modules/js-yaml/lib/schema/default.js @@ -0,0 +1,22 @@ +// JS-YAML's default schema for `safeLoad` function. +// It is not described in the YAML specification. +// +// This schema is based on standard YAML's Core schema and includes most of +// extra types described at YAML tag repository. (http://yaml.org/type/) + + +'use strict'; + + +module.exports = require('./core').extend({ + implicit: [ + require('../type/timestamp'), + require('../type/merge') + ], + explicit: [ + require('../type/binary'), + require('../type/omap'), + require('../type/pairs'), + require('../type/set') + ] +}); diff --git a/node_modules/js-yaml/lib/schema/failsafe.js b/node_modules/js-yaml/lib/schema/failsafe.js new file mode 100644 index 0000000..b7a33eb --- /dev/null +++ b/node_modules/js-yaml/lib/schema/failsafe.js @@ -0,0 +1,17 @@ +// Standard YAML's Failsafe schema. +// http://www.yaml.org/spec/1.2/spec.html#id2802346 + + +'use strict'; + + +var Schema = require('../schema'); + + +module.exports = new Schema({ + explicit: [ + require('../type/str'), + require('../type/seq'), + require('../type/map') + ] +}); diff --git a/node_modules/js-yaml/lib/schema/json.js b/node_modules/js-yaml/lib/schema/json.js new file mode 100644 index 0000000..b73df78 --- /dev/null +++ b/node_modules/js-yaml/lib/schema/json.js @@ -0,0 +1,19 @@ +// Standard YAML's JSON schema. +// http://www.yaml.org/spec/1.2/spec.html#id2803231 +// +// NOTE: JS-YAML does not support schema-specific tag resolution restrictions. +// So, this schema is not such strict as defined in the YAML specification. +// It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc. + + +'use strict'; + + +module.exports = require('./failsafe').extend({ + implicit: [ + require('../type/null'), + require('../type/bool'), + require('../type/int'), + require('../type/float') + ] +}); diff --git a/node_modules/js-yaml/lib/snippet.js b/node_modules/js-yaml/lib/snippet.js new file mode 100644 index 0000000..00e2133 --- /dev/null +++ b/node_modules/js-yaml/lib/snippet.js @@ -0,0 +1,101 @@ +'use strict'; + + +var common = require('./common'); + + +// get snippet for a single line, respecting maxLength +function getLine(buffer, lineStart, lineEnd, position, maxLineLength) { + var head = ''; + var tail = ''; + var maxHalfLength = Math.floor(maxLineLength / 2) - 1; + + if (position - lineStart > maxHalfLength) { + head = ' ... '; + lineStart = position - maxHalfLength + head.length; + } + + if (lineEnd - position > maxHalfLength) { + tail = ' ...'; + lineEnd = position + maxHalfLength - tail.length; + } + + return { + str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, '→') + tail, + pos: position - lineStart + head.length // relative position + }; +} + + +function padStart(string, max) { + return common.repeat(' ', max - string.length) + string; +} + + +function makeSnippet(mark, options) { + options = Object.create(options || null); + + if (!mark.buffer) return null; + + if (!options.maxLength) options.maxLength = 79; + if (typeof options.indent !== 'number') options.indent = 1; + if (typeof options.linesBefore !== 'number') options.linesBefore = 3; + if (typeof options.linesAfter !== 'number') options.linesAfter = 2; + + var re = /\r?\n|\r|\0/g; + var lineStarts = [ 0 ]; + var lineEnds = []; + var match; + var foundLineNo = -1; + + while ((match = re.exec(mark.buffer))) { + lineEnds.push(match.index); + lineStarts.push(match.index + match[0].length); + + if (mark.position <= match.index && foundLineNo < 0) { + foundLineNo = lineStarts.length - 2; + } + } + + if (foundLineNo < 0) foundLineNo = lineStarts.length - 1; + + var result = '', i, line; + var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length; + var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3); + + for (i = 1; i <= options.linesBefore; i++) { + if (foundLineNo - i < 0) break; + line = getLine( + mark.buffer, + lineStarts[foundLineNo - i], + lineEnds[foundLineNo - i], + mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]), + maxLineLength + ); + result = common.repeat(' ', options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + + ' | ' + line.str + '\n' + result; + } + + line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength); + result += common.repeat(' ', options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + + ' | ' + line.str + '\n'; + result += common.repeat('-', options.indent + lineNoLength + 3 + line.pos) + '^' + '\n'; + + for (i = 1; i <= options.linesAfter; i++) { + if (foundLineNo + i >= lineEnds.length) break; + line = getLine( + mark.buffer, + lineStarts[foundLineNo + i], + lineEnds[foundLineNo + i], + mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]), + maxLineLength + ); + result += common.repeat(' ', options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + + ' | ' + line.str + '\n'; + } + + return result.replace(/\n$/, ''); +} + + +module.exports = makeSnippet; diff --git a/node_modules/js-yaml/lib/type.js b/node_modules/js-yaml/lib/type.js new file mode 100644 index 0000000..5e57877 --- /dev/null +++ b/node_modules/js-yaml/lib/type.js @@ -0,0 +1,66 @@ +'use strict'; + +var YAMLException = require('./exception'); + +var TYPE_CONSTRUCTOR_OPTIONS = [ + 'kind', + 'multi', + 'resolve', + 'construct', + 'instanceOf', + 'predicate', + 'represent', + 'representName', + 'defaultStyle', + 'styleAliases' +]; + +var YAML_NODE_KINDS = [ + 'scalar', + 'sequence', + 'mapping' +]; + +function compileStyleAliases(map) { + var result = {}; + + if (map !== null) { + Object.keys(map).forEach(function (style) { + map[style].forEach(function (alias) { + result[String(alias)] = style; + }); + }); + } + + return result; +} + +function Type(tag, options) { + options = options || {}; + + Object.keys(options).forEach(function (name) { + if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) { + throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.'); + } + }); + + // TODO: Add tag format check. + this.options = options; // keep original options in case user wants to extend this type later + this.tag = tag; + this.kind = options['kind'] || null; + this.resolve = options['resolve'] || function () { return true; }; + this.construct = options['construct'] || function (data) { return data; }; + this.instanceOf = options['instanceOf'] || null; + this.predicate = options['predicate'] || null; + this.represent = options['represent'] || null; + this.representName = options['representName'] || null; + this.defaultStyle = options['defaultStyle'] || null; + this.multi = options['multi'] || false; + this.styleAliases = compileStyleAliases(options['styleAliases'] || null); + + if (YAML_NODE_KINDS.indexOf(this.kind) === -1) { + throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.'); + } +} + +module.exports = Type; diff --git a/node_modules/js-yaml/lib/type/binary.js b/node_modules/js-yaml/lib/type/binary.js new file mode 100644 index 0000000..e152351 --- /dev/null +++ b/node_modules/js-yaml/lib/type/binary.js @@ -0,0 +1,125 @@ +'use strict'; + +/*eslint-disable no-bitwise*/ + + +var Type = require('../type'); + + +// [ 64, 65, 66 ] -> [ padding, CR, LF ] +var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r'; + + +function resolveYamlBinary(data) { + if (data === null) return false; + + var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP; + + // Convert one by one. + for (idx = 0; idx < max; idx++) { + code = map.indexOf(data.charAt(idx)); + + // Skip CR/LF + if (code > 64) continue; + + // Fail on illegal characters + if (code < 0) return false; + + bitlen += 6; + } + + // If there are any bits left, source was corrupted + return (bitlen % 8) === 0; +} + +function constructYamlBinary(data) { + var idx, tailbits, + input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan + max = input.length, + map = BASE64_MAP, + bits = 0, + result = []; + + // Collect by 6*4 bits (3 bytes) + + for (idx = 0; idx < max; idx++) { + if ((idx % 4 === 0) && idx) { + result.push((bits >> 16) & 0xFF); + result.push((bits >> 8) & 0xFF); + result.push(bits & 0xFF); + } + + bits = (bits << 6) | map.indexOf(input.charAt(idx)); + } + + // Dump tail + + tailbits = (max % 4) * 6; + + if (tailbits === 0) { + result.push((bits >> 16) & 0xFF); + result.push((bits >> 8) & 0xFF); + result.push(bits & 0xFF); + } else if (tailbits === 18) { + result.push((bits >> 10) & 0xFF); + result.push((bits >> 2) & 0xFF); + } else if (tailbits === 12) { + result.push((bits >> 4) & 0xFF); + } + + return new Uint8Array(result); +} + +function representYamlBinary(object /*, style*/) { + var result = '', bits = 0, idx, tail, + max = object.length, + map = BASE64_MAP; + + // Convert every three bytes to 4 ASCII characters. + + for (idx = 0; idx < max; idx++) { + if ((idx % 3 === 0) && idx) { + result += map[(bits >> 18) & 0x3F]; + result += map[(bits >> 12) & 0x3F]; + result += map[(bits >> 6) & 0x3F]; + result += map[bits & 0x3F]; + } + + bits = (bits << 8) + object[idx]; + } + + // Dump tail + + tail = max % 3; + + if (tail === 0) { + result += map[(bits >> 18) & 0x3F]; + result += map[(bits >> 12) & 0x3F]; + result += map[(bits >> 6) & 0x3F]; + result += map[bits & 0x3F]; + } else if (tail === 2) { + result += map[(bits >> 10) & 0x3F]; + result += map[(bits >> 4) & 0x3F]; + result += map[(bits << 2) & 0x3F]; + result += map[64]; + } else if (tail === 1) { + result += map[(bits >> 2) & 0x3F]; + result += map[(bits << 4) & 0x3F]; + result += map[64]; + result += map[64]; + } + + return result; +} + +function isBinary(obj) { + return Object.prototype.toString.call(obj) === '[object Uint8Array]'; +} + +module.exports = new Type('tag:yaml.org,2002:binary', { + kind: 'scalar', + resolve: resolveYamlBinary, + construct: constructYamlBinary, + predicate: isBinary, + represent: representYamlBinary +}); diff --git a/node_modules/js-yaml/lib/type/bool.js b/node_modules/js-yaml/lib/type/bool.js new file mode 100644 index 0000000..cb77459 --- /dev/null +++ b/node_modules/js-yaml/lib/type/bool.js @@ -0,0 +1,35 @@ +'use strict'; + +var Type = require('../type'); + +function resolveYamlBoolean(data) { + if (data === null) return false; + + var max = data.length; + + return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) || + (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE')); +} + +function constructYamlBoolean(data) { + return data === 'true' || + data === 'True' || + data === 'TRUE'; +} + +function isBoolean(object) { + return Object.prototype.toString.call(object) === '[object Boolean]'; +} + +module.exports = new Type('tag:yaml.org,2002:bool', { + kind: 'scalar', + resolve: resolveYamlBoolean, + construct: constructYamlBoolean, + predicate: isBoolean, + represent: { + lowercase: function (object) { return object ? 'true' : 'false'; }, + uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; }, + camelcase: function (object) { return object ? 'True' : 'False'; } + }, + defaultStyle: 'lowercase' +}); diff --git a/node_modules/js-yaml/lib/type/float.js b/node_modules/js-yaml/lib/type/float.js new file mode 100644 index 0000000..74d77ec --- /dev/null +++ b/node_modules/js-yaml/lib/type/float.js @@ -0,0 +1,97 @@ +'use strict'; + +var common = require('../common'); +var Type = require('../type'); + +var YAML_FLOAT_PATTERN = new RegExp( + // 2.5e4, 2.5 and integers + '^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' + + // .2e4, .2 + // special case, seems not from spec + '|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' + + // .inf + '|[-+]?\\.(?:inf|Inf|INF)' + + // .nan + '|\\.(?:nan|NaN|NAN))$'); + +function resolveYamlFloat(data) { + if (data === null) return false; + + if (!YAML_FLOAT_PATTERN.test(data) || + // Quick hack to not allow integers end with `_` + // Probably should update regexp & check speed + data[data.length - 1] === '_') { + return false; + } + + return true; +} + +function constructYamlFloat(data) { + var value, sign; + + value = data.replace(/_/g, '').toLowerCase(); + sign = value[0] === '-' ? -1 : 1; + + if ('+-'.indexOf(value[0]) >= 0) { + value = value.slice(1); + } + + if (value === '.inf') { + return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY; + + } else if (value === '.nan') { + return NaN; + } + return sign * parseFloat(value, 10); +} + + +var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/; + +function representYamlFloat(object, style) { + var res; + + if (isNaN(object)) { + switch (style) { + case 'lowercase': return '.nan'; + case 'uppercase': return '.NAN'; + case 'camelcase': return '.NaN'; + } + } else if (Number.POSITIVE_INFINITY === object) { + switch (style) { + case 'lowercase': return '.inf'; + case 'uppercase': return '.INF'; + case 'camelcase': return '.Inf'; + } + } else if (Number.NEGATIVE_INFINITY === object) { + switch (style) { + case 'lowercase': return '-.inf'; + case 'uppercase': return '-.INF'; + case 'camelcase': return '-.Inf'; + } + } else if (common.isNegativeZero(object)) { + return '-0.0'; + } + + res = object.toString(10); + + // JS stringifier can build scientific format without dots: 5e-100, + // while YAML requres dot: 5.e-100. Fix it with simple hack + + return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res; +} + +function isFloat(object) { + return (Object.prototype.toString.call(object) === '[object Number]') && + (object % 1 !== 0 || common.isNegativeZero(object)); +} + +module.exports = new Type('tag:yaml.org,2002:float', { + kind: 'scalar', + resolve: resolveYamlFloat, + construct: constructYamlFloat, + predicate: isFloat, + represent: representYamlFloat, + defaultStyle: 'lowercase' +}); diff --git a/node_modules/js-yaml/lib/type/int.js b/node_modules/js-yaml/lib/type/int.js new file mode 100644 index 0000000..3fe3a44 --- /dev/null +++ b/node_modules/js-yaml/lib/type/int.js @@ -0,0 +1,156 @@ +'use strict'; + +var common = require('../common'); +var Type = require('../type'); + +function isHexCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) || + ((0x41/* A */ <= c) && (c <= 0x46/* F */)) || + ((0x61/* a */ <= c) && (c <= 0x66/* f */)); +} + +function isOctCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */)); +} + +function isDecCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)); +} + +function resolveYamlInteger(data) { + if (data === null) return false; + + var max = data.length, + index = 0, + hasDigits = false, + ch; + + if (!max) return false; + + ch = data[index]; + + // sign + if (ch === '-' || ch === '+') { + ch = data[++index]; + } + + if (ch === '0') { + // 0 + if (index + 1 === max) return true; + ch = data[++index]; + + // base 2, base 8, base 16 + + if (ch === 'b') { + // base 2 + index++; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (ch !== '0' && ch !== '1') return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; + } + + + if (ch === 'x') { + // base 16 + index++; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (!isHexCode(data.charCodeAt(index))) return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; + } + + + if (ch === 'o') { + // base 8 + index++; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (!isOctCode(data.charCodeAt(index))) return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; + } + } + + // base 10 (except 0) + + // value should not start with `_`; + if (ch === '_') return false; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (!isDecCode(data.charCodeAt(index))) { + return false; + } + hasDigits = true; + } + + // Should have digits and should not end with `_` + if (!hasDigits || ch === '_') return false; + + return true; +} + +function constructYamlInteger(data) { + var value = data, sign = 1, ch; + + if (value.indexOf('_') !== -1) { + value = value.replace(/_/g, ''); + } + + ch = value[0]; + + if (ch === '-' || ch === '+') { + if (ch === '-') sign = -1; + value = value.slice(1); + ch = value[0]; + } + + if (value === '0') return 0; + + if (ch === '0') { + if (value[1] === 'b') return sign * parseInt(value.slice(2), 2); + if (value[1] === 'x') return sign * parseInt(value.slice(2), 16); + if (value[1] === 'o') return sign * parseInt(value.slice(2), 8); + } + + return sign * parseInt(value, 10); +} + +function isInteger(object) { + return (Object.prototype.toString.call(object)) === '[object Number]' && + (object % 1 === 0 && !common.isNegativeZero(object)); +} + +module.exports = new Type('tag:yaml.org,2002:int', { + kind: 'scalar', + resolve: resolveYamlInteger, + construct: constructYamlInteger, + predicate: isInteger, + represent: { + binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); }, + octal: function (obj) { return obj >= 0 ? '0o' + obj.toString(8) : '-0o' + obj.toString(8).slice(1); }, + decimal: function (obj) { return obj.toString(10); }, + /* eslint-disable max-len */ + hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); } + }, + defaultStyle: 'decimal', + styleAliases: { + binary: [ 2, 'bin' ], + octal: [ 8, 'oct' ], + decimal: [ 10, 'dec' ], + hexadecimal: [ 16, 'hex' ] + } +}); diff --git a/node_modules/js-yaml/lib/type/map.js b/node_modules/js-yaml/lib/type/map.js new file mode 100644 index 0000000..f327bee --- /dev/null +++ b/node_modules/js-yaml/lib/type/map.js @@ -0,0 +1,8 @@ +'use strict'; + +var Type = require('../type'); + +module.exports = new Type('tag:yaml.org,2002:map', { + kind: 'mapping', + construct: function (data) { return data !== null ? data : {}; } +}); diff --git a/node_modules/js-yaml/lib/type/merge.js b/node_modules/js-yaml/lib/type/merge.js new file mode 100644 index 0000000..ae08a86 --- /dev/null +++ b/node_modules/js-yaml/lib/type/merge.js @@ -0,0 +1,12 @@ +'use strict'; + +var Type = require('../type'); + +function resolveYamlMerge(data) { + return data === '<<' || data === null; +} + +module.exports = new Type('tag:yaml.org,2002:merge', { + kind: 'scalar', + resolve: resolveYamlMerge +}); diff --git a/node_modules/js-yaml/lib/type/null.js b/node_modules/js-yaml/lib/type/null.js new file mode 100644 index 0000000..315ca4e --- /dev/null +++ b/node_modules/js-yaml/lib/type/null.js @@ -0,0 +1,35 @@ +'use strict'; + +var Type = require('../type'); + +function resolveYamlNull(data) { + if (data === null) return true; + + var max = data.length; + + return (max === 1 && data === '~') || + (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL')); +} + +function constructYamlNull() { + return null; +} + +function isNull(object) { + return object === null; +} + +module.exports = new Type('tag:yaml.org,2002:null', { + kind: 'scalar', + resolve: resolveYamlNull, + construct: constructYamlNull, + predicate: isNull, + represent: { + canonical: function () { return '~'; }, + lowercase: function () { return 'null'; }, + uppercase: function () { return 'NULL'; }, + camelcase: function () { return 'Null'; }, + empty: function () { return ''; } + }, + defaultStyle: 'lowercase' +}); diff --git a/node_modules/js-yaml/lib/type/omap.js b/node_modules/js-yaml/lib/type/omap.js new file mode 100644 index 0000000..b2b5323 --- /dev/null +++ b/node_modules/js-yaml/lib/type/omap.js @@ -0,0 +1,44 @@ +'use strict'; + +var Type = require('../type'); + +var _hasOwnProperty = Object.prototype.hasOwnProperty; +var _toString = Object.prototype.toString; + +function resolveYamlOmap(data) { + if (data === null) return true; + + var objectKeys = [], index, length, pair, pairKey, pairHasKey, + object = data; + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + pairHasKey = false; + + if (_toString.call(pair) !== '[object Object]') return false; + + for (pairKey in pair) { + if (_hasOwnProperty.call(pair, pairKey)) { + if (!pairHasKey) pairHasKey = true; + else return false; + } + } + + if (!pairHasKey) return false; + + if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey); + else return false; + } + + return true; +} + +function constructYamlOmap(data) { + return data !== null ? data : []; +} + +module.exports = new Type('tag:yaml.org,2002:omap', { + kind: 'sequence', + resolve: resolveYamlOmap, + construct: constructYamlOmap +}); diff --git a/node_modules/js-yaml/lib/type/pairs.js b/node_modules/js-yaml/lib/type/pairs.js new file mode 100644 index 0000000..74b5240 --- /dev/null +++ b/node_modules/js-yaml/lib/type/pairs.js @@ -0,0 +1,53 @@ +'use strict'; + +var Type = require('../type'); + +var _toString = Object.prototype.toString; + +function resolveYamlPairs(data) { + if (data === null) return true; + + var index, length, pair, keys, result, + object = data; + + result = new Array(object.length); + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + + if (_toString.call(pair) !== '[object Object]') return false; + + keys = Object.keys(pair); + + if (keys.length !== 1) return false; + + result[index] = [ keys[0], pair[keys[0]] ]; + } + + return true; +} + +function constructYamlPairs(data) { + if (data === null) return []; + + var index, length, pair, keys, result, + object = data; + + result = new Array(object.length); + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + + keys = Object.keys(pair); + + result[index] = [ keys[0], pair[keys[0]] ]; + } + + return result; +} + +module.exports = new Type('tag:yaml.org,2002:pairs', { + kind: 'sequence', + resolve: resolveYamlPairs, + construct: constructYamlPairs +}); diff --git a/node_modules/js-yaml/lib/type/seq.js b/node_modules/js-yaml/lib/type/seq.js new file mode 100644 index 0000000..be8f77f --- /dev/null +++ b/node_modules/js-yaml/lib/type/seq.js @@ -0,0 +1,8 @@ +'use strict'; + +var Type = require('../type'); + +module.exports = new Type('tag:yaml.org,2002:seq', { + kind: 'sequence', + construct: function (data) { return data !== null ? data : []; } +}); diff --git a/node_modules/js-yaml/lib/type/set.js b/node_modules/js-yaml/lib/type/set.js new file mode 100644 index 0000000..f885a32 --- /dev/null +++ b/node_modules/js-yaml/lib/type/set.js @@ -0,0 +1,29 @@ +'use strict'; + +var Type = require('../type'); + +var _hasOwnProperty = Object.prototype.hasOwnProperty; + +function resolveYamlSet(data) { + if (data === null) return true; + + var key, object = data; + + for (key in object) { + if (_hasOwnProperty.call(object, key)) { + if (object[key] !== null) return false; + } + } + + return true; +} + +function constructYamlSet(data) { + return data !== null ? data : {}; +} + +module.exports = new Type('tag:yaml.org,2002:set', { + kind: 'mapping', + resolve: resolveYamlSet, + construct: constructYamlSet +}); diff --git a/node_modules/js-yaml/lib/type/str.js b/node_modules/js-yaml/lib/type/str.js new file mode 100644 index 0000000..27acc10 --- /dev/null +++ b/node_modules/js-yaml/lib/type/str.js @@ -0,0 +1,8 @@ +'use strict'; + +var Type = require('../type'); + +module.exports = new Type('tag:yaml.org,2002:str', { + kind: 'scalar', + construct: function (data) { return data !== null ? data : ''; } +}); diff --git a/node_modules/js-yaml/lib/type/timestamp.js b/node_modules/js-yaml/lib/type/timestamp.js new file mode 100644 index 0000000..8fa9c58 --- /dev/null +++ b/node_modules/js-yaml/lib/type/timestamp.js @@ -0,0 +1,88 @@ +'use strict'; + +var Type = require('../type'); + +var YAML_DATE_REGEXP = new RegExp( + '^([0-9][0-9][0-9][0-9])' + // [1] year + '-([0-9][0-9])' + // [2] month + '-([0-9][0-9])$'); // [3] day + +var YAML_TIMESTAMP_REGEXP = new RegExp( + '^([0-9][0-9][0-9][0-9])' + // [1] year + '-([0-9][0-9]?)' + // [2] month + '-([0-9][0-9]?)' + // [3] day + '(?:[Tt]|[ \\t]+)' + // ... + '([0-9][0-9]?)' + // [4] hour + ':([0-9][0-9])' + // [5] minute + ':([0-9][0-9])' + // [6] second + '(?:\\.([0-9]*))?' + // [7] fraction + '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour + '(?::([0-9][0-9]))?))?$'); // [11] tz_minute + +function resolveYamlTimestamp(data) { + if (data === null) return false; + if (YAML_DATE_REGEXP.exec(data) !== null) return true; + if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true; + return false; +} + +function constructYamlTimestamp(data) { + var match, year, month, day, hour, minute, second, fraction = 0, + delta = null, tz_hour, tz_minute, date; + + match = YAML_DATE_REGEXP.exec(data); + if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data); + + if (match === null) throw new Error('Date resolve error'); + + // match: [1] year [2] month [3] day + + year = +(match[1]); + month = +(match[2]) - 1; // JS month starts with 0 + day = +(match[3]); + + if (!match[4]) { // no hour + return new Date(Date.UTC(year, month, day)); + } + + // match: [4] hour [5] minute [6] second [7] fraction + + hour = +(match[4]); + minute = +(match[5]); + second = +(match[6]); + + if (match[7]) { + fraction = match[7].slice(0, 3); + while (fraction.length < 3) { // milli-seconds + fraction += '0'; + } + fraction = +fraction; + } + + // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute + + if (match[9]) { + tz_hour = +(match[10]); + tz_minute = +(match[11] || 0); + delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds + if (match[9] === '-') delta = -delta; + } + + date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction)); + + if (delta) date.setTime(date.getTime() - delta); + + return date; +} + +function representYamlTimestamp(object /*, style*/) { + return object.toISOString(); +} + +module.exports = new Type('tag:yaml.org,2002:timestamp', { + kind: 'scalar', + resolve: resolveYamlTimestamp, + construct: constructYamlTimestamp, + instanceOf: Date, + represent: representYamlTimestamp +}); diff --git a/node_modules/js-yaml/package.json b/node_modules/js-yaml/package.json new file mode 100644 index 0000000..17574da --- /dev/null +++ b/node_modules/js-yaml/package.json @@ -0,0 +1,66 @@ +{ + "name": "js-yaml", + "version": "4.1.0", + "description": "YAML 1.2 parser and serializer", + "keywords": [ + "yaml", + "parser", + "serializer", + "pyyaml" + ], + "author": "Vladimir Zapparov ", + "contributors": [ + "Aleksey V Zapparov (http://www.ixti.net/)", + "Vitaly Puzrin (https://github.com/puzrin)", + "Martin Grenfell (http://got-ravings.blogspot.com)" + ], + "license": "MIT", + "repository": "nodeca/js-yaml", + "files": [ + "index.js", + "lib/", + "bin/", + "dist/" + ], + "bin": { + "js-yaml": "bin/js-yaml.js" + }, + "module": "./dist/js-yaml.mjs", + "exports": { + ".": { + "import": "./dist/js-yaml.mjs", + "require": "./index.js" + }, + "./package.json": "./package.json" + }, + "scripts": { + "lint": "eslint .", + "test": "npm run lint && mocha", + "coverage": "npm run lint && nyc mocha && nyc report --reporter html", + "demo": "npm run lint && node support/build_demo.js", + "gh-demo": "npm run demo && gh-pages -d demo -f", + "browserify": "rollup -c support/rollup.config.js", + "prepublishOnly": "npm run gh-demo" + }, + "unpkg": "dist/js-yaml.min.js", + "jsdelivr": "dist/js-yaml.min.js", + "dependencies": { + "argparse": "^2.0.1" + }, + "devDependencies": { + "@rollup/plugin-commonjs": "^17.0.0", + "@rollup/plugin-node-resolve": "^11.0.0", + "ansi": "^0.3.1", + "benchmark": "^2.1.4", + "codemirror": "^5.13.4", + "eslint": "^7.0.0", + "fast-check": "^2.8.0", + "gh-pages": "^3.1.0", + "mocha": "^8.2.1", + "nyc": "^15.1.0", + "rollup": "^2.34.1", + "rollup-plugin-node-polyfills": "^0.2.1", + "rollup-plugin-terser": "^7.0.2", + "shelljs": "^0.8.4" + } +} diff --git a/openapi.yaml b/openapi.yaml index f468a90..9a326e1 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -1,1906 +1,1470 @@ openapi: 3.1.0 info: title: PDCP API - version: '1.0' + version: "1.0" summary: ProjectDiscovery Cloud Platform - description: 'For more details, checkout https://docs.projectdiscovery.io/api-reference/editor/scan' + description: For more details, checkout https://docs.projectdiscovery.io/api-reference/editor/scan servers: - - url: 'https://api.projectdiscovery.io' - description: Production - - url: 'https://api.dev.projectdiscovery.io' - description: Development - - url: 'http://localhost:8080' - description: Localhost +- url: https://api.projectdiscovery.io + description: Production +- url: https://api.dev.projectdiscovery.io + description: Development +- url: http://localhost:8080 + description: Localhost paths: - /v1/scans: + /v2/template/search: get: - operationId: get-v1-scans - summary: Get Scan List - description: Get user scans status + summary: Search Templates + tags: + - template/v2 parameters: - - name: offset - in: query - description: number of scan-status results to skip - schema: - type: integer - - name: limit - in: query - description: number of scan-status results to fetch - schema: - type: integer - - name: search - in: query - description: search term for running scans - schema: - type: string - - name: status - in: query - description: 'filter by status (failed, finished, queued, running, starting, uploaded, scheduled)' - schema: - type: string - - name: sort_asc - in: query - description: 'comma separated ascending sorting e.g sort_asc=created_at,severity' - schema: - type: string - - name: sort_desc - in: query - description: 'comma separated descending sorting e.g sort_desc=created_at,severity' - schema: - type: string - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: + - schema: + type: string + enum: + - public + - private + - public_private + default: public_private + in: query + name: scope + description: Scope of templates to search (public or private) + - schema: + type: integer + default: 50 + in: query + name: limit + description: Maximum number of results to return + - schema: + type: integer + default: 0 + in: query + name: offset + description: Number of results to skip for pagination + - schema: + type: string + items: type: string + in: query + name: fields + description: Specific fields to return in the response + style: form + explode: true + - schema: + type: string + in: query + name: sort_asc + description: Field to sort results in ascending order + - schema: + type: string + in: query + name: sort_desc + description: Field to sort results in descending order + - schema: + type: string + in: query + name: q + description: Search query string + - schema: + type: boolean + default: false + in: query + name: highlight + description: Whether to highlight search matches in results + - schema: + type: integer + default: 5 + in: query + name: facet_size + description: Number of facets to return in the response + - schema: + type: string + in: header + name: X-Team-Id responses: - '200': - $ref: '#/components/responses/GetScansStatusResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '499': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + "200": + description: Successful search response + content: + application/json: + schema: + type: object + required: + - results + - total + - count + - facets + properties: + results: + type: array + items: + $ref: "#/components/schemas/TemplateData" + total: + type: integer + description: Total number of matching results + count: + type: integer + description: Number of results in this response + facets: + $ref: "#/components/schemas/TemplateStats" + message: + type: string + "400": + $ref: "#/components/responses/MessageResponse" + "401": + $ref: "#/components/responses/MessageResponse" + "500": + $ref: "#/components/responses/MessageResponse" default: - $ref: '#/components/responses/ErrorResponse' + $ref: "#/components/responses/MessageResponse" security: - - X-API-Key: [] + - X-API-Key: [] + description: Search templates with filtering, sorting, and faceting capabilities + operationId: get-v2-template-search + /v1/scans: + get: + summary: Get Scan List tags: - - scans + - scans + responses: + "200": + $ref: "#/components/responses/GetScansStatusResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "499": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" + default: + $ref: "#/components/responses/ErrorResponse" + operationId: get-v1-scans + description: Get user scans status + security: + - X-API-Key: [] + parameters: + - schema: + type: integer + in: query + name: offset + description: number of scan-status results to skip + - schema: + type: integer + in: query + name: limit + description: number of scan-status results to fetch + - schema: + type: string + in: query + name: search + description: search term for running scans + - schema: + type: string + in: query + name: status + description: filter by status (failed, finished, queued, running, starting, uploaded, scheduled) + - schema: + type: string + in: query + name: sort_asc + description: comma separated ascending sorting e.g sort_asc=created_at,severity + - schema: + type: string + in: query + name: sort_desc + description: comma separated descending sorting e.g sort_desc=created_at,severity + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id x-internal: false post: - operationId: post-v1-scans summary: Create Scan - description: Trigger a scan - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - requestBody: - $ref: '#/components/requestBodies/TriggerUserScanRequest' + tags: + - scans + operationId: post-v1-scans responses: - '200': - $ref: '#/components/responses/TriggerUserScanResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + "200": + $ref: "#/components/responses/TriggerUserScanResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" default: - $ref: '#/components/responses/ErrorResponse' + $ref: "#/components/responses/ErrorResponse" + description: Trigger a scan security: - - X-API-Key: [] - tags: - - scans + - X-API-Key: [] + requestBody: + $ref: "#/components/requestBodies/TriggerUserScanRequest" + parameters: + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id delete: + summary: Delete Scan in bulk + tags: + - scans operationId: delete-v1-scans - summary: Delete Bulk Scans - description: Delete multiple scans using scan ids - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + responses: + "200": + $ref: "#/components/responses/DeleteScansResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" + default: + $ref: "#/components/responses/ErrorResponse" requestBody: content: application/json: schema: type: object + required: + - scan_ids properties: scan_ids: type: array items: type: string - required: - - scan_ids - responses: - '200': - $ref: '#/components/responses/DeleteScansResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' - default: - $ref: '#/components/responses/ErrorResponse' + description: Delete scans using scan ids security: - - X-API-Key: [] - tags: - - scans - '/v1/scans/{scan_id}': - parameters: - - name: scan_id - in: path - required: true - schema: + - X-API-Key: [] + parameters: + - schema: type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id + /v1/scans/{scan_id}: + parameters: + - schema: + type: string + name: scan_id + in: path + required: true get: - operationId: get-v1-scans-scan_id summary: Get Scan - description: Get details of a scan by scan ID - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + tags: + - scans responses: - '200': - $ref: '#/components/responses/GetScanDetailsResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '404': - $ref: '#/components/responses/ErrorResponse' - '499': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + "200": + $ref: "#/components/responses/GetScanDetailsResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "404": + $ref: "#/components/responses/ErrorResponse" + "499": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" default: - $ref: '#/components/responses/ErrorResponse' + $ref: "#/components/responses/ErrorResponse" + operationId: get-v1-scans-scan_id + description: Get details of a scan by scan ID security: - - X-API-Key: [] - tags: - - scans + - X-API-Key: [] + parameters: + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id delete: - operationId: delete-v1-scans-scan_id summary: Delete Scan - description: Delete a scan using scanId - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + tags: + - scans + operationId: delete-v1-scans-scan_id responses: - '200': - $ref: '#/components/responses/DeleteScansResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + "200": + $ref: "#/components/responses/DeleteScansResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" default: - $ref: '#/components/responses/ErrorResponse' + $ref: "#/components/responses/ErrorResponse" + description: Delete a scan using scanId security: - - X-API-Key: [] - tags: - - scans + - X-API-Key: [] + parameters: + - schema: + type: string + in: header + name: X-Team-Id + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" patch: - operationId: patch-v1-scans-scan_id summary: Update Scan - description: Update scan metadata - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - requestBody: - $ref: '#/components/requestBodies/UpdateScanRequest' + tags: + - scans + operationId: patch-v1-scans-scan_id responses: - '200': - $ref: '#/components/responses/MessageResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + "200": + $ref: "#/components/responses/MessageResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" default: - $ref: '#/components/responses/ErrorResponse' + $ref: "#/components/responses/ErrorResponse" + description: Update scan metadata security: - - X-API-Key: [] - tags: - - scans + - X-API-Key: [] + requestBody: + $ref: "#/components/requestBodies/UpdateScanRequest" + parameters: + - schema: + type: string + in: header + name: X-Team-Id + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" /v1/scans/import: post: - operationId: post-v1-scans-import summary: Import OSS Scan + tags: + - scans + operationId: post-v1-scans-import + responses: + "200": + $ref: "#/components/responses/ImportScanResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" + default: + $ref: "#/components/responses/ErrorResponse" description: Import scan details - parameters: - - name: name - in: query - schema: - type: string - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + security: + - X-API-Key: [] requestBody: content: application/octet-stream: schema: type: string format: binary - responses: - '200': - $ref: '#/components/responses/ImportScanResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' - default: - $ref: '#/components/responses/ErrorResponse' - security: - - X-API-Key: [] - tags: - - scans - '/v1/scans/{scan_id}/stop': - parameters: - - name: scan_id - in: path - required: true - schema: + parameters: + - schema: + type: string + in: query + name: name + - schema: type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id + /v1/scans/{scan_id}/stop: + parameters: + - schema: + type: string + name: scan_id + in: path + required: true post: - operationId: post-v1-scans-scan_id-stop summary: Stop Scan - description: 'Stop a running scan, not applied in any other state.' - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + tags: + - scans + operationId: post-v1-scans-scan_id-stop responses: - '200': - $ref: '#/components/responses/DeleteScansResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + "200": + $ref: "#/components/responses/DeleteScansResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" default: - $ref: '#/components/responses/ErrorResponse' + $ref: "#/components/responses/ErrorResponse" security: - - X-API-Key: [] - tags: - - scans - '/v1/scans/{scan_id}/rescan': - parameters: - - name: scan_id - in: path - required: true - schema: + - X-API-Key: [] + description: Stop a running scan, not applied in any other state. + parameters: + - schema: type: string + in: header + name: X-Team-Id + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + /v1/scans/{scan_id}/rescan: + parameters: + - schema: + type: string + name: scan_id + in: path + required: true post: - operationId: post-v1-scans-scan_id-rescan summary: Rescan scan - description: Re-run a existing scan - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + tags: + - scans + operationId: post-v1-scans-scan_id-rescan responses: - '200': - $ref: '#/components/responses/TriggerUserScanResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + "200": + $ref: "#/components/responses/TriggerUserScanResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" default: - $ref: '#/components/responses/ErrorResponse' + $ref: "#/components/responses/ErrorResponse" security: - - X-API-Key: [] - tags: - - scans - '/v1/scans/vuln/{vuln_id}': + - X-API-Key: [] + description: Re-run a existing scan + parameters: + - schema: + type: string + in: header + name: X-Team-Id + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + /v1/scans/vuln/{vuln_id}: get: - operationId: 'get-v1-scans-vuln-:vulnId' summary: Get Scan Vulnerability - description: 'Get scan result vulnerability by ID ' - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + tags: + - results responses: - '200': - $ref: '#/components/responses/GetScansVulnIdResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + "200": + $ref: "#/components/responses/GetScansVulnIdResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" default: - $ref: '#/components/responses/ErrorResponse' + $ref: "#/components/responses/ErrorResponse" + operationId: get-v1-scans-vuln-:vulnId + description: "Get scan result vulnerability by ID " security: - - X-API-Key: [] - tags: - - results - parameters: - - name: vuln_id - in: path - description: vulnerability ID - required: true - schema: + - X-API-Key: [] + parameters: + - schema: type: string - '/v1/scans/result/{scanId}': + in: header + name: X-Team-Id + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + parameters: + - schema: + type: string + name: vuln_id + in: path + required: true + description: vulnerability ID + /v1/scans/vuln/{vuln_id}/changelogs: get: - operationId: 'get-v1-scans-result-:scanId' - summary: Get Scan Results - description: get results of specific scan by id - parameters: - - name: severity - in: query - description: 'comma separated severity e.g. severity=info,high' - schema: - type: string - - name: search - in: query - description: search term - schema: - type: string - - name: limit - in: query - description: 'number of results ' - schema: - type: integer - - name: offset - in: query - description: number of results to skip - schema: - type: integer - - name: templates - in: query - description: 'comma separated templates e.g. templates=tech-detect,azure-takeover' - schema: - type: string - - name: hosts - in: query - description: 'comma separated host e.g. hosts=https://example.com,https://x.com' - schema: - type: string - - name: time - in: query - description: 'filter by time ( last_day, last_week, last_month )' - schema: - type: string - - name: vuln_status - in: query - description: 'comma separated vuln_status e.g vuln_status=open,fixed' - schema: - type: string - - name: sort_asc - in: query - description: 'comma separated ascending sorting e.g sort_asc=created_at,severity' - schema: - type: string - - name: sort_desc - in: query - description: 'comma separated descending sorting e.g sort_desc=created_at,severity' - schema: - type: string - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + summary: Get Vulnerability Changelogs + tags: + - results responses: - '200': - $ref: '#/components/responses/GetScanResultsResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '499': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + "200": + $ref: "#/components/responses/GetVulnChangelogsResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "499": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" default: - $ref: '#/components/responses/ErrorResponse' + $ref: "#/components/responses/ErrorResponse" + operationId: get-v1-scans-vuln-vuln_id-changelogs + description: get changelogs of specific vulnerability by id security: - - X-API-Key: [] - tags: - - results - parameters: - - name: scanId - in: path - description: scan specific results (by scanId) - required: true - schema: - type: string - /v1/scans/results: - get: - operationId: get-v1-results - summary: Get All Results - description: Get scans results of a user + - X-API-Key: [] parameters: - - name: offset - in: query - description: number of results to skip - schema: - type: integer - - name: limit - in: query - description: number of results to get - schema: - type: integer - - name: severity - in: query - description: 'string separated by comma e.g. info,high' - schema: - type: string - - name: search - in: query - description: search term - schema: - type: string - - name: hosts - in: query - description: 'comma separated host e.g. hosts=https://example.com,https://x.com' - schema: - type: string - - name: templates - in: query - description: 'comma separated templates e.g. templates=tech-detect,azure-takeover' - schema: - type: string - - name: time - in: query - description: 'filter by time ( last_day, last_week, last_month )' - schema: - type: string - - name: vuln_status - in: query - description: 'comma separated vuln_status e.g vuln_status=open,fixed' - schema: - type: string - - name: tags - in: query - description: 'comma separated tags e.g tags=xss,cve' - schema: - type: string - - name: sort_asc - in: query - description: 'comma separated ascending sorting e.g sort_asc=created_at,severity' - schema: - type: string - - name: sort_desc - in: query - description: 'comma separated descending sorting e.g sort_desc=created_at,severity' - schema: - type: string - - name: is_ticket - in: query - description: Return the records that have issue trackers - schema: - type: boolean - - name: labels - in: query - description: 'filter by comma separated labels e.g labels=p1,p2' - schema: - type: string - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - responses: - '200': - $ref: '#/components/responses/GetScanResultsResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '499': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' - default: - $ref: '#/components/responses/ErrorResponse' - security: - - X-API-Key: [] - tags: - - results - parameters: [] - /v1/scans/stats: + - schema: + type: string + enum: + - last_day + - last_week + - last_month + - last_3_months + - last_6_months + - last_12_months + - all_time + default: all_time + in: query + name: time + description: time filter to select + - schema: + type: string + in: query + name: event_type + description: comma separated event_type e.g. event_type=vul_status,vul_status_change + - schema: + type: string + in: query + name: sort_asc + description: comma separated ascending sorting e.g sort_asc=created_at,severity + - schema: + type: string + in: query + name: sort_desc + description: comma separated descending sorting e.g sort_desc=created_at,severity + - schema: + type: integer + in: query + name: limit + description: number of results to get + - schema: + type: integer + in: query + name: offset + description: number of results to skip + - schema: + type: string + in: header + name: X-Team-Id + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + parameters: + - schema: + type: string + name: vuln_id + in: path + required: true + description: vulnerability ID + /v1/scans/vuln/changelogs: get: - operationId: get-v1-scans-stats - summary: Get All Scan Stats - description: Get all scans statistics for a user - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + summary: Get all Vulnerability Changelogs + tags: + - results responses: - '200': - $ref: '#/components/responses/ScanStatsResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '403': - $ref: '#/components/responses/ErrorResponse' - '499': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + "200": + $ref: "#/components/responses/GetVulnChangelogsResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "499": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" default: - $ref: '#/components/responses/ErrorResponse' + $ref: "#/components/responses/ErrorResponse" + operationId: get-v1-scans-vuln-changelogs + description: get changelogs of all vulnerabilities security: - - X-API-Key: [] - tags: - - scans - '/v1/scans/{vuln_id}/retest': - parameters: - - name: vuln_id - in: path - required: true - schema: + - X-API-Key: [] + parameters: + - schema: + type: string + enum: + - last_day + - last_week + - last_month + - last_3_months + - last_6_months + - last_12_months + - all_time + default: all_time + in: query + name: time + description: time filter to select + - schema: + type: string + in: query + name: event_type + description: comma separated event_type e.g. event_type=vul_status,vul_status_change + - schema: + type: string + in: query + name: sort_asc + description: comma separated ascending sorting e.g sort_asc=created_at,severity + - schema: + type: string + in: query + name: sort_desc + description: comma separated descending sorting e.g sort_desc=created_at,severity + - schema: + type: integer + in: query + name: limit + description: number of results to get + - schema: + type: integer + in: query + name: offset + description: number of results to skip + - schema: type: string + in: header + name: X-Team-Id + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + /v1/scans/{vuln_id}/retest: + parameters: + - schema: + type: string + name: vuln_id + in: path + required: true post: - operationId: post-v1-scans-vuln_id-retest summary: Retest vulnerability - description: Retest a scan vulnerability - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - responses: - '200': - $ref: '#/components/responses/PostRescanVulnResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' - default: - $ref: '#/components/responses/ErrorResponse' - security: - - X-API-Key: [] tags: - - scans - /v1/scans/results/filters: - get: - operationId: get-v1-scans-results-filters - summary: Get Scans Result Filters - description: Get users scan-result filters - parameters: - - name: offset - in: query - description: The number of items to skip before starting to collect the result set - schema: - type: integer - - name: limit - in: query - description: The numbers of items to return - schema: - type: integer - - name: scan_id - in: query - description: specific scan_id results filters - schema: - type: string - - name: severity - in: query - description: 'comma separated severity e.g. severities=info,high' - schema: - type: string - - name: templates - in: query - description: 'comma separated templates e.g. templates=tech-detect,azure-takeover' - schema: - type: string - - name: hosts - in: query - description: 'comma separated host e.g. hosts=https://example.com,https://x.com' - schema: - type: string - - name: search - in: query - description: search term - schema: - type: string - - name: type - in: query - description: type of filter - required: true - schema: - type: string - - name: time - in: query - description: 'filter by time ( last_day, last_week, last_month )' - schema: - type: string - - name: vuln_status - in: query - description: 'comma separated vuln_status e.g vuln_status=open,fixed' - schema: - type: string - - name: sort_asc - in: query - description: 'comma separated ascending sorting e.g sort_asc=created_at,severity' - schema: - type: string - - name: sort_desc - in: query - description: 'comma separated descending sorting e.g sort_desc=created_at,severity' - schema: - type: string - - name: tags - in: query - description: 'comma separated tags e.g tags=xss,cve' - schema: - type: string - - name: not_hosts - in: query - description: 'comma separated hosts that should not be returned e.g. not_hosts=https://example.com,https://x.com' - schema: - type: string - - name: not_severity - in: query - description: 'comma separated severity that should not be returned e.g. not_severity=info,high' - schema: - type: string - - name: not_templates - in: query - description: 'comma separated templates that should not be returned e.g. not_templates=tech-detect,azure-takeover' - schema: - type: string - - name: labels - in: query - description: 'filter by comma separated labels e.g labels=p1,p2' - schema: - type: string - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + - scans + operationId: post-v1-scans-vuln_id-retest responses: - '200': - $ref: '#/components/responses/GetScanResultsFiltersResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '499': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + "200": + $ref: "#/components/responses/PostRescanVulnResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" default: - $ref: '#/components/responses/ErrorResponse' + $ref: "#/components/responses/ErrorResponse" security: - - X-API-Key: [] - tags: - - results - /v1/scans/results/stats: - get: - operationId: get-v1-scans-results-stats - summary: Get Results Stats - description: Get user scan results stats + - X-API-Key: [] + description: Retest a scan vulnerability parameters: - - name: offset - in: query - description: The number of items to skip before starting to collect the result set - schema: - type: integer - - name: limit - in: query - description: The numbers of items to return - schema: - type: integer - - name: hosts - in: query - description: 'comma separated host e.g. hosts=https://example.com,https://x.com' - schema: - type: string - - name: templates - in: query - description: 'comma separated templates e.g. templates=tech-detect,azure-takeover' - schema: - type: string - - name: severity - in: query - description: 'comma separated severity e.g. severities=info,high' - schema: - type: string - - name: search - in: query - description: search term - schema: - type: string - - name: scan_id - in: query - description: specific scan_id results filters - schema: - type: string - - name: time - in: query - description: 'filter by time ( last_day, last_week, last_month )' - schema: - type: string - - name: vuln_status - in: query - description: 'comma separated vuln_status e.g vuln_status=open,fixed' - schema: - type: string - - name: tags - in: query - description: 'comma separated tags e.g tags=xss,cve' - schema: - type: string - - name: not_hosts - in: query - description: 'comma separated hosts that should not be returned e.g. not_hosts=https://example.com,https://x.com' - schema: - type: string - - name: not_severity - in: query - description: 'comma separated severity that should not be returned e.g. not_severity=info,high' - schema: - type: string - - name: not_templates - in: query - description: 'comma separated templates that should not be returned e.g. not_templates=tech-detect,azure-takeover' - schema: - type: string - - name: labels - in: query - description: 'filter by comma separated labels e.g labels=p1,p2' - schema: - type: string - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - responses: - '200': - $ref: '#/components/responses/GetScanResultStatsResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '499': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' - default: - $ref: '#/components/responses/ErrorResponse' - security: - - X-API-Key: [] - tags: - - results + - schema: + type: string + in: header + name: X-Team-Id + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + requestBody: + content: + application/json: + schema: + type: object + properties: + socks5_proxy: + type: string /v1/scans/schedule: get: - operationId: get-v1-scans-schedule summary: Get Scan Schedules - description: Get scan schedules for a user - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + tags: + - scans responses: - '200': - $ref: '#/components/responses/GetScanScheduleResponse' - '400': - $ref: '#/components/responses/GetScanScheduleResponse' - '401': - $ref: '#/components/responses/SetScanScheduleResponse' - '500': - $ref: '#/components/responses/SetScanScheduleResponse' + "200": + $ref: "#/components/responses/GetScanScheduleResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" + default: + $ref: "#/components/responses/ErrorResponse" + operationId: get-v1-scans-schedule + description: Get scan schedules for a user security: - - X-API-Key: [] - tags: - - scans + - X-API-Key: [] + parameters: + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id post: - operationId: post-v1-scans-schedule summary: Set Scan Schedule - description: 'set a scan schedule for a user ' - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - requestBody: - $ref: '#/components/requestBodies/SetScanScheduleRequest' + tags: + - scans + operationId: post-v1-scans-schedule responses: - '200': - $ref: '#/components/responses/SetScanScheduleResponse' - '400': - $ref: '#/components/responses/SetScanScheduleResponse' - '401': - $ref: '#/components/responses/SetScanScheduleResponse' - '500': - $ref: '#/components/responses/SetScanScheduleResponse' + "200": + $ref: "#/components/responses/SetScanScheduleResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" default: - $ref: '#/components/responses/ErrorResponse' + $ref: "#/components/responses/ErrorResponse" + description: "set a scan schedule for a user " + requestBody: + $ref: "#/components/requestBodies/SetScanScheduleRequest" security: - - X-API-Key: [] - tags: - - scans + - X-API-Key: [] + parameters: + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id delete: - operationId: delete-v1-scans-schedule summary: Delete Scan Schedule - description: Delete scan schedule for a user - parameters: - - name: scan_id - in: query - description: scan_id of schedule to be deleted - required: true - schema: - type: string - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + tags: + - scans + operationId: delete-v1-scans-schedule responses: - '200': - $ref: '#/components/responses/DeleteScanScheduleResponse' - '400': - $ref: '#/components/responses/DeleteScanScheduleResponse' - '401': - $ref: '#/components/responses/DeleteScanScheduleResponse' - '500': - $ref: '#/components/responses/DeleteScanScheduleResponse' + "200": + $ref: "#/components/responses/DeleteScanScheduleResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" default: - $ref: '#/components/responses/ErrorResponse' - security: - - X-API-Key: [] - tags: - - scans - /v1/retest: - get: - operationId: get-v1-retest - summary: Get All Retest - description: Get user retest results + $ref: "#/components/responses/ErrorResponse" parameters: - - name: offset - in: query - description: number of results to skip - required: true - schema: - type: integer - - name: limit - in: query - description: number of results - required: true - schema: - type: integer - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - responses: - '200': - $ref: '#/components/responses/GetRetestResultsResponse' - '401': - $ref: '#/components/responses/GetRetestResultsResponse' - '500': - $ref: '#/components/responses/GetRetestResultsResponse' + - schema: + type: string + in: query + name: scan_id + required: true + description: scan_id of schedule to be deleted + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id security: - - X-API-Key: [] + - X-API-Key: [] + description: Delete scan schedule for a user + /v1/retest/{vuln_id}: + get: + summary: Get Retest Vulnerability tags: - - retests - post: - operationId: post-v1-retest - summary: Create Retest - description: Trigger a retest scan - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - requestBody: - $ref: '#/components/requestBodies/RetestTemplateRequest' + - retests responses: - '200': - $ref: '#/components/responses/PostRetestTemplateResponse' - '400': - $ref: '#/components/responses/PostRetestTemplateResponse' - '401': - $ref: '#/components/responses/PostRetestTemplateResponse' - '500': - $ref: '#/components/responses/PostRetestTemplateResponse' - security: - - X-API-Key: [] - tags: - - retests - parameters: [] - '/v1/retest/{vuln_id}': - get: + "200": + $ref: "#/components/responses/GetSingleRetestResultResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" + default: + $ref: "#/components/responses/ErrorResponse" operationId: get-v1-retest-vuln_id - summary: Get Retest Vulnerability + security: + - X-API-Key: [] description: Get retest vulnerability (retests from editor) parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - responses: - '200': - $ref: '#/components/responses/GetSingleRetestResultResponse' - '400': - $ref: '#/components/responses/GetSingleRetestResultResponse' - '401': - $ref: '#/components/responses/GetSingleRetestResultResponse' - '500': - $ref: '#/components/responses/GetSingleRetestResultResponse' - security: - - X-API-Key: [] - tags: - - retests - parameters: - - name: vuln_id - in: path - required: true - schema: + - schema: type: string - /v1/assets: + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id + parameters: + - schema: + type: string + name: vuln_id + in: path + required: true + /v1/user/apikey: get: - operationId: get-v1-assets - summary: Get Asset List - description: Get user asset list - parameters: - - name: offset - in: query - description: number of assets to skip - schema: - type: integer - - name: limit - in: query - description: number of assets to fetch - schema: - type: integer - - name: search - in: query - description: search term for asset list - schema: - type: string - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - responses: - '200': - $ref: '#/components/responses/GetAssetsListResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' - default: - $ref: '#/components/responses/ErrorResponse' - security: - - X-API-Key: [] + summary: Get API Key tags: - - assets - post: - operationId: post-v1-assets - summary: Upload Asset - description: Manually upload user assets (uploaded to manual enumeration) - parameters: - - name: name - in: query - description: name of asset - schema: - type: string - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - - name: Content-Type - in: header - description: set the content type header - schema: - type: string - requestBody: - content: - application/octet-stream: - schema: - type: string - format: binary + - users responses: - '200': - $ref: '#/components/responses/UploadAssetResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + "200": + $ref: "#/components/responses/GetUserAPIKeyResponse" + "400": + $ref: "#/components/responses/MessageResponse" + "401": + $ref: "#/components/responses/MessageResponse" + "404": + $ref: "#/components/responses/MessageResponse" + "500": + $ref: "#/components/responses/MessageResponse" default: - $ref: '#/components/responses/ErrorResponse' + $ref: "#/components/responses/ErrorResponse" + operationId: get-v1-user-apikey security: - - X-API-Key: [] + - X-API-Key: [] + description: Get user api-key + post: + summary: Create API Key tags: - - assets - '/v1/assets/{asset_Id}': - parameters: - - name: asset_Id - in: path - required: true - schema: - type: string - get: - operationId: get-v1-assets-assetId - summary: Get Asset Metadata - description: Get asset metadata - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + - users + operationId: post-v1-user-apikey responses: - '200': - $ref: '#/components/responses/GetUserAssetResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + "200": + $ref: "#/components/responses/GetUserAPIKeyResponse" + "400": + $ref: "#/components/responses/MessageResponse" + "401": + $ref: "#/components/responses/MessageResponse" + "404": + $ref: "#/components/responses/MessageResponse" + "500": + $ref: "#/components/responses/MessageResponse" default: - $ref: '#/components/responses/ErrorResponse' + $ref: "#/components/responses/ErrorResponse" security: - - X-API-Key: [] - tags: - - assets + - X-API-Key: [] + description: Create user api-key, this won't create a new api-key if it already exists. delete: - operationId: delete-v1-assets-asset_Id - summary: Delete Asset - description: Delete asset by ID - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + summary: Delete API Key + tags: + - users + operationId: delete-v1-user-apikey responses: - '200': - $ref: '#/components/responses/DeleteAssetResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + "200": + $ref: "#/components/responses/DeleteUserAPIKeyResponse" + "400": + $ref: "#/components/responses/MessageResponse" + "401": + $ref: "#/components/responses/MessageResponse" + "404": + $ref: "#/components/responses/MessageResponse" + "500": + $ref: "#/components/responses/MessageResponse" default: - $ref: '#/components/responses/ErrorResponse' + $ref: "#/components/responses/ErrorResponse" security: - - X-API-Key: [] + - X-API-Key: [] + description: Delete user api-key + /v1/user/apikey/rotate: + post: + summary: Rotate API Key tags: - - assets - patch: - operationId: patch-v1-assets-asset_Id - summary: Update Asset Metadata - description: Update asset metadata - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - requestBody: - $ref: '#/components/requestBodies/UpdateAssetRequest' + - users + operationId: post-v1-user-apikey-rotate responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - message: - type: string - required: - - message - '401': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + "200": + $ref: "#/components/responses/PostApiKeyRotateResponse" + "400": + $ref: "#/components/responses/MessageResponse" + "401": + $ref: "#/components/responses/MessageResponse" + "404": + $ref: "#/components/responses/MessageResponse" + "500": + $ref: "#/components/responses/MessageResponse" default: - $ref: '#/components/responses/ErrorResponse' + $ref: "#/components/responses/ErrorResponse" security: - - X-API-Key: [] - tags: - - assets - '/v1/assets/{asset_id}/contents': + - X-API-Key: [] + description: Rotate user api-key + /v1/template/public: get: - operationId: get-v1-assets-id-contents - summary: Get Asset Content - description: Get user asset content - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + summary: Get Public Template List + tags: + - templates responses: - '200': - description: OK - content: - application/octet-stream: - schema: - type: string - format: binary - '401': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + "200": + $ref: "#/components/responses/GetPublicTemplateList" + "400": + $ref: "#/components/responses/MessageResponse" + "500": + $ref: "#/components/responses/MessageResponse" default: - $ref: '#/components/responses/ErrorResponse' - security: - - X-API-Key: [] - tags: - - assets - parameters: - - name: asset_id - in: path - required: true - schema: - type: string - patch: - operationId: patch-v1-assets-asset_id-contents - summary: Update Asset Content - description: Update existing asset content + $ref: "#/components/responses/ErrorResponse" + operationId: get-v1-template-public + description: Get public-template list parameters: - - name: update_type - in: query - description: 'use append or replace ' - schema: - type: string - enum: - - append - - replace - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - - name: Content-Type - in: header - description: set the content type header - schema: - type: string - requestBody: - content: - application/octet-stream: - schema: - type: string - format: binary + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id + - schema: + type: integer + in: query + name: offset + description: Pagination offset (no. of results to skip) + - schema: + type: integer + in: query + name: limit + description: Pagination limit (max no. of results in response) + - schema: + type: string + in: query + description: "template data fields " + name: fields + /v1/template/early: + get: + summary: Get Early Template List + tags: + - templates responses: - '200': - $ref: '#/components/responses/PatchAssetContentResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + "200": + $ref: "#/components/responses/GetEarlyTempateList" + "400": + $ref: "#/components/responses/MessageResponse" + "403": + $ref: "#/components/responses/MessageResponse" + "500": + $ref: "#/components/responses/MessageResponse" default: - $ref: '#/components/responses/ErrorResponse' + $ref: "#/components/responses/ErrorResponse" + operationId: get-v1-early-templates + description: Get pdcp early template lists security: - - X-API-Key: [] - tags: - - assets - /v1/user/feedback: - post: - operationId: post-v1-user-feedback - summary: Create Feedback - description: Add user feedback + - X-API-Key: [] parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - requestBody: - $ref: '#/components/requestBodies/PostFeedbackRequest' + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id + - schema: + type: integer + in: query + name: offset + - schema: + type: integer + in: query + name: limit + - schema: + type: string + in: query + name: fields + parameters: [] + /v1/template/early/{id}: + get: + summary: Get Early Template + tags: + - templates responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - message: - type: string - required: - - message - '401': + "200": description: Shared Response content: - application/json: + text/plain: schema: - type: object - properties: - message: - type: string - required: - - message - '500': - description: Internal Server Error - content: + type: string application/json: schema: type: object + required: + - message properties: message: type: string - required: - - message + template: + $ref: "#/components/schemas/TemplateData" + "400": + $ref: "#/components/responses/MessageResponse" + "403": + $ref: "#/components/responses/MessageResponse" + "404": + $ref: "#/components/responses/MessageResponse" + "500": + $ref: "#/components/responses/MessageResponse" + default: + $ref: "#/components/responses/ErrorResponse" + operationId: get-v1-early-templates-id + description: Get early template text security: - - X-API-Key: [] + - X-API-Key: [] + parameters: + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id + parameters: + - schema: + type: string + name: id + in: path + required: true + /v1/template/public/{template_id}: + get: + summary: Get Public Template tags: - - users - /v1/user/delete/code: - parameters: [] - post: - operationId: post-v1-user-delete-code - summary: Email user deletion verification code - description: generate and email user deletion verification code + - templates + responses: + "200": + $ref: "#/components/responses/GetTemplateDataResponse" + "400": + $ref: "#/components/responses/MessageResponse" + "500": + $ref: "#/components/responses/MessageResponse" + default: + $ref: "#/components/responses/ErrorResponse" + operationId: get-v1-public-template-data + description: Get public template data parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + - schema: + type: string + in: query + name: fields + description: "template data fields " + - schema: + type: string + in: header + name: X-Team-Id + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + parameters: + - schema: + type: string + name: template_id + in: path + required: true + description: "unique Id of template " + /v1/template: + get: + summary: Get Template List + tags: + - templates responses: - '200': - $ref: '#/components/responses/MessageResponse' - '400': - $ref: '#/components/responses/MessageResponse' - '403': - $ref: '#/components/responses/MessageResponse' - '500': - $ref: '#/components/responses/MessageResponse' + "200": + $ref: "#/components/responses/GetUserTemplateListResponse" + "401": + $ref: "#/components/responses/MessageResponse" + "500": + $ref: "#/components/responses/MessageResponse" + default: + $ref: "#/components/responses/ErrorResponse" + operationId: get-v1-templates security: - - X-API-Key: [] - tags: - - users - /v1/user: - get: - operationId: get-v1-user - summary: Get User Profile - description: Get user profile and permissions + - X-API-Key: [] + description: Get user private(my) templates parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id + - schema: + type: integer + in: query + name: offset + - schema: + type: integer + in: query + name: limit + - schema: + type: string + in: query + name: fields + parameters: [] + post: + summary: Create Template + tags: + - templates + operationId: post-v1-template responses: - '200': - $ref: '#/components/responses/GetUserProfileResponse' - '401': - $ref: '#/components/responses/GetUserProfileResponse' - '500': - $ref: '#/components/responses/GetUserProfileResponse' + "200": + $ref: "#/components/responses/CreateTemplateResponse" + "400": + $ref: "#/components/responses/MessageResponse" + "401": + $ref: "#/components/responses/MessageResponse" + "500": + $ref: "#/components/responses/MessageResponse" + default: + $ref: "#/components/responses/ErrorResponse" security: - - X-API-Key: [] - tags: - - users - delete: - operationId: delete-v1-user - summary: Delete user from system along with all data - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + - X-API-Key: [] requestBody: content: application/json: schema: type: object + required: + - template properties: - code: + template: type: string - required: - - code - responses: - '200': - $ref: '#/components/responses/MessageResponse' - '400': - $ref: '#/components/responses/MessageResponse' - '403': - $ref: '#/components/responses/MessageResponse' - '500': - $ref: '#/components/responses/MessageResponse' - security: - - X-API-Key: [] + description: | + Template in text format + prompt: + type: string + description: Create a private template + parameters: + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id + - schema: + type: string + in: query + name: filename + description: filename for template + - schema: + type: string + in: query + name: dir + description: directories for template + patch: + summary: Update Template tags: - - users - /v1/user/apikey: - get: - operationId: get-v1-user-apikey - summary: Get API Key - description: Get user api-key + - templates + operationId: patch-v1-template responses: - '200': - $ref: '#/components/responses/GetUserAPIKeyResponse' - '401': - $ref: '#/components/responses/GetUserAPIKeyResponse' - '404': - $ref: '#/components/responses/GetUserAPIKeyResponse' - '500': - $ref: '#/components/responses/GetUserAPIKeyResponse' + "200": + $ref: "#/components/responses/UpdateTemplateResponse" + "400": + $ref: "#/components/responses/MessageResponse" + "401": + $ref: "#/components/responses/MessageResponse" + "500": + $ref: "#/components/responses/MessageResponse" + default: + $ref: "#/components/responses/ErrorResponse" security: - - X-API-Key: [] + - X-API-Key: [] + requestBody: + $ref: "#/components/requestBodies/UpdateTemplateRequest" + description: "Update existing private template " + parameters: + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id + /v1/template/{template_id}: + parameters: + - schema: + type: string + name: template_id + in: path + required: true + description: "unique Id of template " + get: + summary: Get Template tags: - - users - post: - operationId: post-v1-user-apikey - summary: Create API Key - description: 'Create user api-key, this won''t create a new api-key if it already exists.' + - templates responses: - '200': - $ref: '#/components/responses/GetUserAPIKeyResponse' - '400': - $ref: '#/components/responses/GetUserAPIKeyResponse' - '500': - $ref: '#/components/responses/GetUserAPIKeyResponse' - security: - - X-API-Key: [] - tags: - - users + "200": + $ref: "#/components/responses/GetTemplateResponse" + "400": + $ref: "#/components/responses/MessageResponse" + "401": + $ref: "#/components/responses/MessageResponse" + "404": + $ref: "#/components/responses/MessageResponse" + "500": + $ref: "#/components/responses/MessageResponse" + default: + $ref: "#/components/responses/ErrorResponse" + operationId: get-v1-template-t_id + security: + - X-API-Key: [] + description: Get private template text using ID + parameters: + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id delete: - operationId: delete-v1-user-apikey - summary: Delete API Key - description: Delete user api-key + summary: Delete Template + tags: + - templates + operationId: delete-v1-template-template_id responses: - '200': - $ref: '#/components/responses/DeleteUserAPIKeyResponse' - '401': - $ref: '#/components/responses/DeleteUserAPIKeyResponse' - '500': - $ref: '#/components/responses/DeleteUserAPIKeyResponse' + "200": + $ref: "#/components/responses/DeleteTemplateResponse" + "400": + $ref: "#/components/responses/MessageResponse" + "401": + $ref: "#/components/responses/MessageResponse" + "500": + $ref: "#/components/responses/MessageResponse" + default: + $ref: "#/components/responses/ErrorResponse" security: - - X-API-Key: [] - tags: - - users - /v1/user/apikey/rotate: + - X-API-Key: [] + description: Delete private template using ID + parameters: + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id + /v1/template/ai: post: - operationId: post-v1-user-apikey-rotate - summary: Rotate API Key - description: Rotate user api-key + summary: Generate AI Template + tags: + - templates + operationId: post-v1-template-ai responses: - '200': - $ref: '#/components/responses/PostApiKeyRotateResponse' - '401': - $ref: '#/components/responses/PostApiKeyRotateResponse' - '500': - $ref: '#/components/responses/PostApiKeyRotateResponse' + "200": + $ref: "#/components/responses/GenerateTemplateResponse" + "400": + $ref: "#/components/responses/MessageResponse" + "401": + $ref: "#/components/responses/MessageResponse" + "403": + $ref: "#/components/responses/MessageResponse" + "500": + $ref: "#/components/responses/MessageResponse" + default: + $ref: "#/components/responses/ErrorResponse" + requestBody: + $ref: "#/components/requestBodies/GenerateTemplateRequest" security: - - X-API-Key: [] - tags: - - users - /v1/template/public: - get: - operationId: get-v1-template-public - summary: Get Public Template List - description: Get public-template list + - X-API-Key: [] + description: Generate a private template with AI Engine parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - responses: - '200': - $ref: '#/components/responses/GetPublicTemplateList' - '201': - $ref: '#/components/responses/GetPublicTemplateList' - '500': - $ref: '#/components/responses/GetPublicTemplateList' - tags: - - templates - /v1/template/early: + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id + /v1/template/share: get: - operationId: get-v1-early-templates - summary: Get Early Template List - description: Get pdcp early template lists - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + summary: Get Shared Template List + tags: + - templates responses: - '200': - $ref: '#/components/responses/GetEarlyTempateList' - '400': - $ref: '#/components/responses/MessageResponse' - '403': - $ref: '#/components/responses/MessageResponse' - '500': - $ref: '#/components/responses/MessageResponse' + "200": + $ref: "#/components/responses/GetShareStatusResponse" + "400": + $ref: "#/components/responses/MessageResponse" + "401": + $ref: "#/components/responses/MessageResponse" + "404": + $ref: "#/components/responses/MessageResponse" + "500": + $ref: "#/components/responses/MessageResponse" + default: + $ref: "#/components/responses/ErrorResponse" + operationId: get-v1-template-share security: - - X-API-Key: [] - tags: - - templates - parameters: [] - '/v1/template/early/{id}': - get: - operationId: get-v1-early-templates-id - summary: Get Early Template - description: Get early template text + - X-API-Key: [] parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id + - schema: + type: string + in: query + name: fields + - schema: + type: integer + in: query + name: limit + description: Limit The numbers of items to return + - schema: + type: integer + in: query + name: offset + description: Offset The numbers of items to skip + - schema: + type: string + in: query + description: SortAsc Sort results in ascending order (CSV field names) + name: sort_asc + - schema: + type: string + in: query + name: sort_desc + description: SortDesc Sort results in descending order (CSV field names) + description: Shared template list + post: + summary: Share Template + tags: + - templates + operationId: post-v1-template-share responses: - '200': - description: Shared Response - content: - text/plain: - schema: - type: string - '400': - $ref: '#/components/responses/MessageResponse' - '403': - $ref: '#/components/responses/MessageResponse' - '404': - $ref: '#/components/responses/MessageResponse' - '500': - $ref: '#/components/responses/MessageResponse' + "200": + $ref: "#/components/responses/ShareTemplateResponse" + "400": + $ref: "#/components/responses/MessageResponse" + "401": + $ref: "#/components/responses/MessageResponse" + "404": + $ref: "#/components/responses/MessageResponse" + "500": + $ref: "#/components/responses/MessageResponse" + default: + $ref: "#/components/responses/ErrorResponse" security: - - X-API-Key: [] - tags: - - templates - parameters: - - name: id - in: path - required: true - schema: + - X-API-Key: [] + requestBody: + $ref: "#/components/requestBodies/ShareTemplateRequest" + description: Share a private template (shared-with-link) + parameters: + - schema: type: string - '/v1/template/public/{template_id}': + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id + /v1/template/share/{template_id}: + parameters: + - schema: + type: string + name: template_id + in: path + required: true + description: unique template ID get: - summary: Get Public Template + summary: Get Shared Template tags: - - templates + - templates responses: - '200': - $ref: '#/components/responses/GetTemplateDataResponse' - '400': - $ref: '#/components/responses/MessageResponse' - '500': - $ref: '#/components/responses/MessageResponse' + "200": + $ref: "#/components/responses/GetSharedTemplateResponse" + "400": + $ref: "#/components/responses/MessageResponse" + "401": + $ref: "#/components/responses/MessageResponse" + "404": + $ref: "#/components/responses/MessageResponse" + "500": + $ref: "#/components/responses/MessageResponse" default: - $ref: '#/components/responses/MessageResponse' - operationId: get-v1-public-template-data - description: Get public template data using template id + $ref: "#/components/responses/ErrorResponse" + operationId: get-v1-template-share-template_id parameters: - - schema: - type: string - in: query - name: fields - description: 'template data fields ' - - schema: - type: string - in: header - name: X-Team-Id - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - parameters: - schema: type: string - name: template_id - in: path - required: true - description: 'Public Template ID' - /v1/template: - get: - operationId: get-v1-templates - summary: Get Template List - description: Get user private(my) templates - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + in: query + name: fields + description: get selected fields e.g. name,template_id,severity, etc + description: Get a shared template text + requestBody: + content: {} + patch: + summary: Update Shared Template + tags: [] responses: - '200': - $ref: '#/components/responses/GetUserTemplateListResponse' - '401': - $ref: '#/components/responses/GetUserTemplateListResponse' - '500': - $ref: '#/components/responses/GetUserTemplateListResponse' - security: - - X-API-Key: [] - tags: - - templates - parameters: [] - post: - operationId: post-v1-template - summary: Create Template - description: Create a private template - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + "200": + $ref: "#/components/responses/UpdateSharedTemplateResponse" + "400": + $ref: "#/components/responses/MessageResponse" + "401": + $ref: "#/components/responses/MessageResponse" + "500": + $ref: "#/components/responses/MessageResponse" + default: + $ref: "#/components/responses/ErrorResponse" + operationId: patch-v1-template-share-template_id + parameters: [] requestBody: content: application/json: schema: type: object properties: - template: + ttl: type: string - prompt: + share_type: type: string - required: - - template - responses: - '200': - $ref: '#/components/responses/CreateTemplateResponse' - '400': - $ref: '#/components/responses/MessageResponse' - '401': - $ref: '#/components/responses/MessageResponse' - '500': - $ref: '#/components/responses/MessageResponse' - security: - - X-API-Key: [] - tags: - - templates - patch: - operationId: patch-v1-template - summary: Update Template - description: 'Update existing private template ' - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - requestBody: - $ref: '#/components/requestBodies/UpdateTemplateRequest' - responses: - '200': - $ref: '#/components/responses/UpdateTemplateResponse' - '400': - $ref: '#/components/responses/MessageResponse' - '401': - $ref: '#/components/responses/MessageResponse' - '500': - $ref: '#/components/responses/MessageResponse' - security: - - X-API-Key: [] - tags: - - templates - '/v1/template/{template_id}': - parameters: - - name: template_id - in: path - description: 'unique Id of template ' - required: true - schema: - type: string - get: - operationId: get-v1-template-t_id - summary: Get Template - description: Get private template text using ID - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - responses: - '200': - $ref: '#/components/responses/GetTemplateResponse' - '400': - $ref: '#/components/responses/GetTemplateResponse' - '401': - $ref: '#/components/responses/GetTemplateResponse' - '404': - $ref: '#/components/responses/MessageResponse' - '500': - $ref: '#/components/responses/GetTemplateResponse' - security: - - X-API-Key: [] - tags: - - templates + users: + type: array + items: + type: integer + emails: + type: array + items: + type: string + organizations: + type: array + items: + type: string delete: - operationId: delete-v1-template-template_id - summary: Delete Template - description: Delete private template using ID - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - responses: - '200': - $ref: '#/components/responses/DeleteTemplateResponse' - '400': - $ref: '#/components/responses/DeleteTemplateResponse' - '401': - $ref: '#/components/responses/DeleteTemplateResponse' - '500': - $ref: '#/components/responses/DeleteTemplateResponse' - security: - - X-API-Key: [] - tags: - - templates - /v1/template/ai: - post: - operationId: post-v1-template-ai - summary: Generate AI Template - description: Generate a private template with AI Engine - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - requestBody: - $ref: '#/components/requestBodies/GenerateTemplateRequest' - responses: - '200': - $ref: '#/components/responses/GenerateTemplateResponse' - '400': - $ref: '#/components/responses/GenerateTemplateResponse' - '401': - $ref: '#/components/responses/GenerateTemplateResponse' - '403': - $ref: '#/components/responses/GenerateTemplateResponse' - '500': - $ref: '#/components/responses/GenerateTemplateResponse' - security: - - X-API-Key: [] - tags: - - templates - /v1/template/share: - get: - operationId: get-v1-template-share - summary: Get Share Status - description: Get template sahred status (shared-with-link) - parameters: - - name: template_id - in: query - description: short uuid of requested template - required: true - schema: - type: string - - name: user_name - in: query - description: user name of logged in user - required: true - schema: - type: string - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - responses: - '200': - $ref: '#/components/responses/GetShareStatusResponse' - '400': - $ref: '#/components/responses/GetShareStatusResponse' - '401': - $ref: '#/components/responses/GetShareStatusResponse' - '404': - $ref: '#/components/responses/GetShareStatusResponse' - '500': - $ref: '#/components/responses/GetShareStatusResponse' - security: - - X-API-Key: [] - tags: - - templates - post: - operationId: post-v1-template-share - summary: Share Template - description: Share a private template (shared-with-link) - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - requestBody: - $ref: '#/components/requestBodies/ShareTemplateRequest' - responses: - '200': - $ref: '#/components/responses/ShareTemplateResponse' - '400': - $ref: '#/components/responses/ShareTemplateResponse' - '401': - $ref: '#/components/responses/ShareTemplateResponse' - '404': - $ref: '#/components/responses/ShareTemplateResponse' - '500': - $ref: '#/components/responses/ShareTemplateResponse' - security: - - X-API-Key: [] - tags: - - templates - '/v1/template/share/{template_id}': - parameters: - - name: template_id - in: path - description: unique template ID - required: true - schema: - type: string - get: - operationId: get-v1-template-share-template_id - summary: Get Shared Template - description: Get a shared template text - parameters: - - name: user_name - in: query - description: user name of template owner - required: true - schema: - type: string - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + summary: Unshare/Delete template + tags: [] responses: - '200': - $ref: '#/components/responses/GetSharedTemplateResponse' - '400': - $ref: '#/components/responses/GetSharedTemplateResponse' - '401': - $ref: '#/components/responses/GetSharedTemplateResponse' - '404': - $ref: '#/components/responses/GetSharedTemplateResponse' - '500': - $ref: '#/components/responses/GetSharedTemplateResponse' - tags: - - templates + "200": + $ref: "#/components/responses/MessageResponse" + "400": + $ref: "#/components/responses/MessageResponse" + "401": + $ref: "#/components/responses/MessageResponse" + "500": + $ref: "#/components/responses/MessageResponse" + default: + $ref: "#/components/responses/ErrorResponse" + operationId: delete-v1-template-share-template_id /v1/scans/scan_ips: get: - operationId: get-v1-scans-scan_ips summary: Get Scan IPs - description: Get list of static IPs used for scan - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + tags: + - scans responses: - '200': - $ref: '#/components/responses/StaticScanIPsResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '403': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + "200": + $ref: "#/components/responses/StaticScanIPsResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "403": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" default: - $ref: '#/components/responses/ErrorResponse' + $ref: "#/components/responses/ErrorResponse" + operationId: get-v1-scans-scan_ips security: - - X-API-Key: [] - tags: - - scans - '/v1/scans/{scan_id}/import': - parameters: - - name: scan_id - in: path - required: true - schema: + - X-API-Key: [] + description: Get user static scan IPs list + parameters: + - schema: type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id + /v1/scans/{scan_id}/import: + parameters: + - schema: + type: string + name: scan_id + in: path + required: true patch: - operationId: patch-v1-scans-scan_id-import summary: Update Imported Scan + operationId: patch-v1-scans-scan_id-import + tags: + - scans + responses: + "200": + $ref: "#/components/responses/MessageResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "403": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" + default: + $ref: "#/components/responses/ErrorResponse" description: Import more results to a given scan - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string requestBody: content: application/octet-stream: schema: type: string format: binary - responses: - '200': - $ref: '#/components/responses/MessageResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '403': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' - default: - $ref: '#/components/responses/ErrorResponse' security: - - X-API-Key: [] - tags: - - scans - '/v1/scans/{scan_id}/export': - parameters: - - name: scan_id - in: path - required: true - schema: + - X-API-Key: [] + parameters: + - schema: type: string - - name: async - in: query - schema: - type: boolean + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id + /v1/scans/{scan_id}/export: + parameters: + - schema: + type: string + name: scan_id + in: path + required: true + - schema: + type: boolean + in: query + name: async get: - operationId: get-v1-scans-scan_id-export summary: Export Scan - description: Export scan results - parameters: - - name: type - in: query - description: 'json, csv, pdf (default json)' - schema: - type: string - enum: - - json - - csv - - pdf - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + tags: + - scans responses: - '200': + "200": description: OK content: application/octet-stream: schema: type: string - '201': + "201": description: Created content: application/json: @@ -1910,38 +1474,80 @@ paths: export_id: type: string required: - - export_id - '401': - $ref: '#/components/responses/ErrorResponse' - '403': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + - export_id + "401": + $ref: "#/components/responses/ErrorResponse" + "403": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" default: - $ref: '#/components/responses/ErrorResponse' + $ref: "#/components/responses/ErrorResponse" + operationId: get-v1-scans-scan_id-export + parameters: + - schema: + type: string + enum: + - json + - csv + - pdf + in: query + name: type + description: json, csv, pdf (default json) + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id security: - - X-API-Key: [] - tags: - - scans + - X-API-Key: [] + description: Export scan results post: - operationId: post-v1-scans-scan_id-export summary: Export Filtered Scan - description: Export filtered scan results + tags: + - scans + responses: + "200": + description: OK + content: + application/octet-stream: + schema: + type: string + "201": + description: Created + content: + application/json: + schema: + type: object + properties: + export_id: + type: string + required: + - export_id + "401": + $ref: "#/components/responses/ErrorResponse" + "403": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" + default: + $ref: "#/components/responses/ErrorResponse" + operationId: post-v1-scans-scan_id-export parameters: - - name: type - in: query - description: 'json, csv, pdf (default json)' - schema: - type: string - enum: - - json - - csv - - pdf - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + - schema: + type: string + enum: + - json + - csv + - pdf + in: query + name: type + description: json, csv, pdf (default json) + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id requestBody: content: application/json: @@ -1962,20 +1568,45 @@ paths: type: array items: type: string + domain: + type: array + items: + type: string + port: + type: array + items: + type: integer template: type: array items: type: string search: type: string + category: + type: array + items: + type: string + security: + - X-API-Key: [] + description: Export filtered scan results + /v1/scans/results/export: + parameters: + - schema: + type: boolean + in: query + name: async + post: + summary: Export filtered Scan results + tags: + - export responses: - '200': + "200": description: OK content: application/octet-stream: schema: type: string - '201': + "201": description: Created content: application/json: @@ -1985,44 +1616,31 @@ paths: export_id: type: string required: - - export_id - '401': - $ref: '#/components/responses/ErrorResponse' - '403': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + - export_id + "401": + $ref: "#/components/responses/ErrorResponse" + "403": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" default: - $ref: '#/components/responses/ErrorResponse' - security: - - X-API-Key: [] - tags: - - scans - /v1/scans/results/export: - parameters: - - name: async - in: query - schema: - type: boolean - post: + $ref: "#/components/responses/ErrorResponse" operationId: post-v1-scans-results-export - summary: Export filtered Scan results - description: Export filtered scan results parameters: - - name: type - in: query - description: 'json, csv, pdf (default json)' - schema: - type: string - enum: - - json - - csv - - pdf - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + - schema: + type: string + enum: + - json + - csv + - pdf + in: query + name: type + description: json, csv, pdf (default json) + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id requestBody: content: application/json: @@ -2043,304 +1661,241 @@ paths: type: array items: type: string + domain: + type: array + items: + type: string + port: + type: array + items: + type: integer template: type: array items: type: string search: type: string - scan_ids: + category: type: array items: type: string - responses: - '200': - description: OK - content: - application/octet-stream: - schema: - type: string - '201': - description: Created - content: - application/json: - schema: - type: object - properties: - export_id: + scan_ids: + type: array + items: type: string - required: - - export_id - '401': - $ref: '#/components/responses/ErrorResponse' - '403': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' - default: - $ref: '#/components/responses/ErrorResponse' security: - - X-API-Key: [] - tags: - - export - /v1/export/list: - get: - operationId: get-v1-export-list - summary: Get export list for user - parameters: - - name: offset - in: query - description: The number of items to skip before starting to collect the result set - schema: - type: integer - - name: limit - in: query - schema: - type: integer - - name: export_status - in: query - schema: - type: string - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - current_page: - type: integer - result_count: - type: integer - total_results: - type: integer - total_pages: - type: integer - data: - type: array - items: - $ref: '#/components/schemas/ExportListItem' - required: - - current_page - - result_count - - total_results - - total_pages - - data - '401': - $ref: '#/components/responses/ErrorResponse' - '403': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' - default: - $ref: '#/components/responses/ErrorResponse' - tags: - - export - '/v1/scans/vuln/{vuln_id}/export': + - X-API-Key: [] + description: Export filtered scan results + /v1/scans/vuln/{vuln_id}/export: parameters: - - name: vuln_id - in: path - required: true - schema: - type: string + - schema: + type: string + name: vuln_id + in: path + required: true get: - operationId: get-v1-scans-vuln-vuln_id-export summary: Export Scan Vulnerability - description: Export a specific scan vulnerability - parameters: - - name: type - in: query - description: 'json, csv (default json)' - schema: - type: string - enum: - - json - - csv - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + tags: + - scans responses: - '200': + "200": description: OK content: application/octet-stream: schema: type: string - '401': - $ref: '#/components/responses/ErrorResponse' - '403': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + "401": + $ref: "#/components/responses/ErrorResponse" + "403": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" default: - $ref: '#/components/responses/ErrorResponse' + $ref: "#/components/responses/ErrorResponse" + operationId: get-v1-scans-vuln-vuln_id-export + parameters: + - schema: + type: string + enum: + - json + - csv + in: query + name: type + description: json, csv (default json) + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id security: - - X-API-Key: [] - tags: - - scans + - X-API-Key: [] + description: Export a specific scan vulnerability /v1/scans/vulns: patch: - operationId: patch-v1-scans-vulns summary: Update Vulnerability Status - description: Batch update vulnerability status - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - requestBody: - $ref: '#/components/requestBodies/PatchScanVulnsRequest' + operationId: patch-v1-scans-vulns + tags: + - scans responses: - '200': - $ref: '#/components/responses/MessageResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + "200": + $ref: "#/components/responses/MessageResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" default: - $ref: '#/components/responses/ErrorResponse' + $ref: "#/components/responses/ErrorResponse" + requestBody: + $ref: "#/components/requestBodies/PatchScanVulnsRequest" security: - - X-API-Key: [] - tags: - - scans + - X-API-Key: [] + description: Batch update vulnerability status + parameters: + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id delete: - operationId: delete-v1-scans-vulns summary: Delete Scan Vulnerability - description: Batch Delete scan vulnerability - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - requestBody: - $ref: '#/components/requestBodies/DeleteVulnsRequest' + operationId: delete-v1-scans-vulns + tags: + - scans responses: - '200': - $ref: '#/components/responses/MessageResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + "200": + $ref: "#/components/responses/MessageResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" default: - $ref: '#/components/responses/ErrorResponse' + $ref: "#/components/responses/ErrorResponse" + requestBody: + $ref: "#/components/requestBodies/DeleteVulnsRequest" security: - - X-API-Key: [] - tags: - - scans + - X-API-Key: [] + description: Batch Delete scan vulnerability + parameters: + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id /v1/scans/vulns/labels: patch: - operationId: patch-v1-scans-vulns-labels summary: Update Vulnerability Labels - description: Batch update vulnerability labels - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - requestBody: - $ref: '#/components/requestBodies/PatchScanVulnsLabelsRequest' + operationId: patch-v1-scans-vulns-labels + tags: + - scans responses: - '200': - $ref: '#/components/responses/MessageResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + "200": + $ref: "#/components/responses/MessageResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" default: - $ref: '#/components/responses/ErrorResponse' + $ref: "#/components/responses/ErrorResponse" + requestBody: + $ref: "#/components/requestBodies/PatchScanVulnsLabelsRequest" security: - - X-API-Key: [] - tags: - - scans + - X-API-Key: [] + description: Batch update vulnerability labels + parameters: + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id /v1/scans/config: get: - operationId: get-v1-scans-config summary: Get Configs List - description: Get user scan configurations list - parameters: - - name: type - in: query - description: filter by the type of config - schema: - type: string - enum: - - scan - - reporting - - template - - alerting - - cloudlist - - name: search - in: query - description: search by config name - schema: - type: string - - name: limit - in: query - description: The numbers of items to return - schema: - type: integer - - name: offset - in: query - description: The number of items to skip before starting to collect the result set - schema: - type: integer - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + tags: + - configurations responses: - '200': + "200": description: OK content: application/json: schema: type: array items: - $ref: '#/components/schemas/ConfigResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '403': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + $ref: "#/components/schemas/ConfigResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "403": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" default: - $ref: '#/components/responses/ErrorResponse' + $ref: "#/components/responses/ErrorResponse" + operationId: get-v1-scans-config + parameters: + - schema: + enum: + - scan + - reporting + - template + - alerting + - cloudlist + - subfinder + - remediation + - vuln_score + type: string + in: query + name: type + description: filter by the type of config + - schema: + type: string + in: query + name: search + description: search by config name + - schema: + type: integer + in: query + name: limit + description: The numbers of items to return + - schema: + type: integer + in: query + description: The number of items to skip before starting to collect the result set + name: offset + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id security: - - X-API-Key: [] - tags: - - configurations + - X-API-Key: [] + description: Get user scan configurations list post: - operationId: post-v1-scans-config summary: Add Config - description: Add a new scan configuration - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - requestBody: - content: + operationId: post-v1-scans-config + tags: + - configurations + responses: + "200": + $ref: "#/components/responses/PostScanConfigResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "403": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" + default: + $ref: "#/components/responses/ErrorResponse" + requestBody: + content: application/json: schema: type: object @@ -2348,79 +1903,84 @@ paths: config: type: string config_type: - $ref: '#/components/schemas/ConfigTypeEnum' + $ref: "#/components/schemas/ConfigTypeEnum" name: type: string global: type: boolean required: - - config - - name - responses: - '200': - $ref: '#/components/responses/PostScanConfigResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '403': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' - default: - $ref: '#/components/responses/ErrorResponse' + - config + - name security: - - X-API-Key: [] - tags: - - configurations - '/v1/scans/config/{config_id}': - parameters: - - name: config_id - in: path - required: true - schema: + - X-API-Key: [] + description: Add a new scan configuration + parameters: + - schema: type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id + /v1/scans/config/{config_id}: + parameters: + - schema: + type: string + name: config_id + in: path + required: true get: - operationId: get-v1-scans-config-config_id summary: Get Config - description: Get a scan configuration - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + tags: + - configurations responses: - '200': + "200": description: OK content: application/json: schema: - $ref: '#/components/schemas/ConfigResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '403': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + $ref: "#/components/schemas/ConfigResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "403": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" default: - $ref: '#/components/responses/ErrorResponse' + $ref: "#/components/responses/ErrorResponse" + operationId: get-v1-scans-config-config_id security: - - X-API-Key: [] - tags: - - configurations + - X-API-Key: [] + description: Get a scan configuration + parameters: + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id + - schema: + type: boolean + in: query + name: config_json + description: config is in json format patch: - operationId: patch-v1-scans-config-config_id summary: Update Config - description: Update existing scan configuration - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + operationId: patch-v1-scans-config-config_id + tags: + - configurations + responses: + "200": + $ref: "#/components/responses/PostScanConfigResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "403": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" + default: + $ref: "#/components/responses/ErrorResponse" requestBody: content: application/json: @@ -2433,168 +1993,91 @@ paths: type: string global: type: boolean - responses: - '200': - $ref: '#/components/responses/PostScanConfigResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '403': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' - default: - $ref: '#/components/responses/ErrorResponse' security: - - X-API-Key: [] - tags: - - configurations + - X-API-Key: [] + description: Update existing scan configuration + parameters: + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id + - schema: + type: boolean + in: query + description: Specify payload is in json + name: config_json delete: - operationId: delete-v1-scans-config-config_id summary: Delete Config - description: Delete scan configuration - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - responses: - '200': - $ref: '#/components/responses/MessageResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '403': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' - default: - $ref: '#/components/responses/ErrorResponse' - security: - - X-API-Key: [] + operationId: delete-v1-scans-config-config_id tags: - - configurations - /v1/scans/config/verify: - post: - operationId: post-v1-scans-config-verify - summary: Verify Config - description: Verify scan configuration - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - requestBody: - $ref: '#/components/requestBodies/VerifyConfigRequest' + - configurations responses: - '200': - $ref: '#/components/responses/VerifyConfigResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + "200": + $ref: "#/components/responses/MessageResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "403": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" default: - $ref: '#/components/responses/ErrorResponse' + $ref: "#/components/responses/ErrorResponse" security: - - X-API-Key: [] - tags: - - configurations - /v1/scans/config/verify/contents: - post: - operationId: post-v1-scans-config-verify-contents - summary: Get Verify Config Contents - description: Get Verify scan configuration contents + - X-API-Key: [] + description: Delete scan configuration parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - requestBody: - $ref: '#/components/requestBodies/VerifyConfigContentsRequest' - responses: - '200': - $ref: '#/components/responses/VerifyConfigContentsResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' - default: - $ref: '#/components/responses/ErrorResponse' - security: - - X-API-Key: [] - tags: - - configurations - '/v1/scans/{scan_id}/config': - parameters: - - name: scan_id - in: path - required: true - schema: + - schema: type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id + /v1/scans/{scan_id}/config: + parameters: + - schema: + type: string + name: scan_id + in: path + required: true get: - operationId: get-scans-id-config summary: Get Scan Config - description: 'Get scan metadata config ' - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + tags: + - scans responses: - '200': + "200": description: OK + headers: {} content: application/json: schema: - $ref: '#/components/schemas/ScanConfig' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + $ref: "#/components/schemas/ScanConfig" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" default: - $ref: '#/components/responses/ErrorResponse' + $ref: "#/components/responses/ErrorResponse" + operationId: get-scans-id-config security: - - X-API-Key: [] - tags: - - scans + - X-API-Key: [] + description: "Get scan metadata config " + parameters: + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id patch: - operationId: patch-scans-id-config summary: Update Scan Config - description: Update scan metadata config - parameters: - - name: update_type - in: query - description: 'Update type: append or replace' - schema: - type: string - default: append - enum: - - append - - replace - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/ScanConfigUpdateItem' + operationId: patch-scans-id-config + tags: + - scans responses: - '200': + "200": description: OK content: application/json: @@ -2603,3824 +2086,3411 @@ paths: properties: ok: type: boolean - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" default: - $ref: '#/components/responses/ErrorResponse' + $ref: "#/components/responses/ErrorResponse" + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/ScanConfigUpdateItem" security: - - X-API-Key: [] - tags: - - scans - /v1/user/subscription: + - X-API-Key: [] + description: Update scan metadata config + parameters: + - schema: + type: string + enum: + - append + - replace + default: append + in: query + name: update_type + description: "Update type: append or replace" + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id + /v1/asset/enumerate: get: - operationId: get-v1-user-subscription - summary: Get Subscription Status - description: Get user subscription status + summary: Get Enumeration List + tags: + - enumerations + responses: + "200": + $ref: "#/components/responses/EnumerateResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "403": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" + default: + $ref: "#/components/responses/ErrorResponse" + operationId: get-v1-asset-enumerate parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + - schema: + type: integer + in: query + name: offset + description: The number of items to skip before starting to collect the result set + - schema: + type: integer + in: query + name: limit + description: The numbers of items to return + - schema: + type: string + in: query + name: search + description: search keyword in enumeration list + - schema: + type: string + in: query + name: enum_type + description: types of enumeration list (comma seperated) + - schema: + type: string + in: query + name: sort_asc + description: comma separated ascending sorting e.g sort_asc=created_at,name + - schema: + type: string + in: query + name: sort_desc + description: comma separated descending sorting e.g sort_desc=created_at,name + - schema: + type: string + in: query + name: status + description: comma separated filter enumeration result by status + - schema: + type: string + enum: + - last_day + - last_week + - last_month + - last_3_months + - last_6_months + - last_12_months + - all_time + default: all_time + in: query + name: time + description: time range to get enumerations from + - schema: + type: string + format: date + in: query + name: start_date + description: time filter start date + - schema: + type: string + format: date + in: query + name: end_date + description: time filter end date + - schema: + type: string + in: query + name: custom_filter + description: custom query to filter. double encode the query string. + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id + security: + - X-API-Key: [] + description: Get enumeration list + post: + summary: Create Enumeration + tags: + - enumerations responses: - '200': + "200": description: OK content: application/json: schema: type: object properties: - status: - type: string - message: + id: type: string - amount: - type: integer - monthly_token: + truncated-scan-targets: type: integer - price_id: - type: string - recurrence: - type: string - from: - type: string - to: - type: string - card: - type: string - brand: + is-public: + type: boolean + bulk_ids: + type: array + items: + type: string + failed_domains: + type: object + additionalProperties: + type: string + description: Map of domain to failure reason + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "403": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" + default: + $ref: "#/components/responses/ErrorResponse" + operationId: post-v1-asset-enumerate + requestBody: + content: + application/json: + schema: + type: object + properties: + root_domains: + type: array + items: type: string - payment_mode: + enrichment_inputs: + type: array + items: type: string - cancel_at: + cloudlist_config_ids: + type: array + items: type: string - trial: + name: + type: string + steps: + type: array + items: type: string - required: - - status - - message - '400': - description: Bad Request - content: - application/json: - schema: - type: object - properties: - message: + enum: + - dns_resolve + - dns_bruteforce + - dns_permute + - port_scan + - http_probe + - http_screenshot + - endpoint_crawling + - dns_passive + - tls_scan + - uncover_assets + - dns_scraping + enumeration_ports: + type: string + alerting_config_ids: + type: array + items: type: string - required: - - message - '500': - description: Internal Server Error - content: - application/json: - schema: - type: object - properties: - message: + disable_global_alert_config: + type: boolean + exclude_targets: + type: array + items: type: string - required: - - message + enumeration_config: + type: object + properties: + follow-redirect: + type: boolean + ports: + type: string + automatic_vuln_scans: + type: boolean + per_domain_enumeration: + type: boolean security: - - X-API-Key: [] - tags: - - users - patch: - operationId: patch-v1-user-subscription - summary: Update current subscription + - X-API-Key: [] + description: Create a new enumeration parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id + delete: + summary: Delete Assets in bulk + tags: + - enumerations + responses: + "200": + $ref: "#/components/responses/MessageResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" + default: + $ref: "#/components/responses/ErrorResponse" + operationId: delete-v1-asset-enumerates requestBody: content: application/json: schema: type: object - properties: - price_id: - type: string required: - - price_id - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - message: - type: string - invoice: - type: string - status: + - asset_ids + properties: + asset_ids: + type: array + items: type: string - required: - - message - - status - '400': - $ref: '#/components/responses/MessageResponse' - '403': - $ref: '#/components/responses/MessageResponse' - '500': - $ref: '#/components/responses/MessageResponse' security: - - X-API-Key: [] - tags: - - users - /v1/asset/enumerate: - get: - operationId: get-v1-asset-enumerate - summary: Get Enumeration List - description: Get enumeration list + - X-API-Key: [] + description: Delete enumeration by enumerate ids parameters: - - name: offset - in: query - description: The number of items to skip before starting to collect the result set - schema: - type: integer - - name: limit - in: query - description: The numbers of items to return - schema: - type: integer - - name: search - in: query - description: search keyword in enumeration list - schema: - type: string - - name: enum_type - in: query - description: types of enumeration list (comma seperated) - schema: - type: string - - name: sort_asc - in: query - description: 'comma separated ascending sorting e.g sort_asc=created_at,name' - schema: - type: string - - name: sort_desc - in: query - description: 'comma separated descending sorting e.g sort_desc=created_at,name' - schema: - type: string - - name: status - in: query - description: comma separated filter enumeration result by status - schema: - type: string - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id + /v1/asset/enumerate/{enumerate_id}: + parameters: + - schema: + type: string + name: enumerate_id + in: path + required: true + get: + summary: Get Enumeration + tags: + - enumerations responses: - '200': - $ref: '#/components/responses/EnumerateResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '403': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + "200": + $ref: "#/components/responses/GetEnumerateIdContentsResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "403": + $ref: "#/components/responses/ErrorResponse" + "499": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" default: - $ref: '#/components/responses/ErrorResponse' + $ref: "#/components/responses/ErrorResponse" + operationId: get-v1-asset-enumerate-enumerate_id security: - - X-API-Key: [] - tags: - - enumerations - post: - operationId: post-v1-asset-enumerate - summary: Create Enumeration - description: Create a new enumeration + - X-API-Key: [] + description: Get enumeration by enumerate_id parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id + patch: + summary: Update Enumeration + tags: + - enumerations + responses: + "200": + $ref: "#/components/responses/MessageResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "403": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" + default: + $ref: "#/components/responses/ErrorResponse" + operationId: patch-v1-asset-enumerate-enumerate_id requestBody: content: application/json: schema: type: object properties: - root_domains: - type: array - items: - type: string - enrichment_inputs: - type: array - items: - type: string - cloudlist_config_ids: - type: array - items: - type: string name: type: string - steps: - type: array - items: - type: string - enum: - - dns_passive - - dns_resolve - - dns_bruteforce - - dns_permute - - port_scan - - http_probe - - http_screenshot - enumeration_ports: - type: string - alerting_config_ids: - type: array - items: - type: string - disable_global_alert_config: - type: boolean - exclude_targets: - type: array - items: - type: string - enumeration_config: - type: object - properties: - follow-redirect: - type: boolean - ports: - type: string + security: + - X-API-Key: [] + description: Update enumeration by enumerate_id + parameters: + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id + delete: + summary: Delete Enumeration + tags: + - enumerations + responses: + "200": + $ref: "#/components/responses/MessageResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" + default: + $ref: "#/components/responses/ErrorResponse" + operationId: delete-v1-asset-enumerate-enumerate_id + security: + - X-API-Key: [] + description: Delete enumeration by enumerate_id + parameters: + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id + /v1/asset/enumerate/{enumerate_id}/rescan: + parameters: + - schema: + type: string + name: enumerate_id + in: path + required: true + post: + summary: Rescan Enumeration + operationId: post-v1-asset-enumerate-enumerate_id-rescan + tags: + - enumerations responses: - '200': + "200": description: OK content: application/json: schema: type: object + required: + - id properties: id: type: string truncated-scan-targets: type: integer - required: - - id - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '403': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "403": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" default: - $ref: '#/components/responses/ErrorResponse' + $ref: "#/components/responses/ErrorResponse" security: - - X-API-Key: [] - tags: - - enumerations - delete: - operationId: delete-v1-asset-enumerates - summary: Delete Bulk Enumeration - description: Delete enumeration by enumerate ids + - X-API-Key: [] + description: Re-run a existing enumeration parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - requestBody: - content: - application/json: - schema: - type: object - properties: - asset_ids: - type: array - items: - type: string - required: - - asset_ids - responses: - '200': - $ref: '#/components/responses/MessageResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' - default: - $ref: '#/components/responses/ErrorResponse' - security: - - X-API-Key: [] - tags: - - enumerations - '/v1/asset/enumerate/{enumerate_id}': - parameters: - - name: enumerate_id - in: path - required: true - schema: + - schema: type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id + /v1/asset/enumerate/{enum_id}/export: + parameters: + - schema: + type: string + name: enum_id + in: path + required: true + - schema: + type: boolean + in: query + name: async get: - operationId: get-v1-asset-enumerate-enumerate_id - summary: Get Enumeration - description: Get enumeration by enumerate_id - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - responses: - '200': - $ref: '#/components/responses/GetEnumerateIdContentsResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '403': - $ref: '#/components/responses/ErrorResponse' - '499': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' - default: - $ref: '#/components/responses/ErrorResponse' - security: - - X-API-Key: [] + summary: Export Enumeration tags: - - enumerations - patch: - operationId: patch-v1-asset-enumerate-enumerate_id - summary: Update Enumeration - description: Update enumeration by enumerate_id - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - requestBody: - content: - application/json: - schema: - type: object - properties: - name: - type: string + - enumerations responses: - '200': - $ref: '#/components/responses/MessageResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '403': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + "200": + description: OK + content: + application/octet-stream: + schema: + type: string + "201": + description: Created + content: + application/json: + schema: + type: object + properties: + export_id: + type: string + required: + - export_id + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" default: - $ref: '#/components/responses/ErrorResponse' - security: - - X-API-Key: [] - tags: - - enumerations - delete: - operationId: delete-v1-asset-enumerate-enumerate_id - summary: Delete Enumeration - description: Delete enumeration by enumerate_id + $ref: "#/components/responses/ErrorResponse" + operationId: get-enumerate-id-export parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - responses: - '200': - $ref: '#/components/responses/MessageResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' - default: - $ref: '#/components/responses/ErrorResponse' - security: - - X-API-Key: [] - tags: - - enumerations - '/v1/asset/enumerate/{enumerate_id}/contents': - parameters: - - name: enumerate_id - in: path - required: true - schema: + - schema: + $ref: "#/components/schemas/EnumExportFormats" + in: query + name: format + - schema: type: string - get: - operationId: get-v1-asset-enumerate-enumerate_id-contents - summary: Get Enumeration Contents - description: Get enumeration content by enumerate_id - parameters: - - name: offset - in: query - description: The number of items to skip before starting to collect the result set - schema: - type: integer - default: 0 - - name: limit - in: query - description: The numbers of items to return - schema: - type: integer - default: 100 - - name: is_tech - in: query - description: Return records that have technologies - schema: - type: boolean - - name: is_favicon - in: query - description: Return the records that have favicon - schema: - type: boolean - - name: search - in: query - description: Search on the content name - schema: - type: string - - name: labels - in: query - description: 'Filter by comma separated labels, e.g-> labels=p1,p2' - schema: - type: string - - name: is_new - in: query - description: Filter by new content - schema: - type: boolean - - name: host - in: query - description: 'Filter by comma separated labels, e.g-> host=p1,p2' - schema: - type: string - - name: port - in: query - description: 'Filter by port separated labels, e.g-> port=p1,p2' - schema: - type: string - - name: status_code - in: query - description: 'Filter by status code separated labels, e.g-> status_code=p1,p2' - schema: - type: string - - name: title - in: query - description: 'Filter by title separated labels, e.g-> title=p1,p2' - schema: - type: string - - name: content_length - in: query - description: 'Filter by content length separated labels, e.g-> content_length=p1,p2' - schema: - type: string - - name: cname - in: query - description: cname to filter - schema: - type: string - - name: domain - in: query - description: 'Filter by domain names separated labels, e.g-> domain=domain1.com,domain2.com' - schema: - type: string - - name: technologies - in: query - description: technologies to filter - schema: - type: string - - name: ip - in: query - description: ips to filter - schema: - type: string - - name: sort_asc - in: query - description: 'comma separated ascending sorting e.g sort_asc=created_at,name' - schema: - type: string - - name: sort_desc - in: query - description: 'comma separated descending sorting e.g sort_desc=created_at,name' - schema: - type: string - - name: is_screenshot - in: query - description: asset with screenshots - schema: - type: boolean - - name: time - in: query - description: time filter to select - schema: - default: all_time - $ref: '#/components/schemas/TimeRangeQueryParameter' - - name: start_date - in: query - description: time filter start date - schema: - type: string - format: date - - name: end_date - in: query - description: time filter end date - schema: - type: string - format: date - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - responses: - '200': - $ref: '#/components/responses/GetEnumerateIdContents' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '403': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' - default: - $ref: '#/components/responses/ErrorResponse' - security: - - X-API-Key: [] - tags: - - enumerations - /v1/asset/enumerate/contents: - get: - operationId: get-v1-asset-enumerate-contents - summary: Get All Enumeration Contents - description: Get All enumeration content - parameters: - - name: offset - in: query - description: The number of items to skip before starting to collect the result set - schema: - type: integer - default: 0 - - name: limit - in: query - description: The numbers of items to return - schema: - type: integer - default: 100 - - name: is_tech - in: query - description: Return records that have technologies - schema: - type: boolean - - name: is_favicon - in: query - description: Return the records that have favicon - schema: - type: boolean - - name: search - in: query - description: Search on the content name - schema: - type: string - - name: labels - in: query - description: 'Filter by comma separated labels, e.g-> labels=p1,p2' - schema: - type: string - - name: is_new - in: query - description: Filter by new content - schema: - type: boolean - - name: host - in: query - description: 'Filter by comma separated labels, e.g-> host=p1,p2' - schema: - type: string - - name: port - in: query - description: 'Filter by port separated labels, e.g-> port=p1,p2' - schema: - type: string - - name: status_code - in: query - description: 'Filter by status code separated labels, e.g-> status_code=p1,p2' - schema: - type: string - - name: title - in: query - description: 'Filter by title separated labels, e.g-> title=p1,p2' - schema: - type: string - - name: content_length - in: query - description: 'Filter by content length separated labels, e.g-> content_length=p1,p2' - schema: - type: string - - name: domain - in: query - description: 'Filter by domain names separated labels, e.g-> domain=domain1.com,domain2.com' - schema: - type: string - - name: cname - in: query - description: cname to filter - schema: - type: string - - name: technologies - in: query - description: technologies to filter - schema: - type: string - - name: ip - in: query - description: ips to filter - schema: - type: string - - name: sort_asc - in: query - description: 'comma separated ascending sorting e.g sort_asc=created_at,name' - schema: - type: string - - name: sort_desc - in: query - description: 'comma separated descending sorting e.g sort_desc=created_at,name' - schema: - type: string - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - responses: - '200': - $ref: '#/components/responses/GetEnumerateIdContents' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '403': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' - default: - $ref: '#/components/responses/ErrorResponse' - security: - - X-API-Key: [] - tags: - - enumerations - '/v1/asset/enumerate/{enumerate_id}/stop': - parameters: - - name: enumerate_id - in: path - required: true - schema: + in: query + name: search + description: Search by string + - schema: type: string - post: - operationId: post-v1-asset-enumerate-enumerate_id-stop - summary: Stop Enumeration - description: Stop a running enumeration - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - responses: - '200': - $ref: '#/components/responses/MessageResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' - default: - $ref: '#/components/responses/ErrorResponse' - security: - - X-API-Key: [] - tags: - - enumerations - '/v1/asset/enumerate/{enumerate_id}/rescan': - parameters: - - name: enumerate_id - in: path - required: true - schema: + in: query + name: labels + description: Filter by comma separated labels, e.g-> labels=p1,p2 + - schema: + type: boolean + in: query + name: is_new + description: Filter by new content + - schema: + type: string + in: query + name: host + description: Filter by comma separated hosts, e.g-> host=p1,p2 + - schema: + type: string + in: query + name: domains + description: Filter by comma separated domains, e.g-> domains=p1,p2 + - schema: + type: string + in: query + name: port + description: Filter by comma separated ports, e.g-> port=p1,p2 + - schema: + type: string + in: query + name: status_code + description: Filter by comma separated status codes, e.g-> status_code=p1,p2 + - schema: + type: string + in: query + name: title + description: Filter by comma separated titles, e.g-> title=p1,p2 + - schema: + type: string + in: query + name: content_length + description: Filter by comma separated content lengths, e.g-> content_length=p1,p2 + - schema: + type: string + in: query + name: cname + description: cname to filter + - schema: + type: string + in: query + name: technologies + description: technologies to filter + - schema: + type: string + in: query + name: ip + description: ips to filter + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id + - schema: + type: string + in: query + name: custom_filter + description: custom query to filter. double encode the query string. + - schema: + type: boolean + in: query + name: is_screenshot + description: Return records that have screenshots + - schema: + type: boolean + in: query + name: is_tech + description: Return records that have technologies + - schema: + type: boolean + in: query + name: is_favicon + description: Return the records that have favicon + - schema: + $ref: "#/components/schemas/TimeRangeQueryParameter" + default: all_time + in: query + name: time + description: time filter to select + - schema: + type: string + format: date + in: query + name: start_date + description: time filter start date + - schema: + type: string + format: date + in: query + name: end_date + description: time filter end date + - schema: type: string + in: query + name: favicon + description: Filter by comma separated favicons, e.g-> favicon=p1,p2 + - schema: + type: boolean + in: query + name: only_dns + description: Query only dns FQDN records + - schema: + type: boolean + in: query + name: only_ip + description: Query only dns IP records + security: + - X-API-Key: [] + description: Export enumeration content + /v1/asset/enumerate/group: post: - operationId: post-v1-asset-enumerate-enumerate_id-rescan - summary: Rescan Enumeration - description: Re-run a existing enumeration - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + summary: Create an asset group + tags: + - enumerations responses: - '200': + "200": description: OK content: application/json: schema: type: object + required: + - id properties: id: type: string - truncated-scan-targets: - type: integer - required: - - id - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '403': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "403": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" default: - $ref: '#/components/responses/ErrorResponse' + $ref: "#/components/responses/ErrorResponse" + requestBody: + $ref: "#/components/requestBodies/CreateAssetGroupRequest" + operationId: post-v1-asset-enumerate-group + parameters: + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id security: - - X-API-Key: [] - tags: - - enumerations - '/v1/asset/enumerate/{enum_id}/export': + - X-API-Key: [] + description: Create an asset group from existing enumeration data using filters + /v1/asset/enumerate/group/{group_id}: parameters: - - name: enum_id - in: path - required: true - schema: - type: string - - name: async - in: query - schema: - type: boolean - get: - operationId: get-enumerate-id-export - summary: Export Enumeration - description: Export enumeration content - parameters: - - name: format - in: query - schema: - $ref: '#/components/schemas/EnumExportFormats' - - name: search - in: query - description: Search by string - schema: - type: string - - name: labels - in: query - description: 'Filter by comma separated labels, e.g-> labels=p1,p2' - schema: - type: string - - name: is_new - in: query - description: Filter by new content - schema: - type: boolean - - name: host - in: query - description: 'Filter by comma separated labels, e.g-> host=p1,p2' - schema: - type: string - - name: port - in: query - description: 'Filter by port separated labels, e.g-> port=p1,p2' - schema: - type: string - - name: status_code - in: query - description: 'Filter by status code separated labels, e.g-> status_code=p1,p2' - schema: - type: string - - name: title - in: query - description: 'Filter by title separated labels, e.g-> title=p1,p2' - schema: - type: string - - name: content_length - in: query - description: 'Filter by content length separated labels, e.g-> content_length=p1,p2' - schema: - type: string - - name: cname - in: query - description: cname to filter - schema: - type: string - - name: technologies - in: query - description: technologies to filter - schema: - type: string - - name: ip - in: query - description: ips to filter - schema: - type: string - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + - schema: + type: string + name: group_id + in: path + required: true + patch: + summary: Update an asset group + tags: + - enumerations responses: - '200': - description: OK - content: - application/octet-stream: - schema: - type: string - '201': - description: Created - content: - application/json: - schema: - type: object - properties: - export_id: - type: string - required: - - export_id - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + "200": + $ref: "#/components/responses/MessageResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "403": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" default: - $ref: '#/components/responses/ErrorResponse' + $ref: "#/components/responses/ErrorResponse" + requestBody: + $ref: "#/components/requestBodies/UpdateAssetGroupRequest" + operationId: patch-v1-asset-enumerate-group + parameters: + - schema: + type: string + enum: + - append + - replace + default: append + in: query + name: update_type + description: Append vs Replace update_type. Default is append + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id security: - - X-API-Key: [] - tags: - - enumerations + - X-API-Key: [] + description: Update an asset group by customising the filters /v1/enumeration/schedule: get: - operationId: get-v1-enumeration-schedule summary: Get Enumeration Schedules - description: Get enumeration re-scan schedule - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + tags: + - enumerations responses: - '200': - $ref: '#/components/responses/GetEnumerationScheduleResponse' - '400': - $ref: '#/components/responses/MessageResponse' - '401': - $ref: '#/components/responses/MessageResponse' - '500': - $ref: '#/components/responses/MessageResponse' + "200": + $ref: "#/components/responses/GetEnumerationScheduleResponse" + "400": + $ref: "#/components/responses/MessageResponse" + "401": + $ref: "#/components/responses/MessageResponse" + "500": + $ref: "#/components/responses/MessageResponse" + default: + $ref: "#/components/responses/ErrorResponse" + operationId: get-v1-enumeration-schedule security: - - X-API-Key: [] - tags: - - enumerations + - X-API-Key: [] + description: Get enumeration re-scan schedule + parameters: + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id post: - operationId: post-v1-enumeration-schedule summary: Set Enumeration Schedule - description: Set enumeration re-scan frequency - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - requestBody: - $ref: '#/components/requestBodies/SetEnumerationScheduleRequest' + operationId: post-v1-enumeration-schedule + tags: + - enumerations responses: - '200': - $ref: '#/components/responses/MessageResponse' - '400': - $ref: '#/components/responses/MessageResponse' - '401': - $ref: '#/components/responses/MessageResponse' - '500': - $ref: '#/components/responses/MessageResponse' + "200": + $ref: "#/components/responses/MessageResponse" + "400": + $ref: "#/components/responses/MessageResponse" + "401": + $ref: "#/components/responses/MessageResponse" + "500": + $ref: "#/components/responses/MessageResponse" default: - $ref: '#/components/responses/ErrorResponse' + $ref: "#/components/responses/ErrorResponse" + requestBody: + $ref: "#/components/requestBodies/SetEnumerationScheduleRequest" security: - - X-API-Key: [] - tags: - - enumerations + - X-API-Key: [] + description: Set enumeration re-scan frequency + parameters: + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id delete: - operationId: delete-v1-enumeration-schedule summary: Delete Enumeration Schedule - description: Delete a re-scan schedule - parameters: - - name: enumeration_id - in: query - description: enumeration_id of the schedule to be deleted - required: true - schema: - type: string - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + operationId: delete-v1-enumeration-schedule + tags: + - enumerations responses: - '200': - $ref: '#/components/responses/MessageResponse' - '400': - $ref: '#/components/responses/MessageResponse' - '401': - $ref: '#/components/responses/MessageResponse' - '500': - $ref: '#/components/responses/MessageResponse' + "200": + $ref: "#/components/responses/MessageResponse" + "400": + $ref: "#/components/responses/MessageResponse" + "401": + $ref: "#/components/responses/MessageResponse" + "500": + $ref: "#/components/responses/MessageResponse" default: - $ref: '#/components/responses/ErrorResponse' + $ref: "#/components/responses/ErrorResponse" + parameters: + - schema: + type: string + in: query + name: enumeration_id + description: enumeration_id of the schedule to be deleted + required: true + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id security: - - X-API-Key: [] - tags: - - enumerations + - X-API-Key: [] + description: Delete a re-scan schedule /v1/team/audit_log: get: - operationId: get-v1-audit-log summary: Get audit logs for team - parameters: - - name: email - in: query - description: filter by specific user - schema: - type: string - - name: action - in: query - description: filter by specific action name - schema: - type: string - - name: offset - in: query - description: number of rows to skip - schema: - type: integer - - name: limit - in: query - description: number of rows to get - schema: - type: integer - - name: start_date - in: query - description: start date from which you want to get logs - schema: - type: string - format: date - - name: end_date - in: query - description: end date till which you want to get logs - schema: - type: string - format: date - - name: time_range - in: query - description: time range to get logs - schema: - type: string - enum: - - current_month - - last_month - - last_3_months - - last_6_months - - last_12_months - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + tags: [] responses: - '200': + "200": description: OK content: application/json: schema: type: object + required: + - message + - data properties: message: type: string data: type: array items: - $ref: '#/components/schemas/UserAuditLogItems' - required: - - message - - data - '400': - $ref: '#/components/responses/MessageResponse' - '401': - $ref: '#/components/responses/MessageResponse' - '500': - $ref: '#/components/responses/MessageResponse' + $ref: "#/components/schemas/UserAuditLogItems" + "400": + $ref: "#/components/responses/MessageResponse" + "401": + $ref: "#/components/responses/MessageResponse" + "500": + $ref: "#/components/responses/MessageResponse" + operationId: get-v1-audit-log security: - - X-API-Key: [] - tags: [] + - X-API-Key: [] + parameters: + - schema: + type: string + in: query + name: email + description: filter by specific user + - schema: + type: string + in: query + name: action + description: filter by specific action name + - schema: + type: integer + in: query + name: offset + description: number of rows to skip + - schema: + type: integer + in: query + name: limit + description: number of rows to get + - schema: + type: string + format: date + in: query + name: start_date + description: start date from which you want to get logs + - schema: + type: string + format: date + in: query + name: end_date + description: end date till which you want to get logs + - schema: + type: string + enum: + - current_month + - last_month + - last_3_months + - last_6_months + - last_12_months + in: query + name: time_range + description: time range to get logs + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id /v1/scans/history: get: - operationId: get-v1-scans-history summary: Get All Scans History - description: Get user scan history details - parameters: - - name: offset - in: query - description: number of rows to skip - schema: - type: integer - - name: limit - in: query - description: number of rows to get - schema: - type: integer - - name: start_date - in: query - description: start date from which you want to get history - schema: - type: string - format: date - - name: end_date - in: query - description: end date till which you want to get history - schema: - type: string - format: date - - name: time_range - in: query - description: time range to get history - schema: - type: string - enum: - - current_month - - last_month - - last_3_months - - last_6_months - - last_12_months - - all_time - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + tags: + - scans responses: - '200': - $ref: '#/components/responses/GetScansHistoryResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + "200": + $ref: "#/components/responses/GetScansHistoryResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" default: - $ref: '#/components/responses/ErrorResponse' + $ref: "#/components/responses/ErrorResponse" + operationId: get-v1-scans-history + parameters: + - schema: + type: integer + in: query + name: offset + description: number of rows to skip + - schema: + type: integer + in: query + name: limit + description: number of rows to get + - schema: + type: string + format: date + in: query + name: start_date + description: start date from which you want to get history + - schema: + type: string + format: date + in: query + name: end_date + description: end date till which you want to get history + - schema: + type: string + enum: + - current_month + - last_month + - last_3_months + - last_6_months + - last_12_months + - all_time + in: query + name: time_range + description: time range to get history + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id security: - - X-API-Key: [] - tags: - - scans - '/v1/scans/{scanId}/history': + - X-API-Key: [] + description: Get user scan history details + /v1/scans/{scanId}/history: parameters: - - name: scanId - in: path - required: true - schema: - type: string + - schema: + type: string + name: scanId + in: path + required: true get: - operationId: get-v1-scans-scanId-history summary: Get Scan History - description: Get scan history detial by scanId - parameters: - - name: offset - in: query - description: number of rows to skip - schema: - type: integer - - name: limit - in: query - description: number of rows to get - schema: - type: integer - - name: start_date - in: query - description: start date from which you want to get history - schema: - type: string - format: date - - name: end_date - in: query - description: end date till which you want to get history - schema: - type: string - format: date - - name: time_range - in: query - description: time range to get history - schema: - type: string - enum: - - current_month - - last_month - - last_3_months - - last_6_months - - last_12_months - - all_time - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + tags: + - scans responses: - '200': - $ref: '#/components/responses/GetScansHistoryResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + "200": + $ref: "#/components/responses/GetScansHistoryResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" default: - $ref: '#/components/responses/ErrorResponse' - security: - - X-API-Key: [] - tags: - - scans - /v1/template/github: - get: - operationId: get-v1-github-templates - summary: Get Github Template List - description: List of all user's github templates + $ref: "#/components/responses/ErrorResponse" + operationId: get-v1-scans-scanId-history parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - data: - type: array - items: - $ref: '#/components/schemas/GithubTemplateListItem' - required: - - data - '400': - $ref: '#/components/responses/MessageResponse' - '401': - $ref: '#/components/responses/MessageResponse' - '500': - $ref: '#/components/responses/MessageResponse' - security: - - X-API-Key: [] - tags: - - templates - parameters: [] - '/v1/template/github/{id}': - parameters: - - name: id - in: path - required: true - schema: + - schema: + type: integer + in: query + name: offset + description: number of rows to skip + - schema: + type: integer + in: query + name: limit + description: number of rows to get + - schema: type: string - get: - operationId: get-v1-github-templates-id - summary: Get Github Template - description: Get github template text - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - responses: - '200': - description: OK - content: - text/plain: - schema: - type: string - '400': - $ref: '#/components/responses/MessageResponse' - '404': - $ref: '#/components/responses/MessageResponse' - '500': - $ref: '#/components/responses/MessageResponse' - security: - - X-API-Key: [] - tags: - - templates - /v1/template/stats: - get: - operationId: get-v1-template-stats - summary: Get Public Template Stats - description: Get public template statistics - parameters: - - name: from - in: query - description: define result number to return from - schema: - type: integer - - name: size - in: query - description: define number of results to return - schema: - type: integer - - name: q - in: query - description: query string to match against all response value - schema: - type: string - - name: fq - in: query - description: define specific field to query - schema: - type: string - - name: fl - in: query - description: define specific field to return - schema: - type: string - - name: sort_by - in: query - description: sort response value based on given key - schema: - type: string - - name: sort_dir - in: query - description: sort direction for given key - schema: - type: string - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/TemplateStats' - '400': - $ref: '#/components/responses/MessageResponse' - '401': - $ref: '#/components/responses/MessageResponse' - '500': - $ref: '#/components/responses/MessageResponse' + format: date + in: query + name: start_date + description: start date from which you want to get history + - schema: + type: string + format: date + in: query + name: end_date + description: end date till which you want to get history + - schema: + type: string + enum: + - current_month + - last_month + - last_3_months + - last_6_months + - last_12_months + - all_time + in: query + name: time_range + description: time range to get history + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id security: - - X-API-Key: [] - tags: - - templates - '/v1/scans/{scan_id}/error_log': + - X-API-Key: [] + description: Get scan history detial by scanId + /v1/scans/{scan_id}/scan_log/export: parameters: - - name: scan_id - in: path - required: true - schema: - type: string + - schema: + type: string + name: scan_id + in: path + required: true get: - operationId: get-scans-id-elog - summary: Get elogs of given scan id - parameters: - - name: host - in: query - description: target to search in log - schema: - type: string - - name: template - in: query - description: template to search in log - schema: - type: string - - name: matched - in: query - description: status to search in log - schema: - type: string - - name: time - in: query - description: time to filter the logs - schema: - type: string - format: date-time - - name: search - in: query - description: 'string to search in error, target and template' - schema: - type: string - - name: error - in: query - description: error to search in log - schema: - type: string - - name: next_page_token - in: query - description: next page token - schema: - type: string - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + summary: Export scan log of given scan id + tags: + - scan_log responses: - '200': + "200": description: OK content: application/json: schema: type: object + required: + - url properties: - logs: - type: array - items: - $ref: '#/components/schemas/ScanLogResp' - next_page_token: + url: type: string - required: - - logs - - next_page_token - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' - default: - $ref: '#/components/responses/ErrorResponse' - tags: - - elog - '/v1/scans/{scan_id}/scan_log': - parameters: - - name: scan_id - in: path - required: true - schema: - type: string - get: - operationId: get-scans-id-scan-log - summary: Get scan log of given scan id - parameters: - - name: host - in: query - description: target to search in log - schema: - type: string - - name: template - in: query - description: template to search in log - schema: - type: string - - name: matched - in: query - description: status to search in log - schema: - type: string - - name: time - in: query - description: time to filter the logs - schema: - type: string - format: date-time - - name: search - in: query - description: 'string to search in error, target and template' - schema: - type: string - - name: next_page_token - in: query - schema: - type: string - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - responses: - '200': - description: OK + "201": + description: Created content: application/json: schema: type: object properties: - logs: - type: array - items: - $ref: '#/components/schemas/ScanLogResp' - next_page_token: + export_id: type: string required: - - logs - - next_page_token - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' - default: - $ref: '#/components/responses/ErrorResponse' - tags: - - scan_log - '/v1/scans/vulns/{vuln_id}/ticket': - parameters: - - name: vuln_id - in: path - required: true - schema: - type: string - post: - operationId: post-vulns-id-ticket - summary: Create vulns export to tracker - description: Create vulns export to tracker - parameters: - - name: reporting_config_id - in: query - schema: - type: string - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - responses: - '200': - $ref: '#/components/responses/VulnsTrackerExportResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '424': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + - export_id + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" default: - $ref: '#/components/responses/ErrorResponse' + $ref: "#/components/responses/ErrorResponse" + operationId: get-scans-id-scan-log-export security: - - X-API-Key: [] - tags: - - scans - delete: - operationId: delete-vulns-id-ticket - summary: Delete vulns tracker association - description: Delete vulns export tracker + - X-API-Key: [] parameters: - - name: provider_name - in: query - schema: - type: string - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id + - schema: + type: integer + format: int64 + in: query + name: rescan_count + - schema: + type: string + in: query + name: host + description: target to search in log + - schema: + type: string + in: query + name: template + description: template to search in log + - schema: + type: string + in: query + name: matched + description: status to search in log + - schema: + type: string + format: date-time + in: query + name: time + description: time to filter the logs + - schema: + type: string + in: query + name: search + description: string to search in error, target and template + - schema: + type: string + in: query + name: error + description: error to search in log + - schema: + $ref: "#/components/schemas/LogExportFormat" + name: format + in: query + description: format of the log file + - schema: + type: boolean + in: query + name: async + - schema: + type: string + in: query + name: alert_email + - schema: + type: string + enum: + - error + - info + - all_logs + default: all_logs + x-go-type-name: ScanLogExportSeverityTypes + in: query + name: severity + /v1/scans/vulns/history: + get: + summary: Get scan log stats of given scan id + tags: + - history + - vuln responses: - '200': + "200": description: OK content: application/json: schema: - type: object - properties: - ok: - type: boolean - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '424': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + $ref: "#/components/schemas/VulnerabilityHistoryDetail" + "400": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" default: - $ref: '#/components/responses/ErrorResponse' - security: - - X-API-Key: [] - tags: - - Scans + $ref: "#/components/responses/ErrorResponse" + operationId: get-vulns-history + parameters: + - schema: + type: array + items: + type: string + in: query + name: vuln_hash + - schema: + type: integer + format: int64 + default: 5 + in: query + name: history_limit + required: false + description: Specifies the maximum number of revisions to be returned. /v1/scans/config/exclude: get: - operationId: get-scans-config-exclude summary: Get excluded templates - description: Get excluded templates - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + tags: + - configurations responses: - '200': - $ref: '#/components/responses/ExcludedTemplateResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + "200": + $ref: "#/components/responses/ExcludedTemplateResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" default: - $ref: '#/components/responses/ErrorResponse' + $ref: "#/components/responses/ErrorResponse" + operationId: get-scans-config-exclude + parameters: + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id security: - - X-API-Key: [] - tags: - - configurations + - X-API-Key: [] + description: Get excluded templates post: + summary: Add excluded templates and targets operationId: post-scans-config-exclude - summary: Add excluded templates - description: Add excluded templates - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - requestBody: - $ref: '#/components/requestBodies/ExcludeConfigRequest' responses: - '200': - $ref: '#/components/responses/MessageResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + "200": + $ref: "#/components/responses/MessageResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" default: - $ref: '#/components/responses/ErrorResponse' - security: - - X-API-Key: [] + $ref: "#/components/responses/ErrorResponse" tags: - - configurations - delete: - operationId: delete-scans-config-exclude - summary: Delete excluded template ids - description: Delete excluded template ids + - configurations parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id requestBody: - $ref: '#/components/requestBodies/DeleteExcludedConfigRequest' + $ref: "#/components/requestBodies/ExcludeConfigRequest" + security: + - X-API-Key: [] + description: Add excluded templates or targets + delete: + summary: Delete excluded templates or targets by ids + operationId: delete-scans-config-exclude responses: - '200': - $ref: '#/components/responses/MessageResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + "200": + $ref: "#/components/responses/MessageResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" default: - $ref: '#/components/responses/ErrorResponse' - security: - - X-API-Key: [] + $ref: "#/components/responses/ErrorResponse" tags: - - configurations - parameters: [] - /v1/scans/token: - get: - operationId: get-v1-scans-token - summary: Get Scans Token - description: Get user scan token usage details + - configurations parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - responses: - '200': - $ref: '#/components/responses/GetScansTokenResponse' - '400': - $ref: '#/components/responses/MessageResponse' - '401': - $ref: '#/components/responses/MessageResponse' - '404': - $ref: '#/components/responses/GetScanTokenErrorResponse' - '500': - $ref: '#/components/responses/MessageResponse' - tags: - - scans - '/v1/asset/{asset_id}': + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id + requestBody: + $ref: "#/components/requestBodies/DeleteExcludedConfigRequest" + security: + - X-API-Key: [] + description: Delete excluded templates or targets by ids + parameters: [] + /v1/scans/{scan_id}/asset/export: parameters: - - name: asset_id - in: path - required: true - schema: - type: integer - format: int64 + - schema: + type: string + name: scan_id + in: path + required: true get: - operationId: get-v1-asset-id - summary: Get enumerated asset details - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - responses: - '200': - $ref: '#/components/responses/GetAssetResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '404': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' - default: - $ref: '#/components/responses/ErrorResponse' + summary: Export Scan Assets tags: - - assets - delete: - operationId: delete-v1-asset-asset_id - summary: Delete enumerated asset - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + - scans responses: - '200': - $ref: '#/components/responses/MessageResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + "200": + description: OK + content: + application/octet-stream: + schema: + type: string + "400": + $ref: "#/components/responses/MessageResponse" + "401": + $ref: "#/components/responses/MessageResponse" + "404": + $ref: "#/components/responses/MessageResponse" + "500": + $ref: "#/components/responses/MessageResponse" default: - $ref: '#/components/responses/ErrorResponse' - tags: - - assets - patch: - operationId: patch-v1-asset-asset_id - summary: Update asset details + $ref: "#/components/responses/ErrorResponse" + operationId: get-v1-scans-scan-id-assets-export + security: + - X-API-Key: [] + description: Export the list of all unique assets for a scan. parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - requestBody: - $ref: '#/components/requestBodies/UpdateEnumeratedAssetRequest' - responses: - '200': - $ref: '#/components/responses/MessageResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' - default: - $ref: '#/components/responses/ErrorResponse' - tags: - - assets - '/v1/asset/enumerate/{enumerate_id}/stats': - parameters: - - name: enumerate_id - in: path - required: true - schema: + - schema: type: string - - name: time in: query - description: time filter to select - schema: - default: all_time - $ref: '#/components/schemas/TimeRangeQueryParameter' - - name: start_date + name: search + description: Search with host or port + - schema: + type: string in: query - description: time filter start date - schema: + name: format + description: supported format is csv, json, or raw (default json) + /v1/asset/enumerate/{enumerate_id}/domains/export: + parameters: + - schema: + type: string + name: enumerate_id + in: path + required: true + get: + summary: Export Enumeration Domains + tags: + - asset + responses: + "200": + description: OK + content: + application/octet-stream: + schema: + type: string + "400": + $ref: "#/components/responses/MessageResponse" + "401": + $ref: "#/components/responses/MessageResponse" + "404": + $ref: "#/components/responses/MessageResponse" + "500": + $ref: "#/components/responses/MessageResponse" + default: + $ref: "#/components/responses/ErrorResponse" + operationId: get-v1-asset-enumerate-enum-id-domains-export + security: + - X-API-Key: [] + description: Export list of unique domains discovered in an enumeration. + parameters: + - schema: type: string - format: date - - name: end_date in: query - description: time filter end date - schema: + name: search + description: Search with domain name + - schema: type: string - format: date + in: query + name: format + description: supported format is csv, raw, or json (default json) + /v1/asset/{asset_id}/changelogs: + parameters: + - schema: + type: integer + format: int64 + name: asset_id + in: path + required: true get: - operationId: get-v1-asset-enumerate-enumerate_id-stats - summary: Get enumeration stats - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + summary: Get Asset Changelogs for a given asset_id + tags: + - assets responses: - '200': - $ref: '#/components/responses/EnumerationStatsResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + "200": + $ref: "#/components/responses/GetAssetChangelogsResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" default: - $ref: '#/components/responses/ErrorResponse' - tags: - - enumerations - /v1/asset/enumerate/stats: - parameters: - - name: time + $ref: "#/components/responses/ErrorResponse" + operationId: get-v1-asset-assetId-changelogs + parameters: + - schema: + type: string + enum: + - last_day + - last_week + - last_month + - last_3_months + - last_6_months + - last_12_months + - all_time + default: all_time in: query + name: time description: time filter to select - schema: - default: all_time - $ref: '#/components/schemas/TimeRangeQueryParameter' - - name: start_date + - schema: + type: string in: query - description: time filter start date - schema: + name: event_type + description: comma separated event_type e.g. event_type=vul_status,vul_status_change + - schema: type: string - format: date - - name: end_date in: query - description: time filter end date - schema: + name: sort_asc + description: comma separated ascending sorting e.g sort_asc=created_at,severity + - schema: type: string - format: date - get: - operationId: get-v1-asset-enumerate-stats - summary: Get all enumeration stats - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - responses: - '200': - $ref: '#/components/responses/EnumerationStatsResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' - default: - $ref: '#/components/responses/ErrorResponse' - tags: - - enumerations - '/v1/asset/enumerate/{enumerate_id}/config': - parameters: - - name: enumerate_id - in: path - required: true - schema: + in: query + name: sort_desc + description: comma separated descending sorting e.g sort_desc=created_at,severity + - schema: + type: integer + in: query + name: limit + description: number of results to get + - schema: + type: integer + in: query + name: offset + description: number of results to skip + - schema: type: string + in: header + name: X-Team-Id + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + security: + - X-API-Key: [] + description: Get asset changelogs + /v1/asset/enumerate/{enumerate_id}/config: + parameters: + - schema: + type: string + name: enumerate_id + in: path + required: true get: - operationId: get-v1-asset-enumerate-enumerate_id-config summary: Get enumeration config - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + tags: + - enumerations responses: - '200': + "200": description: Shared Response content: application/json: schema: - $ref: '#/components/schemas/EnumerationConfig' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' + $ref: "#/components/schemas/EnumerationConfig" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" default: - $ref: '#/components/responses/ErrorResponse' - tags: - - enumerations + $ref: "#/components/responses/ErrorResponse" + operationId: get-v1-asset-enumerate-enumerate_id-config + parameters: + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id patch: - operationId: patch-v1-asset-enumerate-enumerate_id-config summary: Update enumeration config + tags: [] + responses: + "200": + $ref: "#/components/responses/MessageResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" + default: + $ref: "#/components/responses/ErrorResponse" + operationId: patch-v1-asset-enumerate-enumerate_id-config parameters: - - name: update_type - in: query - description: default mode is append - schema: - type: string - enum: - - append - - replace - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + - schema: + type: string + enum: + - append + - replace + in: query + name: update_type + description: default mode is append + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id requestBody: description: Shared Request content: application/json: schema: - $ref: '#/components/schemas/EnumerationConfig' - responses: - '200': - $ref: '#/components/responses/MessageResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' - default: - $ref: '#/components/responses/ErrorResponse' - tags: [] - '/v1/asset/screenshot/{asset_id}': + $ref: "#/components/schemas/EnumerationConfig" + /v1/asset/enumerate/export: parameters: - - name: asset_id - in: path - required: true - schema: - type: string + - schema: + type: boolean + in: query + name: async get: - operationId: get-v1-asset-screenshot-asset_id - summary: Get Asset Screenshot - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string + summary: Export Enumeration of user + tags: + - enumerations responses: - '200': + "200": description: OK content: - image/png: + application/octet-stream: schema: type: string - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' - tags: - - assets - /v1/user/usage: - get: - operationId: get-v1-user-usage - summary: Get API Services Usage - parameters: - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - requestBody: - $ref: '#/components/requestBodies/UsageRequest' - responses: - '200': - $ref: '#/components/responses/UsageResponse' - '400': - $ref: '#/components/responses/MessageResponse' - '401': - $ref: '#/components/responses/MessageResponse' - '500': - $ref: '#/components/responses/MessageResponse' - security: - - X-API-Key: [] - tags: - - usage - parameters: [] - /v1/asset/enumerate/filters: - get: - operationId: get-v1-asset-enumerate-filters - summary: Group assets by filters + "201": + description: Created + content: + application/json: + schema: + type: object + properties: + export_id: + type: string + required: + - export_id + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" + default: + $ref: "#/components/responses/ErrorResponse" + operationId: get-enumerate-export parameters: - - name: offset - in: query - description: The number of items to skip before starting to collect the result set - schema: - type: integer - - name: limit - in: query - description: The numbers of items to return - schema: - type: integer - - name: host - in: query - schema: - type: string - - name: port - in: query - schema: - type: string - - name: ip - in: query - schema: - type: string - - name: cname - in: query - schema: - type: string - - name: technologies - in: query - schema: - type: string - - name: status_code - in: query - schema: - type: string - - name: content_length - in: query - schema: - type: string - - name: domain - in: query - schema: - type: array - items: - type: string - - name: title - in: query - schema: - type: string - - name: webserver - in: query - schema: - type: string - - name: favicon - in: query - schema: - type: string - - name: group_by - in: query - description: 'Group by type. e.g. - host, port, favicon.' - required: true - schema: - $ref: '#/components/schemas/EnumerateFilterTypes' - - name: sort_asc - in: query - description: 'supported sort fields [count]' - schema: - type: string - - name: sort_desc - in: query - description: 'supported sort fields [count]' - schema: - type: string - - name: time - in: query - description: time filter to select - schema: - default: all_time - $ref: '#/components/schemas/TimeRangeQueryParameter' - - name: start_date - in: query - description: time filter start date - schema: - type: string - format: date - - name: end_date - in: query - description: time filter end date - schema: - type: string - format: date - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - responses: - '200': - $ref: '#/components/responses/GetEnumerateFiltersResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' - default: - $ref: '#/components/responses/ErrorResponse' - tags: - - enumerations - '/v1/asset/enumerate/{enumerate_id}/filters': - parameters: - - name: enumerate_id - in: path - required: true - schema: + - schema: + $ref: "#/components/schemas/EnumExportFormats" + in: query + name: format + - schema: type: string - get: - operationId: get-v1-asset-enumerate-id-filters - summary: Group assets by filters for an enumeration - parameters: - - name: offset - in: query - description: The number of items to skip before starting to collect the result set - schema: - type: integer - - name: limit - in: query - description: The numbers of items to return - schema: - type: integer - - name: host - in: query - schema: - type: string - - name: port - in: query - schema: - type: string - - name: ip - in: query - schema: - type: string - - name: cname - in: query - schema: - type: string - - name: technologies - in: query - schema: - type: string - - name: status_code - in: query - schema: - type: string - - name: content_length - in: query - schema: - type: string - - name: domain - in: query - schema: - type: array - items: - type: string - - name: title - in: query - schema: - type: string - - name: webserver - in: query - schema: - type: string - - name: favicon - in: query - schema: - type: string - - name: group_by - in: query - description: 'Group by type. e.g. - host, port, favicon.' - required: true - schema: - $ref: '#/components/schemas/EnumerateFilterTypes' - - name: sort_asc - in: query - description: 'supported sort fields [count]' - schema: - type: string - - name: sort_desc - in: query - description: 'supported sort fields [count]' - schema: - type: string - - name: time - in: query - description: time filter to select - schema: - default: all_time - $ref: '#/components/schemas/TimeRangeQueryParameter' - - name: start_date - in: query - description: time filter start date - schema: - type: string - format: date - - name: end_date - in: query - description: time filter end date - schema: - type: string - format: date - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - responses: - '200': - $ref: '#/components/responses/GetEnumerateFiltersResponse' - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' - default: - $ref: '#/components/responses/ErrorResponse' - tags: - - enumerations - /v1/asset/enumerate/export: - parameters: - - name: async + name: search in: query - schema: + description: Search on the content name + - schema: + type: string + in: query + name: labels + description: Filter by comma separated labels, e.g-> labels=p1,p2 + - schema: type: boolean - get: - operationId: get-enumerate-export - summary: Export Enumeration of user - description: Export enumeration content - parameters: - - name: format - in: query - schema: - $ref: '#/components/schemas/EnumExportFormats' - - name: search - in: query - description: Search on the content name - schema: - type: string - - name: labels - in: query - description: 'Filter by comma separated labels, e.g-> labels=p1,p2' - schema: - type: string - - name: is_new - in: query - description: Filter by new content - schema: - type: boolean - - name: host - in: query - description: 'Filter by comma separated labels, e.g-> host=p1,p2' - schema: - type: string - - name: port - in: query - description: 'Filter by port separated labels, e.g-> port=p1,p2' - schema: - type: string - - name: status_code - in: query - description: 'Filter by status code separated labels, e.g-> status_code=p1,p2' - schema: - type: string - - name: title - in: query - description: 'Filter by title separated labels, e.g-> title=p1,p2' - schema: - type: string - - name: content_length - in: query - description: 'Filter by content length separated labels, e.g-> content_length=p1,p2' - schema: - type: string - - name: domain - in: query - description: 'Filter by domain names separated labels, e.g-> domain=domain1.com,domain2.com' - schema: - type: string - - name: cname - in: query - description: cname to filter - schema: - type: string - - name: technologies - in: query - description: technologies to filter - schema: - type: string - - name: sort_asc - in: query - description: 'comma separated ascending sorting e.g sort_asc=created_at,name' - schema: - type: string - - name: sort_desc - in: query - schema: - type: string - - name: time - in: query - description: time filter to select - schema: - default: all_time - $ref: '#/components/schemas/TimeRangeQueryParameter' - - name: start_date - in: query - description: time filter start date - schema: - type: string - format: date - - name: end_date - in: query - description: time filter end date - schema: - type: string - format: date - - name: X-Team-Id - in: header - description: 'Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team' - schema: - type: string - responses: - '200': - description: OK - content: - application/octet-stream: - schema: - type: string - '201': - description: Created - content: - application/json: - schema: - type: object - properties: - export_id: - type: string - required: - - export_id - '400': - $ref: '#/components/responses/ErrorResponse' - '401': - $ref: '#/components/responses/ErrorResponse' - '500': - $ref: '#/components/responses/ErrorResponse' - default: - $ref: '#/components/responses/ErrorResponse' + in: query + name: is_new + description: Filter by new content + - schema: + type: string + in: query + name: host + description: Filter by comma separated labels, e.g-> host=p1,p2 + - schema: + type: string + in: query + name: port + description: Filter by port separated labels, e.g-> port=p1,p2 + - schema: + type: string + in: query + name: status_code + description: Filter by status code separated labels, e.g-> status_code=p1,p2 + - schema: + type: string + in: query + name: title + description: Filter by title separated labels, e.g-> title=p1,p2 + - schema: + type: string + in: query + name: content_length + description: Filter by content length separated labels, e.g-> content_length=p1,p2 + - schema: + type: string + in: query + name: domain + description: Filter by domain names separated labels, e.g-> domain=domain1.com,domain2.com + - schema: + type: string + in: query + name: cname + description: cname to filter + - schema: + type: string + in: query + name: technologies + description: technologies to filter + - schema: + type: string + in: query + name: sort_asc + description: comma separated ascending sorting e.g sort_asc=created_at,name + - schema: + type: string + in: query + name: sort_desc + - schema: + $ref: "#/components/schemas/TimeRangeQueryParameter" + default: all_time + in: query + name: time + description: time filter to select + - schema: + type: string + format: date + in: query + name: start_date + description: time filter start date + - schema: + type: string + format: date + in: query + name: end_date + description: time filter end date + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id + - schema: + type: string + in: query + name: custom_filter + description: custom query to filter. double encode the query string. + - schema: + type: boolean + in: query + name: is_screenshot + - schema: + type: string + in: query + name: ip + description: ips to filter + - schema: + type: string + in: query + name: favicon + description: Filter by comma separated favicons, e.g-> favicon=p1,p2 + - schema: + type: boolean + in: query + name: only_dns + description: Query only dns FQDN records + - schema: + type: boolean + in: query + name: only_ip + description: Query only dns IP records security: - - X-API-Key: [] - tags: - - enumerations + - X-API-Key: [] + description: Export enumeration content /v1/user/tunnels: get: - operationId: get-v1-user-tunnels summary: Get Tunnels List + tags: + - users responses: - '200': - $ref: '#/components/responses/GetUserTunnelResponse' - '400': - $ref: '#/components/responses/MessageResponse' - '401': - $ref: '#/components/responses/MessageResponse' - '404': - $ref: '#/components/responses/MessageResponse' - '500': - $ref: '#/components/responses/MessageResponse' + "200": + $ref: "#/components/responses/GetUserTunnelResponse" + "400": + $ref: "#/components/responses/MessageResponse" + "401": + $ref: "#/components/responses/MessageResponse" + "404": + $ref: "#/components/responses/MessageResponse" + "500": + $ref: "#/components/responses/MessageResponse" default: - $ref: '#/components/responses/MessageResponse' + $ref: "#/components/responses/ErrorResponse" + operationId: get-v1-user-tunnels security: - - X-API-Key: [] - tags: - - users + - X-API-Key: [] parameters: [] - /v1/asset/exposures/metrics: + patch: + summary: Rename Tunnel + tags: [] + responses: + "200": + $ref: "#/components/responses/MessageResponse" + "400": + $ref: "#/components/responses/MessageResponse" + "401": + $ref: "#/components/responses/MessageResponse" + "404": + $ref: "#/components/responses/MessageResponse" + "500": + $ref: "#/components/responses/MessageResponse" + default: + $ref: "#/components/responses/ErrorResponse" + operationId: patch-v1-user-tunnels + requestBody: + content: + application/json: + schema: + type: object + required: + - name + - id + properties: + name: + type: string + id: + type: string + /v1/scans/config/severity: get: - operationId: get-v1-asset-exposures-metrics - summary: Get exposure metrics + summary: Get custom severity mappings + tags: + - configurations + responses: + "200": + $ref: "#/components/responses/GetSeverityConfigResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "404": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" + default: + $ref: "#/components/responses/ErrorResponse" + operationId: get-v1-scans-config-severity parameters: - - name: interval - in: query - description: The time interval for the metrics - required: false - schema: - type: string - default: monthly - enum: - - monthly + - schema: + type: string + in: header + name: X-Team-Id + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + post: + summary: Add custom severity mapping + tags: + - configurations responses: - '200': - $ref: '#/components/responses/ExposureMetricsResponse' - '400': - $ref: '#/components/responses/MessageResponse' - '401': - $ref: '#/components/responses/MessageResponse' - '404': - $ref: '#/components/responses/MessageResponse' - '500': - $ref: '#/components/responses/MessageResponse' + "200": + $ref: "#/components/responses/PostSeverityConfigResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "404": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" default: - $ref: '#/components/responses/MessageResponse' - security: - - X-API-Key: [] + $ref: "#/components/responses/ErrorResponse" + operationId: post-v1-scans-config-severity + parameters: + - schema: + type: string + in: header + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + name: X-Team-Id + requestBody: + $ref: "#/components/requestBodies/AddCustomSeverityMappingRequest" + delete: + summary: Delete custom severity mapping tags: - - asset -components: - parameters: - template_id: - name: template_id - in: query - schema: - type: string - description: short uuid of requested template - required: true - user_name: - name: user_name - in: query - required: true - schema: - type: string - description: user name of logged in user - schemas: - EnumExportFormats: - type: string - enum: - - raw - - json - - csv - title: EnumExportFormats - TimeRangeQueryParameter: - type: string - enum: - - last_day - - last_week - - last_month - - last_3_months - - last_6_months - - last_12_months - - all_time - title: TimeRangeQueryParameter - EnumerateFilterTypes: - type: string - enum: - - host - - port - - ip - - cname - - technologies - - status_code - - content_length - - title - - webserver - - favicon - - domain - title: EnumerateFilterTypes - EnumerateFiltersItem: - type: object - properties: - value: - type: string - port: - type: integer - technologies: - type: integer - categories: - type: array - items: - type: string - description: - type: string - website: - type: string - cpe: + - configurations + responses: + "200": + $ref: "#/components/responses/MessageResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "404": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" + default: + $ref: "#/components/responses/ErrorResponse" + operationId: delete-v1-scans-config-severity + parameters: + - schema: type: string - icon: + in: header + name: X-Team-Id + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + requestBody: + $ref: "#/components/requestBodies/DeleteCustomSeverityMappingRequest" + /v1/scans/config/{config_id}/severity: + parameters: + - schema: + type: integer + format: int64 + name: config_id + in: path + required: true + patch: + summary: Modify custom severity mapping + tags: + - configurations + responses: + "200": + $ref: "#/components/responses/MessageResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "404": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" + default: + $ref: "#/components/responses/ErrorResponse" + operationId: patch-v1-scans-config-config_id-severity + parameters: + - schema: type: string - favicon_body: + in: header + name: X-Team-Id + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + requestBody: + $ref: "#/components/requestBodies/AddCustomSeverityMappingRequest" + /v1/leaks/domain: + get: + summary: Your GET endpoint + tags: [] + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: "#/components/schemas/LeaksEntity" + total_leaks: + type: number + filtered: + type: boolean + search_query: + type: string + total_pages: + type: number + current_page: + type: number + "400": + $ref: "#/components/responses/MessageResponse" + "401": + $ref: "#/components/responses/MessageResponse" + "403": + $ref: "#/components/responses/MessageResponse" + "404": + $ref: "#/components/responses/MessageResponse" + "500": + $ref: "#/components/responses/MessageResponse" + default: + $ref: "#/components/responses/ErrorResponse" + operationId: get-v1-leaks-domain + parameters: + - schema: type: string - count: - type: integer - required: - - value - - count - title: EnumerateFiltersItem - VulnerabilityResults: - type: object - properties: - matcher_status: - type: boolean - vuln_id: + in: query + name: search + description: Search query to filter results across all fields + - schema: + type: number + in: query + name: limit + description: Number of results per page for pagination + - schema: + type: number + in: query + name: page_number + description: Page number for pagination (starts from 1) + - schema: type: string - target: + format: date + in: query + name: start_date + description: time filter start date + - schema: type: string - template_url: + default: all_time + enum: + - all_time + - current_month + - last_month + - last_3_months + - last_6_months + - last_12_months + in: query + name: time_range + - schema: type: string - created_at: + format: date + in: query + name: end_date + description: time filter end date + - schema: type: string - updated_at: + enum: + - url + - username + - log_date + - country + - device_ip + - host_username + - hostname + - os + - source + - hardware_id + - malware_path + in: query + name: sort_by + description: supported sort fields + - schema: type: string - scan_id: + enum: + - asc + - desc + in: query + name: sort_order + description: supported sort order (asc or desc) + - schema: type: string - event: - type: array - items: - $ref: '#/components/schemas/VulnerabilityEvent' - template_id: + enum: + - fixed + - unfixed + in: query + name: status + description: supported status (fixed or unfixed) + /v1/leaks/email: + get: + summary: Your GET endpoint + tags: [] + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: "#/components/schemas/LeaksEntity" + total_leaks: + type: number + total_pages: + type: number + current_page: + type: number + "400": + $ref: "#/components/responses/MessageResponse" + "401": + $ref: "#/components/responses/MessageResponse" + "403": + $ref: "#/components/responses/MessageResponse" + "404": + $ref: "#/components/responses/MessageResponse" + "500": + $ref: "#/components/responses/MessageResponse" + default: + $ref: "#/components/responses/ErrorResponse" + operationId: get-v1-leaks-email + parameters: + - schema: type: string - template_path: + in: query + name: search + description: Search query to filter results across all fields + - schema: + type: number + in: query + name: limit + description: Number of results per page for pagination + - schema: + type: number + in: query + name: page_number + description: Page number for pagination (starts from 1) + - schema: type: string - template_encoded: + format: date + in: query + name: start_date + description: time filter start date + - schema: type: string - result_type: + default: all_time + enum: + - all_time + - current_month + - last_month + - last_3_months + - last_6_months + - last_12_months + in: query + name: time_range + - schema: type: string - vuln_status: + format: date + in: query + name: end_date + description: time filter end date + - schema: type: string - vuln_hash: + enum: + - url + - username + - log_date + - country + - device_ip + - host_username + - hostname + - os + - source + - hardware_id + - malware_path + in: query + name: sort_by + description: supported sort fields + - schema: type: string - labels: - type: array - items: - type: string - required: - - matcher_status - - vuln_id - - target - - created_at - - scan_id - - event - - template_id - - result_type - - vuln_hash - PrivateTemplates: - type: object - properties: - name: + enum: + - asc + - desc + in: query + name: sort_order + description: supported sort order (asc or desc) + - schema: type: string - contents: + enum: + - fixed + - unfixed + in: query + name: status + description: supported status (fixed or unfixed) + /v1/leaks/domain/customers: + get: + summary: Your GET endpoint + tags: [] + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: "#/components/schemas/LeaksEntity" + total_leaks: + type: number + total_pages: + type: number + current_page: + type: number + "400": + $ref: "#/components/responses/MessageResponse" + "401": + $ref: "#/components/responses/MessageResponse" + "403": + $ref: "#/components/responses/MessageResponse" + "404": + $ref: "#/components/responses/MessageResponse" + "500": + $ref: "#/components/responses/MessageResponse" + default: + $ref: "#/components/responses/ErrorResponse" + operationId: get-v1-leaks-domain-customers + parameters: + - schema: type: string - required: - - name - - contents - title: PrivateTemplates - AssetListItem: - type: object - properties: - asset_count: + in: query + name: search + description: Search query to filter results across all fields + - schema: type: integer - asset_id: - type: string - uploaded_at: - type: string - name: - type: string - required: - - asset_count - - asset_id - - uploaded_at - - name - title: AssetListItem - ScanSchedule: - type: object - properties: - scan_frequency: + in: query + name: limit + description: Number of results per page for pagination + - schema: + type: integer + in: query + name: page_number + description: Page number for pagination (starts from 1) + - schema: type: string - scan_id: + format: date + in: query + name: start_date + description: time filter start date + - schema: type: string - schedule_last_run: + default: all_time + enum: + - all_time + - current_month + - last_month + - last_3_months + - last_6_months + - last_12_months + in: query + name: time_range + - schema: type: string - schedule_next_run: + format: date + in: query + name: end_date + description: time filter end date + - schema: type: string - start_time: + enum: + - url + - username + - log_date + - country + - device_ip + - host_username + - hostname + - os + - source + - hardware_id + - malware_path + in: query + name: sort_by + description: supported sort fields + - schema: type: string - format: time - hourly_frequency: - type: integer - custom_weekdays: - description: |- - Array of integer denoting the weekdays on which the scan is supposed to run. - 0-6 denoting Sunday-Saturday. - type: array - items: - type: integer - minimum: 0 - maximum: 6 - required: - - scan_frequency - - scan_id - - schedule_last_run - - schedule_next_run - title: ScanSchedule - ScanStatusItem: - type: object - properties: - scan_id: + enum: + - asc + - desc + in: query + name: sort_order + description: supported sort order (asc or desc) + - schema: type: string - status: - type: string - scan_time_elapsed: - type: string - progress: + enum: + - fixed + - unfixed + in: query + name: status + description: supported status (fixed or unfixed) + /v1/asset/enumerate/{enumerate_id}/history: + parameters: + - schema: + type: string + name: enumerate_id + in: path + required: true + get: + summary: Get Enumeration History + tags: [] + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + current_page: + type: integer + result_count: + type: integer + total_pages: + type: integer + total_results: + type: integer + total_enumeration: + type: integer + format: int64 + total_unique_enumeration: + type: integer + format: int64 + data: + type: array + items: + $ref: "#/components/schemas/EnumerationHistoryDataResponse" + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "403": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" + default: + $ref: "#/components/responses/ErrorResponse" + operationId: get-v1-asset-enumerate-enumerate_id-history + parameters: + - schema: type: integer - failure_reason: + in: query + name: offset + description: The number of items to skip before starting to collect the result set + - schema: + type: integer + in: query + name: limit + description: The numbers of items to return + - schema: type: string - created_at: + format: date + in: query + name: start_date + description: time filter start date + - schema: type: string - updated_at: + default: all_time + enum: + - all_time + - current_month + - last_month + - last_3_months + - last_6_months + - last_12_months + in: query + name: time_range + - schema: type: string - total_target: - type: integer - completed_at: + format: date + in: query + name: end_date + description: time filter end date + - schema: type: string - total_scan: + in: header + name: X-Team-Id + description: "Retrieve the Team ID from: https://cloud.projectdiscovery.io/settings/team" + description: Get asset enumeration history data + /v2/vulnerability/search: + get: + summary: Full Text Search + tags: [] + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + count: + type: integer + facets: + type: object + additionalProperties: + $ref: "#/components/schemas/Facets" + results: + type: array + items: + $ref: "#/components/schemas/Vulnerability" + total: + type: integer + "400": + $ref: "#/components/responses/ErrorResponse" + "401": + $ref: "#/components/responses/ErrorResponse" + "403": + $ref: "#/components/responses/ErrorResponse" + "404": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" + default: + $ref: "#/components/responses/ErrorResponse" + operationId: get-v2-vulnerability-search + description: Full text search on vulnerabilities + parameters: + - schema: type: integer - total_template: + in: query + name: limit + description: The numbers of items to return + - schema: type: integer - name: + in: query + name: offset + description: The numbers of items to skip + - schema: type: string - severity: - type: object - is_oss: - type: boolean - is_cloud: - type: boolean - asset_ids: - type: array - items: - type: string - is_rescan: - type: boolean - public_templates: - type: array - items: - type: string - report_config_ids: - type: array + in: query + name: sort_asc + description: Sort results in ascending order (CSV field names) + - schema: + type: string + in: query + name: sort_desc + description: Sort results in descending order (CSV field names) + - schema: items: type: string - rescan_count: - type: integer - scan_config_ids: type: array + in: query + name: fields + description: List of fields to return(comma separated) + - schema: items: type: string - template_ids: type: array + in: query + name: term_facets + description: List of fields to return(comma separated) + - schema: items: type: string - template_urls: type: array - items: - type: string - schedule: - $ref: '#/components/schemas/ScanSchedule' - total_result: + in: query + name: range_facets + description: List of fields to return(comma separated) + - schema: + type: string + in: query + name: q + description: query + - schema: + type: boolean + in: query + name: highlight + description: Whether to highlight the search results + - schema: + type: integer + in: query + name: facet_size + description: Number of facets to return + parameters: [] + /v2/vulnerability/{id}: + parameters: + - schema: + type: string + name: id + in: path + required: true + get: + summary: Get Vulnerability by ID + tags: [] + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + data: + $ref: "#/components/schemas/Vulnerability" + "400": + $ref: "#/components/responses/ErrorResponse" + "404": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" + default: + $ref: "#/components/responses/ErrorResponse" + operationId: get-vulnerability-by-id + description: Get Vulnerability by ID + parameters: + - schema: + type: string + in: query + name: fields + description: "template data fields " + /v2/vulnerability/filters: + get: + summary: Get All Filters for Vulnerabilities + tags: [] + responses: + "200": + description: OK + content: + application/json: + schema: + type: array + items: + type: object + required: + - can_sort + - data_type + - description + - examples + - facet_possible + - field + - search_analyzer + - enum_values + properties: + can_sort: + type: boolean + description: Indicates if sorting is possible by this field. + data_type: + type: string + description: The data type of the filter field (e.g., string, number, datetime). + description: + type: string + description: A human-readable description of the filter field. + examples: + type: array + description: Example usage of the filter. + items: + type: string + facet_possible: + type: boolean + description: Indicates if faceting is possible for this field. + field: + type: string + description: The name of the filter field. + search_analyzer: + type: string + description: The search analyzer used for this field. + enum_values: + description: The possible values for this field. + items: + type: string + type: array + "400": + $ref: "#/components/responses/ErrorResponse" + "404": + $ref: "#/components/responses/ErrorResponse" + "500": + $ref: "#/components/responses/ErrorResponse" + default: + $ref: "#/components/responses/ErrorResponse" + operationId: get-v2-vulnerability-filters + description: Get all filters for vulnerabilities + parameters: [] +components: + schemas: + AssetCategory: + title: AssetCategory + type: object + required: + - name + - total_assets + - technologies + properties: + name: + type: string + total_assets: type: integer + technologies: + type: object + additionalProperties: + type: integer + DomainVerificationRequest: + title: DomainVerificationRequest + type: object required: - - scan_id - - status - - scan_time_elapsed - - progress - - failure_reason - - created_at - - updated_at - - total_target - - completed_at - - total_scan - - total_template - - name - - is_oss - - is_cloud - - total_result - title: ScanStatusItem - JiraVerifyContentItemIssueType: + - domain + - status + - created_at + - expires_at + - verification_attempts + properties: + domain: + type: string + description: The domain being verified + status: + type: string + enum: + - pending + - verified + - expired + description: Current verification status + verification_string: + type: string + description: TXT record value to add to DNS (only present for pending requests) + created_at: + type: string + format: date-time + description: When the verification request was created + expires_at: + type: string + format: date-time + description: When the verification request expires + verification_attempts: + type: integer + description: Number of verification attempts made + last_attempt_at: + type: string + format: date-time + description: When the last verification attempt was made + VerifyConfigContentsRequestProvider: + title: VerifyConfigContentsRequestProvider + type: string + enum: + - jira + - linear + OAuthStatus: + title: OAuthStatus + type: string + enum: + - not_connected + - pending + - success + OAuthMetadata: + title: OAuthMetadata + type: object + properties: + installation_url: + type: string + required: + - installation_url + LogExportFormat: + title: LogExportFormat + type: string + enum: + - raw + - json + - csv + EnumExportFormats: + title: EnumExportFormats + type: string + enum: + - raw + - json + - csv + TimeRangeQueryParameter: + title: TimeRangeQueryParameter + type: string + enum: + - last_day + - last_week + - last_month + - last_3_months + - last_6_months + - last_12_months + - all_time + EnumerateFilterTypes: + title: EnumerateFilterTypes + type: string + enum: + - host + - port + - ip + - cname + - technologies + - status_code + - content_length + - title + - webserver + - favicon + - domain + - labels + ExcludeConfigRequestType: + title: ExcludeConfigRequestType + type: string + enum: + - scan_target + - template + - enumeration_target + AssetChangelogs: type: object + required: + - id + - enumeration_id + - name + - created_at + - updated_at properties: id: + type: integer + format: int64 + enumeration_id: type: string name: type: string - statuses: + created_at: + type: string + format: date-time + updated_at: + type: string + format: date-time + status_code: + type: integer + technologies: type: array items: type: string - required: - - id - - name - title: JiraVerifyContentItemIssueType - JiraVerifyContentItem: - type: object - properties: - project_id: + webserver: type: string - project_name: + request: type: string - issue_types: + response: + type: string + cname: type: array items: - type: object - $ref: '#/components/schemas/JiraVerifyContentItemIssueType' - required: - - project_id - - project_name - - issue_types - title: JiraVerifyContentItem - VulnerabilityEvent: - type: object - properties: - curl-command: - type: string - extracted-results: + type: string + labels: type: array items: type: string - extractor-name: + ip: + type: string + content_length: + type: integer + title: type: string host: type: string - info: - type: object - properties: - classification: - type: object - properties: - cpe: - type: string - cve-id: - type: array - items: - type: string - cvss-metrics: - type: string - cvss-score: - type: number - cwe-id: - type: array - items: - type: string - epss-percentile: - type: number - epss-score: - type: number - metadata: - type: object - author: - type: array - items: - type: string - description: - type: string - impact: - type: string - name: - type: string - tags: - type: array - items: - type: string - reference: - type: array - items: - type: string - remediation: - type: string - severity: - type: string - required: - - name - ip: + port: + type: integer + technology_details: type: string - matched-at: + format: json + is_new: + type: boolean + body: type: string - matched-line: + change_event: type: array items: - type: integer - matcher-name: - type: string - matcher-status: - type: boolean - path: - type: string - request: - type: string - response: - type: string - template-id: - type: string - template-path: - type: string - timestamp: - type: string - type: - type: string - issue_trackers: - type: object - properties: - jira: - $ref: '#/components/schemas/VulnIssueTrackerItem' - github: - $ref: '#/components/schemas/VulnIssueTrackerItem' - gitlab: - $ref: '#/components/schemas/VulnIssueTrackerItem' - linear: - $ref: '#/components/schemas/VulnIssueTrackerItem' - title: VulnerabilityEvent - FiltersItem: + $ref: "#/components/schemas/VulnerabilityChangelogsEvent" + EnumerateFiltersItem: + title: EnumerateFiltersItem type: object properties: + labels: + type: string value: type: string - name: + port: + type: integer + technologies: + type: integer + categories: + type: array + items: + type: string + description: type: string - severity: + website: type: string - count: - type: integer - required: - - value - - count - title: FilterItem - UserWorkspaces: - type: object - properties: - name: + cpe: type: string - team_id: + icon: type: string - active: - type: boolean - plan: + favicon_body: type: string - member_count: - type: integer - required: - - name - - team_id - - active - - plan - - member_count - title: UserWorkspaces - ScanStats: - type: object - properties: - cves: - type: integer - matched: - type: integer - not_matched: - type: integer - severity: - type: object - total_count: - type: integer - total_scan: - type: integer - total_target: - type: integer - total_template: + count: type: integer - vuln_status: - type: object required: - - cves - - matched - - not_matched - - total_count - - total_scan - - total_target - - total_template - title: ScanStats - VulnerabilityResultsOld: + - value + - count + VulnerabilityResults: type: object properties: - scan_id: + matcher_status: + type: boolean + vuln_id: type: string target: type: string - template_encoded: - type: string template_url: type: string - template_path: - type: string - template_id: - type: string - vuln_id: - type: string - matcher_status: - type: boolean created_at: type: string updated_at: type: string + scan_id: + type: string event: - $ref: '#/components/schemas/VulnerabilityEvent' - id: + type: array + items: + $ref: "#/components/schemas/VulnerabilityEvent" + template_id: + type: string + template_path: + type: string + template_encoded: + type: string + result_type: type: string vuln_status: type: string vuln_hash: type: string + is_regression: + type: boolean + labels: + type: array + items: + type: string + port: + type: integer + asset_metadata: + type: object + $ref: "#/components/schemas/EnumerationContent" required: - - scan_id - - target - - template_id - - vuln_id - - matcher_status - - created_at - - event - title: VulnerabilityResultsOld - templateListItem: + - matcher_status + - vuln_id + - target + - created_at + - scan_id + - event + - template_id + - result_type + - vuln_hash + VulnerabilityChangelogs: + title: VulnerabilityChangelogs type: object properties: - created_at: + matcher_status: + type: boolean + vuln_id: type: string - id: + target: type: string - name: + template_url: + type: string + created_at: type: string - shared_publicly: - type: boolean updated_at: type: string - required: - - created_at - - id - - name - title: templateListItem - ExportListItem: - description: Export List Item - type: object - properties: - id: + scan_id: type: string - name: + event: + type: object + $ref: "#/components/schemas/VulnerabilityEvent" + change_event: + type: array + items: + $ref: "#/components/schemas/VulnerabilityChangelogsEvent" + template_id: type: string - export_status: + template_path: type: string - item_type: + template_encoded: type: string - download_signed_url: + result_type: type: string - created_at: + vuln_status: type: string - format: date-time + vuln_hash: + type: string + labels: + type: array + items: + type: string required: - - id - - name - - export_status - - item_type - - created_at - title: ExportListItem - UserAuditLogItems: + - matcher_status + - vuln_id + - target + - created_at + - scan_id + - event + - template_id + - result_type + - vuln_hash + PrivateTemplates: + title: PrivateTemplates type: object properties: - created_at: - type: string - email: - type: string - action: - type: string - status: - type: integer - method: + name: type: string - ip: + contents: type: string required: - - created_at - - email - - action - - status - - method - - ip - title: UserAuditLogItems - PublicTemplateListItem: + - name + - contents + AssetListItem: + title: AssetListItem type: object properties: - id: + asset_count: + type: integer + asset_id: type: string - templateURL: + uploaded_at: type: string name: type: string required: - - id - - templateURL - - name - title: PublicTemplateListItem - EarlyTemplateListItem: - type: object - properties: - id: - type: string - templateURL: - type: string - name: - type: string - required: - - id - - templateURL - - name - title: EarlyTemplateListItem - TeamMemberItem: + - asset_count + - asset_id + - uploaded_at + - name + ScanSchedule: + title: ScanSchedule type: object + required: + - scan_frequency + - scan_id + - schedule_last_run + - schedule_next_run properties: - email: - type: string - status: + scan_frequency: type: string - role: + scan_id: type: string - invited_at: + schedule_last_run: type: string - accepted_at: + schedule_next_run: type: string - profile_image: + start_time: type: string - required: - - email - - status - - role - title: TeamMemberItem - WorkspaceItem: + format: time + hourly_frequency: + type: integer + custom_weekdays: + type: array + description: |- + Array of integer denoting the weekdays on which the scan is supposed to run. + 0-6 denoting Sunday-Saturday. + items: + type: integer + minimum: 0 + maximum: 6 + ScanAssetListItem: + title: ScanAssetListItem type: object + required: + - host + - scanned_on properties: - id: - type: string - name: - type: string - created_at: + host: type: string - member_count: + port: type: integer - owner_email: + scanned_on: type: string - required: - - id - - name - - created_at - - member_count - - owner_email - title: TeamMemberItem - ScanUsageStatsResponse: - description: 'Scan Usage Stats ' + format: date-time + ScanAssetListItemOptional: + title: ScanAssetListItem type: object + required: + - host + - scanned_on properties: - time: - type: string - format: date-time - scan_id: + host: type: string - user_id: - type: integer - format: int64 - completed_request: - type: integer - format: int64 - total_target: - type: integer - format: int64 - total_templates: - type: integer - format: int64 - total_result: + port: type: integer - format: int64 - severity_breakdown: + scanned_on: type: string - format: json - required: - - time - - scan_id - - user_id - - completed_request - - total_target - - total_templates - - total_result - - severity_breakdown - title: ScanUsageStatsResponse - VulnStatusEnum: - enum: - - open - - false_positive - - fixed - - duplicate - - fix_in_progress - - accepted_risk - title: VulnStatusEnum - ConfigResponse: + format: date-time + EnumerationDomainListItem: + title: EnumerationDomainListItem type: object + required: + - domain + - enumerated_on properties: - id: - type: string - config: - type: string - config_type: - $ref: '#/components/schemas/ConfigTypeEnum' - name: - type: string - read_only: - type: boolean - global: - type: boolean - provider_name: - type: string - created_at: + domain: type: string - format: date-time - updated_at: + enumerated_on: type: string format: date-time - required: - - id - - config - - config_type - - name - - created_at - - updated_at - title: ConfigResponse - ConfigTypeEnum: - type: string - enum: - - scan - - reporting - - template - - alerting - - cloudlist - title: ConfigTypeEnum - EnumerationStats: + ScanStatusItem: + title: ScanStatusItem type: object - properties: - hosts: - type: integer - format: int64 - http: - type: integer - format: int64 - endpoints: - type: integer - format: int64 - ports: - type: integer - format: int64 - total_assets: - type: integer - format: int64 required: - - hosts - - http - - endpoints - - ports - - total_assets - title: EnumerationStats - EnumerateData: - type: object + - scan_id + - status + - scan_time_elapsed + - progress + - failure_reason + - created_at + - updated_at + - total_target + - completed_at + - total_scan + - total_template + - name + - is_oss + - is_cloud + - total_result properties: - id: - type: string - name: + scan_id: type: string status: type: string - failure_reason: - type: string - completed_at: - type: string - format: date-time - enumeration_time: + scan_time_elapsed: type: string - format: duration - enumeration_type: + progress: + type: integer + failure_reason: type: string - enumeration_stats: - $ref: '#/components/schemas/EnumerationStats' created_at: type: string - format: date-time updated_at: type: string - format: date-time - root_domains: + total_target: + type: integer + completed_at: + type: string + total_scan: + type: integer + total_template: + type: integer + name: + type: string + severity: + type: object + is_oss: + type: boolean + is_cloud: + type: boolean + asset_ids: type: array items: type: string - enrichment_hosts_count: - type: integer is_rescan: type: boolean - rescan_count: - type: integer - cloudlist_config_ids: + public_templates: type: array items: type: string - cloudlist_provider_name: - type: string - enumeration_time_elapsed: - type: string - total_assets: - type: integer - format: int64 - new_assets: - type: integer - format: int64 - domain_names: + report_config_ids: type: array items: type: string - schedule: - $ref: '#/components/schemas/EnumerationSchedule' - required: - - id - - name - - status - - created_at - title: EnumerateData - EnumerationContent: - type: object - properties: - enumeration_id: - type: string - name: - type: string - created_at: - type: string - updated_at: - type: string - id: + rescan_count: type: integer - format: int64 - labels: + scan_config_ids: type: array items: type: string - cname: + template_ids: type: array items: type: string - host: - type: string - port: - type: integer - ip: + template_urls: type: array items: type: string - status_code: - type: integer - content_length: + schedule: + $ref: "#/components/schemas/ScanSchedule" + total_result: type: integer - title: + is_automatic: + type: boolean + JiraVerifyContentItemIssueType: + title: JiraVerifyContentItemIssueType + type: object + properties: + id: type: string - technologies: + name: + type: string + statuses: type: array items: type: string - webserver: + required: + - id + - name + JiraVerifyContentItem: + title: JiraVerifyContentItem + type: object + properties: + project_id: type: string - method: + project_name: type: string - source: + issue_types: + type: array + items: + type: object + $ref: "#/components/schemas/JiraVerifyContentItemIssueType" + required: + - project_id + - project_name + - issue_types + LinearVerifyContentItemOpenState: + title: LinearVerifyContentItemOpenState + type: object + properties: + id: type: string - is_new: - type: boolean - type: + name: type: string - asset_hash: + required: + - id + - name + LinearVerifyContentItem: + title: LinearVerifyContentItem + type: object + properties: + team_id: type: string - technology_details: - type: object - additionalProperties: - $ref: '#/components/schemas/EnumerationContentTechnologyDetails' - screenshot_path: - type: string - favicon: - type: string - favicon_body: - type: string - cdn_name: + team_name: type: string - chain_status_codes: + open_states: type: array items: - type: string - domain_name: - type: string - redirect_location: - type: string + type: object + $ref: "#/components/schemas/LinearVerifyContentItemOpenState" required: - - enumeration_id - - name - - created_at - - id - - is_new - title: EnumerationContent - EnumerationContentTechnologyDetails: + - team_id + - team_name + - open_states + VulnerabilityChangelogsEvent: + title: VulnerabilityChangelogsEvent type: object properties: - description: - type: string - website: - type: string - icon: + name: + description: The name of the event type: string - categories: - type: array - items: - type: string - title: EnumerationContentTechnologyDetails - EnumerationIds: + from: + description: The from value of the event + to: + description: The to value of the event + VulnerabilityEvent: + title: VulnerabilityEvent type: object properties: - id: + curl-command: type: string - type: + extracted-results: type: array items: type: string - required: - - id - - type - title: EnumerationIds - EnumerationSchedule: - type: object - properties: - enumeration_id: - type: string - scan_frequency: + extractor-name: type: string - schedule_last_run: + host: type: string - schedule_next_run: + info: + type: object + required: + - name + properties: + classification: + type: object + properties: + cpe: + type: string + cve-id: + type: array + items: + type: string + cvss-metrics: + type: string + cvss-score: + type: number + cwe-id: + type: array + items: + type: string + epss-percentile: + type: number + epss-score: + type: number + metadata: + type: object + author: + type: array + items: + type: string + description: + type: string + impact: + type: string + name: + type: string + tags: + type: array + items: + type: string + reference: + type: array + items: + type: string + remediation: + type: string + severity: + type: string + ip: type: string - start_time: + matched-at: type: string - format: time - hourly_frequency: - type: integer - custom_weekdays: - description: |- - Array of integer denoting the weekdays on which the scan is supposed to run. - 0-6 denoting Sunday-Saturday. + matched-line: type: array items: type: integer - minimum: 0 - maximum: 6 - required: - - enumeration_id - - scan_frequency - - schedule_last_run - - schedule_next_run - title: EnumerationSchedule - ScansHistoryItems: + matcher-name: + type: string + matcher-status: + type: boolean + path: + type: string + request: + type: string + response: + type: string + template-id: + type: string + template-path: + type: string + timestamp: + type: string + type: + type: string + error: + type: string + issue_trackers: + type: object + properties: + jira: + $ref: "#/components/schemas/VulnIssueTrackerItem" + github: + $ref: "#/components/schemas/VulnIssueTrackerItem" + gitlab: + $ref: "#/components/schemas/VulnIssueTrackerItem" + linear: + $ref: "#/components/schemas/VulnIssueTrackerItem" + custom: + $ref: "#/components/schemas/VulnIssueTrackerItem" + port: + type: string + FiltersItem: + title: FilterItem type: object properties: - completed_request: + value: + type: string + name: + type: string + severity: + type: string + count: type: integer + required: + - value + - count + UserWorkspaces: + title: UserWorkspaces + type: object + required: + - name + - team_id + - active + - plan + - member_count + - role + - default + properties: name: type: string - scan_id: + team_id: type: string - scan_time: + active: + type: boolean + plan: + type: string + member_count: + type: integer + role: type: string + default: + type: boolean + ScanStats: + title: ScanStats + type: object + properties: + cves: + type: integer + matched: + type: integer + not_matched: + type: integer severity: type: object - status: - type: string - time: - type: string - total_request: + total_count: type: integer - total_result: + total_scan: type: integer total_target: type: integer - total_templates: + total_template: type: integer - title: ScansHistoryItems - GithubTemplateListItem: + vuln_status: + type: object + total_regression: + type: integer + format: int64 + required: + - cves + - matched + - not_matched + - total_count + - total_scan + - total_target + - total_template + - total_regression + VulnerabilityResultsOld: + title: VulnerabilityResultsOld type: object + required: + - scan_id + - target + - template_id + - vuln_id + - matcher_status + - created_at + - event properties: - id: + scan_id: type: string - templateURL: + target: type: string - name: + template_encoded: type: string - required: - - id - - templateURL - - name - title: GithubTemplateListItem - IntegrationListItems: - type: object - properties: - connection_id: + template_url: type: string - integration_id: + template_path: type: string - status: + template_id: type: string - identifier: + vuln_id: type: string - org_name: + matcher_status: + type: boolean + created_at: type: string - account_type: + updated_at: type: string - handle: + event: + $ref: "#/components/schemas/VulnerabilityEvent" + id: + type: string + vuln_status: + type: string + vuln_hash: + type: string + port: + type: integer + asset_metadata: + type: object + $ref: "#/components/schemas/EnumerationContent" + templateListItem: + title: templateListItem + type: object + properties: + created_at: + type: string + id: + type: string + name: + type: string + shared_publicly: + type: boolean + updated_at: type: string required: - - connection_id - - integration_id - - status - - identifier - - org_name - - account_type - - handle - title: GithubTemplateListItem - TemplateStats: + - created_at + - id + - name + ExportListItem: + title: ExportListItem type: object properties: - date: + id: type: string - statistics: - type: object - properties: - authors: - type: object - classification: - type: object - properties: - total: - type: integer - cvss-metrics: - type: integer - cvss-score: - type: integer - cve-id: - type: integer - cwe-id: - type: integer - description: - type: integer - directory: - type: object - properties: - total: - type: integer - name: - type: integer - references: - type: integer - remediation: - type: integer - severity: - type: object - properties: - total: - type: integer - critical: - type: integer - high: - type: integer - medium: - type: integer - low: - type: integer - info: - type: integer - unknown: - type: integer - tags: - type: object - total: - type: integer - type: - type: object - properties: - total: - type: integer - http: - type: integer - dns: - type: integer - network: - type: integer - file: - type: integer - ssl: - type: integer - websocket: - type: integer - workflow: - type: integer - headless: - type: integer - template-version: + name: type: string - x-examples: - Example 1: - date: '2024-02-03T08:40:19.911720715Z' - statistics: - authors: - 0h1in9e: 1 - 0ri2n: 13 - 0ut0fb4nd: 1 - 0w4ys: 3 - classification: - total: 4772 - cvss-metrics: 4650 - cvss-score: 2999 - cve-id: 2349 - cwe-id: 4679 - description: 6665 - directory: - total: 0 - name: 7810 - references: 5369 - remediation: 2231 - severity: - total: 7810 - critical: 947 - high: 1563 - medium: 1457 - low: 257 - info: 3551 - unknown: 35 - tags: - '360': 1 - '3600': 1 - '''rpcms''': 1 - total: 7810 - type: - total: 7810 - http: 7005 - dns: 21 - network: 134 - file: 312 - ssl: 27 - websocket: 0 - workflow: 191 - headless: 16 - template-version: main - TemplateLeaderboard: + export_status: + type: string + item_type: + type: string + download_signed_url: + type: string + created_at: + type: string + format: date-time + description: Export List Item + required: + - id + - name + - export_status + - item_type + - created_at + UserAuditLogItems: + title: UserAuditLogItems type: object + required: + - created_at + - email + - action + - status + - method + - ip + - path properties: - data: - type: array - items: - type: object - properties: - author: - type: string - category: - type: object - properties: - cloud: - type: integer - cve: - type: integer - fuzz: - type: integer - kve: - type: integer - links: - type: object - properties: - email: - type: string - github: - type: string - linkedin: - type: string - twitter: - type: string - website: - type: string - points: - type: integer - protocol: - type: object - properties: - dns: - type: integer - file: - type: integer - headless: - type: integer - http: - type: integer - ssl: - type: integer - tcp: - type: integer - rank: - type: integer - severity: - type: object - properties: - critical: - type: integer - high: - type: integer - info: - type: integer - low: - type: integer - medium: - type: integer - unknown: - type: integer - templates: - type: integer - date: + created_at: type: string - result: - type: integer - total: + email: + type: string + action: + type: string + status: type: integer - x-examples: - Example 1: - data: - - author: dhiyaneshdk - category: - cloud: 0 - cve: 154 - fuzz: 1 - kve: 34 - links: - email: '' - github: '' - linkedin: '' - twitter: '' - website: '' - points: 26065 - protocol: - dns: 0 - file: 85 - headless: 1 - http: 1044 - ssl: 0 - tcp: 1 - rank: 1 - severity: - critical: 90 - high: 195 - info: 592 - low: 89 - medium: 161 - unknown: 12 - templates: 1139 - - author: naglis - category: - cloud: 0 - cve: 0 - fuzz: 0 - kve: 0 - links: - email: '' - github: '' - linkedin: '' - twitter: '' - website: '' - points: 10 - protocol: - dns: 0 - file: 1 - headless: 0 - http: 0 - ssl: 0 - tcp: 0 - rank: 792 - severity: - critical: 0 - high: 0 - info: 1 - low: 0 - medium: 0 - unknown: 0 - templates: 1 - date: all_time - result: 794 - total: 794 - EnumerationIDTypes: + method: + type: string + ip: + type: string + path: + type: string + PublicTemplateListItem: + title: PublicTemplateListItem type: object properties: id: type: string + templateURL: + type: string + name: + type: string required: - - id - title: EnumerationIDTypes - EnumerationIDTypesDetail: + - id + - templateURL + - name + EarlyTemplateListItem: + title: EarlyTemplateListItem type: object properties: id: type: string - name: - type: string - total_assets: - type: integer - enumeration_type: + templateURL: type: string - cloudlist_provider_name: + name: type: string - types: - type: array - items: - enum: - - hosts - - ports - - http - - endpoints required: - - id - - types - - name - - enumeration_type - title: EnumerationIDTypesDetail - ScanConfigItem: + - id + - templateURL + - name + TeamMemberItem: + title: TeamMemberItem type: object properties: - id: + email: type: string - name: + status: type: string - provider_name: + role: type: string - config_type: + invited_at: + type: string + accepted_at: + type: string + profile_image: + type: string + last_sign_in: type: string required: - - id - - name - - config_type - title: ScanConfigItem - ScanConfig: + - email + - status + - role + InvoiceItem: + description: Example response type: object + required: + - invoice_number + - amount + - paid_on + - status + - invoice_url properties: - targets: - type: array - items: - type: string - assets_lists: - type: array - items: - type: string - public_templates: - type: array - items: - type: string - early_templates: - type: array - items: - type: string - template_urls: - type: array - items: - type: string - template_ids: - type: array - items: - type: string - scan_config_ids: - type: array - items: - $ref: '#/components/schemas/ScanConfigItem' - report_config_ids: - type: array - items: - $ref: '#/components/schemas/ScanConfigItem' - alerting_config_ids: - type: array - items: - $ref: '#/components/schemas/ScanConfigItem' - enumeration_ids: - type: array - items: - $ref: '#/components/schemas/EnumerationIDTypesDetail' - title: ScanConfig - ScanConfigUpdateItem: - type: object - properties: - targets: - type: array - items: - type: string - assets_lists: - type: array - items: - type: string - templates: - type: array - items: - type: string - early_templates: - type: array - items: - type: string - scan_config_ids: - type: array - items: - type: string - report_config_ids: - type: array - items: - type: string - alerting_config_ids: - type: array - items: - type: string - enumeration_ids: - type: array - items: - $ref: '#/components/schemas/EnumerationIDTypes' - title: ScanConfigUpdateItem - ScanLogResp: - type: object - properties: - target: - type: string - template_id: - type: string - matched: - type: boolean - error: - type: string - timestamp: + invoice_number: type: string - severity: + description: The invoice number + amount: + type: integer + format: int64 + description: Total amount of the invoice in USD + paid_on: type: string - event: + format: date-time + nullable: true + description: The date when the invoice was paid + status: type: string - vuln_hash: + description: The status of the invoice + invoice_url: type: string - required: - - target - - template_id - - matched - - timestamp - title: ScanLogResp - SchedulerFrequency: - description: Allowed frequencies for the scheduler - type: string - enum: - - hourly - - daily - - weekly - - monthly - - custom - title: SchedulerFrequency - ExcludedTemplate: + format: uri + description: URL to view the invoice + WorkspaceItem: + title: TeamMemberItem type: object properties: id: - type: integer - format: int64 - value: + type: string + name: type: string created_at: type: string - format: date-time - updated_at: + member_count: + type: integer + owner_email: type: string - format: date-time required: - - id - - value - - created_at - - updated_at - title: ExcludedTemplate - EnumerationCounts: - description: Example response + - id + - name + - created_at + - member_count + - owner_email + ScanUsageStatsResponse: + title: ScanUsageStatsResponse type: object + description: "Scan Usage Stats " properties: - total_enumeration: + time: + type: string + format: date-time + scan_id: + type: string + user_id: type: integer format: int64 - total_unique_enumeration: + completed_request: type: integer format: int64 - total_uploaded_enumeration: + total_target: type: integer format: int64 - total_discovery_enumeration: + total_templates: type: integer format: int64 - total_cloud_enumeration: + total_result: type: integer format: int64 - title: EnumerationCounts - AssetStats: + severity_breakdown: + type: string + format: json + required: + - time + - scan_id + - user_id + - completed_request + - total_target + - total_templates + - total_result + - severity_breakdown + VulnStatusEnum: + title: VulnStatusEnum + enum: + - open + - false_positive + - fixed + - duplicate + - fix_in_progress + - accepted_risk + - triaged + ConfigResponse: + title: ConfigResponse + type: object + properties: + id: + type: string + config: + type: string + config_type: + $ref: "#/components/schemas/ConfigTypeEnum" + name: + type: string + read_only: + type: boolean + global: + type: boolean + provider_name: + type: string + created_at: + type: string + format: date-time + updated_at: + type: string + format: date-time + required: + - id + - config + - config_type + - name + - created_at + - updated_at + ConfigTypeEnum: + title: ConfigTypeEnum + type: string + enum: + - scan + - reporting + - template + - alerting + - cloudlist + - subfinder + EnumerationStats: + title: EnumerationStats type: object + required: + - hosts + - http + - endpoints + - ports + - total_assets properties: hosts: type: integer @@ -6434,888 +5504,3716 @@ components: ports: type: integer format: int64 - new_assets: - type: integer - format: int64 total_assets: type: integer format: int64 - technologies: + total_asset_groups: type: integer format: int64 - required: - - hosts - - http - - endpoints - - ports - - total_assets - - new_assets - - technologies - title: AssetStats - PriceListItem: + EnumerateData: + title: EnumerateData type: object - properties: - price_id: - type: string - amount: - type: integer - monthly_token: - type: integer - recurrence: - type: string required: - - price_id - - amount - - recurrence - - monthly_token - title: PriceListItem - VulnIssueTrackerItem: - type: object + - id + - name + - status + - created_at properties: id: type: string - url: - type: string - title: VulnIssueTrackerItem - EnumerationConfig: - type: object - properties: name: type: string + status: + type: string + failure_reason: + type: string + completed_at: + type: string + format: date-time + enumeration_time: + type: string + format: duration + enumeration_type: + type: string + enumeration_stats: + $ref: "#/components/schemas/EnumerationStats" + created_at: + type: string + format: date-time + updated_at: + type: string + format: date-time root_domains: type: array items: type: string - enrichment_inputs: + enrichment_hosts_count: + type: integer + is_rescan: + type: boolean + rescan_count: + type: integer + cloudlist_config_ids: type: array items: type: string - steps: + cloudlist_provider_name: + type: string + enumeration_time_elapsed: + type: string + total_assets: + type: integer + format: int64 + new_assets: + type: integer + format: int64 + domain_names: type: array items: type: string - enum: - - dns_resolve - - dns_bruteforce - - dns_permute - - port_scan - - http_probe - - http_screenshot - - dns_passive - enum_ports: - type: string - enumeration_config: - $ref: '#/components/schemas/EnumerationLaunchConfig' - title: EnumerationConfig - EnumerationLaunchConfig: - type: object - properties: - follow-redirect: + schedule: + $ref: "#/components/schemas/EnumerationSchedule" + is_public: type: boolean - ports: + asset_group_filters: + type: object + $ref: "#/components/schemas/AssetFilters" + body: type: string - title: EnumerationLaunchConfig - TunnelItem: + automatic_vuln_scans: + type: boolean + EnumerationContent: + title: EnumerationContent type: object + required: + - enumeration_id + - name + - created_at + - id + - is_new properties: - name: + enumeration_id: type: string - os: + name: type: string - arch: + created_at: type: string - tunnel_ip: + updated_at: type: string - tunnel_port: + id: + type: integer + format: int64 + labels: + type: array + items: + type: string + cname: + type: array + items: + type: string + host: type: string - client_ip: + port: + type: integer + ip: + type: array + items: + type: string + status_code: + type: integer + content_length: + type: integer + vulnerabilities: + type: integer + format: int64 + title: type: string - username: + technologies: + type: array + items: + type: string + webserver: type: string - token: + method: + type: string + is_new: + type: boolean + type: + type: string + asset_hash: + type: string + technology_details: + type: object + additionalProperties: + $ref: "#/components/schemas/EnumerationContentTechnologyDetails" + screenshot_path: + type: string + favicon: + type: string + favicon_body: + type: string + cdn_name: + type: string + chain_status_codes: + type: array + items: + type: string + domain_name: + type: string + redirect_location: + type: string + asn: + as_number: + type: string + as_country: + type: string + as_name: + type: string + as_range: + type: array + items: + type: string + type: object + properties: + as_country: + type: string + as_name: + type: string + as_number: + type: string + as_range: + type: array + items: + type: string + tls_serial_number: + type: string + tls_subject_org: + type: string + tls_issuer_org: + type: string + tls_expired: + type: boolean + tls_not_before: + type: string + format: date-time + tls_self_signed: + type: boolean + tls_mismatched: + type: boolean + tls_revoked: + type: boolean + tls_untrusted: + type: boolean + tls_subject_cn: + type: string + tls_subject_an: + type: array + items: + type: string + body: + type: string + tls_not_after: + type: string + format: date-time + enumeration_name: type: string + extended_metadata: + type: object + source_type: + type: string + source: + type: array + items: + $ref: "#/components/schemas/EnumerationSourceValue" + EnumerationSourceValue: + type: object required: - - name - - os - - arch - - tunnel_ip - - tunnel_port - - client_ip - - username - - token - title: TunnelItem - ServiceUsageItem: + - source + - metadata + properties: + source: + type: string + metadata: + type: object + additionalProperties: + type: string + EnumerationContentTechnologyDetails: + title: EnumerationContentTechnologyDetails type: object properties: - used: + description: + type: string + website: + type: string + icon: + type: string + categories: + type: array + items: + type: string + EnumerationIds: + title: EnumerationIds + type: object + required: + - id + properties: + id: + type: string + EnumerationSchedule: + title: EnumerationSchedule + type: object + required: + - enumeration_id + - scan_frequency + - schedule_last_run + - schedule_next_run + properties: + enumeration_id: + type: string + scan_frequency: + type: string + schedule_last_run: + type: string + schedule_next_run: + type: string + start_time: + type: string + format: time + hourly_frequency: type: integer - remaining: + custom_weekdays: + type: array + description: |- + Array of integer denoting the weekdays on which the scan is supposed to run. + 0-6 denoting Sunday-Saturday. + items: + type: integer + minimum: 0 + maximum: 6 + ScansHistoryItems: + title: ScansHistoryItems + type: object + properties: + completed_request: type: integer - total: + name: + type: string + scan_id: + type: string + scan_time: + type: string + severity: + type: object + status: + type: string + time: + type: string + total_request: + type: integer + total_result: + type: integer + total_target: type: integer + total_templates: + type: integer + error_details: + type: string + GithubTemplateListItem: + title: GithubTemplateListItem + type: object + properties: + id: + type: string + templateURL: + type: string + name: + type: string required: - - used - - remaining - - total - title: ServiceUsageLimitItem - UsageRangeEnum: - type: string - enum: - - daily - - weekly - - monthly - - custom - title: UsageRangeEnum - ExposuresTimeSeries: + - id + - templateURL + - name + IntegrationListItems: + title: GithubTemplateListItem type: object properties: - date: + connection_id: type: string - format: date - assets: - type: integer - technologies: - type: integer - title: ExposuresTimeSeries - requestBodies: - UpdateTemplateRequest: + integration_id: + type: string + status: + type: string + identifier: + type: string + org_name: + type: string + account_type: + type: string + handle: + type: string + required: + - connection_id + - integration_id + - status + - identifier + - org_name + - account_type + - handle + TemplateStats: + type: object + x-examples: + Example 1: + date: "2024-02-03T08:40:19.911720715Z" + statistics: + authors: + 0h1in9e: 1 + 0ri2n: 13 + 0ut0fb4nd: 1 + 0w4ys: 3 + classification: + total: 4772 + cvss-metrics: 4650 + cvss-score: 2999 + cve-id: 2349 + cwe-id: 4679 + description: 6665 + directory: + total: 0 + name: 7810 + references: 5369 + remediation: 2231 + severity: + total: 7810 + critical: 947 + high: 1563 + medium: 1457 + low: 257 + info: 3551 + unknown: 35 + tags: + "360": 1 + "3600": 1 + "rpcms": 1 + total: 7810 + type: + total: 7810 + http: 7005 + dns: 21 + network: 134 + file: 312 + ssl: 27 + websocket: 0 + workflow: 191 + headless: 16 + template-version: main + required: + - buckets + - missing + - other + - total + properties: + is_new: + $ref: "#/components/schemas/StatBuckets" + creation_stats: + $ref: "#/components/schemas/StatBuckets" + author: + $ref: "#/components/schemas/StatBuckets" + is_early: + $ref: "#/components/schemas/StatBuckets" + dir: + $ref: "#/components/schemas/StatBuckets" + product: + $ref: "#/components/schemas/StatBuckets" + severity: + $ref: "#/components/schemas/StatBuckets" + tags: + $ref: "#/components/schemas/StatBuckets" + type: + $ref: "#/components/schemas/StatBuckets" + vendor: + $ref: "#/components/schemas/StatBuckets" + TemplateLeaderboard: + type: object + properties: + data: + type: array + items: + type: object + properties: + author: + type: string + category: + type: object + properties: + cloud: + type: integer + cve: + type: integer + fuzz: + type: integer + kve: + type: integer + links: + type: object + properties: + email: + type: string + github: + type: string + linkedin: + type: string + twitter: + type: string + website: + type: string + points: + type: integer + protocol: + type: object + properties: + dns: + type: integer + file: + type: integer + headless: + type: integer + http: + type: integer + ssl: + type: integer + tcp: + type: integer + rank: + type: integer + severity: + type: object + properties: + critical: + type: integer + high: + type: integer + info: + type: integer + low: + type: integer + medium: + type: integer + unknown: + type: integer + templates: + type: integer + date: + type: string + result: + type: integer + total: + type: integer + x-examples: + Example 1: + data: + - author: dhiyaneshdk + category: + cloud: 0 + cve: 154 + fuzz: 1 + kve: 34 + links: + email: "" + github: "" + linkedin: "" + twitter: "" + website: "" + points: 26065 + protocol: + dns: 0 + file: 85 + headless: 1 + http: 1044 + ssl: 0 + tcp: 1 + rank: 1 + severity: + critical: 90 + high: 195 + info: 592 + low: 89 + medium: 161 + unknown: 12 + templates: 1139 + - author: naglis + category: + cloud: 0 + cve: 0 + fuzz: 0 + kve: 0 + links: + email: "" + github: "" + linkedin: "" + twitter: "" + website: "" + points: 10 + protocol: + dns: 0 + file: 1 + headless: 0 + http: 0 + ssl: 0 + tcp: 0 + rank: 792 + severity: + critical: 0 + high: 0 + info: 1 + low: 0 + medium: 0 + unknown: 0 + templates: 1 + date: all_time + result: 794 + total: 794 + EnumerationIDTypes: + title: EnumerationIDTypes + type: object + required: + - id + properties: + id: + type: string + EnumerationIDTypesDetail: + title: EnumerationIDTypesDetail + type: object + properties: + id: + type: string + name: + type: string + total_assets: + type: integer + enumeration_type: + type: string + cloudlist_provider_name: + type: string + types: + type: array + items: + enum: + - hosts + - ports + - http + - endpoints + required: + - id + - types + - name + - enumeration_type + ScanConfigItem: + title: ScanConfigItem + type: object + properties: + id: + type: string + name: + type: string + provider_name: + type: string + config_type: + type: string + required: + - id + - name + - config_type + ScanConfig: + title: ScanConfig + type: object + properties: + targets: + type: array + items: + type: string + assets_lists: + type: array + items: + type: string + public_templates: + type: array + items: + type: string + early_templates: + type: array + items: + type: string + template_urls: + type: array + items: + type: string + template_ids: + type: array + items: + type: string + scan_config_ids: + type: array + items: + $ref: "#/components/schemas/ScanConfigItem" + report_config_ids: + type: array + items: + $ref: "#/components/schemas/ScanConfigItem" + alerting_config_ids: + type: array + items: + $ref: "#/components/schemas/ScanConfigItem" + enumeration_ids: + type: array + items: + $ref: "#/components/schemas/EnumerationIDTypesDetail" + socks5_proxy: + type: string + scan_all_assets: + type: boolean + ScanConfigUpdateItem: + title: ScanConfigUpdateItem + type: object + properties: + targets: + type: array + items: + type: string + assets_lists: + type: array + items: + type: string + templates: + type: array + items: + type: string + early_templates: + type: array + items: + type: string + scan_config_ids: + type: array + items: + type: string + report_config_ids: + type: array + items: + type: string + alerting_config_ids: + type: array + items: + type: string + enumeration_ids: + type: array + items: + $ref: "#/components/schemas/EnumerationIDTypes" + socks5_proxy: + type: string + scan_all_assets: + type: boolean + ScanLogResp: + title: ScanLogResp + type: object + required: + - target + - template_id + - matched + - timestamp + properties: + target: + type: string + template_id: + type: string + matched: + type: boolean + error: + type: string + timestamp: + type: string + severity: + type: string + event: + type: string + vuln_hash: + type: string + SchedulerFrequency: + title: SchedulerFrequency + type: string + enum: + - hourly + - daily + - weekly + - monthly + - custom + description: Allowed frequencies for the scheduler + ExcludedTemplate: + title: Excluded Templates and targets + type: object + properties: + id: + type: integer + format: int64 + value: + type: string + exclude_type: + $ref: "#/components/schemas/ExcludeConfigRequestType" + created_at: + type: string + format: date-time + updated_at: + type: string + format: date-time + required: + - id + - value + - exclude_type + - created_at + - updated_at + EnumerationCounts: + description: Example response + title: EnumerationCounts + type: object + properties: + total_enumeration: + type: integer + format: int64 + total_unique_enumeration: + type: integer + format: int64 + total_uploaded_enumeration: + type: integer + format: int64 + total_discovery_enumeration: + type: integer + format: int64 + total_cloud_enumeration: + type: integer + format: int64 + AssetStats: + title: AssetStats + type: object + properties: + host: + type: integer + format: int64 + new_assets: + type: integer + format: int64 + total_assets: + type: integer + format: int64 + technologies: + type: integer + format: int64 + domains: + type: integer + format: int64 + port: + type: integer + format: int64 + screenshots: + type: integer + format: int64 + vulnerabilities: + type: integer + format: int64 + required: + - domains + - host + - port + - total_assets + - new_assets + - technologies + - vulnerabilities + - screenshots + PriceListItem: + title: PriceListItem + type: object + required: + - price_id + - amount + - recurrence + - monthly_token + properties: + price_id: + type: string + amount: + type: integer + monthly_token: + type: integer + recurrence: + type: string + VulnIssueTrackerItem: + title: VulnIssueTrackerItem + type: object + properties: + id: + type: string + url: + type: string + AIMeta: + type: object + properties: + model_used: + description: The AI model used to generate the template + type: string + is_prompt_by_human: + description: Whether the prompt was written by a human + type: boolean + is_template_by_human: + description: Whether the template was written by a human + type: boolean + prompt: + description: The prompt used to generate the template + type: string + TemplateData: + description: Template Document or object + type: object + properties: + uri: + type: string + description: The URI of the template (could be a path or a ksuid) + id: + type: string + description: The ID of the template + name: + type: string + description: The name of the template + author: + type: array + description: The authors of the template + items: + type: string + tags: + type: array + description: The tags of the template + items: + type: string + severity: + type: string + description: The severity of the template + type: + type: string + description: The type of the template + dir: + type: string + ref: + type: string + vendor: + type: string + description: The vendor of the template + product: + type: string + description: The product of the template + classification: + $ref: "#/components/schemas/Classification" + description: Classification of template including additional metadata like cve-id, cwe-id etc + metadata: + type: object + digest: + type: string + description: The digest of the template + created_at: + type: string + format: date-time + description: The time when template was created + updated_at: + type: string + format: date-time + description: The time when template was updated + release_tag: + type: string + description: The release tag of the template (contains tag when the file was first released) + is_early: + type: boolean + description: True if template is in early access + raw: + type: string + description: The raw unparsed template + template_id: + type: string + description: + type: string + filename: + type: string + impact: + type: string + ai_meta: + $ref: "#/components/schemas/AIMeta" + references: + type: array + items: + type: string + template_type: + enum: + - public + - user + - shared + is_draft: + type: boolean + is_github: + type: boolean + is_new: + type: boolean + is_pdresearch: + type: boolean + is_pdteam: + type: boolean + is_pdtemplate: + type: boolean + remediation: + type: string + SharedTemplateData: + allOf: + - $ref: "#/components/schemas/TemplateData" + - type: object + properties: + ttl: + type: string + description: Time to live duration (1d ,1m etc) + share_type: + type: string + description: Type of share (unlisted, users, organization) + users_email: + type: array + description: List of email addresses or user IDs to share with (required if share_type is set to "users") + items: + type: string + organizations: + type: array + items: + type: string + Classification: + description: Classification of template including additional metadata like cve-id, cwe-id etc + type: object + properties: + cve-id: + type: array + items: + type: string + description: CVE IDs for the template + cwe-id: + type: array + items: + type: string + description: CWE IDs for the template + cvss-metrics: + type: string + description: CVSS Metrics for the template + cvss-score: + type: number + format: float + description: CVSS Score for the template + epss-score: + type: number + format: float + description: EPSS Score for the template + epss-percentile: + type: number + format: float + description: EPSS Percentile for the template + cpe: + type: string + description: CPE for the template + EnumerationConfig: + title: EnumerationConfig + type: object + properties: + name: + type: string + root_domains: + type: array + items: + type: string + enrichment_inputs: + type: array + items: + type: string + steps: + type: array + items: + type: string + enum: + - dns_resolve + - dns_bruteforce + - dns_permute + - port_scan + - http_probe + - http_screenshot + - endpoint_crawling + - dns_passive + - tls_scan + - uncover_assets + - dns_scraping + enum_ports: + type: string + enumeration_config: + $ref: "#/components/schemas/EnumerationLaunchConfig" + alerting_config_ids: + type: array + items: + type: string + subfinder_config_ids: + type: array + items: + type: string + automatic_vuln_scans: + type: boolean + EnumerationLaunchConfig: + title: EnumerationLaunchConfig + type: object + properties: + follow-redirect: + type: boolean + ports: + type: string + UserSetupStatsItem: + title: UserSetupStatsItem + type: object + required: + - name + - count + properties: + name: + type: string + count: + type: integer + first_created_at: + type: string + last_created_at: + type: string + TunnelItem: + title: TunnelItem + type: object + required: + - name + - os + - arch + - tunnel_ip + - tunnel_port + - client_ip + - username + - token + - id + - status + properties: + name: + type: string + os: + type: string + arch: + type: string + tunnel_ip: + type: string + tunnel_port: + type: string + client_ip: + type: string + username: + type: string + token: + type: string + id: + type: string + last_update: + type: string + status: + type: string + ServiceUsageItem: + title: ServiceUsageLimitItem + type: object + required: + - used + - remaining + - total + properties: + used: + type: integer + remaining: + type: integer + total: + type: integer + UsageRangeEnum: + title: UsageRangeEnum + type: string + enum: + - daily + - weekly + - monthly + - custom + GetAutomationsListItem: + title: GetAutomationsListItem + type: object + required: + - name + - event + - status + - created_at + - updated_at + properties: + name: + type: string + event: + type: string + status: + type: string + created_at: + type: string + updated_at: + type: string + AutomationScanData: + title: AutomationScanData + type: object + properties: + targets: + type: array + items: + type: string + templates: + type: array + items: + type: string + name: + type: string + alerting_config_ids: + type: array + items: + type: string + scan_config_ids: + type: array + items: + type: string + reporting_config_ids: + type: array + items: + type: string + early_templates: + type: array + items: + type: string + exclude_targets: + type: array + items: + type: string + enumeration_ids: + type: array + items: + $ref: "#/components/schemas/EnumerationIds" + disable_global_alert_config: + type: boolean + disable_global_report_config: + type: boolean + disable_global_scan_config: + type: boolean + socks5_proxy: + type: string + scan_id: + type: string + update_existing_scan: + type: boolean + scan_all_assets: + type: boolean + GetAutomationItem: + title: GetAutomationItem + type: object + required: + - id + - name + - event + - status + - created_at + - updated_at + - data + properties: + id: + type: integer + name: + type: string + event: + type: string + status: + type: string + created_at: + type: string + updated_at: + type: string + data: + $ref: "#/components/schemas/AutomationScanData" + AdminAutomationsItem: + title: AdminAutomationsItem + type: object + required: + - name + - status + - created_at + - updated_at + - user_id + - scan_data + properties: + name: + type: string + status: + type: string + created_at: + type: string + updated_at: + type: string + user_id: + type: integer + scan_data: + $ref: "#/components/schemas/AutomationScanData" + ExposuresTimeSeries: + title: ExposuresTimeSeries + type: object + properties: + date: + type: string + format: date + assets: + type: integer + technologies: + type: integer + hosts: + type: integer + ScanExposuresTimeSeries: + title: ScanExposuresTimeSeries + type: object + required: + - date + - open_vulnerability + - fixed_vulnerability + - new_vulnerability + properties: + date: + type: string + format: date + open_vulnerability: + $ref: "#/components/schemas/VulnMetricSeverityBreakdown" + fixed_vulnerability: + $ref: "#/components/schemas/VulnMetricSeverityBreakdown" + new_vulnerability: + $ref: "#/components/schemas/VulnMetricSeverityBreakdown" + ScanRegressionRemediationTimeSeries: + title: ScanRegressionRemediationTimeSeries + type: object + required: + - date + - data + properties: + date: + type: string + format: date + avg_remediation_time: + type: string + data: + $ref: "#/components/schemas/VulnMetricSeverityBreakdown" + ContributorSummary: + title: ContributorSummary + type: object + properties: + category_breakdown: + type: object + properties: + cloud: + type: integer + cve: + type: integer + dast: + type: integer + kev: + type: integer + other: + type: integer + contributor: + type: string + score: + type: integer + socials: + type: object + total_templates: + type: integer + StatBuckets: + title: StatBuckets + type: object + properties: + buckets: + type: object + additionalProperties: + type: integer + missing: + type: integer + other: + type: integer + total: + type: integer + VulnerabilityHistoryDetail: + type: object + additionalProperties: + $ref: "#/components/schemas/VulnerabilityHistory" + VulnerabilityHistory: + type: object + properties: + history_count: + type: integer + format: int64 + description: The total number of revisions for the vulnerability. + history: + type: array + items: + type: object + properties: + severity: + type: string + target: + type: string + template_id: + type: string + matched: + type: boolean + timestamp: + type: string + format: date-time + vuln_hash: + type: string + event: + type: string + description: A list of events associated with the vulnerability. + required: + - history_count + - history + AssetFilters: + title: AssetFilters + type: object + additionalProperties: false + properties: + is_tech: + type: boolean + description: Return records that have technologies + is_favicon: + type: boolean + description: Return the records that have favicon + is_new: + type: boolean + description: Filter by new content + labels: + type: string + description: Filter by comma separated labels, e.g-> labels=p1,p2 + host: + type: string + description: Filter by comma separated hosts, e.g-> host=p1,p2 + port: + type: string + description: Filter by comma separated ports, e.g-> port=p1,p2 + status_code: + type: string + description: Filter by comma separated status codes, e.g-> status_code=p1,p2 + content_length: + type: string + description: Filter by comma separated content lengths, e.g-> content_length=p1,p2 + title: + type: string + description: Filter by comma separated titles, e.g-> title=p1,p2 + domain: + type: array + description: Filter by comma separated domain names, e.g-> domain=domain1.com,domain2.com + items: + type: string + cname: + type: string + description: Filter by comma separated cnames, e.g-> cname=p1,p2 + technologies: + type: string + description: Filter by comma separated technologies, e.g-> technologies=p1,p2 + ip: + type: string + description: Filter by comma separated ips, e.g-> ip=p1,p2 + is_screenshot: + type: boolean + description: Return the records with screenshots + time: + $ref: "#/components/schemas/TimeRangeQueryParameter" + description: Filter by time range + start_date: + type: string + format: date + description: Filter by start date + end_date: + type: string + format: date + description: Filter by end date + custom_filter: + type: string + description: Filter by custom filter. Double encode the query string. + search: + type: string + description: Search on the content name + enumeration_id: + type: string + description: Filter by enumeration id + only_dns: + type: boolean + description: Query only dns FQDN records + only_ip: + type: boolean + description: Query only dns IP records + BillingCycle: + title: BillingCycle + type: object + required: + - id + - start_date + - end_date + - unique_asset_count + properties: + id: + type: integer + start_date: + type: string + format: date-time + end_date: + type: string + format: date-time + unique_asset_count: + type: integer + VulnMetricSeverityBreakdown: + title: VulnMetricSeverityBreakdown + type: object + required: + - total_count + - severity_breakdown + - total_fixed + properties: + total_fixed: + type: integer + total_count: + type: integer + severity_breakdown: + $ref: "#/components/schemas/SeverityBreakdown" + status_breakdown: + $ref: "#/components/schemas/StatusBreakdown" + SeverityBreakdown: + title: SeverityBreakdown + type: object + properties: + critical: + type: integer + high: + type: integer + medium: + type: integer + low: + type: integer + info: + type: integer + unknown: + type: integer + StatusBreakdown: + title: StatusBreakdown + type: object + properties: + open: + type: integer + fixed: + type: integer + false_positive: + type: integer + duplicate: + type: integer + fix_in_progress: + type: integer + accepted_risk: + type: integer + triaged: + type: integer + RemediationEfficiencyData: + title: RemediationEfficiencyData + type: object + required: + - vulnerability_severity + - average_time_to_remediate + - target_time_to_remediate + - remediation_trend + - timely_remediated_count + - total_vulnerabilities + properties: + vulnerability_severity: + type: string + average_time_to_remediate: + type: integer + target_time_to_remediate: + type: integer + remediation_trend: + type: integer + timely_remediated_count: + type: integer + total_vulnerabilities: + type: integer + OrganizationInfo: + title: OrganizationInfo + description: Organization Information + properties: + acquirer_slug: + description: Slug of acquiring organization if applicable + type: string + contact_email: + description: Contact email address + type: string + domain: + description: Primary domain of the organization + type: string + image_url: + description: URL to organization's image + type: string + industries: + description: Industries of the organization + items: + type: string + type: array + legal_name: + description: Legal name of the organization + type: string + linkedin: + description: LinkedIn profile URL + type: string + name: + description: The organization name + type: string + num_employees_enum: + description: Employee count range category + type: string + org_status: + description: Status of the organization + type: string + short_description: + description: Brief description of the organization + type: string + slug: + description: URL-friendly identifier + type: string + subsidary_domains: + description: List of subsidiary domains + items: + type: string + type: array + total_subdomains: + description: Total number of subdomains + type: integer + total_subsidaries: + description: Total number of subsidiaries + type: integer + total_subsidary_domains: + description: Total number of subsidiary domains + type: integer + total_subsidary_subdomains: + description: Total number of subdomains across all subsidiary domains + type: integer + twitter: + description: Twitter profile URL + type: string + type: object + OrganizationFullInfo: + allOf: + - $ref: "#/components/schemas/OrganizationInfo" + - properties: + aliases: + description: List of organization aliases + items: + type: string + type: array + category_groups: + description: Macro level category groups (e.g. AI instead of generative_ai) + items: + type: string + type: array + created_at: + description: Timestamp when the organization record was created + format: date-time + type: string + description: + description: Full description of the organization + type: string + founded_on.value: + description: Organization founding date (YYYY-MM-DD) + type: string + rank: + description: Organization's rank + type: integer + subsidaries: + description: List of all subsidiary organizations + items: + $ref: "#/components/schemas/OrganizationInfo" + type: array + updated_at: + description: Timestamp when the organization record was last updated + format: date-time + type: string + type: object + RootDomainInfo: + title: RootDomainInfo + additionalProperties: false + description: Root Domain Information + properties: + domain: + description: The root domain name + type: string + image_url: + description: URL to domain's image + type: string + name: + description: The domain name + type: string + organization_slug: + description: Slug identifier of the associated organization + type: string + total_subdomains: + description: The total number of subdomains + type: integer + type: object + DomainSearchItem: + title: DomainSearchItem + type: object + required: + - name + - type + - search_score + properties: + domain: + $ref: "#/components/schemas/RootDomainInfo" + name: + description: The display name for autocomplete + type: string + organization: + $ref: "#/components/schemas/OrganizationInfo" + search_score: + description: The search score of the result + type: number + type: + description: Indicates whether this is an organization or domain result + enum: + - organization + - domain + type: string + OpenVulnerabilityScoreMetrics: + title: OpenVulnerabilityScoreMetrics + type: object + properties: + severity_breakdown: + $ref: "#/components/schemas/SeverityBreakdown" + total_cve: + type: integer + total_kev: + type: integer + VulnScoreMetricsTimeSeries: + title: VulnScoreMetricsTimeSeries + type: object + properties: + date: + type: string + format: date + security_score: + type: number + format: double + open_vulnerability: + $ref: "#/components/schemas/OpenVulnerabilityScoreMetrics" + total_scanned_assets: + type: integer + total_affected_assets: + type: integer + description: "" + SharedTemplateMetaData: + title: SharedTemplateMetaData + type: object + properties: + expires_at: + type: string + format: date-time + organizations: + type: array + items: + type: string + share_type: + type: string + template_id: + type: string + users_email: + type: array + items: + type: string + UploadTemplate: + title: UploadTemplate + type: object + properties: + ai_meta: + $ref: "#/components/schemas/AIMeta" + dir: + type: string + filename: + type: string + template: + type: string + TemplateFileMetadata: + title: TemplateFileMetadata + type: object + required: + - dir + - filename + - template_id + - uri + properties: + dir: + type: string + description: | + Directory of the template + filename: + type: string + description: | + Name of the template + template_id: + type: string + description: Template ID + uri: + type: string + description: URI of the template + description: Template File Metadata + FailedTemplateFileMetadataUpdate: + title: FailedTemplateFileMetadataUpdate + type: object + required: + - dir + - filename + - template_id + - error + properties: + dir: + type: string + description: Directory of the template + filename: + type: string + description: Name of the template + template_id: + type: string + description: Template ID + error: + type: string + description: Error message + PatchTemplateFileMetadata: + title: PatchTemplateFileMetadata + type: object + required: + - dir + - filename + - template_id + properties: + dir: + type: string + filename: + type: string + template_id: + type: string + CustomSeverityMapping: + title: CustomSeverityMapping + type: object + required: + - id + - template_id + - original_severity + - custom_severity + - created_at + - updated_at + properties: + id: + type: integer + format: int64 + template_id: + type: string + original_severity: + type: string + custom_severity: + type: string + vuln_id: + type: string + created_at: + type: string + format: date-time + updated_at: + type: string + format: date-time + DevicesCount: + title: DevicesCount + type: object + properties: + devices: + type: number + CustomersCount: + title: CustomersCount + type: object + properties: + customers: + type: number + EmployeesCount: + title: EmployeesCount + type: object + properties: + employees: + type: number + UsersCount: + title: UsersCount + type: object + properties: + user: + type: number + CombolistExposureCount: + title: CombolistExposureCount + type: object + properties: + combolist_exposure: + type: number + LeakCountryStats: + title: LeakCountryStats + type: object + properties: + Country: + type: string + CredentialsCount: + type: number + UsedUrlsCount: + title: UsedUrlsCount + type: object + properties: + Occurrences: + type: number + url: + type: string + LeaksTimeline: + title: LeaksTimeline + type: object + properties: + CredentialsCount: + type: number + Month: + type: number + Year: + type: number + LeaksUsersSampleData: + title: LeaksUsersSampleData + type: object + properties: + password: + type: string + username: + type: string + url: + type: string + country: + type: string + log_date: + type: string + LeaksEntity: + title: LeaksEntity + type: object + properties: + id: + type: string + url: + type: string + username: + type: string + password: + type: string + device_ip: + type: string + host_username: + type: string + os: + type: string + malware_path: + type: string + country: + type: string + log_date: + type: string + hardware_id: + type: string + hostname: + type: string + status: + $ref: "#/components/schemas/LeaksEntityStatus" + EnumerationHistoryDataResponse: + title: EnumerationHistoryDataResponse + type: object + required: + - enum_id + - name + - enum_type + - enum_started_at + - enum_finished_at + - enumeration_time + - status + - new_assets_discovered + - total_targets_processed + properties: + enum_id: + type: string + name: + type: string + enum_type: + type: string + enum_started_at: + type: string + format: date-time + enum_finished_at: + type: string + format: date-time + enumeration_time: + type: string + format: duration + status: + type: string + new_assets_discovered: + type: integer + total_targets_processed: + type: integer + error_details: + type: string + Facets: + title: Facets + type: object + properties: + buckets: + type: object + additionalProperties: + type: integer + missing: + type: integer + others: + type: integer + total: + type: integer + Vulnerability: + title: Vulnerability + allOf: + - $ref: "#/components/schemas/VulnerabilityInfo" + - $ref: "#/components/schemas/NucleiTemplate" + - type: object + properties: + affected_products: + type: array + items: + $ref: "#/components/schemas/ProductInfo" + created_at: + type: string + format: date-time + doc_id: + type: string + doc_type: + type: string + exposure: + $ref: "#/components/schemas/VulnExposure" + h1: + $ref: "#/components/schemas/H1Stats" + updated_at: + type: string + format: date-time + ntps: + type: integer + VulnerabilityInfo: + additionalProperties: false + allOf: + - $ref: "#/components/schemas/CVEInfo" + - properties: + citations: + description: Citations for the vulnerability/template + items: + $ref: "#/components/schemas/Citation" + type: array + cwe: + description: CWE IDs associated with the vulnerability + items: + type: string + type: array + description: + description: Description of the vulnerability/template + type: string + impact: + description: Impact of the vulnerability/template + type: string + name: + description: Name of the vulnerability/template + type: string + product: + description: Product associated with the vulnerability/template + type: string + remediation: + description: Remediation for the vulnerability/template + type: string + severity: + description: Severity of the vulnerability/template + type: string + vendor: + description: Vendor associated with the vulnerability/template + type: string + weaknesses: + description: Weaknesses associated with the vulnerability + items: + $ref: "#/components/schemas/Weakness" + type: array + type: object + type: object + title: "" + CVEInfo: + additionalProperties: false + properties: + age_in_days: + description: Age in days for the cve + type: integer + assignee: + description: Assignee for the cve + type: string + cve_created_at: + description: Created at date for the cve + format: date-time + type: string + cve_id: + description: CVE ID for the cve + type: string + cve_updated_at: + description: Updated at date for the cve + format: date-time + type: string + cvss_metrics: + description: CVSS Metrics for the cve + example: 3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H + type: string + cvss_score: + description: CVSS Score for the cve + example: 9.8 + format: double + type: number + epss_percentile: + description: EPSS Percentile for the template. + example: 0.42509 + format: double + type: number + epss_score: + description: EPSS Score for the template. + example: 0.42509 + format: double + type: number + is_kev: + description: True if the cve is a kev + type: boolean + is_vkev: + description: True if the cve is a vkev + type: boolean + is_oss: + description: True if the cve is an oss cve + type: boolean + is_patch_available: + description: True if the cve has a patch available + type: boolean + is_poc: + description: True if the cve has a poc + type: boolean + is_remote: + description: True if the cve is a remote cve + type: boolean + is_template: + description: True if the cve has a template + type: boolean + kev: + description: KEV info for the cve + items: + $ref: "#/components/schemas/KevInfo" + type: array + poc_count: + description: Count of pocs for the vulnerability + type: integer + pocs: + description: Contains all known proof of concepts for the vulnerability + items: + $ref: "#/components/schemas/POC" + type: array + vuln_status: + description: Status of the cve + type: string + type: object + KevInfo: + title: KevInfo + type: object + properties: + added_date: + type: string + format: date-time + due_date: + type: string + format: date-time + known_ransomware_campaign_use: + type: boolean + source: + type: string + POC: + title: POC + type: object + properties: + added_at: + type: string + format: date-time + source: + type: string + url: + type: string + Citation: + title: Citation + type: object + properties: + source: + type: string + description: Source for the citation + tags: + type: array + description: Tags for the citation + items: + type: string + url: + type: string + description: Url for the citation + Weakness: + title: Weakness + type: object + properties: + cwe_id: + type: string + description: CWE ID for the weakness + cwe_name: + type: string + description: CWE Name for the weakness + NucleiTemplate: + title: NucleiTemplate + allOf: + - $ref: "#/components/schemas/TemplateSourceMeta" + - $ref: "#/components/schemas/TemplateStatus" + - $ref: "#/components/schemas/TemplateFileMeta" + - $ref: "#/components/schemas/TemplateContent" + - $ref: "#/components/schemas/TemplateSharingMetadata" + - type: object + properties: + ai_meta: + $ref: "#/components/schemas/AIMeta" + classification: + $ref: "#/components/schemas/Classification" + id: + type: string + TemplateSharingMetadata: + properties: + organizations: + description: Organizations of the template + items: + type: string + type: array + origin_template_id: + description: Origin template ID of the template + type: string + share_type: + description: Share type of the template + type: string + ttl: + description: TTL of the template + type: string + ttl_from: + description: TTL from of the template + type: string + users: + description: Users of the template + items: + type: integer + type: array + type: object + TemplateSourceMeta: + properties: + category: + description: Category of the template + type: string + integration_id: + description: Integration ID of the template + type: string + integration_type: + description: Integration type of the template + type: string + pull_request: + description: Pull request of the template + type: string + ref: + description: Reference of the template + type: string + release_tag: + description: Release tag of the template + type: string + score: + description: Score of the template + type: integer + template_type: + description: Type of the template + type: string + type: object + TemplateStatus: + properties: + is_draft: + description: Is the template a draft + type: boolean + is_early: + description: Is the template in early access + type: boolean + is_github: + description: Is the template from github + type: boolean + is_new: + description: Is the template new + type: boolean + is_pdresearch: + description: Is the template from pdresearch + type: boolean + is_pdteam: + description: Is the template from pdteam + type: boolean + is_pdtemplate: + description: Is the template from pdtemplate + type: boolean + type: object + TemplateFileMeta: + title: TemplateFileMeta + type: object + properties: + directory: + type: string + description: Directory of template + filename: + type: string + description: | + Filename of template + uri: + type: string + description: Uri of template + TemplateContent: + title: TemplateContent + type: object + properties: + author: + type: array + description: Authors of the template + items: + type: string + digest: + type: string + description: Digest of the template + metadata: + type: object + description: MetaData of the template + raw: + type: string + description: Raw string of the template + tags: + type: array + description: Tags of the template + items: + type: string + type: + type: string + description: Type of the template + ProductInfo: + title: ProductInfo + type: object + properties: + cpe: + type: array + items: + type: string + product: + type: string + project_repos: + type: object + projects: + type: array + items: + type: string + vendor: + type: string + product_category: + type: string + product_type: + type: string + industry: + type: string + tech_domain: + type: string + is_pd: + type: boolean + SearchEngineStats: + title: SearchEngineStats + type: object + properties: + max_hosts: + type: integer + description: Maximum number of hosts for the product + min_hosts: + type: integer + description: Minimum number of hosts for the product + queries: + type: array + description: Queries for the product + items: + type: string + ExposureStats: + title: ExposureStats + type: object + properties: + fofa: + $ref: "#/components/schemas/SearchEngineStats" + id: + type: string + max_hosts: + type: integer + min_hosts: + type: integer + shodan: + $ref: "#/components/schemas/SearchEngineStats" + VulnExposure: + title: VulnExposure + type: object + properties: + max_hosts: + type: integer + min_hosts: + type: integer + values: + type: array + items: + $ref: "#/components/schemas/ExposureStats" + H1Stats: + title: H1Stats + type: object + properties: + delta_rank: + type: integer + delta_reports: + type: integer + rank: + type: integer + reports: + type: integer + StatisticsResponse: + title: StatisticsResponse + type: object + properties: + status_code_stats: + type: object + additionalProperties: + type: integer + error_stats: + type: object + additionalProperties: + type: integer + waf_stats: + type: object + additionalProperties: + type: integer + LeaksEntityStatus: + title: LeaksEntityStatus + enum: + - fixed + - unfixed + - NA + securitySchemes: + X-API-Key: + name: X-API-Key + type: apiKey + in: header + responses: + GetTemplateDataResponse: + description: Example response + content: + application/json: + schema: + type: object + required: + - message + properties: + message: + type: string + data: + $ref: "#/components/schemas/TemplateData" + GetTemplateResponse: + description: Example response + content: + application/json: + schema: + type: object + required: + - message + properties: + message: + type: string + template: + $ref: "#/components/schemas/TemplateData" + application/xml: + schema: + type: object + properties: {} + examples: {} + CreateTemplateResponse: + description: Example response + content: + application/json: + schema: + type: object + required: + - message + - template_id + - template_name + properties: + message: + type: string + template_id: + type: string + template_name: + type: string + template: + $ref: "#/components/schemas/TemplateData" + UpdateTemplateResponse: + description: Example response + content: + application/json: + schema: + type: object + required: + - message + - template_id + - template_name + properties: + message: + type: string + status: + type: boolean + template_id: + type: string + template_name: + type: string + template: + $ref: "#/components/schemas/TemplateData" + GenerateTemplateResponse: + description: Example response + content: + application/json: + schema: + type: object + required: + - message + properties: + template_id: + type: string + message: + type: string + completion: + type: string + name: + type: string + canRun: + type: boolean + comment: + type: string + is_valid: + type: boolean + retry_count: + type: integer + feedback: + type: string + targets: + type: array + items: + type: string + retest: + type: array + items: + type: object + properties: + target: + type: string + matched: + type: boolean + vuln_id: + type: string + ShareTemplateResponse: + description: Example response + content: + application/json: + schema: + type: object + required: + - message + - result + properties: + message: + type: string + result: + $ref: "#/components/schemas/SharedTemplateMetaData" + GetSharedTemplateResponse: + description: Example response + content: + application/json: + schema: + type: object + required: + - message + - result + properties: + message: + type: string + result: + $ref: "#/components/schemas/SharedTemplateData" + GetUserProfileResponse: + description: Example response + content: + application/json: + schema: + type: object + required: + - message + properties: + ai_status: + type: boolean + email: + type: string + name: + type: string + message: + type: string + cloud_scans: + type: boolean + static_scan: + type: boolean + early_template: + type: boolean + team_name: + type: string + is_team_owner: + type: boolean + is_read_only: + type: boolean + team_owner_name: + type: string + trial_status: + type: string + role: + type: string + plan: + type: string + personal_account_plan: + type: string + applied_promo_code: + type: string + full_port_scan: + type: boolean + workspaces: + type: array + items: + $ref: "#/components/schemas/UserWorkspaces" + DeleteTemplateResponse: + description: Example response + content: + application/json: + schema: + type: object + properties: + message: + type: string + status: + type: boolean + required: + - message + GetPublicTemplateList: + description: Example response + content: + application/json: + schema: + type: object + required: + - message + - count + - total + - results + properties: + message: + type: string + count: + type: integer + total: + type: integer + results: + type: array + items: + $ref: "#/components/schemas/TemplateData" + GetRetestResultsResponse: + description: Example response + content: + application/json: + schema: + type: object + properties: + message: + type: string + results: + type: array + items: + $ref: "#/components/schemas/VulnerabilityResults" + required: + - message + - results + application/xml: + schema: + type: object + properties: {} + GetSingleRetestResultResponse: + description: Example response + content: + application/json: + schema: + type: object + properties: + message: + type: string + results: + $ref: "#/components/schemas/VulnerabilityResults" + required: + - message + - results + GetScansStatusResponse: + description: Example response + content: + application/json: + schema: + type: object + properties: + current_page: + type: integer + result_count: + type: integer + total_results: + type: integer + total_pages: + type: integer + message: + type: string + data: + type: array + items: + $ref: "#/components/schemas/ScanStatusItem" + required: + - message + - current_page + - result_count + - total_results + - total_pages + - data + TriggerUserScanResponse: + description: Example response + content: + application/json: + schema: + type: object + required: + - message + properties: + id: + type: string + message: + type: string + truncated-scan-targets: + type: integer + application/xml: + schema: + type: object + properties: + message: + type: string + id: + type: string + multipart/form-data: + schema: + type: object + properties: + message: + type: string + id: + type: string + required: + - message + text/html: + schema: + type: object + properties: + message: + type: string + id: + type: string + required: + - message + GetScanDetailsResponse: + description: Example response + content: + application/json: + schema: + $ref: "#/components/schemas/ScanStatusItem" + DeleteScansResponse: + description: Example response + content: + application/json: + schema: + type: object + properties: + message: + type: string + ok: + type: boolean + required: + - message + GetScanResultsResponse: + description: Example response content: application/json: schema: type: object + required: + - current_page + - result_count + - total_results + - total_pages + - message + - data properties: - template: - type: string - template_id: - type: string - prompt: + current_page: + type: integer + result_count: + type: integer + total_results: + type: integer + total_pages: + type: integer + message: type: string + data: + type: array + items: + $ref: "#/components/schemas/VulnerabilityResults" + stats: + type: object + properties: + total: + type: integer + filters: + type: object + GetVulnChangelogsResponse: + description: Example response + content: + application/json: + schema: + type: object required: - - template - - template_id - CreateTemplateRequest: + - data + properties: + data: + type: array + items: + $ref: "#/components/schemas/VulnerabilityChangelogs" + PostRetestTemplateResponse: + description: Example response content: application/json: schema: type: object properties: - template: + message: type: string - GenerateTemplateRequest: + results: + $ref: "#/components/schemas/VulnerabilityResults" + required: + - message + GetScansVulnIdResponse: + description: /scans/vuln/:vuln_id + content: + application/json: + schema: + $ref: "#/components/schemas/VulnerabilityResultsOld" + ImportScanResponse: + description: "" content: application/json: schema: type: object + description: Scan is a single scan object properties: - prompt: + id: + type: string + message: type: string required: - - prompt - RetestTemplateRequest: + - id + - message + GetAssetsListResponse: + description: Example response content: application/json: schema: type: object properties: - template_encoded: + message: type: string - target: + data: + type: array + items: + $ref: "#/components/schemas/AssetListItem" + required: + - message + - data + UploadAssetResponse: + description: Example response + content: + application/json: + schema: + type: object + properties: + message: type: string - template_path: + upload_status: type: string - template_url: + asset_id: type: string - template_id: + uploaded_at: type: string - vuln_id: + name: type: string - ShareTemplateRequest: + required: + - message + GetUserAssetResponse: + description: Example response content: application/json: schema: type: object properties: - template_id: + message: + type: string + asset_count: + type: integer + asset_id: + type: string + uploaded_at: + type: string + name: type: string - is_public: - type: boolean required: - - template_id - - is_public - TriggerUserScanRequest: + - message + DeleteAssetResponse: + description: Example response content: application/json: schema: type: object properties: - targets: - type: array - items: - type: string - templates: - type: array - items: - type: string - assets: - type: array - items: - type: string - private_templates: - type: array - items: - $ref: '#/components/schemas/PrivateTemplates' - name: - type: string - recommended: - type: boolean - all: - type: boolean - alerting_config_ids: - type: array - items: - type: string - scan_config_ids: - type: array - items: - type: string - reporting_config_ids: - type: array - items: - type: string - early_templates: - type: array - items: - type: string - exclude_targets: - type: array - items: - type: string - enumeration_ids: - type: array - items: - $ref: '#/components/schemas/EnumerationIds' - schedule_only: - type: boolean - disable_global_alert_config: - type: boolean - disable_global_report_config: - type: boolean - disable_global_scan_config: - type: boolean - socks5_proxy: + message: type: string - SetScanScheduleRequest: + required: + - message + GetUserAPIKeyResponse: + description: Example response content: application/json: schema: type: object properties: - scan_id: + message: type: string - scan_frequency: - $ref: '#/components/schemas/SchedulerFrequency' - start_time: + api_key: type: string - format: time - hourly_frequency: - type: integer - maximum: 24 - minimum: 1 - custom_weekdays: - description: |- - 0-6 denoting Sunday-Saturday. - It accepts an array of weekday - type: array - items: - type: integer - minimum: 0 - maximum: 6 required: - - scan_id - - scan_frequency - SetEnumerationScheduleRequest: + - message + - api_key + DeleteUserAPIKeyResponse: + description: Example response content: application/json: schema: type: object properties: - enumeration_id: - type: string - scan_frequency: - $ref: '#/components/schemas/SchedulerFrequency' - start_time: + message: type: string - format: time - hourly_frequency: - type: integer - maximum: 24 - minimum: 1 - custom_weekdays: - description: |- - 0-6 denoting Sunday-Saturday. - It accepts an array of weekday - type: array - items: - type: integer - minimum: 0 - maximum: 6 required: - - enumeration_id - - scan_frequency - UpdateAssetRequest: + - message + GetScanResultsFiltersResponse: + description: Example response content: application/json: schema: type: object + required: + - message + - current_page + - result_count + - total_results + - total_pages + - data + - new_matched properties: - name: + message: type: string - required: - - name - UpdateScanRequest: + current_page: + type: integer + result_count: + type: integer + total_results: + type: integer + total_pages: + type: integer + data: + type: array + items: + $ref: "#/components/schemas/FiltersItem" + new_matched: + type: integer + GetScanResultStatsResponse: + description: Example response content: application/json: schema: type: object properties: - name: + message: type: string + stats: + $ref: "#/components/schemas/ScanStats" required: - - name - PostFeedbackRequest: + - message + SetScanScheduleResponse: + description: Example response content: application/json: schema: type: object properties: - feedback_text: + message: type: string required: - - feedback_text - PatchUserProfile: + - message + GetScanScheduleResponse: + description: Example response content: application/json: schema: type: object properties: - email: + message: type: string - ai_status: - type: boolean - scan_status: - type: boolean - static_scan: - type: boolean - early_template: - type: boolean - max_team: - type: integer - read_only: - type: boolean - audit_log: - type: boolean + schedules: + type: array + items: + $ref: "#/components/schemas/ScanSchedule" required: - - email - CreateTeamRequest: + - message + - schedules + PatchAssetContentResponse: + description: Example response content: application/json: schema: type: object properties: - name: + message: + type: string + update_status: type: string required: - - name - AddTeamMemberRequest: + - message + GetUserTemplateListResponse: + description: Example response content: application/json: schema: type: object + required: + - results properties: - email: + message: type: string - required: - - email - DeleteTeamMemberRequest: + count: + type: integer + total: + type: integer + results: + type: array + items: + $ref: "#/components/schemas/TemplateData" + GetShareStatusResponse: + description: Example response content: application/json: schema: type: object + required: + - message properties: - email: + count: + type: integer + message: type: string - required: - - email - InviteTeamMemberRequest: + total: + type: integer + results: + type: array + items: + $ref: "#/components/schemas/SharedTemplateData" + DeleteScanScheduleResponse: + description: Example response content: application/json: schema: type: object properties: - invite_code: + message: type: string required: - - invite_code - PatchTeamMemberRequest: + - message + PostApiKeyRotateResponse: + description: Example response content: application/json: schema: type: object properties: - email: + message: type: string - role: + api_key: type: string required: - - email - AdminAddTeamMemberRequest: + - message + - api_key + GetUserSetupStatsResponse: + description: Example response content: application/json: schema: type: object properties: - owner_email: - type: string - member_email: + message: type: string + onboarding_steps: + type: object + properties: + vulnerability_scan: + type: boolean + asset_discovery: + type: boolean + alerting_integration: + type: boolean + reporting_integration: + type: boolean + cloud_integration: + type: boolean + subfinder_integration: + type: boolean + vulnerability_upload: + type: boolean + realtime_autoscan: + type: boolean + team_member_invitation: + type: boolean required: - - owner_email - - member_email - PatchScanVulnsRequest: + - message + - onboarding_steps + GetBillingAssetsResponse: + description: Example response content: application/json: schema: type: object properties: - vuln_ids: - type: array - items: - type: string - vuln_status: - $ref: '#/components/schemas/VulnStatusEnum' - type: - type: string - scan_id: - type: string - severity: - type: array - items: - type: string - host: - type: array - items: - type: string - template: + total_asset: + type: integer + total_unique_asset: + type: integer + total_billing_asset: + type: integer + total_unique_billing_asset: + type: integer + total_asset_group: + type: integer + asset_groups: type: array items: - type: string - search: - type: string - required: - - vuln_status - PatchScanVulnsLabelsRequest: + type: object + properties: + name: + type: string + total_unique_asset: + type: integer + total_asset: + type: integer + total_billing_asset: + type: integer + total_unique_billing_asset: + type: integer + GetPromocodeDetailsResponse: + description: Example response content: application/json: schema: type: object + required: + - message + - promo_code + - allowed_plan + - valid_for_days + - base_domain_count + - scan_tokens properties: - ids: - type: array - items: - type: string - type: + message: type: string - labels: + promo_code: + type: string + allowed_plan: type: array items: type: string - required: - - ids - VerifyConfigRequest: + valid_for_days: + type: integer + base_domain_count: + type: integer + scan_tokens: + type: integer + MessageResponse: + description: Example response content: application/json: schema: type: object + required: + - message properties: - config: - type: string - config_type: + message: type: string - required: - - config - VerifyConfigContentsRequest: + PatchUserProfileResponse: + description: Example response content: application/json: schema: type: object properties: - config: - type: string - config_type: + message: type: string + ai_status: + type: boolean + scan_status: + type: boolean + static_scan: + type: boolean + early_template: + type: boolean required: - - config - DeleteVulnsRequest: + - message + PostCreateUserResponse: + description: Example response content: application/json: schema: type: object properties: - ids: - type: array - items: - type: string - type: + message: type: string - vuln_status: - type: array - items: - type: string - scan_id: + ai_status: + type: boolean + scan_status: + type: boolean + static_scan: + type: boolean + early_template: + type: boolean + user_id: + type: integer + name: type: string - severity: - type: array - items: - type: string - host: - type: array - items: - type: string - template: - type: array - items: - type: string - search: + email: type: string - CreateContributeRequest: + role: + type: string + invite_url: + type: string + password: + type: string + required: + - message + PostRescanVulnResponse: + description: Example response content: application/json: schema: type: object properties: - email: - type: string - name: - type: string - template: + message: type: string - anonymous: - type: boolean + results: + $ref: "#/components/schemas/VulnerabilityResultsOld" required: - - template - - anonymous - ExcludeConfigRequest: + - message + GetEarlyTempateList: + description: Early Template Response content: application/json: schema: type: object + required: + - message properties: - values: + message: + type: string + total: + type: integer + count: + type: integer + results: type: array items: - type: string - required: - - values - DeleteExcludedConfigRequest: + $ref: "#/components/schemas/TemplateData" + UpdateTeamResponse: + description: Example response content: application/json: schema: type: object properties: - ids: - type: array - items: - type: integer - format: int64 + name: + type: string + message: + type: string required: - - ids - UpdateEnumeratedAssetRequest: + - message + GetTeamResponse: + description: Get the workspace details content: application/json: schema: type: object properties: - labels: + workspaces: type: array items: - type: string + $ref: "#/components/schemas/WorkspaceItem" + message: + type: string name: type: string - PatchTeamAdmin: + required: + - message + GetTeamMembersResponse: + description: Example response content: application/json: schema: type: object properties: - max_members: + message: + type: string + max_team_members: type: integer + members: + type: array + items: + $ref: "#/components/schemas/TeamMemberItem" required: - - max_members - UsageRequest: + - message + - members + - max_team_members + StaticScanIPsResponse: + description: "" content: application/json: schema: type: object - properties: - range: - $ref: '#/components/schemas/UsageRangeEnum' - startDate: - type: string - endDate: - type: string required: - - range - AdminSetUsageLimit: + - ips + properties: + ips: + type: array + items: + type: object + required: + - ip + properties: + ip: + type: string + GetEnumerateIdContents: + description: Example response content: application/json: schema: type: object + required: + - current_page + - result_count + - total_results + - total_pages + - message + - data properties: - email: + current_page: + type: integer + result_count: + type: integer + total_results: + type: integer + total_pages: + type: integer + message: type: string - format: email - chaos_allowed_requests: - type: number - cvemap_allowed_requests: - type: number - asnmap_allpwed_requests: - type: number - required: - - email - AdminUsageRequest: + data: + type: array + items: + $ref: "#/components/schemas/EnumerationContent" + GetEnumerateIdContentsResponse: + description: Example response content: application/json: schema: type: object + required: + - message + - data properties: - email: - type: string - format: email - range: - $ref: '#/components/schemas/UsageRangeEnum' - startDate: - type: string - endDate: + message: type: string - required: - - email - - range - responses: - GetTemplateResponse: + data: + $ref: "#/components/schemas/EnumerateData" + GetEnumerationScheduleResponse: description: Example response content: application/json: schema: type: object + required: + - message + - schedules properties: - prompt: - type: string message: type: string - template: - type: string - is_public: - type: boolean - required: - - message - application/xml: - schema: - type: object - CreateTemplateResponse: + schedules: + type: array + items: + $ref: "#/components/schemas/EnumerationSchedule" + VerifyConfigResponse: description: Example response content: application/json: schema: type: object + required: + - is_verified + - response properties: - message: - type: string - status: + is_verified: type: boolean - template_id: - type: string - template_name: + response: type: string - required: - - message - - template_id - - template_name - UpdateTemplateResponse: + VerifyConfigContentsResponse: description: Example response content: application/json: schema: type: object properties: - message: - type: string - status: - type: boolean - template_id: - type: string - template_name: - type: string - required: - - message - - template_id - - template_name - GenerateTemplateResponse: + jira: + type: array + items: + type: object + $ref: "#/components/schemas/JiraVerifyContentItem" + linear: + type: array + items: + type: object + $ref: "#/components/schemas/LinearVerifyContentItem" + ScanStatsResponse: description: Example response content: application/json: schema: type: object - properties: - template_id: - type: string - message: - type: string - completion: - type: string - name: - type: string required: - - message - ShareTemplateResponse: + - scan_stats + - scan_status + properties: + scan_stats: + type: object + required: + - total_scan + - total_unique_scan + - total_uploaded_scan + - total_scheduled_scan + properties: + total_scan: + type: integer + total_unique_scan: + type: integer + total_uploaded_scan: + type: integer + total_scheduled_scan: + type: integer + scan_status: + type: object + required: + - failed + - finished + - queued + - running + - starting + - stopped + - uploaded + properties: + failed: + type: integer + finished: + type: integer + queued: + type: integer + running: + type: integer + starting: + type: integer + stopped: + type: integer + uploaded: + type: integer + GetScansHistoryResponse: description: Example response content: application/json: schema: type: object + required: + - current_page + - result_count + - total_results + - total_pages + - message + - data properties: message: type: string - template_id: - type: string - status: - type: boolean + current_page: + type: integer + result_count: + type: integer + total_results: + type: integer + total_pages: + type: integer + data: + type: array + items: + $ref: "#/components/schemas/ScansHistoryItems" + total_completed_request: + type: integer + total_scan_run: + type: integer + total_unique_scan_run: + type: integer + EnumerateResponse: + description: Example response + content: + application/json: + schema: + type: object required: - - message - GetSharedTemplateResponse: + - current_page + - result_count + - total_results + - total_pages + - data + properties: + current_page: + type: integer + result_count: + type: integer + total_results: + type: integer + total_pages: + type: integer + data: + type: array + items: + $ref: "#/components/schemas/EnumerateData" + PostScanConfigResponse: description: Example response content: application/json: schema: type: object + required: + - message properties: - template: - type: string - template_name: + id: type: string message: type: string - required: - - message - GetUserProfileResponse: + ErrorResponse: description: Example response content: application/json: schema: type: object + required: + - message properties: - ai_status: - type: boolean - email: - type: string - name: - type: string message: type: string - cloud_scans: - type: boolean - static_scan: - type: boolean - early_template: - type: boolean - team_name: + kind: type: string - is_team_owner: - type: boolean - is_read_only: - type: boolean - team_owner_name: + code: type: string - trial_status: + error: type: string - role: + error_id: type: string - plan: + param: type: string - workspaces: - type: array - items: - $ref: '#/components/schemas/UserWorkspaces' - required: - - message - DeleteTemplateResponse: + status: + type: integer + VulnsTrackerExportResponse: description: Example response content: application/json: schema: type: object + required: + - ok + - vuln_id + - reporting_config_id + - reporting_config_name + - ticket_url + - ticket_id + - tracker_name properties: - message: - type: string - status: + ok: type: boolean - required: - - message - GetPublicTemplateList: + vuln_id: + type: string + reporting_config_id: + type: string + reporting_config_name: + type: string + ticket_url: + type: string + ticket_id: + type: string + tracker_name: + type: string + ExcludedTemplateResponse: description: Example response content: application/json: schema: type: object + required: + - data properties: - version: - type: string data: type: array items: - $ref: '#/components/schemas/PublicTemplateListItem' - required: - - version - - data - GetRetestResultsResponse: + $ref: "#/components/schemas/ExcludedTemplate" + GetScansTokenResponse: description: Example response content: application/json: schema: type: object + required: + - scan_tokens + - used_scan_token + - remaining_scan_token + - is_scannable + - start_date + - end_date + - subscription_type + - base_domain_count + - remaining_domain_count properties: - message: + scan_tokens: + type: integer + format: int64 + used_scan_token: + type: integer + format: int64 + remaining_scan_token: + type: integer + format: int64 + base_domain_count: + type: integer + format: int64 + remaining_domain_count: + type: integer + format: int64 + is_scannable: + type: boolean + start_date: type: string - results: + format: date-time + end_date: + type: string + format: date-time + expire_date: + type: string + format: date-time + verified_domain: type: array items: - $ref: '#/components/schemas/VulnerabilityResults' - required: - - message - - results - application/xml: - schema: - type: object - GetSingleRetestResultResponse: + type: string + old_plan: + type: string + old_plan_expired_at: + type: string + format: date-time + subscription_type: + enum: + - TRIAL + - ENT_TRIAL + - PRO + - ENT + - FREE + - VERIFIED_FREE + - GROWTH + AssetCountResponse: description: Example response content: application/json: schema: type: object + required: + - message + - asset_count properties: message: type: string - results: - $ref: '#/components/schemas/VulnerabilityResults' - required: - - message - - results - GetScansStatusResponse: + asset_count: + type: integer + GetAssetChangelogsResponse: description: Example response content: application/json: schema: type: object + required: + - message + - current_page + - result_count + - total_results + - total_pages + - data properties: + message: + type: string current_page: type: integer result_count: @@ -7324,1043 +9222,1125 @@ components: type: integer total_pages: type: integer - message: - type: string data: type: array items: - $ref: '#/components/schemas/ScanStatusItem' - required: - - message - - current_page - - result_count - - total_results - - total_pages - - data - TriggerUserScanResponse: + type: object + $ref: "#/components/schemas/AssetChangelogs" + GetAssetResponse: description: Example response content: application/json: schema: type: object + required: + - id + - enumeration_id + - name + - created_at + - updated_at properties: id: + type: integer + format: int64 + enumeration_id: type: string - message: + name: type: string - truncated-scan-targets: + created_at: + type: string + format: date-time + updated_at: + type: string + format: date-time + status_code: type: integer - required: - - message - application/xml: - schema: - type: object - properties: - message: + technologies: + type: array + items: + type: string + webserver: type: string - id: + request: type: string - multipart/form-data: - schema: - type: object - properties: - message: + response: type: string - id: + cname: + type: array + items: + type: string + labels: + type: array + items: + type: string + ip: type: string - required: - - message - text/html: - schema: - type: object - properties: - message: + content_length: + type: integer + title: type: string - id: + host: type: string - required: - - message - GetScanDetailsResponse: - description: Example response - content: - application/json: - schema: - $ref: '#/components/schemas/ScanStatusItem' - DeleteScansResponse: + port: + type: integer + technology_details: + type: string + format: json + is_new: + type: boolean + body: + type: string + EnumerationStatsResponse: description: Example response content: application/json: schema: type: object - properties: - message: - type: string - ok: - type: boolean required: - - message - GetScanResultsResponse: + - asset_stats + properties: + asset_stats: + $ref: "#/components/schemas/AssetStats" + enumeration_stats: + $ref: "#/components/schemas/EnumerationCounts" + PriceListResponse: description: Example response content: application/json: schema: type: object + required: + - list + - message properties: - current_page: - type: integer - result_count: - type: integer - total_results: - type: integer - total_pages: - type: integer - message: - type: string - data: + list: type: array items: - $ref: '#/components/schemas/VulnerabilityResults' - stats: - type: object - properties: - total: - type: integer - filters: - type: object - required: - - current_page - - result_count - - total_results - - total_pages - - message - - data - PostRetestTemplateResponse: + $ref: "#/components/schemas/PriceListItem" + message: + type: string + GetScanTokenErrorResponse: description: Example response content: application/json: schema: type: object + required: + - message + - subscription_type properties: message: type: string - results: - $ref: '#/components/schemas/VulnerabilityResults' - required: - - message - GetScansVulnIdResponse: - description: '/scans/vuln/:vuln_id' - content: - application/json: - schema: - $ref: '#/components/schemas/VulnerabilityResultsOld' - ImportScanResponse: - description: '' + subscription_type: + type: string + UsageResponse: + description: Example response content: application/json: schema: - description: Scan is a single scan object type: object + required: + - message properties: - id: - type: string message: type: string - required: - - id - - message - GetAssetsListResponse: + cvemap: + $ref: "#/components/schemas/ServiceUsageItem" + chaos: + $ref: "#/components/schemas/ServiceUsageItem" + asnmap: + $ref: "#/components/schemas/ServiceUsageItem" + GetEnumerateFiltersResponse: description: Example response content: application/json: schema: type: object + required: + - message + - current_page + - result_count + - total_results + - total_pages + - data properties: message: type: string + current_page: + type: integer + result_count: + type: integer + total_results: + type: integer + total_pages: + type: integer data: type: array items: - $ref: '#/components/schemas/AssetListItem' - required: - - message - - data - UploadAssetResponse: + $ref: "#/components/schemas/EnumerateFiltersItem" + GetUserTunnelResponse: description: Example response content: application/json: schema: type: object + required: + - message properties: message: type: string - upload_status: - type: string - asset_id: - type: string - uploaded_at: - type: string - name: - type: string - required: - - message - GetUserAssetResponse: + tunnels: + type: array + items: + $ref: "#/components/schemas/TunnelItem" + ExposureMetricsResponse: description: Example response content: application/json: schema: type: object properties: - message: - type: string - asset_count: + total_assets: type: integer - asset_id: - type: string - uploaded_at: - type: string - name: - type: string - required: - - message - DeleteAssetResponse: + new_assets: + type: integer + unique_technologies: + type: integer + new_technologies: + type: integer + total_hosts: + type: integer + new_hosts: + type: integer + time_series: + type: array + items: + $ref: "#/components/schemas/ExposuresTimeSeries" + ScanExposureMetricsResponse: description: Example response content: application/json: schema: type: object properties: - message: - type: string - required: - - message - GetUserAPIKeyResponse: + new_vulnerability: + type: integer + open_vulnerability: + type: integer + fixed_vulnerability: + type: integer + time_series: + type: array + items: + $ref: "#/components/schemas/ScanExposuresTimeSeries" + ScanRegressionRemediationMetricsResponse: description: Example response content: application/json: schema: type: object properties: - message: + regression_rate: + type: integer + avg_remediation_time: type: string - api_key: + regression_state: type: string - required: - - message - - api_key - DeleteUserAPIKeyResponse: + total_fixed: + type: integer + total_count: + type: integer + severity_breakdown: + $ref: "#/components/schemas/SeverityBreakdown" + status_breakdown: + $ref: "#/components/schemas/StatusBreakdown" + time_series: + type: array + items: + $ref: "#/components/schemas/ScanRegressionRemediationTimeSeries" + GetAutomationsListResponse: description: Example response content: application/json: schema: type: object + required: + - message + - automations properties: message: type: string - required: - - message - GetScanResultsFiltersResponse: + automations: + type: array + items: + $ref: "#/components/schemas/GetAutomationsListItem" + GetAutomationIdResponse: description: Example response content: application/json: schema: type: object - properties: - message: - type: string - current_page: - type: integer - result_count: - type: integer - total_results: - type: integer - total_pages: - type: integer - data: - type: array - items: - $ref: '#/components/schemas/FiltersItem' - new_matched: - type: integer required: - - message - - current_page - - result_count - - total_results - - total_pages - - data - - new_matched - GetScanResultStatsResponse: + - message + properties: + message: + type: string + automation: + $ref: "#/components/schemas/GetAutomationItem" + AdminAutomationsResponse: description: Example response content: application/json: schema: type: object + required: + - message + - automations properties: message: type: string - stats: - $ref: '#/components/schemas/ScanStats' - required: - - message - SetScanScheduleResponse: + automations: + type: array + items: + $ref: "#/components/schemas/AdminAutomationsItem" + BillingCycleResponse: description: Example response content: application/json: schema: type: object - properties: - message: - type: string required: - - message - GetScanScheduleResponse: + - cycles + properties: + cycles: + type: array + items: + $ref: "#/components/schemas/BillingCycle" + GetRemediationEfficiencyResponse: description: Example response content: application/json: schema: type: object + required: + - remediation_efficiency + - remediation_state + - data properties: - message: + remediation_efficiency: + type: integer + remediation_state: type: string - schedules: + data: type: array items: - $ref: '#/components/schemas/ScanSchedule' - required: - - message - - schedules - PatchAssetContentResponse: + $ref: "#/components/schemas/RemediationEfficiencyData" + VulnScoreMetricsResponse: description: Example response content: application/json: schema: type: object + required: + - security_score + - security_state + - open_vulnerability + - total_scanned_assets + - total_affected_assets + - time_series properties: - message: - type: string - update_status: + security_score: + type: number + format: double + security_state: type: string - required: - - message - GetUserTemplateListResponse: - description: Example response + open_vulnerability: + $ref: "#/components/schemas/OpenVulnerabilityScoreMetrics" + total_scanned_assets: + type: integer + total_affected_assets: + type: integer + time_series: + type: array + items: + $ref: "#/components/schemas/VulnScoreMetricsTimeSeries" + DomainSearchResults: + description: Domain Search Results content: application/json: schema: type: object + required: + - count + - results + - total properties: - data: + count: + type: integer + results: type: array items: - $ref: '#/components/schemas/templateListItem' - message: - type: string - required: - - data - - message - GetShareStatusResponse: - description: Example response + $ref: "#/components/schemas/DomainSearchItem" + total: + type: integer + OrganizationSearchResults: + description: Organization Search Results content: application/json: schema: type: object - properties: - is_public: - type: boolean - template_identifier: - type: string - message: - type: string required: - - message - DeleteScanScheduleResponse: + - count + - results + - total + properties: + count: + type: integer + results: + type: array + items: + $ref: "#/components/schemas/OrganizationFullInfo" + total: + type: integer + UpdateSharedTemplateResponse: description: Example response content: application/json: schema: type: object + required: + - message + - result properties: message: type: string - required: - - message - PostApiKeyRotateResponse: + result: + $ref: "#/components/schemas/SharedTemplateMetaData" + GetSeverityConfigResponse: description: Example response content: application/json: schema: type: object - properties: - message: - type: string - api_key: - type: string required: - - message - - api_key - MessageResponse: + - custom_severity_mappings + properties: + custom_severity_mappings: + type: array + items: + $ref: "#/components/schemas/CustomSeverityMapping" + PostSeverityConfigResponse: description: Example response content: application/json: schema: type: object + required: + - message + - id properties: + id: + type: integer + format: int64 message: type: string + parameters: + template_id: + name: template_id + in: query + schema: + type: string + description: short uuid of requested template + required: true + user_name: + name: user_name + in: query + required: true + schema: + type: string + description: user name of logged in user + requestBodies: + DeleteAssetsRequest: + content: + application/json: + schema: + type: object required: - - message - PatchUserProfileResponse: - description: Example response + - filters + properties: + filters: + $ref: "#/components/schemas/AssetFilters" + UpdateAssetLabelsRequest: content: application/json: schema: type: object + required: + - filters + - labels properties: - message: - type: string - ai_status: - type: boolean - scan_status: - type: boolean - static_scan: - type: boolean - early_template: - type: boolean + filters: + $ref: "#/components/schemas/AssetFilters" + labels: + type: array + items: + type: string + AssetIdLabelsRequest: + content: + application/json: + schema: + type: object required: - - message - PostCreateUserResponse: - description: Example response + - labels + properties: + labels: + type: array + items: + type: string + UpdateTemplateRequest: content: application/json: schema: type: object + required: + - template + - template_id properties: - message: + template: type: string - ai_status: - type: boolean - scan_status: - type: boolean - static_scan: - type: boolean - early_template: - type: boolean - user_id: - type: integer - name: + template_id: type: string - email: + prompt: type: string - role: + filename: type: string - required: - - message - PostRescanVulnResponse: - description: Example response + dir: + type: string + CreateTemplateRequest: content: application/json: schema: type: object properties: - message: + template: type: string - results: - $ref: '#/components/schemas/VulnerabilityResultsOld' - required: - - message - GetEarlyTempateList: - description: Early Template Response + GenerateTemplateRequest: content: application/json: schema: type: object + required: + - prompt properties: - version: + prompt: type: string - data: + retest: + type: boolean + disableAutoSave: + type: boolean + default: false + images: type: array items: - $ref: '#/components/schemas/EarlyTemplateListItem' - required: - - version - - data - UpdateTeamResponse: - description: Example response + type: string + RetestTemplateRequest: content: application/json: schema: type: object properties: - name: + template_encoded: type: string - message: + target: + type: string + template_path: + type: string + template_url: + type: string + template_id: + type: string + vuln_id: type: string + ShareTemplateRequest: + content: + application/json: + schema: + type: object required: - - message - GetTeamResponse: - description: Get the workspace details + - template_id + - share_type + properties: + template_id: + type: string + share_type: + enum: + - unlisted + - organization + - users + ttl: + type: string + organizations: + type: array + items: + type: string + emails: + type: array + items: + type: string + TriggerUserScanRequest: content: application/json: schema: type: object properties: - workspaces: + targets: type: array items: - $ref: '#/components/schemas/WorkspaceItem' - message: - type: string + type: string + templates: + type: array + items: + type: string + assets: + type: array + items: + type: string + private_templates: + type: array + items: + $ref: "#/components/schemas/PrivateTemplates" name: type: string - required: - - message - GetTeamMembersResponse: - description: Example response + recommended: + type: boolean + all: + type: boolean + alerting_config_ids: + type: array + items: + type: string + scan_config_ids: + type: array + items: + type: string + reporting_config_ids: + type: array + items: + type: string + early_templates: + type: array + items: + type: string + exclude_targets: + type: array + items: + type: string + enumeration_ids: + type: array + items: + $ref: "#/components/schemas/EnumerationIds" + schedule_only: + type: boolean + disable_global_alert_config: + type: boolean + disable_global_report_config: + type: boolean + disable_global_scan_config: + type: boolean + socks5_proxy: + type: string + automatic_scan: + type: boolean + scan_all_assets: + type: boolean + SetScanScheduleRequest: content: application/json: schema: type: object + required: + - scan_id + - scan_frequency properties: - message: + scan_id: type: string - max_team_members: + scan_frequency: + $ref: "#/components/schemas/SchedulerFrequency" + start_time: + type: string + format: time + hourly_frequency: type: integer - members: + minimum: 1 + maximum: 24 + custom_weekdays: type: array + description: |- + 0-6 denoting Sunday-Saturday. + It accepts an array of weekday items: - $ref: '#/components/schemas/TeamMemberItem' - required: - - message - - members - - max_team_members - StaticScanIPsResponse: - description: '' + type: integer + minimum: 0 + maximum: 6 + SetEnumerationScheduleRequest: content: application/json: schema: type: object + required: + - enumeration_id + - scan_frequency properties: - ips: + enumeration_id: + type: string + scan_frequency: + $ref: "#/components/schemas/SchedulerFrequency" + start_time: + type: string + format: time + hourly_frequency: + type: integer + minimum: 1 + maximum: 24 + custom_weekdays: type: array + description: |- + 0-6 denoting Sunday-Saturday. + It accepts an array of weekday items: - type: object - required: - - ip - properties: - ip: - type: string - required: - - ips - GetEnumerateIdContents: - description: Example response + type: integer + minimum: 0 + maximum: 6 + UpdateAssetRequest: content: application/json: schema: type: object properties: - current_page: - type: integer - result_count: - type: integer - total_results: - type: integer - total_pages: - type: integer - message: + name: type: string - data: - type: array - items: - $ref: '#/components/schemas/EnumerationContent' required: - - message - - current_page - - result_count - - total_results - - total_pages - - data - GetEnumerateIdContentsResponse: - description: Example response + - name + UpdateScanRequest: content: application/json: schema: type: object properties: - message: + name: type: string - data: - $ref: '#/components/schemas/EnumerateData' required: - - message - - data - GetEnumerationScheduleResponse: - description: Example response + - name + PostFeedbackRequest: content: application/json: schema: type: object properties: - message: + feedback_text: type: string - schedules: - type: array - items: - $ref: '#/components/schemas/EnumerationSchedule' required: - - message - - schedules - VerifyConfigResponse: - description: Example response + - feedback_text + PatchUserProfile: content: application/json: schema: type: object properties: - is_verified: + email: + type: string + ai_status: type: boolean - response: + scan_status: + type: boolean + static_scan: + type: boolean + early_template: + type: boolean + max_team: + type: integer + read_only: + type: boolean + audit_log: + type: boolean + cloud_region: type: string + full_port_scan: + type: boolean required: - - is_verified - - response - VerifyConfigContentsResponse: - description: Example response + - email + CreateTeamRequest: content: application/json: schema: type: object properties: - jira: - type: array - items: - type: object - $ref: '#/components/schemas/JiraVerifyContentItem' - ScanStatsResponse: - description: Example response + name: + type: string + required: + - name + AddTeamMemberRequest: content: application/json: schema: type: object properties: - scan_stats: - type: object - properties: - total_scan: - type: integer - total_unique_scan: - type: integer - total_uploaded_scan: - type: integer - total_scheduled_scan: - type: integer - required: - - total_scan - - total_unique_scan - - total_uploaded_scan - - total_scheduled_scan - scan_status: - type: object - properties: - failed: - type: integer - finished: - type: integer - queued: - type: integer - running: - type: integer - starting: - type: integer - stopped: - type: integer - uploaded: - type: integer - required: - - failed - - finished - - queued - - running - - starting - - stopped - - uploaded + email: + type: string required: - - scan_stats - - scan_status - GetScansHistoryResponse: - description: Example response + - email + DeleteTeamMemberRequest: content: application/json: schema: type: object properties: - message: + email: type: string - current_page: - type: integer - result_count: - type: integer - total_results: - type: integer - total_pages: - type: integer - data: - type: array - items: - $ref: '#/components/schemas/ScansHistoryItems' - total_completed_request: - type: integer - total_scan_run: - type: integer - total_unique_scan_run: - type: integer required: - - current_page - - result_count - - total_results - - total_pages - - message - - data - EnumerateResponse: - description: Example response + - email + InviteTeamMemberRequest: content: application/json: schema: type: object properties: - current_page: - type: integer - result_count: - type: integer - total_results: - type: integer - total_pages: - type: integer - data: - type: array - items: - $ref: '#/components/schemas/EnumerateData' + invite_code: + type: string required: - - current_page - - result_count - - total_results - - total_pages - - data - PostScanConfigResponse: - description: Example response + - invite_code + PatchTeamMemberRequest: content: application/json: schema: type: object properties: - id: + email: type: string - message: + role: type: string required: - - message - ErrorResponse: - description: Example response + - email + AdminAddTeamMemberRequest: content: application/json: schema: type: object properties: - message: - type: string - kind: - type: string - code: - type: string - error: - type: string - error_id: + owner_email: type: string - param: + member_email: type: string - status: - type: integer required: - - message - VulnsTrackerExportResponse: - description: Example response + - owner_email + - member_email + PatchScanVulnsRequest: content: application/json: schema: type: object + required: + - vuln_status properties: - ok: - type: boolean - vuln_id: - type: string - reporting_config_id: - type: string - reporting_config_name: - type: string - ticket_url: + vuln_ids: + type: array + items: + type: string + vuln_status: + $ref: "#/components/schemas/VulnStatusEnum" + type: type: string - ticket_id: + scan_id: type: string - tracker_name: + severity: + type: array + items: + type: string + host: + type: array + items: + type: string + template: + type: array + items: + type: string + search: type: string - required: - - ok - - vuln_id - - reporting_config_id - - reporting_config_name - - ticket_url - - ticket_id - - tracker_name - ExcludedTemplateResponse: - description: Example response + PatchScanVulnsLabelsRequest: content: application/json: schema: type: object + required: + - ids properties: - data: + ids: type: array items: - $ref: '#/components/schemas/ExcludedTemplate' - required: - - data - GetScansTokenResponse: - description: Example response + type: string + type: + type: string + labels: + type: array + items: + type: string + VerifyConfigRequest: content: application/json: schema: type: object + required: + - config properties: - scan_tokens: - type: integer - format: int64 - used_scan_token: - type: integer - format: int64 - remaining_scan_token: - type: integer - format: int64 - base_domain_count: - type: integer - format: int64 - remaining_domain_count: - type: integer - format: int64 - is_scannable: - type: boolean - start_date: - type: string - format: date-time - end_date: + config: type: string - format: date-time - expire_date: + config_type: type: string - format: date-time - subscription_type: - enum: - - BASIC - - TRIAL - - CUSTOM - - PRO - required: - - scan_tokens - - used_scan_token - - remaining_scan_token - - is_scannable - - start_date - - end_date - - subscription_type - - base_domain_count - - remaining_domain_count - - expire_date - GetAssetResponse: - description: Example response + VerifyConfigContentsRequest: content: application/json: schema: type: object properties: - id: - type: integer - format: int64 - enumeration_id: - type: string - name: - type: string - created_at: + config: type: string - format: date-time - updated_at: + config_type: type: string - format: date-time - status_code: - type: integer - technologies: + provider: + $ref: "#/components/schemas/VerifyConfigContentsRequestProvider" + DeleteVulnsRequest: + content: + application/json: + schema: + type: object + properties: + ids: type: array items: type: string - webserver: - type: string - request: + type: type: string - response: + vuln_status: + type: array + items: + type: string + scan_id: type: string - cname: + severity: type: array items: type: string - labels: + host: type: array items: type: string - ip: + template: + type: array + items: + type: string + search: type: string - content_length: - type: integer - title: + CreateContributeRequest: + content: + application/json: + schema: + type: object + properties: + email: type: string - host: + name: type: string - port: - type: integer - technology_details: + template: type: string - format: json - is_new: + anonymous: type: boolean required: - - id - - enumeration_id - - name - - created_at - - updated_at - EnumerationStatsResponse: - description: Example response + - template + - anonymous + ExcludeConfigRequest: content: application/json: schema: type: object + required: + - values + - exclude_type properties: - asset_stats: - $ref: '#/components/schemas/AssetStats' - enumeration_stats: - $ref: '#/components/schemas/EnumerationCounts' + values: + type: array + items: + type: string + exclude_type: + $ref: "#/components/schemas/ExcludeConfigRequestType" + DeleteExcludedConfigRequest: + content: + application/json: + schema: + type: object required: - - asset_stats - PriceListResponse: - description: Example response + - ids + properties: + ids: + type: array + items: + type: integer + format: int64 + UpdateEnumeratedAssetRequest: content: application/json: schema: type: object properties: - list: + labels: type: array items: - $ref: '#/components/schemas/PriceListItem' - message: + type: string + name: type: string + PatchTeamAdmin: + content: + application/json: + schema: + type: object required: - - list - - message - GetScanTokenErrorResponse: - description: Example response + - max_members + properties: + max_members: + type: integer + UsageRequest: content: application/json: schema: type: object + required: + - range properties: - message: + range: + $ref: "#/components/schemas/UsageRangeEnum" + startDate: type: string - subscription_type: + endDate: type: string + AdminSetUsageLimit: + content: + application/json: + schema: + type: object required: - - message - - subscription_type - UsageResponse: - description: Example response + - email + properties: + email: + type: string + format: email + chaos_allowed_requests: + type: number + cvemap_allowed_requests: + type: number + asnmap_allpwed_requests: + type: number + AdminUsageRequest: content: application/json: schema: type: object + required: + - email + - range properties: - message: + email: type: string - cvemap: - $ref: '#/components/schemas/ServiceUsageItem' - chaos: - $ref: '#/components/schemas/ServiceUsageItem' - asnmap: - $ref: '#/components/schemas/ServiceUsageItem' + format: email + range: + $ref: "#/components/schemas/UsageRangeEnum" + startDate: + type: string + endDate: + type: string + AddAutomation: + content: + application/json: + schema: + type: object required: - - message - GetEnumerateFiltersResponse: - description: Example response + - name + - status + - event + - scan_data + properties: + name: + type: string + status: + type: string + event: + type: string + scan_data: + $ref: "#/components/schemas/AutomationScanData" + enumeration_id: + type: string + UpdateAutomationRequest: content: application/json: schema: type: object properties: - message: + name: type: string - current_page: - type: integer - result_count: - type: integer - total_results: - type: integer - total_pages: - type: integer - data: - type: array - items: - $ref: '#/components/schemas/EnumerateFiltersItem' + status: + type: string + scan_data: + $ref: "#/components/schemas/AutomationScanData" + CreateAssetGroupRequest: + content: + application/json: + schema: + type: object required: - - message - - current_page - - result_count - - total_results - - total_pages - - data - GetUserTunnelResponse: - description: Example response + - filters + properties: + filters: + $ref: "#/components/schemas/AssetFilters" + name: + type: string + UpdateAssetGroupRequest: content: application/json: schema: type: object + required: + - filters properties: - message: + filters: + $ref: "#/components/schemas/AssetFilters" + name: type: string - tunnels: - type: array - items: - $ref: '#/components/schemas/TunnelItem' + AddCustomSeverityMappingRequest: + content: + application/json: + schema: + type: object required: - - message - ExposureMetricsResponse: - description: Example response + - template_id + - custom_severity + properties: + template_id: + type: string + custom_severity: + type: string + vuln_id: + type: string + DeleteCustomSeverityMappingRequest: content: application/json: schema: type: object + required: + - ids properties: - total_assets: - type: integer - new_assets: - type: integer - unique_technologies: - type: integer - new_technologies: - type: integer - time_series: + ids: type: array items: - $ref: '#/components/schemas/ExposuresTimeSeries' - securitySchemes: - X-API-Key: - name: X-API-Key - type: apiKey - in: header -security: - - X-API-Key: [] + type: integer + format: int64 x-internal: false +security: +- X-API-Key: [] diff --git a/package-lock.json b/package-lock.json index 100640e..6788b3a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,6 +7,7 @@ "dependencies": { "@types/react": "^19.0.8", "clsx": "^2.1.1", + "js-yaml": "^4.1.0", "react": "^19.0.0", "tailwind-merge": "^3.0.1" } @@ -20,6 +21,12 @@ "csstype": "^3.0.2" } }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "license": "Python-2.0" + }, "node_modules/clsx": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", @@ -35,6 +42,18 @@ "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==", "license": "MIT" }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, "node_modules/react": { "version": "19.0.0", "resolved": "https://registry.npmjs.org/react/-/react-19.0.0.tgz", diff --git a/package.json b/package.json index daa4ae2..a0723fc 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "dependencies": { "@types/react": "^19.0.8", "clsx": "^2.1.1", + "js-yaml": "^4.1.0", "react": "^19.0.0", "tailwind-merge": "^3.0.1" }