@robosystems/client 0.3.33 → 0.3.35
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/artifacts/LedgerClient.d.ts +66 -1
- package/artifacts/LedgerClient.js +92 -1
- package/artifacts/LedgerClient.ts +143 -1
- package/artifacts/graphql/generated/graphql.d.ts +17 -0
- package/artifacts/graphql/generated/graphql.js +48 -1
- package/artifacts/graphql/generated/graphql.ts +60 -0
- package/artifacts/graphql/queries/ledger/elements.js +1 -0
- package/artifacts/graphql/queries/ledger/elements.ts +1 -0
- package/artifacts/graphql/queries/ledger/mappingCandidates.d.ts +8 -0
- package/artifacts/graphql/queries/ledger/mappingCandidates.js +21 -0
- package/artifacts/graphql/queries/ledger/mappingCandidates.ts +19 -0
- package/index.ts +2 -2
- package/package.json +1 -1
- package/sdk/index.d.ts +2 -2
- package/sdk/index.js +4 -3
- package/sdk/index.ts +2 -2
- package/sdk/sdk.gen.d.ts +8 -2
- package/sdk/sdk.gen.js +13 -2
- package/sdk/sdk.gen.ts +13 -2
- package/sdk/types.gen.d.ts +84 -0
- package/sdk/types.gen.ts +90 -0
- package/sdk.gen.d.ts +8 -2
- package/sdk.gen.js +13 -2
- package/sdk.gen.ts +13 -2
- package/types.gen.d.ts +84 -0
- package/types.gen.ts +90 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AssociationResponse, AutoMapElementsOperation, CreateAgentRequest, CreateEventBlockRequest, CreateEventHandlerRequest, CreateInformationBlockRequest, CreateMappingAssociationOperation, CreateTaxonomyBlockRequest, CreateViewRequest, DeleteInformationBlockRequest, DeleteInformationBlockResponse, DeleteMappingAssociationOperation, DeleteResult, DeleteTaxonomyBlockRequest, DeleteTaxonomyBlockResponse, EntityTaxonomyResponse, EvaluateRulesRequest, EvaluateRulesResponse, EventBlockEnvelope, EventHandlerResponse, FinancialStatementAnalysisRequest, InformationBlockEnvelope, JournalEntryResponse, LedgerAgentResponse, LinkEntityTaxonomyRequest, LiveFinancialStatementRequest, OperationEnvelope, PreviewEventBlockResponse, PublishListMemberResponse, PublishListResponse, ReportResponse, ShareReportResponse, TaxonomyBlockEnvelope, UpdateAgentRequest, UpdateEntityRequest, UpdateEventBlockRequest, UpdateEventHandlerRequest, UpdateInformationBlockRequest, UpdateJournalEntryRequest, UpdateTaxonomyBlockRequest } from '../types.gen';
|
|
2
2
|
import type { TokenProvider } from './graphql/client';
|
|
3
|
-
import { type GetInformationBlockQuery, type GetLedgerAccountRollupsQuery, type GetLedgerAccountTreeQuery, type GetLedgerAgentQuery, type GetLedgerClosingBookStructuresQuery, type GetLedgerEntityQuery, type GetLedgerEventBlockQuery, type GetLedgerFiscalCalendarQuery, type GetLedgerMappedTrialBalanceQuery, type GetLedgerMappingCoverageQuery, type GetLedgerMappingQuery, type GetLedgerPeriodCloseStatusQuery, type GetLedgerPeriodDraftsQuery, type GetLedgerPublishListQuery, type GetLedgerReportingTaxonomyQuery, type GetLedgerReportPackageQuery, type GetLedgerReportQuery, type GetLedgerStatementQuery, type GetLedgerSummaryQuery, type GetLedgerTransactionQuery, type GetLedgerTrialBalanceQuery, type ListInformationBlocksQuery, type ListLedgerAccountsQuery, type ListLedgerAgentsQuery, type ListLedgerElementsQuery, type ListLedgerEntitiesQuery, type ListLedgerEventBlocksQuery, type ListLedgerMappingsQuery, type ListLedgerPublishListsQuery, type ListLedgerReportsQuery, type ListLedgerStructuresQuery, type ListLedgerTaxonomiesQuery, type ListLedgerTransactionsQuery, type ListLedgerUnmappedElementsQuery } from './graphql/generated/graphql';
|
|
3
|
+
import { type GetInformationBlockQuery, type GetLedgerAccountRollupsQuery, type GetLedgerAccountTreeQuery, type GetLedgerAgentQuery, type GetLedgerClosingBookStructuresQuery, type GetLedgerEntityQuery, type GetLedgerEventBlockQuery, type GetLedgerFiscalCalendarQuery, type GetLedgerMappedTrialBalanceQuery, type GetLedgerMappingCoverageQuery, type GetLedgerMappingQuery, type GetLedgerPeriodCloseStatusQuery, type GetLedgerPeriodDraftsQuery, type GetLedgerPublishListQuery, type GetLedgerReportingTaxonomyQuery, type GetLedgerReportPackageQuery, type GetLedgerReportQuery, type GetLedgerStatementQuery, type GetLedgerSummaryQuery, type GetLedgerTransactionQuery, type GetLedgerTrialBalanceQuery, type ListInformationBlocksQuery, type ListLedgerAccountsQuery, type ListLedgerAgentsQuery, type ListLedgerElementsQuery, type ListLedgerEntitiesQuery, type ListLedgerEventBlocksQuery, type ListLedgerMappingsQuery, type ListLedgerPublishListsQuery, type ListLedgerReportsQuery, type ListLedgerStructuresQuery, type ListLedgerTaxonomiesQuery, type ListLedgerTransactionsQuery, type ListLedgerUnmappedElementsQuery, type MappingCandidatesQuery } from './graphql/generated/graphql';
|
|
4
4
|
export type LedgerEntity = NonNullable<GetLedgerEntityQuery['entity']>;
|
|
5
5
|
export type LedgerEntitySummary = ListLedgerEntitiesQuery['entities'][number];
|
|
6
6
|
export type LedgerSummary = NonNullable<GetLedgerSummaryQuery['summary']>;
|
|
@@ -22,6 +22,7 @@ export type LedgerTaxonomyList = NonNullable<ListLedgerTaxonomiesQuery['taxonomi
|
|
|
22
22
|
export type LedgerTaxonomy = LedgerTaxonomyList['taxonomies'][number];
|
|
23
23
|
export type LedgerElementList = NonNullable<ListLedgerElementsQuery['elements']>;
|
|
24
24
|
export type LedgerElement = LedgerElementList['elements'][number];
|
|
25
|
+
export type LedgerMappingCandidate = MappingCandidatesQuery['mappingCandidates'][number];
|
|
25
26
|
export type LedgerUnmappedElement = ListLedgerUnmappedElementsQuery['unmappedElements'][number];
|
|
26
27
|
export type LedgerStructureList = NonNullable<ListLedgerStructuresQuery['structures']>;
|
|
27
28
|
export type LedgerStructure = LedgerStructureList['structures'][number];
|
|
@@ -52,6 +53,27 @@ export type StatementRow = StatementData['rows'][number];
|
|
|
52
53
|
export type PublishList = NonNullable<ListLedgerPublishListsQuery['publishLists']>['publishLists'][number];
|
|
53
54
|
export type PublishListDetail = NonNullable<GetLedgerPublishListQuery['publishList']>;
|
|
54
55
|
export type PublishListMember = PublishListDetail['members'][number];
|
|
56
|
+
/**
|
|
57
|
+
* Presigned-URL response for a Report bundle download.
|
|
58
|
+
*
|
|
59
|
+
* Returned by ``LedgerClient.getReportBundleDownloadUrl`` — the
|
|
60
|
+
* ``downloadUrl`` is a time-limited URL that streams the
|
|
61
|
+
* serialization artifact directly from object storage. Browser
|
|
62
|
+
* callers typically follow the URL via ``window.location.href`` or
|
|
63
|
+
* an anchor element to trigger the file download.
|
|
64
|
+
*/
|
|
65
|
+
export interface ReportBundleDownloadResponse {
|
|
66
|
+
/** Presigned URL that streams the bundle directly from S3. */
|
|
67
|
+
downloadUrl: string;
|
|
68
|
+
/** ISO-8601 UTC instant at which the presigned URL stops working. */
|
|
69
|
+
expiresAt: string;
|
|
70
|
+
/** MIME type of the artifact behind the URL. */
|
|
71
|
+
contentType: string;
|
|
72
|
+
/** Serialization flavor — ``jsonld`` is the Phase 1a default. */
|
|
73
|
+
format: string;
|
|
74
|
+
/** Bundle generation number stamped on the Report. */
|
|
75
|
+
generationCount: number;
|
|
76
|
+
}
|
|
55
77
|
export interface PeriodSpecInput {
|
|
56
78
|
start: string;
|
|
57
79
|
end: string;
|
|
@@ -299,6 +321,14 @@ export declare class LedgerClient {
|
|
|
299
321
|
limit?: number;
|
|
300
322
|
offset?: number;
|
|
301
323
|
}): Promise<LedgerElementList | null>;
|
|
324
|
+
/**
|
|
325
|
+
* rs-gaap concepts a CoA element of the given EFS `classification`
|
|
326
|
+
* (asset / liability / equity / revenue / expense) may map to — limited
|
|
327
|
+
* to concepts that render under the graph's active Reporting Style, with
|
|
328
|
+
* statement-level subtotals excluded. Use this to populate the mapping
|
|
329
|
+
* picker so it never offers an unreachable target.
|
|
330
|
+
*/
|
|
331
|
+
getMappingCandidates(graphId: string, classification: string): Promise<LedgerMappingCandidate[]>;
|
|
302
332
|
/** CoA elements not yet mapped to a reporting concept. */
|
|
303
333
|
listUnmappedElements(graphId: string, options?: {
|
|
304
334
|
mappingId?: string;
|
|
@@ -553,6 +583,32 @@ export declare class LedgerClient {
|
|
|
553
583
|
regenerateReport(graphId: string, reportId: string, periodStart?: string, periodEnd?: string): Promise<ReportOperationAck<ReportResponse>>;
|
|
554
584
|
/** Delete a report and its generated facts. */
|
|
555
585
|
deleteReport(graphId: string, reportId: string): Promise<DeleteResult>;
|
|
586
|
+
/**
|
|
587
|
+
* Get a short-lived presigned URL for downloading a published
|
|
588
|
+
* Report's serialization bundle.
|
|
589
|
+
*
|
|
590
|
+
* Phase 1a only resolves the JSON-LD flavor; reserved RDF and XBRL
|
|
591
|
+
* flavors return HTTP 400 until their producers ship. Reports
|
|
592
|
+
* published before the serialization feature shipped will resolve
|
|
593
|
+
* to a 404 — those Reports have no stamped bundle_url and must be
|
|
594
|
+
* regenerated to produce one.
|
|
595
|
+
*
|
|
596
|
+
* The returned ``downloadUrl`` is a presigned S3 URL valid for
|
|
597
|
+
* ``expiresIn`` seconds (default 300, max 3600). Browser callers
|
|
598
|
+
* typically navigate to it via ``window.location.href`` (or assign
|
|
599
|
+
* to an `<a href>` and click) to trigger the file download; the
|
|
600
|
+
* server-set Content-Disposition forces "attachment" with a
|
|
601
|
+
* versioned filename.
|
|
602
|
+
*
|
|
603
|
+
* @param graphId Graph identifier owning the Report.
|
|
604
|
+
* @param reportId Report identifier (rpt_-prefixed ULID).
|
|
605
|
+
* @param options.format Serialization flavor — defaults to ``'jsonld'``.
|
|
606
|
+
* @param options.expiresIn Presigned URL lifetime, in seconds.
|
|
607
|
+
*/
|
|
608
|
+
getReportBundleDownloadUrl(graphId: string, reportId: string, options?: {
|
|
609
|
+
format?: string;
|
|
610
|
+
expiresIn?: number;
|
|
611
|
+
}): Promise<ReportBundleDownloadResponse>;
|
|
556
612
|
/**
|
|
557
613
|
* Share a published report to every member of a publish list. Each
|
|
558
614
|
* target graph receives a snapshot copy of the report's facts.
|
|
@@ -609,5 +665,14 @@ export declare class LedgerClient {
|
|
|
609
665
|
* sign that a synchronous operation failed silently.
|
|
610
666
|
*/
|
|
611
667
|
private requireResult;
|
|
668
|
+
/**
|
|
669
|
+
* Resolve the current bearer token / API key for non-GraphQL REST
|
|
670
|
+
* calls. Mirrors the GraphQL client's behaviour — dynamic
|
|
671
|
+
* ``tokenProvider`` is consulted first (so JWT rotation flows
|
|
672
|
+
* naturally), then the static ``token`` config. Returns ``null``
|
|
673
|
+
* when no credential is configured; the caller decides whether to
|
|
674
|
+
* proceed anonymously or short-circuit with an error.
|
|
675
|
+
*/
|
|
676
|
+
private resolveToken;
|
|
612
677
|
}
|
|
613
678
|
export {};
|
|
@@ -182,6 +182,16 @@ class LedgerClient {
|
|
|
182
182
|
offset: options?.offset ?? 0,
|
|
183
183
|
}, 'List elements', (data) => data.elements);
|
|
184
184
|
}
|
|
185
|
+
/**
|
|
186
|
+
* rs-gaap concepts a CoA element of the given EFS `classification`
|
|
187
|
+
* (asset / liability / equity / revenue / expense) may map to — limited
|
|
188
|
+
* to concepts that render under the graph's active Reporting Style, with
|
|
189
|
+
* statement-level subtotals excluded. Use this to populate the mapping
|
|
190
|
+
* picker so it never offers an unreachable target.
|
|
191
|
+
*/
|
|
192
|
+
async getMappingCandidates(graphId, classification) {
|
|
193
|
+
return this.gqlQuery(graphId, graphql_1.MappingCandidatesDocument, { classification }, 'Mapping candidates', (data) => data.mappingCandidates);
|
|
194
|
+
}
|
|
185
195
|
/** CoA elements not yet mapped to a reporting concept. */
|
|
186
196
|
async listUnmappedElements(graphId, options) {
|
|
187
197
|
return this.gqlQuery(graphId, graphql_1.ListLedgerUnmappedElementsDocument, { mappingId: options?.mappingId ?? null }, 'List unmapped elements', (data) => data.unmappedElements);
|
|
@@ -687,7 +697,7 @@ class LedgerClient {
|
|
|
687
697
|
mapping_id: options.mappingId,
|
|
688
698
|
period_start: options.periodStart,
|
|
689
699
|
period_end: options.periodEnd,
|
|
690
|
-
taxonomy_id: options.taxonomyId ?? '
|
|
700
|
+
taxonomy_id: options.taxonomyId ?? 'rs-gaap',
|
|
691
701
|
period_type: options.periodType ?? 'quarterly',
|
|
692
702
|
comparative: options.comparative ?? true,
|
|
693
703
|
};
|
|
@@ -754,6 +764,66 @@ class LedgerClient {
|
|
|
754
764
|
}));
|
|
755
765
|
return (envelope.result ?? { deleted: true });
|
|
756
766
|
}
|
|
767
|
+
/**
|
|
768
|
+
* Get a short-lived presigned URL for downloading a published
|
|
769
|
+
* Report's serialization bundle.
|
|
770
|
+
*
|
|
771
|
+
* Phase 1a only resolves the JSON-LD flavor; reserved RDF and XBRL
|
|
772
|
+
* flavors return HTTP 400 until their producers ship. Reports
|
|
773
|
+
* published before the serialization feature shipped will resolve
|
|
774
|
+
* to a 404 — those Reports have no stamped bundle_url and must be
|
|
775
|
+
* regenerated to produce one.
|
|
776
|
+
*
|
|
777
|
+
* The returned ``downloadUrl`` is a presigned S3 URL valid for
|
|
778
|
+
* ``expiresIn`` seconds (default 300, max 3600). Browser callers
|
|
779
|
+
* typically navigate to it via ``window.location.href`` (or assign
|
|
780
|
+
* to an `<a href>` and click) to trigger the file download; the
|
|
781
|
+
* server-set Content-Disposition forces "attachment" with a
|
|
782
|
+
* versioned filename.
|
|
783
|
+
*
|
|
784
|
+
* @param graphId Graph identifier owning the Report.
|
|
785
|
+
* @param reportId Report identifier (rpt_-prefixed ULID).
|
|
786
|
+
* @param options.format Serialization flavor — defaults to ``'jsonld'``.
|
|
787
|
+
* @param options.expiresIn Presigned URL lifetime, in seconds.
|
|
788
|
+
*/
|
|
789
|
+
async getReportBundleDownloadUrl(graphId, reportId, options = {}) {
|
|
790
|
+
const format = options.format ?? 'jsonld';
|
|
791
|
+
const expiresIn = options.expiresIn ?? 300;
|
|
792
|
+
const url = `${this.config.baseUrl.replace(/\/$/, '')}` +
|
|
793
|
+
`/extensions/roboledger/${encodeURIComponent(graphId)}` +
|
|
794
|
+
`/reports/${encodeURIComponent(reportId)}/download` +
|
|
795
|
+
`?format=${encodeURIComponent(format)}&expires_in=${expiresIn}`;
|
|
796
|
+
const headers = new Headers({ Accept: 'application/json', ...(this.config.headers ?? {}) });
|
|
797
|
+
const token = await this.resolveToken();
|
|
798
|
+
if (token) {
|
|
799
|
+
// ``rfs…`` long-lived keys go in X-API-Key; everything else is
|
|
800
|
+
// a short-lived JWT. Mirrors the GraphQL client behaviour at
|
|
801
|
+
// ``clients/graphql/client.ts``.
|
|
802
|
+
if (token.startsWith('rfs')) {
|
|
803
|
+
headers.set('X-API-Key', token);
|
|
804
|
+
}
|
|
805
|
+
else {
|
|
806
|
+
headers.set('Authorization', `Bearer ${token}`);
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
const response = await fetch(url, {
|
|
810
|
+
method: 'GET',
|
|
811
|
+
headers,
|
|
812
|
+
credentials: this.config.credentials,
|
|
813
|
+
});
|
|
814
|
+
if (!response.ok) {
|
|
815
|
+
const body = await response.text();
|
|
816
|
+
throw new Error(`Get report bundle download URL failed (${response.status}): ${body}`);
|
|
817
|
+
}
|
|
818
|
+
const raw = (await response.json());
|
|
819
|
+
return {
|
|
820
|
+
downloadUrl: raw.download_url,
|
|
821
|
+
expiresAt: raw.expires_at,
|
|
822
|
+
contentType: raw.content_type,
|
|
823
|
+
format: raw.format,
|
|
824
|
+
generationCount: raw.generation_count,
|
|
825
|
+
};
|
|
826
|
+
}
|
|
757
827
|
/**
|
|
758
828
|
* Share a published report to every member of a publish list. Each
|
|
759
829
|
* target graph receives a snapshot copy of the report's facts.
|
|
@@ -900,6 +970,27 @@ class LedgerClient {
|
|
|
900
970
|
}
|
|
901
971
|
return result;
|
|
902
972
|
}
|
|
973
|
+
/**
|
|
974
|
+
* Resolve the current bearer token / API key for non-GraphQL REST
|
|
975
|
+
* calls. Mirrors the GraphQL client's behaviour — dynamic
|
|
976
|
+
* ``tokenProvider`` is consulted first (so JWT rotation flows
|
|
977
|
+
* naturally), then the static ``token`` config. Returns ``null``
|
|
978
|
+
* when no credential is configured; the caller decides whether to
|
|
979
|
+
* proceed anonymously or short-circuit with an error.
|
|
980
|
+
*/
|
|
981
|
+
async resolveToken() {
|
|
982
|
+
if (this.config.tokenProvider) {
|
|
983
|
+
try {
|
|
984
|
+
const token = await this.config.tokenProvider();
|
|
985
|
+
return token ?? null;
|
|
986
|
+
}
|
|
987
|
+
catch (err) {
|
|
988
|
+
console.warn('[RoboSystems SDK] tokenProvider threw — sending unauthenticated request:', err);
|
|
989
|
+
return null;
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
return this.config.token ?? null;
|
|
993
|
+
}
|
|
903
994
|
}
|
|
904
995
|
exports.LedgerClient = LedgerClient;
|
|
905
996
|
// ── Module-private conversion helpers ─────────────────────────────────
|
|
@@ -155,6 +155,7 @@ import {
|
|
|
155
155
|
ListLedgerTaxonomiesDocument,
|
|
156
156
|
ListLedgerTransactionsDocument,
|
|
157
157
|
ListLedgerUnmappedElementsDocument,
|
|
158
|
+
MappingCandidatesDocument,
|
|
158
159
|
type GetInformationBlockQuery,
|
|
159
160
|
type GetLedgerAccountRollupsQuery,
|
|
160
161
|
type GetLedgerAccountTreeQuery,
|
|
@@ -189,6 +190,7 @@ import {
|
|
|
189
190
|
type ListLedgerTaxonomiesQuery,
|
|
190
191
|
type ListLedgerTransactionsQuery,
|
|
191
192
|
type ListLedgerUnmappedElementsQuery,
|
|
193
|
+
type MappingCandidatesQuery,
|
|
192
194
|
} from './graphql/generated/graphql'
|
|
193
195
|
|
|
194
196
|
// ── Friendly types derived from GraphQL codegen ────────────────────────
|
|
@@ -231,6 +233,7 @@ export type LedgerTaxonomy = LedgerTaxonomyList['taxonomies'][number]
|
|
|
231
233
|
|
|
232
234
|
export type LedgerElementList = NonNullable<ListLedgerElementsQuery['elements']>
|
|
233
235
|
export type LedgerElement = LedgerElementList['elements'][number]
|
|
236
|
+
export type LedgerMappingCandidate = MappingCandidatesQuery['mappingCandidates'][number]
|
|
234
237
|
export type LedgerUnmappedElement = ListLedgerUnmappedElementsQuery['unmappedElements'][number]
|
|
235
238
|
|
|
236
239
|
export type LedgerStructureList = NonNullable<ListLedgerStructuresQuery['structures']>
|
|
@@ -277,6 +280,36 @@ export type PublishList = NonNullable<
|
|
|
277
280
|
export type PublishListDetail = NonNullable<GetLedgerPublishListQuery['publishList']>
|
|
278
281
|
export type PublishListMember = PublishListDetail['members'][number]
|
|
279
282
|
|
|
283
|
+
/**
|
|
284
|
+
* Presigned-URL response for a Report bundle download.
|
|
285
|
+
*
|
|
286
|
+
* Returned by ``LedgerClient.getReportBundleDownloadUrl`` — the
|
|
287
|
+
* ``downloadUrl`` is a time-limited URL that streams the
|
|
288
|
+
* serialization artifact directly from object storage. Browser
|
|
289
|
+
* callers typically follow the URL via ``window.location.href`` or
|
|
290
|
+
* an anchor element to trigger the file download.
|
|
291
|
+
*/
|
|
292
|
+
export interface ReportBundleDownloadResponse {
|
|
293
|
+
/** Presigned URL that streams the bundle directly from S3. */
|
|
294
|
+
downloadUrl: string
|
|
295
|
+
/** ISO-8601 UTC instant at which the presigned URL stops working. */
|
|
296
|
+
expiresAt: string
|
|
297
|
+
/** MIME type of the artifact behind the URL. */
|
|
298
|
+
contentType: string
|
|
299
|
+
/** Serialization flavor — ``jsonld`` is the Phase 1a default. */
|
|
300
|
+
format: string
|
|
301
|
+
/** Bundle generation number stamped on the Report. */
|
|
302
|
+
generationCount: number
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
interface RawReportBundleDownloadResponse {
|
|
306
|
+
download_url: string
|
|
307
|
+
expires_at: string
|
|
308
|
+
content_type: string
|
|
309
|
+
format: string
|
|
310
|
+
generation_count: number
|
|
311
|
+
}
|
|
312
|
+
|
|
280
313
|
export interface PeriodSpecInput {
|
|
281
314
|
start: string
|
|
282
315
|
end: string
|
|
@@ -887,6 +920,26 @@ export class LedgerClient {
|
|
|
887
920
|
)
|
|
888
921
|
}
|
|
889
922
|
|
|
923
|
+
/**
|
|
924
|
+
* rs-gaap concepts a CoA element of the given EFS `classification`
|
|
925
|
+
* (asset / liability / equity / revenue / expense) may map to — limited
|
|
926
|
+
* to concepts that render under the graph's active Reporting Style, with
|
|
927
|
+
* statement-level subtotals excluded. Use this to populate the mapping
|
|
928
|
+
* picker so it never offers an unreachable target.
|
|
929
|
+
*/
|
|
930
|
+
async getMappingCandidates(
|
|
931
|
+
graphId: string,
|
|
932
|
+
classification: string
|
|
933
|
+
): Promise<LedgerMappingCandidate[]> {
|
|
934
|
+
return this.gqlQuery(
|
|
935
|
+
graphId,
|
|
936
|
+
MappingCandidatesDocument,
|
|
937
|
+
{ classification },
|
|
938
|
+
'Mapping candidates',
|
|
939
|
+
(data) => data.mappingCandidates
|
|
940
|
+
)
|
|
941
|
+
}
|
|
942
|
+
|
|
890
943
|
/** CoA elements not yet mapped to a reporting concept. */
|
|
891
944
|
async listUnmappedElements(
|
|
892
945
|
graphId: string,
|
|
@@ -1730,7 +1783,7 @@ export class LedgerClient {
|
|
|
1730
1783
|
mapping_id: options.mappingId,
|
|
1731
1784
|
period_start: options.periodStart,
|
|
1732
1785
|
period_end: options.periodEnd,
|
|
1733
|
-
taxonomy_id: options.taxonomyId ?? '
|
|
1786
|
+
taxonomy_id: options.taxonomyId ?? 'rs-gaap',
|
|
1734
1787
|
period_type: options.periodType ?? 'quarterly',
|
|
1735
1788
|
comparative: options.comparative ?? true,
|
|
1736
1789
|
}
|
|
@@ -1846,6 +1899,71 @@ export class LedgerClient {
|
|
|
1846
1899
|
return (envelope.result ?? { deleted: true }) as DeleteResult
|
|
1847
1900
|
}
|
|
1848
1901
|
|
|
1902
|
+
/**
|
|
1903
|
+
* Get a short-lived presigned URL for downloading a published
|
|
1904
|
+
* Report's serialization bundle.
|
|
1905
|
+
*
|
|
1906
|
+
* Phase 1a only resolves the JSON-LD flavor; reserved RDF and XBRL
|
|
1907
|
+
* flavors return HTTP 400 until their producers ship. Reports
|
|
1908
|
+
* published before the serialization feature shipped will resolve
|
|
1909
|
+
* to a 404 — those Reports have no stamped bundle_url and must be
|
|
1910
|
+
* regenerated to produce one.
|
|
1911
|
+
*
|
|
1912
|
+
* The returned ``downloadUrl`` is a presigned S3 URL valid for
|
|
1913
|
+
* ``expiresIn`` seconds (default 300, max 3600). Browser callers
|
|
1914
|
+
* typically navigate to it via ``window.location.href`` (or assign
|
|
1915
|
+
* to an `<a href>` and click) to trigger the file download; the
|
|
1916
|
+
* server-set Content-Disposition forces "attachment" with a
|
|
1917
|
+
* versioned filename.
|
|
1918
|
+
*
|
|
1919
|
+
* @param graphId Graph identifier owning the Report.
|
|
1920
|
+
* @param reportId Report identifier (rpt_-prefixed ULID).
|
|
1921
|
+
* @param options.format Serialization flavor — defaults to ``'jsonld'``.
|
|
1922
|
+
* @param options.expiresIn Presigned URL lifetime, in seconds.
|
|
1923
|
+
*/
|
|
1924
|
+
async getReportBundleDownloadUrl(
|
|
1925
|
+
graphId: string,
|
|
1926
|
+
reportId: string,
|
|
1927
|
+
options: { format?: string; expiresIn?: number } = {}
|
|
1928
|
+
): Promise<ReportBundleDownloadResponse> {
|
|
1929
|
+
const format = options.format ?? 'jsonld'
|
|
1930
|
+
const expiresIn = options.expiresIn ?? 300
|
|
1931
|
+
const url =
|
|
1932
|
+
`${this.config.baseUrl.replace(/\/$/, '')}` +
|
|
1933
|
+
`/extensions/roboledger/${encodeURIComponent(graphId)}` +
|
|
1934
|
+
`/reports/${encodeURIComponent(reportId)}/download` +
|
|
1935
|
+
`?format=${encodeURIComponent(format)}&expires_in=${expiresIn}`
|
|
1936
|
+
const headers = new Headers({ Accept: 'application/json', ...(this.config.headers ?? {}) })
|
|
1937
|
+
const token = await this.resolveToken()
|
|
1938
|
+
if (token) {
|
|
1939
|
+
// ``rfs…`` long-lived keys go in X-API-Key; everything else is
|
|
1940
|
+
// a short-lived JWT. Mirrors the GraphQL client behaviour at
|
|
1941
|
+
// ``clients/graphql/client.ts``.
|
|
1942
|
+
if (token.startsWith('rfs')) {
|
|
1943
|
+
headers.set('X-API-Key', token)
|
|
1944
|
+
} else {
|
|
1945
|
+
headers.set('Authorization', `Bearer ${token}`)
|
|
1946
|
+
}
|
|
1947
|
+
}
|
|
1948
|
+
const response = await fetch(url, {
|
|
1949
|
+
method: 'GET',
|
|
1950
|
+
headers,
|
|
1951
|
+
credentials: this.config.credentials,
|
|
1952
|
+
})
|
|
1953
|
+
if (!response.ok) {
|
|
1954
|
+
const body = await response.text()
|
|
1955
|
+
throw new Error(`Get report bundle download URL failed (${response.status}): ${body}`)
|
|
1956
|
+
}
|
|
1957
|
+
const raw = (await response.json()) as RawReportBundleDownloadResponse
|
|
1958
|
+
return {
|
|
1959
|
+
downloadUrl: raw.download_url,
|
|
1960
|
+
expiresAt: raw.expires_at,
|
|
1961
|
+
contentType: raw.content_type,
|
|
1962
|
+
format: raw.format,
|
|
1963
|
+
generationCount: raw.generation_count,
|
|
1964
|
+
}
|
|
1965
|
+
}
|
|
1966
|
+
|
|
1849
1967
|
/**
|
|
1850
1968
|
* Share a published report to every member of a publish list. Each
|
|
1851
1969
|
* target graph receives a snapshot copy of the report's facts.
|
|
@@ -2072,6 +2190,30 @@ export class LedgerClient {
|
|
|
2072
2190
|
}
|
|
2073
2191
|
return result
|
|
2074
2192
|
}
|
|
2193
|
+
|
|
2194
|
+
/**
|
|
2195
|
+
* Resolve the current bearer token / API key for non-GraphQL REST
|
|
2196
|
+
* calls. Mirrors the GraphQL client's behaviour — dynamic
|
|
2197
|
+
* ``tokenProvider`` is consulted first (so JWT rotation flows
|
|
2198
|
+
* naturally), then the static ``token`` config. Returns ``null``
|
|
2199
|
+
* when no credential is configured; the caller decides whether to
|
|
2200
|
+
* proceed anonymously or short-circuit with an error.
|
|
2201
|
+
*/
|
|
2202
|
+
private async resolveToken(): Promise<string | null> {
|
|
2203
|
+
if (this.config.tokenProvider) {
|
|
2204
|
+
try {
|
|
2205
|
+
const token = await this.config.tokenProvider()
|
|
2206
|
+
return token ?? null
|
|
2207
|
+
} catch (err) {
|
|
2208
|
+
console.warn(
|
|
2209
|
+
'[RoboSystems SDK] tokenProvider threw — sending unauthenticated request:',
|
|
2210
|
+
err
|
|
2211
|
+
)
|
|
2212
|
+
return null
|
|
2213
|
+
}
|
|
2214
|
+
}
|
|
2215
|
+
return this.config.token ?? null
|
|
2216
|
+
}
|
|
2075
2217
|
}
|
|
2076
2218
|
|
|
2077
2219
|
// ── Module-private conversion helpers ─────────────────────────────────
|
|
@@ -1451,6 +1451,7 @@ export type Query = {
|
|
|
1451
1451
|
libraryTaxonomyArcs: Array<LibraryAssociation>;
|
|
1452
1452
|
mappedTrialBalance: Maybe<MappedTrialBalance>;
|
|
1453
1453
|
mapping: Maybe<MappingDetail>;
|
|
1454
|
+
mappingCandidates: Array<Element>;
|
|
1454
1455
|
mappingCoverage: Maybe<MappingCoverage>;
|
|
1455
1456
|
mappings: Maybe<StructureList>;
|
|
1456
1457
|
openPayables: OpenBalanceAggregate;
|
|
@@ -1609,6 +1610,9 @@ export type QueryMappedTrialBalanceArgs = {
|
|
|
1609
1610
|
export type QueryMappingArgs = {
|
|
1610
1611
|
mappingId: Scalars['String']['input'];
|
|
1611
1612
|
};
|
|
1613
|
+
export type QueryMappingCandidatesArgs = {
|
|
1614
|
+
classification: Scalars['String']['input'];
|
|
1615
|
+
};
|
|
1612
1616
|
export type QueryMappingCoverageArgs = {
|
|
1613
1617
|
mappingId: Scalars['String']['input'];
|
|
1614
1618
|
};
|
|
@@ -2474,6 +2478,7 @@ export type ListLedgerElementsQuery = {
|
|
|
2474
2478
|
description: string | null;
|
|
2475
2479
|
qname: string | null;
|
|
2476
2480
|
namespace: string | null;
|
|
2481
|
+
trait: string | null;
|
|
2477
2482
|
subClassification: string | null;
|
|
2478
2483
|
balanceType: string;
|
|
2479
2484
|
periodType: string;
|
|
@@ -2968,6 +2973,17 @@ export type GetLedgerMappingQuery = {
|
|
|
2968
2973
|
}>;
|
|
2969
2974
|
} | null;
|
|
2970
2975
|
};
|
|
2976
|
+
export type MappingCandidatesQueryVariables = Exact<{
|
|
2977
|
+
classification: Scalars['String']['input'];
|
|
2978
|
+
}>;
|
|
2979
|
+
export type MappingCandidatesQuery = {
|
|
2980
|
+
mappingCandidates: Array<{
|
|
2981
|
+
id: string;
|
|
2982
|
+
name: string;
|
|
2983
|
+
qname: string | null;
|
|
2984
|
+
trait: string | null;
|
|
2985
|
+
}>;
|
|
2986
|
+
};
|
|
2971
2987
|
export type GetLedgerMappingCoverageQueryVariables = Exact<{
|
|
2972
2988
|
mappingId: Scalars['String']['input'];
|
|
2973
2989
|
}>;
|
|
@@ -3791,6 +3807,7 @@ export declare const GetInformationBlockDocument: DocumentNode<GetInformationBlo
|
|
|
3791
3807
|
export declare const ListInformationBlocksDocument: DocumentNode<ListInformationBlocksQuery, ListInformationBlocksQueryVariables>;
|
|
3792
3808
|
export declare const GetLedgerMappedTrialBalanceDocument: DocumentNode<GetLedgerMappedTrialBalanceQuery, GetLedgerMappedTrialBalanceQueryVariables>;
|
|
3793
3809
|
export declare const GetLedgerMappingDocument: DocumentNode<GetLedgerMappingQuery, GetLedgerMappingQueryVariables>;
|
|
3810
|
+
export declare const MappingCandidatesDocument: DocumentNode<MappingCandidatesQuery, MappingCandidatesQueryVariables>;
|
|
3794
3811
|
export declare const GetLedgerMappingCoverageDocument: DocumentNode<GetLedgerMappingCoverageQuery, GetLedgerMappingCoverageQueryVariables>;
|
|
3795
3812
|
export declare const ListLedgerMappingsDocument: DocumentNode<ListLedgerMappingsQuery, ListLedgerMappingsQueryVariables>;
|
|
3796
3813
|
export declare const GetLedgerPeriodCloseStatusDocument: DocumentNode<GetLedgerPeriodCloseStatusQuery, GetLedgerPeriodCloseStatusQueryVariables>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ListLibraryTaxonomiesDocument = exports.GetLibraryElementDocument = exports.SearchLibraryElementsDocument = exports.ListLibraryElementsDocument = exports.GetLibraryElementEquivalentsDocument = exports.GetLibraryElementClassificationsDocument = exports.GetLibraryElementArcsDocument = exports.ListLibraryTaxonomyArcsDocument = exports.ListLedgerUnmappedElementsDocument = exports.GetLedgerTrialBalanceDocument = exports.ListLedgerTransactionsDocument = exports.GetLedgerTransactionDocument = exports.ListLedgerTaxonomiesDocument = exports.GetLedgerSummaryDocument = exports.ListLedgerStructuresDocument = exports.GetLedgerStatementDocument = exports.ListLedgerReportsDocument = exports.GetLedgerReportingTaxonomyDocument = exports.GetLedgerReportPackageDocument = exports.GetLedgerReportDocument = exports.ListLedgerPublishListsDocument = exports.GetLedgerPublishListDocument = exports.GetLedgerPeriodDraftsDocument = exports.GetLedgerPeriodCloseStatusDocument = exports.ListLedgerMappingsDocument = exports.GetLedgerMappingCoverageDocument = exports.MappingCandidatesDocument = exports.GetLedgerMappingDocument = exports.GetLedgerMappedTrialBalanceDocument = exports.ListInformationBlocksDocument = exports.GetInformationBlockDocument = exports.GetLedgerFiscalCalendarDocument = exports.ListLedgerEventBlocksDocument = exports.GetLedgerEventBlockDocument = exports.GetLedgerEntityDocument = exports.ListLedgerEntitiesDocument = exports.ListLedgerElementsDocument = exports.GetLedgerClosingBookStructuresDocument = exports.ListLedgerAgentsDocument = exports.GetLedgerAgentDocument = exports.ListLedgerAccountsDocument = exports.GetLedgerAccountTreeDocument = exports.GetLedgerAccountRollupsDocument = exports.GetInvestorSecurityDocument = exports.ListInvestorSecuritiesDocument = exports.ListInvestorPositionsDocument = exports.GetInvestorPositionDocument = exports.ListInvestorPortfoliosDocument = exports.GetInvestorPortfolioBlockDocument = exports.GetInvestorHoldingsDocument = void 0;
|
|
4
|
+
exports.GetLibraryTaxonomyDocument = void 0;
|
|
4
5
|
exports.GetInvestorHoldingsDocument = {
|
|
5
6
|
kind: 'Document',
|
|
6
7
|
definitions: [
|
|
@@ -1255,6 +1256,7 @@ exports.ListLedgerElementsDocument = {
|
|
|
1255
1256
|
{ kind: 'Field', name: { kind: 'Name', value: 'description' } },
|
|
1256
1257
|
{ kind: 'Field', name: { kind: 'Name', value: 'qname' } },
|
|
1257
1258
|
{ kind: 'Field', name: { kind: 'Name', value: 'namespace' } },
|
|
1259
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'trait' } },
|
|
1258
1260
|
{ kind: 'Field', name: { kind: 'Name', value: 'subClassification' } },
|
|
1259
1261
|
{ kind: 'Field', name: { kind: 'Name', value: 'balanceType' } },
|
|
1260
1262
|
{ kind: 'Field', name: { kind: 'Name', value: 'periodType' } },
|
|
@@ -2399,6 +2401,51 @@ exports.GetLedgerMappingDocument = {
|
|
|
2399
2401
|
},
|
|
2400
2402
|
],
|
|
2401
2403
|
};
|
|
2404
|
+
exports.MappingCandidatesDocument = {
|
|
2405
|
+
kind: 'Document',
|
|
2406
|
+
definitions: [
|
|
2407
|
+
{
|
|
2408
|
+
kind: 'OperationDefinition',
|
|
2409
|
+
operation: 'query',
|
|
2410
|
+
name: { kind: 'Name', value: 'MappingCandidates' },
|
|
2411
|
+
variableDefinitions: [
|
|
2412
|
+
{
|
|
2413
|
+
kind: 'VariableDefinition',
|
|
2414
|
+
variable: { kind: 'Variable', name: { kind: 'Name', value: 'classification' } },
|
|
2415
|
+
type: {
|
|
2416
|
+
kind: 'NonNullType',
|
|
2417
|
+
type: { kind: 'NamedType', name: { kind: 'Name', value: 'String' } },
|
|
2418
|
+
},
|
|
2419
|
+
},
|
|
2420
|
+
],
|
|
2421
|
+
selectionSet: {
|
|
2422
|
+
kind: 'SelectionSet',
|
|
2423
|
+
selections: [
|
|
2424
|
+
{
|
|
2425
|
+
kind: 'Field',
|
|
2426
|
+
name: { kind: 'Name', value: 'mappingCandidates' },
|
|
2427
|
+
arguments: [
|
|
2428
|
+
{
|
|
2429
|
+
kind: 'Argument',
|
|
2430
|
+
name: { kind: 'Name', value: 'classification' },
|
|
2431
|
+
value: { kind: 'Variable', name: { kind: 'Name', value: 'classification' } },
|
|
2432
|
+
},
|
|
2433
|
+
],
|
|
2434
|
+
selectionSet: {
|
|
2435
|
+
kind: 'SelectionSet',
|
|
2436
|
+
selections: [
|
|
2437
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'id' } },
|
|
2438
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'name' } },
|
|
2439
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'qname' } },
|
|
2440
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'trait' } },
|
|
2441
|
+
],
|
|
2442
|
+
},
|
|
2443
|
+
},
|
|
2444
|
+
],
|
|
2445
|
+
},
|
|
2446
|
+
},
|
|
2447
|
+
],
|
|
2448
|
+
};
|
|
2402
2449
|
exports.GetLedgerMappingCoverageDocument = {
|
|
2403
2450
|
kind: 'Document',
|
|
2404
2451
|
definitions: [
|
|
@@ -1500,6 +1500,7 @@ export type Query = {
|
|
|
1500
1500
|
libraryTaxonomyArcs: Array<LibraryAssociation>
|
|
1501
1501
|
mappedTrialBalance: Maybe<MappedTrialBalance>
|
|
1502
1502
|
mapping: Maybe<MappingDetail>
|
|
1503
|
+
mappingCandidates: Array<Element>
|
|
1503
1504
|
mappingCoverage: Maybe<MappingCoverage>
|
|
1504
1505
|
mappings: Maybe<StructureList>
|
|
1505
1506
|
openPayables: OpenBalanceAggregate
|
|
@@ -1685,6 +1686,10 @@ export type QueryMappingArgs = {
|
|
|
1685
1686
|
mappingId: Scalars['String']['input']
|
|
1686
1687
|
}
|
|
1687
1688
|
|
|
1689
|
+
export type QueryMappingCandidatesArgs = {
|
|
1690
|
+
classification: Scalars['String']['input']
|
|
1691
|
+
}
|
|
1692
|
+
|
|
1688
1693
|
export type QueryMappingCoverageArgs = {
|
|
1689
1694
|
mappingId: Scalars['String']['input']
|
|
1690
1695
|
}
|
|
@@ -2592,6 +2597,7 @@ export type ListLedgerElementsQuery = {
|
|
|
2592
2597
|
description: string | null
|
|
2593
2598
|
qname: string | null
|
|
2594
2599
|
namespace: string | null
|
|
2600
|
+
trait: string | null
|
|
2595
2601
|
subClassification: string | null
|
|
2596
2602
|
balanceType: string
|
|
2597
2603
|
periodType: string
|
|
@@ -3070,6 +3076,14 @@ export type GetLedgerMappingQuery = {
|
|
|
3070
3076
|
} | null
|
|
3071
3077
|
}
|
|
3072
3078
|
|
|
3079
|
+
export type MappingCandidatesQueryVariables = Exact<{
|
|
3080
|
+
classification: Scalars['String']['input']
|
|
3081
|
+
}>
|
|
3082
|
+
|
|
3083
|
+
export type MappingCandidatesQuery = {
|
|
3084
|
+
mappingCandidates: Array<{ id: string; name: string; qname: string | null; trait: string | null }>
|
|
3085
|
+
}
|
|
3086
|
+
|
|
3073
3087
|
export type GetLedgerMappingCoverageQueryVariables = Exact<{
|
|
3074
3088
|
mappingId: Scalars['String']['input']
|
|
3075
3089
|
}>
|
|
@@ -5097,6 +5111,7 @@ export const ListLedgerElementsDocument = {
|
|
|
5097
5111
|
{ kind: 'Field', name: { kind: 'Name', value: 'description' } },
|
|
5098
5112
|
{ kind: 'Field', name: { kind: 'Name', value: 'qname' } },
|
|
5099
5113
|
{ kind: 'Field', name: { kind: 'Name', value: 'namespace' } },
|
|
5114
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'trait' } },
|
|
5100
5115
|
{ kind: 'Field', name: { kind: 'Name', value: 'subClassification' } },
|
|
5101
5116
|
{ kind: 'Field', name: { kind: 'Name', value: 'balanceType' } },
|
|
5102
5117
|
{ kind: 'Field', name: { kind: 'Name', value: 'periodType' } },
|
|
@@ -6244,6 +6259,51 @@ export const GetLedgerMappingDocument = {
|
|
|
6244
6259
|
},
|
|
6245
6260
|
],
|
|
6246
6261
|
} as unknown as DocumentNode<GetLedgerMappingQuery, GetLedgerMappingQueryVariables>
|
|
6262
|
+
export const MappingCandidatesDocument = {
|
|
6263
|
+
kind: 'Document',
|
|
6264
|
+
definitions: [
|
|
6265
|
+
{
|
|
6266
|
+
kind: 'OperationDefinition',
|
|
6267
|
+
operation: 'query',
|
|
6268
|
+
name: { kind: 'Name', value: 'MappingCandidates' },
|
|
6269
|
+
variableDefinitions: [
|
|
6270
|
+
{
|
|
6271
|
+
kind: 'VariableDefinition',
|
|
6272
|
+
variable: { kind: 'Variable', name: { kind: 'Name', value: 'classification' } },
|
|
6273
|
+
type: {
|
|
6274
|
+
kind: 'NonNullType',
|
|
6275
|
+
type: { kind: 'NamedType', name: { kind: 'Name', value: 'String' } },
|
|
6276
|
+
},
|
|
6277
|
+
},
|
|
6278
|
+
],
|
|
6279
|
+
selectionSet: {
|
|
6280
|
+
kind: 'SelectionSet',
|
|
6281
|
+
selections: [
|
|
6282
|
+
{
|
|
6283
|
+
kind: 'Field',
|
|
6284
|
+
name: { kind: 'Name', value: 'mappingCandidates' },
|
|
6285
|
+
arguments: [
|
|
6286
|
+
{
|
|
6287
|
+
kind: 'Argument',
|
|
6288
|
+
name: { kind: 'Name', value: 'classification' },
|
|
6289
|
+
value: { kind: 'Variable', name: { kind: 'Name', value: 'classification' } },
|
|
6290
|
+
},
|
|
6291
|
+
],
|
|
6292
|
+
selectionSet: {
|
|
6293
|
+
kind: 'SelectionSet',
|
|
6294
|
+
selections: [
|
|
6295
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'id' } },
|
|
6296
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'name' } },
|
|
6297
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'qname' } },
|
|
6298
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'trait' } },
|
|
6299
|
+
],
|
|
6300
|
+
},
|
|
6301
|
+
},
|
|
6302
|
+
],
|
|
6303
|
+
},
|
|
6304
|
+
},
|
|
6305
|
+
],
|
|
6306
|
+
} as unknown as DocumentNode<MappingCandidatesQuery, MappingCandidatesQueryVariables>
|
|
6247
6307
|
export const GetLedgerMappingCoverageDocument = {
|
|
6248
6308
|
kind: 'Document',
|
|
6249
6309
|
definitions: [
|