@nasebanal/cli 0.13.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/specs/specs.yaml CHANGED
@@ -2,7 +2,7 @@ openapi: 3.0.3
2
2
  info:
3
3
  title: NASEBANAL Specs API
4
4
  description: "Backend of the own API specs on the NASEBANAL API Specs site. A person on the Free plan keeps up to 20 specs of their own; an organization on the Enterprise plan keeps up to 100. Either uploads OpenAPI documents, keeps their versions and reads them in the same reference view as the NASEBANAL APIs. A spec belongs to exactly one owner, the person or the organization: every request names it in `X-Active-Organization-Id` (an organization id, or `personal`), and only the owner (for an organization, its members) can see or change its specs. Authenticates users via Auth0 JWT and Personal Access Tokens (PAT) and integrates with the Account API (membership and the Enterprise subscription). Every response is wrapped as `{ success, data }` (or `{ success: false, error }`)."
5
- version: 1.3.0
5
+ version: 1.5.0
6
6
  contact:
7
7
  name: NASEBANAL
8
8
  url: https://www.nasebanal.com
@@ -485,7 +485,7 @@ paths:
485
485
  - Specs
486
486
  operationId: createSpec
487
487
  summary: Create a spec
488
- description: Creates the spec and its first revision from the document in `content`, optionally filed in the group `group_id` (without one the spec stands on its own, so no group has to be made first). The document is validated as OpenAPI 3.x before anything is stored; one that is not is refused with `422 INVALID_SPEC` and the reasons. The spec's API version (`api_version`, for example `v1`) is the one given, else the MAJOR of the document's `info.version` (`1.8.0` is `v1`, `v2.0` is `v2`); a version with no major to read (a calendar version such as `2023-01`) needs `api_version` said, or the request is refused with `400 API_VERSION_REQUIRED`. A new major API version is a new spec.
488
+ description: Creates the spec and its first revision from the document in `content`, optionally filed in the group `group_id` (without one the spec stands on its own, so no group has to be made first). The document is validated as OpenAPI 3.x before anything is stored; one that is not is refused with `422 INVALID_SPEC` and the reasons. The spec's API version (`api_version`, for example `v1`) is the one given, else the MAJOR of the document's `info.version` (`1.8.0` is `v1`, `v2.0` is `v2`); a version with no major to read (a calendar version such as `2023-01`) needs `api_version` said, or the request is refused with `400 API_VERSION_REQUIRED`. A new major API version is a new spec. A later version of an API names its initial version (the first spec registered for the API). Send `initial_spec_id` and the new spec is filed in that spec's group and repository (they must be the same if sent too). The API version is the document's, and no spec of that API may have it already (the initial spec's own included). Versions are registered in order, so the API version must be the next one after the highest the API has (v1, v2, then v3), and to leave room for one that is not ready a placeholder of it is registered first. Refused with `404 INITIAL_NOT_FOUND`, `400 INITIAL_NOT_INITIAL`, `400 INITIAL_GROUP_MISMATCH`, `400 INITIAL_REPOSITORY_MISMATCH`, `409 INITIAL_VERSION_TAKEN` or `409 INITIAL_VERSION_NOT_NEXT`. The spec's description is the one sent, else the first paragraph of the document's `info.description`.
489
489
  parameters:
490
490
  - $ref: "#/components/parameters/ActiveOrganization"
491
491
  requestBody:
@@ -561,7 +561,7 @@ paths:
561
561
  - Specs
562
562
  operationId: updateSpec
563
563
  summary: Update a spec
564
- description: Renames the spec, changes its description or moves it to another group, or out of its group (`group_id`, `null` for none). Send only the fields to change, which include the quality settings of the spec (`public_badge`, `report_access`, `rotate_quality_public_id`). The API version is fixed when the spec is created, so a different `api_version` is refused with `400` (register the other API version as a new spec). The document itself is never edited - upload a new revision instead.
564
+ description: Renames the spec, changes its description or moves it to another group, or out of its group (`group_id`, `null` for none). Send only the fields to change, which include the quality settings of the spec (`public_badge`, `report_access`, `rotate_quality_public_id`). The API version is fixed when the spec is created, so a different `api_version` is refused with `400` (register the other API version as a new spec). The document itself is never edited - upload a new revision instead. `initial_spec_id` makes the spec a later version of an API (the same rules and refusals as when creating) or, with `null`, an API of its own. The specs of one API keep the group and repository of its initial version, so moving one is refused with `409 VERSION_FAMILY_MEMBER` unless it leaves the API in the same request; an initial version that has later versions cannot become a later version (`409 INITIAL_HAS_VERSIONS`).
565
565
  requestBody:
566
566
  required: true
567
567
  content:
@@ -600,7 +600,7 @@ paths:
600
600
  - Specs
601
601
  operationId: deleteSpec
602
602
  summary: Delete a spec
603
- description: Deletes the spec and every one of its versions. Cannot be undone.
603
+ description: Deletes the spec and every one of its versions. Cannot be undone. The initial version of an API that has later versions cannot be deleted (`409 INITIAL_HAS_VERSIONS`), so delete or detach the later versions first.
604
604
  responses:
605
605
  "204":
606
606
  description: Deleted
@@ -658,7 +658,7 @@ paths:
658
658
  - Versions
659
659
  operationId: createSpecVersion
660
660
  summary: Upload a new version
661
- description: Adds the document in `content` as the next REVISION of the spec (the number counts up inside the spec's API version). Validated like `createSpec`. A document identical to the latest revision is refused with `409 UNCHANGED` rather than stored twice. A document whose `info.version` has another major than the spec's API version (`v1` spec, `2.0.0` document) is another API version and is refused with `409 API_VERSION_MISMATCH` (register it as a new spec). A document with no major to read is accepted, the spec's API version stands.
661
+ description: Adds the document in `content` as the next REVISION of the spec (the number counts up inside the spec's API version). Validated like `createSpec`. A document identical to the latest revision is refused with `409 UNCHANGED` rather than stored twice. A document whose `info.version` has another major than the spec's API version (`v1` spec, `2.0.0` document) is another API version and is refused with `409 API_VERSION_MISMATCH` (register it as a new spec). A document with no major to read is accepted, the spec's API version stands. The spec's title and description follow the new document (its `info.title` and the first paragraph of its `info.description`, none when it has none).
662
662
  requestBody:
663
663
  required: true
664
664
  content:
@@ -1200,6 +1200,7 @@ components:
1200
1200
  - openapi_version
1201
1201
  - latest_version
1202
1202
  - api_version
1203
+ - initial_spec_id
1203
1204
  - reference_access
1204
1205
  - public_badge
1205
1206
  - report_access
@@ -1247,6 +1248,10 @@ components:
1247
1248
  type: string
1248
1249
  example: v1
1249
1250
  description: "The API version this spec is (`v1`, `v2`: the generation of the API, which changes only with a breaking change). Fixed when the spec is created, from the given `api_version` or the major of the document's `info.version`; a new major API version is a new spec. Results and monitors are about the spec, so they need no version of their own."
1251
+ initial_spec_id:
1252
+ type: string
1253
+ nullable: true
1254
+ description: The first spec registered for the API this spec is a later version of (its initial version), or `null` when this spec is an API of its own or is the initial version itself. The specs of one API share the group and repository of the initial version and have one spec per API version; a CI names the initial version by id and finds the spec of any API version of it.
1250
1255
  created_by_user_id:
1251
1256
  type: integer
1252
1257
  nullable: true
@@ -1383,6 +1388,10 @@ components:
1383
1388
  pattern: ^[A-Za-z0-9._-]{1,32}$
1384
1389
  example: v1
1385
1390
  description: "The API version of the spec (letters, digits, `.`, `_`, `-`; trimmed). Optional: left out, it is the major of the document's `info.version` (`1.8.0` is `v1`). Required when `info.version` has no major to read (`2023-01`), refused with `400 API_VERSION_REQUIRED` otherwise. Fixed for the life of the spec."
1391
+ initial_spec_id:
1392
+ type: string
1393
+ nullable: true
1394
+ description: The initial version of the API this new spec is a later version of. The new spec is filed in that spec's group and repository (taken from it when `group_id` and `repository_id` are left out), and its API version must not be one that API already has. Optional.
1386
1395
  SpecUpdate:
1387
1396
  type: object
1388
1397
  properties:
@@ -1390,6 +1399,10 @@ components:
1390
1399
  type: string
1391
1400
  pattern: ^[A-Za-z0-9._-]{1,32}$
1392
1401
  description: "Not changeable: the API version is fixed when the spec is created. Sending the spec's own value again is accepted; a different one is refused with `400` (a new API version is registered as a new spec)."
1402
+ initial_spec_id:
1403
+ type: string
1404
+ nullable: true
1405
+ description: The initial version of the API this spec is a later version of, with the same rules as when creating; `null` makes the spec an API of its own. A spec in an API cannot change its group or repository (`409 VERSION_FAMILY_MEMBER`) unless it leaves the API in the same request.
1393
1406
  group_id:
1394
1407
  type: string
1395
1408
  nullable: true
package/specs/target.yaml CHANGED
@@ -2,7 +2,7 @@ openapi: 3.0.3
2
2
  info:
3
3
  title: NASEBANAL Target API
4
4
  description: "Target API for NASEBANAL. Provides hierarchical target management: users define goals and organize them in a tree structure. Parent-child links are persisted via `targets.parent_target_id` (authoritative since migration 0017); a legacy cell-based storage layer is kept in sync best-effort for backward compatibility. Targets can be shared with other users (read/write, optionally including the subtree and linked Recorder data), and ownership of a personal target subtree can be transferred to a recipient via an email-approved migration flow. Supports user authentication via Auth0 JWT and Personal Access Tokens (PAT)."
5
- version: 1.5.1
5
+ version: 1.6.0
6
6
  contact:
7
7
  name: NASEBANAL
8
8
  url: https://www.nasebanal.com
@@ -906,6 +906,106 @@ paths:
906
906
  $ref: "#/components/responses/Unauthorized"
907
907
  "404":
908
908
  $ref: "#/components/responses/NotFound"
909
+ /api/v1/export:
910
+ get:
911
+ summary: Take a complete copy of an organization's data
912
+ description: "Everything the caller may take, as JSON: targets with their cells, in keyset pages (`after_id`, 50 targets a page) that the caller walks until `next_after_id` is null. An organization admin takes every member's targets, a member only their own. Read-only, so an admin of an organization whose Enterprise contract has ended can still take the data away before deleting the organization."
913
+ operationId: exportData
914
+ tags:
915
+ - Backup
916
+ parameters:
917
+ - name: X-Active-Organization-Id
918
+ in: header
919
+ required: true
920
+ description: "The organization acted on (an organization id). The backup is a feature of organizations (Enterprise): without it the answer is 403 ORGANIZATION_REQUIRED."
921
+ schema:
922
+ type: integer
923
+ minimum: 1
924
+ - name: after_id
925
+ in: query
926
+ description: Return the targets after this id (the previous page's `next_after_id`); empty starts at the beginning.
927
+ schema:
928
+ type: string
929
+ maxLength: 64
930
+ responses:
931
+ "200":
932
+ description: One section (or page) of the copy
933
+ content:
934
+ application/json:
935
+ schema:
936
+ type: object
937
+ properties:
938
+ success:
939
+ type: boolean
940
+ enum:
941
+ - true
942
+ data:
943
+ $ref: "#/components/schemas/TargetExportPage"
944
+ "400":
945
+ $ref: "#/components/responses/ValidationError"
946
+ "401":
947
+ $ref: "#/components/responses/Unauthorized"
948
+ "403":
949
+ description: No organization selected (ORGANIZATION_REQUIRED) or no access to the organization
950
+ content:
951
+ application/json:
952
+ schema:
953
+ $ref: "#/components/schemas/Error"
954
+ example:
955
+ success: false
956
+ error:
957
+ code: ORGANIZATION_REQUIRED
958
+ message: The complete backup is for organizations (Enterprise)
959
+ /api/v1/import/full:
960
+ post:
961
+ summary: Put a complete copy back
962
+ description: "Restores an exported file (or a part of it: up to 40 targets per request) into the active organization, owned by the importer. An organization admin only. Targets the organization already has are left alone and counted, so putting the same file back twice changes nothing the second time."
963
+ operationId: importFull
964
+ tags:
965
+ - Backup
966
+ parameters:
967
+ - name: X-Active-Organization-Id
968
+ in: header
969
+ required: true
970
+ description: "The organization acted on (an organization id). The backup is a feature of organizations (Enterprise): without it the answer is 403 ORGANIZATION_REQUIRED."
971
+ schema:
972
+ type: integer
973
+ minimum: 1
974
+ requestBody:
975
+ required: true
976
+ content:
977
+ application/json:
978
+ schema:
979
+ $ref: "#/components/schemas/TargetImportRequest"
980
+ responses:
981
+ "200":
982
+ description: What was created, what was already there and what was skipped
983
+ content:
984
+ application/json:
985
+ schema:
986
+ type: object
987
+ properties:
988
+ success:
989
+ type: boolean
990
+ enum:
991
+ - true
992
+ data:
993
+ $ref: "#/components/schemas/TargetImportResult"
994
+ "400":
995
+ $ref: "#/components/responses/ValidationError"
996
+ "401":
997
+ $ref: "#/components/responses/Unauthorized"
998
+ "403":
999
+ description: Not an organization admin, no organization selected (ORGANIZATION_REQUIRED), or the organization's contract has ended (ORG_READ_ONLY)
1000
+ content:
1001
+ application/json:
1002
+ schema:
1003
+ $ref: "#/components/schemas/Error"
1004
+ example:
1005
+ success: false
1006
+ error:
1007
+ code: FORBIDDEN
1008
+ message: The complete backup is for organizations (Enterprise)
909
1009
  components:
910
1010
  securitySchemes:
911
1011
  BearerAuth:
@@ -1463,6 +1563,90 @@ components:
1463
1563
  details:
1464
1564
  type: object
1465
1565
  additionalProperties: true
1566
+ TargetExportPage:
1567
+ type: object
1568
+ description: A page of an organization's complete copy.
1569
+ required:
1570
+ - format
1571
+ - version
1572
+ - scope
1573
+ - exported_at
1574
+ - targets
1575
+ - next_after_id
1576
+ properties:
1577
+ format:
1578
+ type: string
1579
+ enum:
1580
+ - nb-target-export
1581
+ version:
1582
+ type: integer
1583
+ enum:
1584
+ - 1
1585
+ scope:
1586
+ type: object
1587
+ properties:
1588
+ organization_id:
1589
+ type: integer
1590
+ exported_at:
1591
+ type: string
1592
+ format: date-time
1593
+ targets:
1594
+ type: array
1595
+ description: Targets with every column of the table, each with its `cells`.
1596
+ items:
1597
+ type: object
1598
+ additionalProperties: true
1599
+ next_after_id:
1600
+ type: string
1601
+ nullable: true
1602
+ description: Pass it as `after_id` for the next page; null when there is none.
1603
+ TargetImportRequest:
1604
+ type: object
1605
+ description: An exported file, or a part of it. One request takes at most 40 targets.
1606
+ required:
1607
+ - format
1608
+ - version
1609
+ properties:
1610
+ format:
1611
+ type: string
1612
+ enum:
1613
+ - nb-target-export
1614
+ version:
1615
+ type: integer
1616
+ enum:
1617
+ - 1
1618
+ targets:
1619
+ type: array
1620
+ items:
1621
+ type: object
1622
+ additionalProperties: true
1623
+ TargetImportResult:
1624
+ type: object
1625
+ required:
1626
+ - targets_created
1627
+ - targets_existing
1628
+ - targets_skipped
1629
+ - cells_in_file
1630
+ - skipped
1631
+ properties:
1632
+ targets_created:
1633
+ type: integer
1634
+ targets_existing:
1635
+ type: integer
1636
+ targets_skipped:
1637
+ type: integer
1638
+ cells_in_file:
1639
+ type: integer
1640
+ skipped:
1641
+ type: array
1642
+ description: The first targets that were skipped, with the reason (at most 50).
1643
+ items:
1644
+ type: object
1645
+ properties:
1646
+ index:
1647
+ type: integer
1648
+ reason:
1649
+ type: string
1466
1650
  responses:
1467
1651
  Unauthorized:
1468
1652
  description: Authentication required or invalid token
@@ -1530,3 +1714,5 @@ tags:
1530
1714
  description: Individual storage cell management on a target
1531
1715
  - name: Sharing
1532
1716
  description: Sharing targets with other users and transferring ownership
1717
+ - name: Backup
1718
+ description: Complete backup and restore of an organization (Enterprise)