@nasebanal/cli 0.12.0 → 0.14.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/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.0
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)