@abyss-project/tools 1.0.5 → 1.2.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/.eslintrc.js +33 -33
- package/.prettierrc +5 -5
- package/README.md +32 -32
- package/dist/api/beam.api.d.ts +48 -0
- package/dist/api/beam.api.js +104 -0
- package/dist/api/beam.api.js.map +1 -0
- package/dist/api/extraction-plan-preset.api.d.ts +9 -0
- package/dist/api/extraction-plan-preset.api.js +23 -0
- package/dist/api/extraction-plan-preset.api.js.map +1 -0
- package/dist/api/extraction-plan-preset.api.test.d.ts +1 -0
- package/dist/api/extraction-plan-preset.api.test.js +41 -0
- package/dist/api/extraction-plan-preset.api.test.js.map +1 -0
- package/dist/api/extraction-settings.api.d.ts +4 -0
- package/dist/api/extraction-settings.api.js +22 -0
- package/dist/api/extraction-settings.api.js.map +1 -0
- package/dist/api/extraction.api.d.ts +74 -0
- package/dist/api/extraction.api.js +416 -0
- package/dist/api/extraction.api.js.map +1 -0
- package/dist/api/index.d.ts +4 -1
- package/dist/api/index.js +4 -1
- package/dist/api/index.js.map +1 -1
- package/dist/constants/beam.constants.d.ts +1 -0
- package/dist/constants/beam.constants.js +5 -0
- package/dist/constants/beam.constants.js.map +1 -0
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/index.js +1 -0
- package/dist/constants/index.js.map +1 -1
- package/dist/index.d.ts +108 -59
- package/dist/index.js +106 -59
- package/dist/index.js.map +1 -1
- package/dist/types/enum/beam.enum.d.ts +12 -0
- package/dist/types/enum/beam.enum.js +18 -0
- package/dist/types/enum/beam.enum.js.map +1 -0
- package/dist/types/enum/combine-strategy.enum.d.ts +5 -0
- package/dist/types/enum/combine-strategy.enum.js +10 -0
- package/dist/types/enum/combine-strategy.enum.js.map +1 -0
- package/dist/types/enum/content-share.enum.d.ts +3 -1
- package/dist/types/enum/content-share.enum.js +2 -0
- package/dist/types/enum/content-share.enum.js.map +1 -1
- package/dist/types/enum/document-type.enum.d.ts +9 -0
- package/dist/types/enum/document-type.enum.js +14 -0
- package/dist/types/enum/document-type.enum.js.map +1 -0
- package/dist/types/enum/extraction-feedback-issue-type.enum.d.ts +8 -0
- package/dist/types/enum/extraction-feedback-issue-type.enum.js +13 -0
- package/dist/types/enum/extraction-feedback-issue-type.enum.js.map +1 -0
- package/dist/types/enum/extraction-warning.enum.d.ts +7 -0
- package/dist/types/enum/extraction-warning.enum.js +12 -0
- package/dist/types/enum/extraction-warning.enum.js.map +1 -0
- package/dist/types/enum/index.d.ts +7 -0
- package/dist/types/enum/index.js +7 -0
- package/dist/types/enum/index.js.map +1 -1
- package/dist/types/enum/interpreter-kind.enum.d.ts +5 -0
- package/dist/types/enum/interpreter-kind.enum.js +10 -0
- package/dist/types/enum/interpreter-kind.enum.js.map +1 -0
- package/dist/types/enum/provider-kind.enum.d.ts +10 -0
- package/dist/types/enum/provider-kind.enum.js +16 -0
- package/dist/types/enum/provider-kind.enum.js.map +1 -0
- package/dist/types/interface/api/requests/beam.request.d.ts +122 -0
- package/dist/types/interface/api/{responses/pdf.response.js → requests/beam.request.js} +1 -1
- package/dist/types/interface/api/requests/beam.request.js.map +1 -0
- package/dist/types/interface/api/requests/{rcb.request.d.ts → extraction.request.d.ts} +81 -52
- package/dist/types/interface/api/requests/{pdf.public.request.js → extraction.request.js} +1 -1
- package/dist/types/interface/api/requests/extraction.request.js.map +1 -0
- package/dist/types/interface/api/requests/index.d.ts +2 -1
- package/dist/types/interface/api/requests/index.js +2 -1
- package/dist/types/interface/api/requests/index.js.map +1 -1
- package/dist/types/interface/api/responses/beam.response.d.ts +92 -0
- package/dist/types/interface/api/responses/{rcb.response.js → beam.response.js} +1 -1
- package/dist/types/interface/api/responses/beam.response.js.map +1 -0
- package/dist/types/interface/api/responses/extraction.response.d.ts +403 -0
- package/dist/types/interface/api/{requests/user-tag.request.js → responses/extraction.response.js} +1 -1
- package/dist/types/interface/api/responses/extraction.response.js.map +1 -0
- package/dist/types/interface/api/responses/index.d.ts +2 -1
- package/dist/types/interface/api/responses/index.js +2 -1
- package/dist/types/interface/api/responses/index.js.map +1 -1
- package/dist/types/interface/models/beam.dto.d.ts +58 -0
- package/dist/types/interface/{api/requests/pdf.request.js → models/beam.dto.js} +1 -1
- package/dist/types/interface/models/beam.dto.js.map +1 -0
- package/dist/types/interface/models/extraction-fetched-provenance.dto.test.d.ts +1 -0
- package/dist/types/interface/models/extraction-fetched-provenance.dto.test.js +159 -0
- package/dist/types/interface/models/extraction-fetched-provenance.dto.test.js.map +1 -0
- package/dist/types/interface/models/extraction-plan.dto.d.ts +163 -0
- package/dist/types/interface/models/extraction-plan.dto.js +11 -0
- package/dist/types/interface/models/extraction-plan.dto.js.map +1 -0
- package/dist/types/interface/models/extraction-plan.dto.test.d.ts +1 -0
- package/dist/types/interface/models/extraction-plan.dto.test.js +35 -0
- package/dist/types/interface/models/extraction-plan.dto.test.js.map +1 -0
- package/dist/types/interface/models/extraction-spatial-template.dto.d.ts +37 -0
- package/dist/types/interface/{api/requests/rcb.request.js → models/extraction-spatial-template.dto.js} +1 -1
- package/dist/types/interface/models/extraction-spatial-template.dto.js.map +1 -0
- package/dist/types/interface/models/extraction-spatial-template.dto.test.d.ts +1 -0
- package/dist/types/interface/models/extraction-spatial-template.dto.test.js +15 -0
- package/dist/types/interface/models/extraction-spatial-template.dto.test.js.map +1 -0
- package/dist/types/interface/models/{rcb.dto.d.ts → extraction.dto.d.ts} +64 -48
- package/dist/types/interface/models/extraction.dto.js +28 -0
- package/dist/types/interface/models/extraction.dto.js.map +1 -0
- package/dist/types/interface/models/index.d.ts +4 -1
- package/dist/types/interface/models/index.js +4 -1
- package/dist/types/interface/models/index.js.map +1 -1
- package/dist/types/interface/models/organization.dto.d.ts +2 -0
- package/dist/utils/{rcb-webhook.utils.d.ts → extraction-webhook.utils.d.ts} +2 -2
- package/dist/utils/{rcb-webhook.utils.js → extraction-webhook.utils.js} +4 -4
- package/dist/utils/extraction-webhook.utils.js.map +1 -0
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/shape.utils.js +18 -18
- package/package.json +14 -9
- package/src/api/abyss.admin.api.ts +54 -54
- package/src/api/atlas-document.api.ts +68 -68
- package/src/api/atlas-group.api.ts +69 -69
- package/src/api/atlas-page.api.ts +124 -124
- package/src/api/atlas.api.ts +103 -103
- package/src/api/atlas.public.api.ts +42 -42
- package/src/api/beam.api.ts +300 -0
- package/src/api/board-card-checklist.api.ts +99 -99
- package/src/api/board-card-comment.api.ts +57 -57
- package/src/api/board-card-document.api.ts +57 -57
- package/src/api/board-card.api.ts +137 -137
- package/src/api/board-column.api.ts +54 -54
- package/src/api/board-label.api.ts +87 -87
- package/src/api/board.api.ts +122 -122
- package/src/api/draw.api.ts +97 -97
- package/src/api/draw.public.api.ts +48 -48
- package/src/api/extraction-plan-preset.api.test.ts +24 -0
- package/src/api/extraction-plan-preset.api.ts +51 -0
- package/src/api/extraction-settings.api.ts +59 -0
- package/src/api/extraction.api.ts +899 -0
- package/src/api/index.ts +56 -51
- package/src/api/memo.api.ts +97 -97
- package/src/api/metrics.api.ts +27 -27
- package/src/api/monitor.api.ts +6 -6
- package/src/api/organization.api.ts +14 -14
- package/src/api/retrospective-card.api.ts +74 -74
- package/src/api/retrospective-member.api.ts +54 -54
- package/src/api/retrospective-section.api.ts +74 -74
- package/src/api/retrospective.api.ts +124 -124
- package/src/api/retrospective.public.api.ts +147 -147
- package/src/api/short-link.admin.api.ts +39 -39
- package/src/api/short-link.api.ts +125 -125
- package/src/api/short-link.public.api.ts +60 -60
- package/src/api/tag.api.ts +72 -72
- package/src/api/tests/beam.api.spec.ts +42 -0
- package/src/constants/atlas.constants.ts +2 -2
- package/src/constants/beam.constants.ts +4 -0
- package/src/constants/board.constants.ts +7 -7
- package/src/constants/index.ts +6 -5
- package/src/constants/memo.constants.ts +3 -3
- package/src/constants/short-link.constants.ts +11 -11
- package/src/constants/tag.constants.ts +3 -3
- package/src/index.ts +840 -747
- package/src/server-sent-events/index.ts +13 -13
- package/src/server-sent-events/protocols/atlas/atlas.sse-protocol.ts +90 -90
- package/src/server-sent-events/protocols/atlas/index.ts +1 -1
- package/src/server-sent-events/protocols/board/board.sse-protocol.ts +115 -115
- package/src/server-sent-events/protocols/board/index.ts +1 -1
- package/src/server-sent-events/protocols/board-card/board-card.sse-protocol.ts +26 -26
- package/src/server-sent-events/protocols/board-card/index.ts +1 -1
- package/src/server-sent-events/protocols/index.ts +26 -26
- package/src/server-sent-events/protocols/retrospective/index.ts +1 -1
- package/src/server-sent-events/protocols/retrospective/retrospective.sse-protocol.ts +92 -92
- package/src/server-sent-events/server-sent-events.manager.ts +73 -73
- package/src/types/draw.type.ts +173 -173
- package/src/types/enum/api-error.enum.ts +23 -23
- package/src/types/enum/beam.enum.ts +24 -0
- package/src/types/enum/board-activity.enum.ts +189 -189
- package/src/types/enum/board-column-type.enum.ts +6 -6
- package/src/types/enum/combine-strategy.enum.ts +7 -0
- package/src/types/enum/content-share.enum.ts +38 -36
- package/src/types/enum/document-type.enum.ts +10 -0
- package/src/types/enum/extraction-feedback-issue-type.enum.ts +10 -0
- package/src/types/enum/extraction-warning.enum.ts +21 -0
- package/src/types/enum/index.ts +13 -6
- package/src/types/enum/interpreter-kind.enum.ts +7 -0
- package/src/types/enum/pdf-operation.enum.ts +98 -98
- package/src/types/enum/provider-kind.enum.ts +13 -0
- package/src/types/enum/rcb-bank.enum.ts +137 -137
- package/src/types/index.ts +5 -5
- package/src/types/interface/api/index.ts +5 -5
- package/src/types/interface/api/requests/abyss.admin.request.ts +20 -20
- package/src/types/interface/api/requests/atlas-document.request.ts +32 -32
- package/src/types/interface/api/requests/atlas-group.request.ts +45 -45
- package/src/types/interface/api/requests/atlas-page.request.ts +84 -84
- package/src/types/interface/api/requests/atlas.public.request.ts +21 -21
- package/src/types/interface/api/requests/atlas.request.ts +52 -52
- package/src/types/interface/api/requests/beam.request.ts +152 -0
- package/src/types/interface/api/requests/board-card-checklist.request.ts +61 -61
- package/src/types/interface/api/requests/board-card-comment.request.ts +28 -28
- package/src/types/interface/api/requests/board-card-document.request.ts +29 -29
- package/src/types/interface/api/requests/board-card.request.ts +86 -86
- package/src/types/interface/api/requests/board-column.request.ts +30 -30
- package/src/types/interface/api/requests/board-label.request.ts +42 -42
- package/src/types/interface/api/requests/board.request.ts +61 -61
- package/src/types/interface/api/requests/draw.public.request.ts +20 -20
- package/src/types/interface/api/requests/draw.request.ts +49 -49
- package/src/types/interface/api/requests/extraction.request.ts +366 -0
- package/src/types/interface/api/requests/index.ts +29 -28
- package/src/types/interface/api/requests/memo.request.ts +49 -49
- package/src/types/interface/api/requests/metrics.request.ts +7 -7
- package/src/types/interface/api/requests/retrospective-card.request.ts +38 -38
- package/src/types/interface/api/requests/retrospective-member.request.ts +20 -20
- package/src/types/interface/api/requests/retrospective-section.request.ts +43 -43
- package/src/types/interface/api/requests/retrospective.public.request.ts +84 -84
- package/src/types/interface/api/requests/retrospective.request.ts +59 -59
- package/src/types/interface/api/requests/short-link.admin.request.ts +35 -35
- package/src/types/interface/api/requests/short-link.public.request.ts +40 -40
- package/src/types/interface/api/requests/short-link.request.ts +71 -71
- package/src/types/interface/api/requests/tag.request.ts +54 -54
- package/src/types/interface/api/requests/transfer.request.ts +3 -3
- package/src/types/interface/api/responses/abyss.admin.response.ts +28 -28
- package/src/types/interface/api/responses/atlas-document.response.ts +24 -24
- package/src/types/interface/api/responses/atlas-group.response.ts +23 -23
- package/src/types/interface/api/responses/atlas-page.response.ts +53 -53
- package/src/types/interface/api/responses/atlas.public.response.ts +21 -21
- package/src/types/interface/api/responses/atlas.response.ts +32 -32
- package/src/types/interface/api/responses/beam.response.ts +122 -0
- package/src/types/interface/api/responses/board-card-checklist.response.ts +31 -31
- package/src/types/interface/api/responses/board-card-comment.response.ts +20 -20
- package/src/types/interface/api/responses/board-card-document.response.ts +21 -21
- package/src/types/interface/api/responses/board-card.response.ts +55 -55
- package/src/types/interface/api/responses/board-column.response.ts +20 -20
- package/src/types/interface/api/responses/board-label.response.ts +31 -31
- package/src/types/interface/api/responses/board.response.ts +81 -81
- package/src/types/interface/api/responses/count.response.ts +9 -9
- package/src/types/interface/api/responses/draw.public.response.ts +22 -22
- package/src/types/interface/api/responses/draw.response.ts +32 -32
- package/src/types/interface/api/responses/enriched-paginate.response.ts +11 -11
- package/src/types/interface/api/responses/extraction.response.ts +454 -0
- package/src/types/interface/api/responses/index.ts +33 -32
- package/src/types/interface/api/responses/memo.response.ts +32 -32
- package/src/types/interface/api/responses/metrics.response.ts +22 -22
- package/src/types/interface/api/responses/monitor.response.ts +8 -8
- package/src/types/interface/api/responses/recent.response.ts +18 -18
- package/src/types/interface/api/responses/retrospective-card.response.ts +23 -23
- package/src/types/interface/api/responses/retrospective-member.response.ts +22 -22
- package/src/types/interface/api/responses/retrospective-section.response.ts +23 -23
- package/src/types/interface/api/responses/retrospective.public.response.ts +57 -57
- package/src/types/interface/api/responses/retrospective.response.ts +32 -32
- package/src/types/interface/api/responses/short-link.admin.response.ts +21 -21
- package/src/types/interface/api/responses/short-link.public.response.ts +26 -26
- package/src/types/interface/api/responses/short-link.response.ts +38 -38
- package/src/types/interface/api/responses/tag.response.ts +38 -38
- package/src/types/interface/api/responses/transfer.response.ts +14 -14
- package/src/types/interface/api/type-message/api-error.ts +7 -7
- package/src/types/interface/api/type-message/base-paginate.ts +11 -11
- package/src/types/interface/api/type-message/response.ts +6 -6
- package/src/types/interface/index.ts +2 -2
- package/src/types/interface/models/atlas-document.dto.ts +22 -22
- package/src/types/interface/models/atlas-group.dto.ts +21 -21
- package/src/types/interface/models/atlas-page-content.dto.ts +17 -17
- package/src/types/interface/models/atlas-page.dto.ts +26 -26
- package/src/types/interface/models/atlas.dto.ts +34 -34
- package/src/types/interface/models/beam.dto.ts +67 -0
- package/src/types/interface/models/board-activity.dto.ts +20 -20
- package/src/types/interface/models/board-card-checklist-row.dto.ts +14 -14
- package/src/types/interface/models/board-card-checklist.dto.ts +16 -16
- package/src/types/interface/models/board-card-comment.dto.ts +15 -15
- package/src/types/interface/models/board-card-document.dto.ts +22 -22
- package/src/types/interface/models/board-card-label.dto.ts +14 -14
- package/src/types/interface/models/board-card-member.dto.ts +14 -14
- package/src/types/interface/models/board-card.dto.ts +37 -37
- package/src/types/interface/models/board-column.dto.ts +17 -17
- package/src/types/interface/models/board-label.dto.ts +13 -13
- package/src/types/interface/models/board.dto.ts +33 -33
- package/src/types/interface/models/content-share.dto.ts +16 -16
- package/src/types/interface/models/draw.dto.ts +30 -30
- package/src/types/interface/models/extraction-fetched-provenance.dto.test.ts +193 -0
- package/src/types/interface/models/extraction-plan.dto.test.ts +47 -0
- package/src/types/interface/models/extraction-plan.dto.ts +241 -0
- package/src/types/interface/models/extraction-spatial-template.dto.test.ts +27 -0
- package/src/types/interface/models/extraction-spatial-template.dto.ts +48 -0
- package/src/types/interface/models/{rcb.dto.ts → extraction.dto.ts} +317 -267
- package/src/types/interface/models/index.ts +34 -31
- package/src/types/interface/models/memo.dto.ts +23 -23
- package/src/types/interface/models/organization.dto.ts +21 -12
- package/src/types/interface/models/project.dto.ts +25 -25
- package/src/types/interface/models/retrospective-card.dto.ts +17 -17
- package/src/types/interface/models/retrospective-member.dto.ts +15 -15
- package/src/types/interface/models/retrospective-section.dto.ts +16 -16
- package/src/types/interface/models/retrospective.dto.ts +32 -32
- package/src/types/interface/models/short-link-click.dto.ts +33 -33
- package/src/types/interface/models/short-link.dto.ts +49 -49
- package/src/types/interface/models/tag.dto.ts +26 -26
- package/src/types/interface/models/team.dto.ts +12 -12
- package/src/types/interface/models/user.dto.ts +26 -26
- package/src/types/tests/beam-management-types.spec.ts +38 -0
- package/src/types/tests/beam-share-enums.spec.ts +11 -0
- package/src/types/tests/beam.dto.spec.ts +61 -0
- package/src/types/tests/beam.request-response.spec.ts +43 -0
- package/src/utils/board.utils.ts +57 -57
- package/src/utils/enum.utils.ts +5 -5
- package/src/utils/error.utils.ts +30 -30
- package/src/utils/{rcb-webhook.utils.ts → extraction-webhook.utils.ts} +30 -30
- package/src/utils/icons.utils.ts +96 -96
- package/src/utils/index.ts +6 -6
- package/src/utils/shape.utils.ts +292 -292
- package/tsconfig.json +36 -35
- package/dist/api/atlas-page-content.api.d.ts +0 -0
- package/dist/api/atlas-page-content.api.js +0 -2
- package/dist/api/atlas-page-content.api.js.map +0 -1
- package/dist/api/pdf.api.d.ts +0 -15
- package/dist/api/pdf.api.js +0 -61
- package/dist/api/pdf.api.js.map +0 -1
- package/dist/api/pdf.public.api.d.ts +0 -8
- package/dist/api/pdf.public.api.js +0 -33
- package/dist/api/pdf.public.api.js.map +0 -1
- package/dist/api/rcb.api.d.ts +0 -72
- package/dist/api/rcb.api.js +0 -400
- package/dist/api/rcb.api.js.map +0 -1
- package/dist/api/user-tag.api.d.ts +0 -9
- package/dist/api/user-tag.api.js +0 -37
- package/dist/api/user-tag.api.js.map +0 -1
- package/dist/constants/user-tag.constants.d.ts +0 -3
- package/dist/constants/user-tag.constants.js +0 -7
- package/dist/constants/user-tag.constants.js.map +0 -1
- package/dist/types/enum/pdf-session.enum.d.ts +0 -10
- package/dist/types/enum/pdf-session.enum.js +0 -16
- package/dist/types/enum/pdf-session.enum.js.map +0 -1
- package/dist/types/interface/api/requests/pdf.public.request.d.ts +0 -19
- package/dist/types/interface/api/requests/pdf.public.request.js.map +0 -1
- package/dist/types/interface/api/requests/pdf.request.d.ts +0 -50
- package/dist/types/interface/api/requests/pdf.request.js.map +0 -1
- package/dist/types/interface/api/requests/rcb.request.js.map +0 -1
- package/dist/types/interface/api/requests/user-tag.request.d.ts +0 -44
- package/dist/types/interface/api/requests/user-tag.request.js.map +0 -1
- package/dist/types/interface/api/responses/pdf.public.response.d.ts +0 -33
- package/dist/types/interface/api/responses/pdf.public.response.js +0 -3
- package/dist/types/interface/api/responses/pdf.public.response.js.map +0 -1
- package/dist/types/interface/api/responses/pdf.response.d.ts +0 -35
- package/dist/types/interface/api/responses/pdf.response.js.map +0 -1
- package/dist/types/interface/api/responses/rcb.response.d.ts +0 -376
- package/dist/types/interface/api/responses/rcb.response.js.map +0 -1
- package/dist/types/interface/api/responses/user-tag.response.d.ts +0 -32
- package/dist/types/interface/api/responses/user-tag.response.js +0 -3
- package/dist/types/interface/api/responses/user-tag.response.js.map +0 -1
- package/dist/types/interface/models/pdf-session.dto.d.ts +0 -28
- package/dist/types/interface/models/pdf-session.dto.js +0 -3
- package/dist/types/interface/models/pdf-session.dto.js.map +0 -1
- package/dist/types/interface/models/rcb.dto.js +0 -26
- package/dist/types/interface/models/rcb.dto.js.map +0 -1
- package/dist/types/interface/models/user-tag.dto.d.ts +0 -22
- package/dist/types/interface/models/user-tag.dto.js +0 -3
- package/dist/types/interface/models/user-tag.dto.js.map +0 -1
- package/dist/utils/rcb-webhook.utils.js.map +0 -1
- package/src/api/rcb.api.ts +0 -829
- package/src/types/interface/api/requests/rcb.request.ts +0 -267
- package/src/types/interface/api/responses/rcb.response.ts +0 -399
package/src/api/rcb.api.ts
DELETED
|
@@ -1,829 +0,0 @@
|
|
|
1
|
-
// ──────────────────────────────────────────────
|
|
2
|
-
// RCB (bank statement extraction) — user-facing API.
|
|
3
|
-
//
|
|
4
|
-
// Sync helper accepts an inline PDF buffer (multipart) or a storage_file_id.
|
|
5
|
-
// Queue helper enqueues for async processing + webhook delivery.
|
|
6
|
-
// ──────────────────────────────────────────────
|
|
7
|
-
|
|
8
|
-
import { AbyssToolsCore } from '..';
|
|
9
|
-
import {
|
|
10
|
-
IExtractRcbBody,
|
|
11
|
-
IExtractBulkRcbBody,
|
|
12
|
-
IDetectBulkRcbBody,
|
|
13
|
-
IListFilesRcbQuery,
|
|
14
|
-
IPatchFileRcbBody,
|
|
15
|
-
IPatchExtractionRcbBody,
|
|
16
|
-
ISearchExtractionRecordsRcbQuery,
|
|
17
|
-
IExportExtractionRcbQuery,
|
|
18
|
-
IAsyncExportExtractionRcbBody,
|
|
19
|
-
IListUsageRcbQuery,
|
|
20
|
-
ISummaryUsageRcbQuery,
|
|
21
|
-
IListWebhookDeliveriesRcbQuery,
|
|
22
|
-
IReplayWebhookDeliveryRcbBody,
|
|
23
|
-
IMintShareExtractionRcbBody,
|
|
24
|
-
} from '../types';
|
|
25
|
-
import {
|
|
26
|
-
IExtractSyncRcbResponse,
|
|
27
|
-
IExtractQueueRcbResponse,
|
|
28
|
-
IExtractBulkRcbResponse,
|
|
29
|
-
IDetectRcbResponse,
|
|
30
|
-
IDetectBulkRcbResponse,
|
|
31
|
-
IListFilesRcbResponse,
|
|
32
|
-
IGetFileRcbResponse,
|
|
33
|
-
IListFileExtractionsRcbResponse,
|
|
34
|
-
IGetExtractionRcbResponse,
|
|
35
|
-
ISearchExtractionRecordsRcbResponse,
|
|
36
|
-
IDiffExtractionsRcbResponse,
|
|
37
|
-
IAsyncExportRcbResponse,
|
|
38
|
-
IGetExportJobRcbResponse,
|
|
39
|
-
ICreateTemplateRcbResponse,
|
|
40
|
-
IUpdateTemplateRcbResponse,
|
|
41
|
-
IListTemplatesRcbResponse,
|
|
42
|
-
IGetTemplateRcbResponse,
|
|
43
|
-
IListTemplateVersionsRcbResponse,
|
|
44
|
-
IRcbTemplateCollection,
|
|
45
|
-
IImportTemplateCollectionRcbResponse,
|
|
46
|
-
IGetJobRcbResponse,
|
|
47
|
-
ICreateFeedbackRcbResponse,
|
|
48
|
-
IListFeedbackRcbResponse,
|
|
49
|
-
IGetFeedbackRcbResponse,
|
|
50
|
-
IHealthRcbResponse,
|
|
51
|
-
IStatsRcbResponse,
|
|
52
|
-
ISummaryUsageRcbResponse,
|
|
53
|
-
IGetQuotaRcbResponse,
|
|
54
|
-
IListWebhookDeliveriesRcbResponse,
|
|
55
|
-
IGetWebhookDeliveryRcbResponse,
|
|
56
|
-
IGetSharedExtractionRcbResponse,
|
|
57
|
-
IMintShareExtractionRcbResponse,
|
|
58
|
-
IChangelogRcbResponse,
|
|
59
|
-
} from '../types';
|
|
60
|
-
import {
|
|
61
|
-
ICreateTemplateRcbBody,
|
|
62
|
-
IUpdateTemplateRcbBody,
|
|
63
|
-
IPatchTemplateMetaRcbBody,
|
|
64
|
-
ICreateFeedbackRcbBody,
|
|
65
|
-
IPatchFeedbackRcbBody,
|
|
66
|
-
IListFeedbackRcbQuery,
|
|
67
|
-
IListSharedFilesRcbQuery,
|
|
68
|
-
IPaginateRcbWebhookQuery,
|
|
69
|
-
ICreateRcbWebhookBody,
|
|
70
|
-
IUpdateRcbWebhookBody,
|
|
71
|
-
IRcbWebhookScopeQuery,
|
|
72
|
-
} from '../types';
|
|
73
|
-
import type {
|
|
74
|
-
IPaginateRcbWebhookResponse,
|
|
75
|
-
IGetRcbWebhookResponse,
|
|
76
|
-
ICreateRcbWebhookResponse,
|
|
77
|
-
IUpdateRcbWebhookResponse,
|
|
78
|
-
IDeleteRcbWebhookResponse,
|
|
79
|
-
IResetSecretRcbWebhookResponse,
|
|
80
|
-
} from '../types';
|
|
81
|
-
|
|
82
|
-
const DEFAULT_API_KEY_HEADER = 'x-api-key';
|
|
83
|
-
|
|
84
|
-
function authHeader(apiKey?: string): Record<string, string> {
|
|
85
|
-
return apiKey ? { [DEFAULT_API_KEY_HEADER]: apiKey } : {};
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
async function loadFormData(): Promise<any> {
|
|
89
|
-
if (typeof FormData !== 'undefined' && typeof window !== 'undefined') {
|
|
90
|
-
return FormData;
|
|
91
|
-
}
|
|
92
|
-
// Use indirect eval so bundlers (esbuild/vite/webpack) do not try to
|
|
93
|
-
// resolve the Node-only "form-data" package when this file is included
|
|
94
|
-
// in a browser bundle. The require only runs at runtime on Node.
|
|
95
|
-
// eslint-disable-next-line @typescript-eslint/no-implied-eval, no-new-func
|
|
96
|
-
const nodeRequire: NodeRequire = new Function('return require')();
|
|
97
|
-
return nodeRequire('form-data');
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
function serializeParams<T extends object>(o: T): Record<string, unknown> {
|
|
101
|
-
const out: Record<string, unknown> = {};
|
|
102
|
-
for (const [k, v] of Object.entries(o as Record<string, unknown>)) {
|
|
103
|
-
if (v === undefined || v === null) continue;
|
|
104
|
-
out[k] = v instanceof Date ? v.toISOString() : v;
|
|
105
|
-
}
|
|
106
|
-
return out;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// ─── EXTRACT ─────────────────────────────────
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Optional per-call extras for extract endpoints. `idempotencyKey` is a
|
|
113
|
-
* Stripe-style replay key (24h window) sent as the `Idempotency-Key` header —
|
|
114
|
-
* not part of the request body.
|
|
115
|
-
*/
|
|
116
|
-
export interface ExtractCallOptions {
|
|
117
|
-
idempotencyKey?: string;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
export const extractSyncRcb = async (
|
|
121
|
-
body: IExtractRcbBody,
|
|
122
|
-
apiKey?: string,
|
|
123
|
-
opts: ExtractCallOptions = {},
|
|
124
|
-
): Promise<IExtractSyncRcbResponse> => {
|
|
125
|
-
return postExtract(
|
|
126
|
-
{ ...body, processing: 'sync' },
|
|
127
|
-
apiKey,
|
|
128
|
-
opts,
|
|
129
|
-
) as Promise<IExtractSyncRcbResponse>;
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
export const extractQueueRcb = async (
|
|
133
|
-
body: IExtractRcbBody,
|
|
134
|
-
apiKey?: string,
|
|
135
|
-
opts: ExtractCallOptions = {},
|
|
136
|
-
): Promise<IExtractQueueRcbResponse> => {
|
|
137
|
-
return postExtract(
|
|
138
|
-
{ ...body, processing: 'queue' },
|
|
139
|
-
apiKey,
|
|
140
|
-
opts,
|
|
141
|
-
) as Promise<IExtractQueueRcbResponse>;
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
const postExtract = async (
|
|
145
|
-
body: IExtractRcbBody,
|
|
146
|
-
apiKey?: string,
|
|
147
|
-
opts: ExtractCallOptions = {},
|
|
148
|
-
): Promise<unknown> => {
|
|
149
|
-
const extraHeaders: Record<string, string> = {};
|
|
150
|
-
if (opts.idempotencyKey) {
|
|
151
|
-
extraHeaders['Idempotency-Key'] = opts.idempotencyKey;
|
|
152
|
-
}
|
|
153
|
-
if (body.pdf) {
|
|
154
|
-
const isBrowser = typeof window !== 'undefined' && typeof FormData !== 'undefined';
|
|
155
|
-
const filename = body.pdf_filename ?? 'rcb.pdf';
|
|
156
|
-
if (isBrowser) {
|
|
157
|
-
const form = new FormData();
|
|
158
|
-
const blob = new Blob([body.pdf as Uint8Array], { type: 'application/pdf' });
|
|
159
|
-
form.append('file', blob, filename);
|
|
160
|
-
appendIf(form, 'mode', body.mode);
|
|
161
|
-
if (body.hint) form.append('hint', JSON.stringify(body.hint));
|
|
162
|
-
appendIf(form, 'template_id', body.template_id);
|
|
163
|
-
if (body.template) form.append('template', JSON.stringify(body.template));
|
|
164
|
-
appendIf(form, 'user_external_id', body.user_external_id);
|
|
165
|
-
if (body.user_metadata) form.append('user_metadata', JSON.stringify(body.user_metadata));
|
|
166
|
-
if (typeof body.archive === 'boolean') form.append('archive', String(body.archive));
|
|
167
|
-
if (typeof body.force === 'boolean') form.append('force', String(body.force));
|
|
168
|
-
if (body.processing) form.append('processing', body.processing);
|
|
169
|
-
return (
|
|
170
|
-
await AbyssToolsCore.axios.post(`rcb/extract`, form, {
|
|
171
|
-
headers: { ...authHeader(apiKey), ...extraHeaders },
|
|
172
|
-
maxBodyLength: Infinity,
|
|
173
|
-
maxContentLength: Infinity,
|
|
174
|
-
})
|
|
175
|
-
).data;
|
|
176
|
-
}
|
|
177
|
-
const FormDataCtor = await loadFormData();
|
|
178
|
-
const form = new FormDataCtor();
|
|
179
|
-
const buf = Buffer.isBuffer(body.pdf) ? body.pdf : Buffer.from(body.pdf);
|
|
180
|
-
form.append('file', buf, {
|
|
181
|
-
filename,
|
|
182
|
-
contentType: 'application/pdf',
|
|
183
|
-
});
|
|
184
|
-
appendIf(form, 'mode', body.mode);
|
|
185
|
-
if (body.hint) form.append('hint', JSON.stringify(body.hint));
|
|
186
|
-
appendIf(form, 'template_id', body.template_id);
|
|
187
|
-
if (body.template) form.append('template', JSON.stringify(body.template));
|
|
188
|
-
appendIf(form, 'user_external_id', body.user_external_id);
|
|
189
|
-
if (body.user_metadata) form.append('user_metadata', JSON.stringify(body.user_metadata));
|
|
190
|
-
if (typeof body.archive === 'boolean') form.append('archive', String(body.archive));
|
|
191
|
-
if (typeof body.force === 'boolean') form.append('force', String(body.force));
|
|
192
|
-
if (body.processing) form.append('processing', body.processing);
|
|
193
|
-
return (
|
|
194
|
-
await AbyssToolsCore.axios.post(`rcb/extract`, form, {
|
|
195
|
-
headers: {
|
|
196
|
-
...(typeof form.getHeaders === 'function' ? form.getHeaders() : {}),
|
|
197
|
-
...authHeader(apiKey),
|
|
198
|
-
...extraHeaders,
|
|
199
|
-
},
|
|
200
|
-
maxBodyLength: Infinity,
|
|
201
|
-
maxContentLength: Infinity,
|
|
202
|
-
})
|
|
203
|
-
).data;
|
|
204
|
-
}
|
|
205
|
-
// Strip `pdf` from the JSON body (only used for multipart upload above).
|
|
206
|
-
const jsonBody: Omit<IExtractRcbBody, 'pdf'> = { ...body };
|
|
207
|
-
delete (jsonBody as { pdf?: unknown }).pdf;
|
|
208
|
-
return (
|
|
209
|
-
await AbyssToolsCore.axios.post(`rcb/extract`, jsonBody, {
|
|
210
|
-
headers: { ...authHeader(apiKey), ...extraHeaders },
|
|
211
|
-
})
|
|
212
|
-
).data;
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
function appendIf(form: any, key: string, value: unknown): void {
|
|
216
|
-
if (value === undefined || value === null) return;
|
|
217
|
-
form.append(key, String(value));
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
export const extractBulkRcb = async (
|
|
221
|
-
body: IExtractBulkRcbBody,
|
|
222
|
-
apiKey?: string,
|
|
223
|
-
): Promise<IExtractBulkRcbResponse> => {
|
|
224
|
-
return (
|
|
225
|
-
await AbyssToolsCore.axios.post<IExtractBulkRcbResponse>(`rcb/extract/bulk`, body, {
|
|
226
|
-
headers: authHeader(apiKey),
|
|
227
|
-
})
|
|
228
|
-
).data;
|
|
229
|
-
};
|
|
230
|
-
|
|
231
|
-
// ─── DETECT ──────────────────────────────────
|
|
232
|
-
|
|
233
|
-
export const detectRcb = async (
|
|
234
|
-
pdf: Buffer | Uint8Array,
|
|
235
|
-
pdfFilename = 'rcb.pdf',
|
|
236
|
-
apiKey?: string,
|
|
237
|
-
): Promise<IDetectRcbResponse> => {
|
|
238
|
-
const isBrowser = typeof window !== 'undefined' && typeof FormData !== 'undefined';
|
|
239
|
-
if (isBrowser) {
|
|
240
|
-
const form = new FormData();
|
|
241
|
-
const blob = new Blob([pdf as Uint8Array], { type: 'application/pdf' });
|
|
242
|
-
form.append('file', blob, pdfFilename);
|
|
243
|
-
return (
|
|
244
|
-
await AbyssToolsCore.axios.post<IDetectRcbResponse>(`rcb/detect`, form, {
|
|
245
|
-
headers: authHeader(apiKey),
|
|
246
|
-
maxBodyLength: Infinity,
|
|
247
|
-
maxContentLength: Infinity,
|
|
248
|
-
})
|
|
249
|
-
).data;
|
|
250
|
-
}
|
|
251
|
-
const FormDataCtor = await loadFormData();
|
|
252
|
-
const form = new FormDataCtor();
|
|
253
|
-
const buf = Buffer.isBuffer(pdf) ? pdf : Buffer.from(pdf);
|
|
254
|
-
form.append('file', buf, { filename: pdfFilename, contentType: 'application/pdf' });
|
|
255
|
-
return (
|
|
256
|
-
await AbyssToolsCore.axios.post<IDetectRcbResponse>(`rcb/detect`, form, {
|
|
257
|
-
headers: {
|
|
258
|
-
...(typeof form.getHeaders === 'function' ? form.getHeaders() : {}),
|
|
259
|
-
...authHeader(apiKey),
|
|
260
|
-
},
|
|
261
|
-
maxBodyLength: Infinity,
|
|
262
|
-
maxContentLength: Infinity,
|
|
263
|
-
})
|
|
264
|
-
).data;
|
|
265
|
-
};
|
|
266
|
-
|
|
267
|
-
export const detectBulkRcb = async (
|
|
268
|
-
body: IDetectBulkRcbBody,
|
|
269
|
-
apiKey?: string,
|
|
270
|
-
): Promise<IDetectBulkRcbResponse> => {
|
|
271
|
-
return (
|
|
272
|
-
await AbyssToolsCore.axios.post<IDetectBulkRcbResponse>(`rcb/detect/bulk`, body, {
|
|
273
|
-
headers: authHeader(apiKey),
|
|
274
|
-
})
|
|
275
|
-
).data;
|
|
276
|
-
};
|
|
277
|
-
|
|
278
|
-
// ─── FILES ───────────────────────────────────
|
|
279
|
-
|
|
280
|
-
export const listFilesRcb = async (
|
|
281
|
-
query: IListFilesRcbQuery = {},
|
|
282
|
-
apiKey?: string,
|
|
283
|
-
): Promise<IListFilesRcbResponse> => {
|
|
284
|
-
return (
|
|
285
|
-
await AbyssToolsCore.axios.get<IListFilesRcbResponse>(`rcb/files`, {
|
|
286
|
-
params: serializeParams(query),
|
|
287
|
-
headers: authHeader(apiKey),
|
|
288
|
-
})
|
|
289
|
-
).data;
|
|
290
|
-
};
|
|
291
|
-
|
|
292
|
-
export const getFileRcb = async (fileId: string, apiKey?: string): Promise<IGetFileRcbResponse> => {
|
|
293
|
-
return (
|
|
294
|
-
await AbyssToolsCore.axios.get<IGetFileRcbResponse>(`rcb/files/${fileId}`, {
|
|
295
|
-
headers: authHeader(apiKey),
|
|
296
|
-
})
|
|
297
|
-
).data;
|
|
298
|
-
};
|
|
299
|
-
|
|
300
|
-
export const listFileExtractionsRcb = async (
|
|
301
|
-
fileId: string,
|
|
302
|
-
query: { limit?: number; offset?: number } = {},
|
|
303
|
-
apiKey?: string,
|
|
304
|
-
): Promise<IListFileExtractionsRcbResponse> => {
|
|
305
|
-
return (
|
|
306
|
-
await AbyssToolsCore.axios.get<IListFileExtractionsRcbResponse>(
|
|
307
|
-
`rcb/files/${fileId}/extractions`,
|
|
308
|
-
{ params: serializeParams(query), headers: authHeader(apiKey) },
|
|
309
|
-
)
|
|
310
|
-
).data;
|
|
311
|
-
};
|
|
312
|
-
|
|
313
|
-
export const patchFileRcb = async (
|
|
314
|
-
fileId: string,
|
|
315
|
-
body: IPatchFileRcbBody,
|
|
316
|
-
apiKey?: string,
|
|
317
|
-
): Promise<IGetFileRcbResponse> => {
|
|
318
|
-
return (
|
|
319
|
-
await AbyssToolsCore.axios.patch<IGetFileRcbResponse>(`rcb/files/${fileId}`, body, {
|
|
320
|
-
headers: authHeader(apiKey),
|
|
321
|
-
})
|
|
322
|
-
).data;
|
|
323
|
-
};
|
|
324
|
-
|
|
325
|
-
export const downloadFileBundleRcb = async (
|
|
326
|
-
fileId: string,
|
|
327
|
-
query: { format?: 'csv' | 'json' } = {},
|
|
328
|
-
apiKey?: string,
|
|
329
|
-
): Promise<Buffer> => {
|
|
330
|
-
const res = await AbyssToolsCore.axios.get(`rcb/files/${fileId}/bundle`, {
|
|
331
|
-
params: serializeParams(query),
|
|
332
|
-
responseType: 'arraybuffer',
|
|
333
|
-
headers: authHeader(apiKey),
|
|
334
|
-
});
|
|
335
|
-
return Buffer.from(res.data as ArrayBuffer);
|
|
336
|
-
};
|
|
337
|
-
|
|
338
|
-
// ─── EXTRACTIONS ─────────────────────────────
|
|
339
|
-
|
|
340
|
-
export const getExtractionRcb = async (
|
|
341
|
-
extractionId: string,
|
|
342
|
-
apiKey?: string,
|
|
343
|
-
): Promise<IGetExtractionRcbResponse> => {
|
|
344
|
-
return (
|
|
345
|
-
await AbyssToolsCore.axios.get<IGetExtractionRcbResponse>(`rcb/extractions/${extractionId}`, {
|
|
346
|
-
headers: authHeader(apiKey),
|
|
347
|
-
})
|
|
348
|
-
).data;
|
|
349
|
-
};
|
|
350
|
-
|
|
351
|
-
export const patchExtractionRcb = async (
|
|
352
|
-
extractionId: string,
|
|
353
|
-
body: IPatchExtractionRcbBody,
|
|
354
|
-
apiKey?: string,
|
|
355
|
-
): Promise<IGetExtractionRcbResponse> => {
|
|
356
|
-
return (
|
|
357
|
-
await AbyssToolsCore.axios.patch<IGetExtractionRcbResponse>(
|
|
358
|
-
`rcb/extractions/${extractionId}`,
|
|
359
|
-
body,
|
|
360
|
-
{ headers: authHeader(apiKey) },
|
|
361
|
-
)
|
|
362
|
-
).data;
|
|
363
|
-
};
|
|
364
|
-
|
|
365
|
-
export const searchExtractionRecordsRcb = async (
|
|
366
|
-
extractionId: string,
|
|
367
|
-
query: ISearchExtractionRecordsRcbQuery = {},
|
|
368
|
-
apiKey?: string,
|
|
369
|
-
): Promise<ISearchExtractionRecordsRcbResponse> => {
|
|
370
|
-
return (
|
|
371
|
-
await AbyssToolsCore.axios.get<ISearchExtractionRecordsRcbResponse>(
|
|
372
|
-
`rcb/extractions/${extractionId}/records`,
|
|
373
|
-
{ params: serializeParams(query), headers: authHeader(apiKey) },
|
|
374
|
-
)
|
|
375
|
-
).data;
|
|
376
|
-
};
|
|
377
|
-
|
|
378
|
-
export const exportExtractionRcb = async (
|
|
379
|
-
extractionId: string,
|
|
380
|
-
query: IExportExtractionRcbQuery,
|
|
381
|
-
apiKey?: string,
|
|
382
|
-
): Promise<{ body: string; contentType: string }> => {
|
|
383
|
-
const res = await AbyssToolsCore.axios.get(`rcb/extractions/${extractionId}/export`, {
|
|
384
|
-
params: serializeParams(query),
|
|
385
|
-
responseType: 'text',
|
|
386
|
-
transformResponse: (d) => d,
|
|
387
|
-
headers: authHeader(apiKey),
|
|
388
|
-
});
|
|
389
|
-
return {
|
|
390
|
-
body: typeof res.data === 'string' ? res.data : String(res.data),
|
|
391
|
-
contentType: String(res.headers?.['content-type'] ?? 'application/octet-stream'),
|
|
392
|
-
};
|
|
393
|
-
};
|
|
394
|
-
|
|
395
|
-
export const asyncExportExtractionRcb = async (
|
|
396
|
-
extractionId: string,
|
|
397
|
-
body: IAsyncExportExtractionRcbBody,
|
|
398
|
-
apiKey?: string,
|
|
399
|
-
): Promise<IAsyncExportRcbResponse> => {
|
|
400
|
-
return (
|
|
401
|
-
await AbyssToolsCore.axios.post<IAsyncExportRcbResponse>(
|
|
402
|
-
`rcb/extractions/${extractionId}/export/async`,
|
|
403
|
-
body,
|
|
404
|
-
{ headers: authHeader(apiKey) },
|
|
405
|
-
)
|
|
406
|
-
).data;
|
|
407
|
-
};
|
|
408
|
-
|
|
409
|
-
export const getExportJobRcb = async (
|
|
410
|
-
jobId: string,
|
|
411
|
-
apiKey?: string,
|
|
412
|
-
): Promise<IGetExportJobRcbResponse> => {
|
|
413
|
-
return (
|
|
414
|
-
await AbyssToolsCore.axios.get<IGetExportJobRcbResponse>(`rcb/exports/jobs/${jobId}`, {
|
|
415
|
-
headers: authHeader(apiKey),
|
|
416
|
-
})
|
|
417
|
-
).data;
|
|
418
|
-
};
|
|
419
|
-
|
|
420
|
-
export const diffExtractionsRcb = async (
|
|
421
|
-
extractionId: string,
|
|
422
|
-
otherId: string,
|
|
423
|
-
apiKey?: string,
|
|
424
|
-
): Promise<IDiffExtractionsRcbResponse> => {
|
|
425
|
-
return (
|
|
426
|
-
await AbyssToolsCore.axios.get<IDiffExtractionsRcbResponse>(
|
|
427
|
-
`rcb/extractions/${extractionId}/diff/${otherId}`,
|
|
428
|
-
{ headers: authHeader(apiKey) },
|
|
429
|
-
)
|
|
430
|
-
).data;
|
|
431
|
-
};
|
|
432
|
-
|
|
433
|
-
// ─── TEMPLATES ───────────────────────────────
|
|
434
|
-
|
|
435
|
-
export const listTemplatesRcb = async (apiKey?: string): Promise<IListTemplatesRcbResponse> => {
|
|
436
|
-
return (
|
|
437
|
-
await AbyssToolsCore.axios.get<IListTemplatesRcbResponse>(`rcb/templates`, {
|
|
438
|
-
headers: authHeader(apiKey),
|
|
439
|
-
})
|
|
440
|
-
).data;
|
|
441
|
-
};
|
|
442
|
-
|
|
443
|
-
export const createTemplateRcb = async (
|
|
444
|
-
body: ICreateTemplateRcbBody,
|
|
445
|
-
apiKey?: string,
|
|
446
|
-
): Promise<ICreateTemplateRcbResponse> => {
|
|
447
|
-
return (
|
|
448
|
-
await AbyssToolsCore.axios.post<ICreateTemplateRcbResponse>(`rcb/templates`, body, {
|
|
449
|
-
headers: authHeader(apiKey),
|
|
450
|
-
})
|
|
451
|
-
).data;
|
|
452
|
-
};
|
|
453
|
-
|
|
454
|
-
export const getTemplateRcb = async (
|
|
455
|
-
templateId: string,
|
|
456
|
-
apiKey?: string,
|
|
457
|
-
): Promise<IGetTemplateRcbResponse> => {
|
|
458
|
-
return (
|
|
459
|
-
await AbyssToolsCore.axios.get<IGetTemplateRcbResponse>(`rcb/templates/${templateId}`, {
|
|
460
|
-
headers: authHeader(apiKey),
|
|
461
|
-
})
|
|
462
|
-
).data;
|
|
463
|
-
};
|
|
464
|
-
|
|
465
|
-
export const updateTemplateRcb = async (
|
|
466
|
-
templateId: string,
|
|
467
|
-
body: IUpdateTemplateRcbBody,
|
|
468
|
-
apiKey?: string,
|
|
469
|
-
): Promise<IUpdateTemplateRcbResponse> => {
|
|
470
|
-
return (
|
|
471
|
-
await AbyssToolsCore.axios.put<IUpdateTemplateRcbResponse>(
|
|
472
|
-
`rcb/templates/${templateId}`,
|
|
473
|
-
body,
|
|
474
|
-
{ headers: authHeader(apiKey) },
|
|
475
|
-
)
|
|
476
|
-
).data;
|
|
477
|
-
};
|
|
478
|
-
|
|
479
|
-
export const patchTemplateMetaRcb = async (
|
|
480
|
-
templateId: string,
|
|
481
|
-
body: IPatchTemplateMetaRcbBody,
|
|
482
|
-
apiKey?: string,
|
|
483
|
-
): Promise<void> => {
|
|
484
|
-
await AbyssToolsCore.axios.patch(`rcb/templates/${templateId}/meta`, body, {
|
|
485
|
-
headers: authHeader(apiKey),
|
|
486
|
-
});
|
|
487
|
-
};
|
|
488
|
-
|
|
489
|
-
export const deleteTemplateRcb = async (templateId: string, apiKey?: string): Promise<void> => {
|
|
490
|
-
await AbyssToolsCore.axios.delete(`rcb/templates/${templateId}`, {
|
|
491
|
-
headers: authHeader(apiKey),
|
|
492
|
-
});
|
|
493
|
-
};
|
|
494
|
-
|
|
495
|
-
export const listTemplateVersionsRcb = async (
|
|
496
|
-
templateId: string,
|
|
497
|
-
apiKey?: string,
|
|
498
|
-
): Promise<IListTemplateVersionsRcbResponse> => {
|
|
499
|
-
return (
|
|
500
|
-
await AbyssToolsCore.axios.get<IListTemplateVersionsRcbResponse>(
|
|
501
|
-
`rcb/templates/${templateId}/versions`,
|
|
502
|
-
{ headers: authHeader(apiKey) },
|
|
503
|
-
)
|
|
504
|
-
).data;
|
|
505
|
-
};
|
|
506
|
-
|
|
507
|
-
export const exportTemplateCollectionRcb = async (
|
|
508
|
-
ids: string[] | null,
|
|
509
|
-
apiKey?: string,
|
|
510
|
-
): Promise<IRcbTemplateCollection> => {
|
|
511
|
-
const res = await AbyssToolsCore.axios.get<IRcbTemplateCollection>(`rcb/templates/export`, {
|
|
512
|
-
params: ids && ids.length ? { ids: ids.join(',') } : {},
|
|
513
|
-
headers: authHeader(apiKey),
|
|
514
|
-
responseType: 'json',
|
|
515
|
-
});
|
|
516
|
-
return res.data;
|
|
517
|
-
};
|
|
518
|
-
|
|
519
|
-
export const importTemplateCollectionRcb = async (
|
|
520
|
-
doc: IRcbTemplateCollection,
|
|
521
|
-
apiKey?: string,
|
|
522
|
-
): Promise<IImportTemplateCollectionRcbResponse> => {
|
|
523
|
-
return (
|
|
524
|
-
await AbyssToolsCore.axios.post<IImportTemplateCollectionRcbResponse>(
|
|
525
|
-
`rcb/templates/import`,
|
|
526
|
-
doc,
|
|
527
|
-
{ headers: authHeader(apiKey) },
|
|
528
|
-
)
|
|
529
|
-
).data;
|
|
530
|
-
};
|
|
531
|
-
|
|
532
|
-
// ─── JOBS ────────────────────────────────────
|
|
533
|
-
|
|
534
|
-
export const getJobRcb = async (jobId: string, apiKey?: string): Promise<IGetJobRcbResponse> => {
|
|
535
|
-
return (
|
|
536
|
-
await AbyssToolsCore.axios.get<IGetJobRcbResponse>(`rcb/jobs/${jobId}`, {
|
|
537
|
-
headers: authHeader(apiKey),
|
|
538
|
-
})
|
|
539
|
-
).data;
|
|
540
|
-
};
|
|
541
|
-
|
|
542
|
-
export const retryJobRcb = async (jobId: string, apiKey?: string): Promise<void> => {
|
|
543
|
-
await AbyssToolsCore.axios.post(`rcb/jobs/${jobId}/retry`, undefined, {
|
|
544
|
-
headers: authHeader(apiKey),
|
|
545
|
-
});
|
|
546
|
-
};
|
|
547
|
-
|
|
548
|
-
export const cancelJobRcb = async (jobId: string, apiKey?: string): Promise<void> => {
|
|
549
|
-
await AbyssToolsCore.axios.delete(`rcb/jobs/${jobId}`, { headers: authHeader(apiKey) });
|
|
550
|
-
};
|
|
551
|
-
|
|
552
|
-
// ─── FEEDBACK ────────────────────────────────
|
|
553
|
-
|
|
554
|
-
export const submitFeedbackRcb = async (
|
|
555
|
-
body: ICreateFeedbackRcbBody,
|
|
556
|
-
apiKey?: string,
|
|
557
|
-
): Promise<ICreateFeedbackRcbResponse> => {
|
|
558
|
-
return (
|
|
559
|
-
await AbyssToolsCore.axios.post<ICreateFeedbackRcbResponse>(`rcb/feedback`, body, {
|
|
560
|
-
headers: authHeader(apiKey),
|
|
561
|
-
})
|
|
562
|
-
).data;
|
|
563
|
-
};
|
|
564
|
-
|
|
565
|
-
export const listFeedbackRcb = async (
|
|
566
|
-
query: IListFeedbackRcbQuery = {},
|
|
567
|
-
apiKey?: string,
|
|
568
|
-
): Promise<IListFeedbackRcbResponse> => {
|
|
569
|
-
return (
|
|
570
|
-
await AbyssToolsCore.axios.get<IListFeedbackRcbResponse>(`rcb/feedback`, {
|
|
571
|
-
params: serializeParams(query),
|
|
572
|
-
headers: authHeader(apiKey),
|
|
573
|
-
})
|
|
574
|
-
).data;
|
|
575
|
-
};
|
|
576
|
-
|
|
577
|
-
export const getFeedbackRcb = async (
|
|
578
|
-
feedbackId: string,
|
|
579
|
-
apiKey?: string,
|
|
580
|
-
): Promise<IGetFeedbackRcbResponse> => {
|
|
581
|
-
return (
|
|
582
|
-
await AbyssToolsCore.axios.get<IGetFeedbackRcbResponse>(`rcb/feedback/${feedbackId}`, {
|
|
583
|
-
headers: authHeader(apiKey),
|
|
584
|
-
})
|
|
585
|
-
).data;
|
|
586
|
-
};
|
|
587
|
-
|
|
588
|
-
export const patchFeedbackRcb = async (
|
|
589
|
-
feedbackId: string,
|
|
590
|
-
body: IPatchFeedbackRcbBody,
|
|
591
|
-
apiKey?: string,
|
|
592
|
-
): Promise<IGetFeedbackRcbResponse> => {
|
|
593
|
-
return (
|
|
594
|
-
await AbyssToolsCore.axios.patch<IGetFeedbackRcbResponse>(`rcb/feedback/${feedbackId}`, body, {
|
|
595
|
-
headers: authHeader(apiKey),
|
|
596
|
-
})
|
|
597
|
-
).data;
|
|
598
|
-
};
|
|
599
|
-
|
|
600
|
-
// ─── HEALTH / STATS / USAGE / QUOTA ─────────
|
|
601
|
-
|
|
602
|
-
export const healthRcb = async (apiKey?: string): Promise<IHealthRcbResponse> => {
|
|
603
|
-
return (
|
|
604
|
-
await AbyssToolsCore.axios.get<IHealthRcbResponse>(`rcb/health`, {
|
|
605
|
-
headers: authHeader(apiKey),
|
|
606
|
-
})
|
|
607
|
-
).data;
|
|
608
|
-
};
|
|
609
|
-
|
|
610
|
-
export const statsRcb = async (apiKey?: string): Promise<IStatsRcbResponse> => {
|
|
611
|
-
return (
|
|
612
|
-
await AbyssToolsCore.axios.get<IStatsRcbResponse>(`rcb/stats`, {
|
|
613
|
-
headers: authHeader(apiKey),
|
|
614
|
-
})
|
|
615
|
-
).data;
|
|
616
|
-
};
|
|
617
|
-
|
|
618
|
-
export const listUsageRcb = async (
|
|
619
|
-
query: IListUsageRcbQuery = {},
|
|
620
|
-
apiKey?: string,
|
|
621
|
-
): Promise<{ data: unknown[]; total?: number }> => {
|
|
622
|
-
return (
|
|
623
|
-
await AbyssToolsCore.axios.get<{ data: unknown[]; total?: number }>(`rcb/usage`, {
|
|
624
|
-
params: serializeParams(query),
|
|
625
|
-
headers: authHeader(apiKey),
|
|
626
|
-
})
|
|
627
|
-
).data;
|
|
628
|
-
};
|
|
629
|
-
|
|
630
|
-
export const summaryUsageRcb = async (
|
|
631
|
-
query: ISummaryUsageRcbQuery = {},
|
|
632
|
-
apiKey?: string,
|
|
633
|
-
): Promise<ISummaryUsageRcbResponse> => {
|
|
634
|
-
return (
|
|
635
|
-
await AbyssToolsCore.axios.get<ISummaryUsageRcbResponse>(`rcb/usage/summary`, {
|
|
636
|
-
params: serializeParams(query),
|
|
637
|
-
headers: authHeader(apiKey),
|
|
638
|
-
})
|
|
639
|
-
).data;
|
|
640
|
-
};
|
|
641
|
-
|
|
642
|
-
export const getQuotaRcb = async (apiKey?: string): Promise<IGetQuotaRcbResponse> => {
|
|
643
|
-
return (
|
|
644
|
-
await AbyssToolsCore.axios.get<IGetQuotaRcbResponse>(`rcb/quota`, {
|
|
645
|
-
headers: authHeader(apiKey),
|
|
646
|
-
})
|
|
647
|
-
).data;
|
|
648
|
-
};
|
|
649
|
-
|
|
650
|
-
// ─── SHARED FILES (content_share-backed) ────
|
|
651
|
-
//
|
|
652
|
-
// Types live in `../types/interface/api/requests/rcb.request.ts` so they
|
|
653
|
-
// stay alongside every other RCB SDK contract.
|
|
654
|
-
|
|
655
|
-
export const listSharedFilesRcb = async (
|
|
656
|
-
query: IListSharedFilesRcbQuery = {},
|
|
657
|
-
apiKey?: string,
|
|
658
|
-
): Promise<IListFilesRcbResponse> =>
|
|
659
|
-
(
|
|
660
|
-
await AbyssToolsCore.axios.get<IListFilesRcbResponse>(`rcb/files/shared`, {
|
|
661
|
-
params: serializeParams(query),
|
|
662
|
-
headers: authHeader(apiKey),
|
|
663
|
-
})
|
|
664
|
-
).data;
|
|
665
|
-
|
|
666
|
-
// ─── WEBHOOK DELIVERIES ─────────────────────
|
|
667
|
-
|
|
668
|
-
export const listWebhookDeliveriesRcb = async (
|
|
669
|
-
query: IListWebhookDeliveriesRcbQuery = {},
|
|
670
|
-
apiKey?: string,
|
|
671
|
-
): Promise<IListWebhookDeliveriesRcbResponse> => {
|
|
672
|
-
return (
|
|
673
|
-
await AbyssToolsCore.axios.get<IListWebhookDeliveriesRcbResponse>(`rcb/webhooks/deliveries`, {
|
|
674
|
-
params: serializeParams(query),
|
|
675
|
-
headers: authHeader(apiKey),
|
|
676
|
-
})
|
|
677
|
-
).data;
|
|
678
|
-
};
|
|
679
|
-
|
|
680
|
-
export const getWebhookDeliveryRcb = async (
|
|
681
|
-
deliveryId: string,
|
|
682
|
-
apiKey?: string,
|
|
683
|
-
): Promise<IGetWebhookDeliveryRcbResponse> => {
|
|
684
|
-
return (
|
|
685
|
-
await AbyssToolsCore.axios.get<IGetWebhookDeliveryRcbResponse>(
|
|
686
|
-
`rcb/webhooks/deliveries/${deliveryId}`,
|
|
687
|
-
{ headers: authHeader(apiKey) },
|
|
688
|
-
)
|
|
689
|
-
).data;
|
|
690
|
-
};
|
|
691
|
-
|
|
692
|
-
export const replayWebhookDeliveryRcb = async (
|
|
693
|
-
deliveryId: string,
|
|
694
|
-
body: IReplayWebhookDeliveryRcbBody = {},
|
|
695
|
-
apiKey?: string,
|
|
696
|
-
): Promise<IGetWebhookDeliveryRcbResponse> => {
|
|
697
|
-
return (
|
|
698
|
-
await AbyssToolsCore.axios.post<IGetWebhookDeliveryRcbResponse>(
|
|
699
|
-
`rcb/webhooks/deliveries/${deliveryId}/replay`,
|
|
700
|
-
body,
|
|
701
|
-
{ headers: authHeader(apiKey) },
|
|
702
|
-
)
|
|
703
|
-
).data;
|
|
704
|
-
};
|
|
705
|
-
|
|
706
|
-
// ─── WEBHOOK SUBSCRIPTIONS (CRUD) ───────────
|
|
707
|
-
//
|
|
708
|
-
// Request / response types are defined alongside every other RCB SDK
|
|
709
|
-
// contract — see ../types/interface/api/{requests,responses}/rcb.*.ts.
|
|
710
|
-
|
|
711
|
-
export const paginateRcbWebhook = async (
|
|
712
|
-
query: IPaginateRcbWebhookQuery = {},
|
|
713
|
-
apiKey?: string,
|
|
714
|
-
): Promise<IPaginateRcbWebhookResponse> =>
|
|
715
|
-
(
|
|
716
|
-
await AbyssToolsCore.axios.get<IPaginateRcbWebhookResponse>(`rcb/webhook`, {
|
|
717
|
-
params: serializeParams(query),
|
|
718
|
-
headers: authHeader(apiKey),
|
|
719
|
-
})
|
|
720
|
-
).data;
|
|
721
|
-
|
|
722
|
-
export const getRcbWebhook = async (
|
|
723
|
-
webhookId: string,
|
|
724
|
-
scope: IRcbWebhookScopeQuery = {},
|
|
725
|
-
apiKey?: string,
|
|
726
|
-
): Promise<IGetRcbWebhookResponse> =>
|
|
727
|
-
(
|
|
728
|
-
await AbyssToolsCore.axios.get<IGetRcbWebhookResponse>(
|
|
729
|
-
`rcb/webhook/${webhookId}`,
|
|
730
|
-
{ params: serializeParams(scope), headers: authHeader(apiKey) },
|
|
731
|
-
)
|
|
732
|
-
).data;
|
|
733
|
-
|
|
734
|
-
export const createRcbWebhook = async (
|
|
735
|
-
body: ICreateRcbWebhookBody,
|
|
736
|
-
scope: IRcbWebhookScopeQuery = {},
|
|
737
|
-
apiKey?: string,
|
|
738
|
-
): Promise<ICreateRcbWebhookResponse> =>
|
|
739
|
-
(
|
|
740
|
-
await AbyssToolsCore.axios.post<ICreateRcbWebhookResponse>(
|
|
741
|
-
`rcb/webhook`,
|
|
742
|
-
body,
|
|
743
|
-
{ params: serializeParams(scope), headers: authHeader(apiKey) },
|
|
744
|
-
)
|
|
745
|
-
).data;
|
|
746
|
-
|
|
747
|
-
export const updateRcbWebhook = async (
|
|
748
|
-
webhookId: string,
|
|
749
|
-
body: IUpdateRcbWebhookBody,
|
|
750
|
-
scope: IRcbWebhookScopeQuery = {},
|
|
751
|
-
apiKey?: string,
|
|
752
|
-
): Promise<IUpdateRcbWebhookResponse> =>
|
|
753
|
-
(
|
|
754
|
-
await AbyssToolsCore.axios.put<IUpdateRcbWebhookResponse>(
|
|
755
|
-
`rcb/webhook/${webhookId}`,
|
|
756
|
-
body,
|
|
757
|
-
{ params: serializeParams(scope), headers: authHeader(apiKey) },
|
|
758
|
-
)
|
|
759
|
-
).data;
|
|
760
|
-
|
|
761
|
-
export const deleteRcbWebhook = async (
|
|
762
|
-
webhookId: string,
|
|
763
|
-
scope: IRcbWebhookScopeQuery = {},
|
|
764
|
-
apiKey?: string,
|
|
765
|
-
): Promise<IDeleteRcbWebhookResponse> =>
|
|
766
|
-
(
|
|
767
|
-
await AbyssToolsCore.axios.delete<IDeleteRcbWebhookResponse>(
|
|
768
|
-
`rcb/webhook/${webhookId}`,
|
|
769
|
-
{ params: serializeParams(scope), headers: authHeader(apiKey) },
|
|
770
|
-
)
|
|
771
|
-
).data;
|
|
772
|
-
|
|
773
|
-
export const resetSecretRcbWebhook = async (
|
|
774
|
-
webhookId: string,
|
|
775
|
-
scope: IRcbWebhookScopeQuery = {},
|
|
776
|
-
apiKey?: string,
|
|
777
|
-
): Promise<IResetSecretRcbWebhookResponse> =>
|
|
778
|
-
(
|
|
779
|
-
await AbyssToolsCore.axios.post<IResetSecretRcbWebhookResponse>(
|
|
780
|
-
`rcb/webhook/${webhookId}/reset-secret`,
|
|
781
|
-
undefined,
|
|
782
|
-
{ params: serializeParams(scope), headers: authHeader(apiKey) },
|
|
783
|
-
)
|
|
784
|
-
).data;
|
|
785
|
-
|
|
786
|
-
// ─── SHARE ───────────────────────────────────
|
|
787
|
-
|
|
788
|
-
export const mintShareExtractionRcb = async (
|
|
789
|
-
extractionId: string,
|
|
790
|
-
body: IMintShareExtractionRcbBody = {},
|
|
791
|
-
apiKey?: string,
|
|
792
|
-
): Promise<IMintShareExtractionRcbResponse> => {
|
|
793
|
-
return (
|
|
794
|
-
await AbyssToolsCore.axios.post<IMintShareExtractionRcbResponse>(
|
|
795
|
-
`rcb/share/owner/extractions/${extractionId}`,
|
|
796
|
-
body,
|
|
797
|
-
{ headers: authHeader(apiKey) },
|
|
798
|
-
)
|
|
799
|
-
).data;
|
|
800
|
-
};
|
|
801
|
-
|
|
802
|
-
export const revokeShareExtractionRcb = async (
|
|
803
|
-
extractionId: string,
|
|
804
|
-
apiKey?: string,
|
|
805
|
-
): Promise<void> => {
|
|
806
|
-
await AbyssToolsCore.axios.delete(`rcb/share/owner/extractions/${extractionId}`, {
|
|
807
|
-
headers: authHeader(apiKey),
|
|
808
|
-
});
|
|
809
|
-
};
|
|
810
|
-
|
|
811
|
-
export const getSharedExtractionRcbPublic = async (
|
|
812
|
-
token: string,
|
|
813
|
-
): Promise<IGetSharedExtractionRcbResponse> => {
|
|
814
|
-
return (
|
|
815
|
-
await AbyssToolsCore.axios.get<IGetSharedExtractionRcbResponse>(
|
|
816
|
-
`rcb/share/extractions/${token}`,
|
|
817
|
-
)
|
|
818
|
-
).data;
|
|
819
|
-
};
|
|
820
|
-
|
|
821
|
-
// ─── CHANGELOG ──────────────────────────────
|
|
822
|
-
|
|
823
|
-
export const changelogRcb = async (apiKey?: string): Promise<IChangelogRcbResponse> => {
|
|
824
|
-
return (
|
|
825
|
-
await AbyssToolsCore.axios.get<IChangelogRcbResponse>(`rcb/changelog`, {
|
|
826
|
-
headers: authHeader(apiKey),
|
|
827
|
-
})
|
|
828
|
-
).data;
|
|
829
|
-
};
|