@robosystems/client 0.3.39 → 0.3.40

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.
@@ -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, type MappingCandidatesQuery } 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, type ReportDownloadFormat } 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']>;
@@ -56,7 +56,7 @@ export type PublishListMember = PublishListDetail['members'][number];
56
56
  /**
57
57
  * Presigned-URL response for a Report bundle download.
58
58
  *
59
- * Returned by ``LedgerClient.getReportBundleDownloadUrl`` — the
59
+ * Returned by ``LedgerClient.getReportDownloadUrl`` — the
60
60
  * ``downloadUrl`` is a time-limited URL that streams the
61
61
  * serialization artifact directly from object storage. Browser
62
62
  * callers typically follow the URL via ``window.location.href`` or
@@ -69,7 +69,7 @@ export interface ReportBundleDownloadResponse {
69
69
  expiresAt: string;
70
70
  /** MIME type of the artifact behind the URL. */
71
71
  contentType: string;
72
- /** Serialization flavor — ``jsonld`` is the Phase 1a default. */
72
+ /** Serialization flavor — ``jsonld`` or ``xbrl-2.1``. */
73
73
  format: string;
74
74
  /** Bundle generation number stamped on the Report. */
75
75
  generationCount: number;
@@ -587,51 +587,29 @@ export declare class LedgerClient {
587
587
  * Get a short-lived presigned URL for downloading a published
588
588
  * Report's serialization bundle.
589
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.
590
+ * A download is a read, so this resolves through GraphQL
591
+ * (`reportDownloadUrl`) the retired `GET .../reports/{id}/download`
592
+ * REST resource is gone. Every flavor resolves to a presigned S3 URL:
593
+ * JSON-LD is stamped at publish time; XBRL is materialized + cached
594
+ * on first request. The returned `downloadUrl` is valid for
595
+ * `expiresIn` seconds (default 300, max 3600); browser callers
596
+ * navigate to it via `window.location.href` (or an `<a href>` click)
597
+ * to trigger the download — the server-set Content-Disposition forces
598
+ * "attachment" with a versioned filename.
595
599
  *
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.
600
+ * Returns `null` when the report doesn't exist. A report that has
601
+ * never been published surfaces a `REPORT_BUNDLE_NOT_AVAILABLE`
602
+ * GraphQL error (regenerate it to produce a bundle).
602
603
  *
603
604
  * @param graphId Graph identifier owning the Report.
604
605
  * @param reportId Report identifier (rpt_-prefixed ULID).
605
- * @param options.format Serialization flavor — defaults to ``'jsonld'``.
606
+ * @param options.format Serialization flavor — `JSONLD` (default) or `XBRL_2_1`.
606
607
  * @param options.expiresIn Presigned URL lifetime, in seconds.
607
608
  */
608
- getReportBundleDownloadUrl(graphId: string, reportId: string, options?: {
609
- format?: string;
609
+ getReportDownloadUrl(graphId: string, reportId: string, options?: {
610
+ format?: ReportDownloadFormat;
610
611
  expiresIn?: number;
611
- }): Promise<ReportBundleDownloadResponse>;
612
- /**
613
- * Download the Report's serialization bundle as an XBRL 2.1 zip.
614
- *
615
- * Rebuilds the bundle on the server and streams the zip body
616
- * directly — no S3 presigned URL is involved (XBRL is on-demand
617
- * emit, per the serialization spec). The returned ``Blob`` can be
618
- * saved via URL.createObjectURL + a temporary anchor click to
619
- * trigger the browser download dialog.
620
- *
621
- * The zip contains five files: ``instance.xml``, ``report.xsd``,
622
- * ``report-pre.xml``, ``report-cal.xml``, ``report-def.xml``.
623
- *
624
- * @param graphId Graph identifier owning the Report.
625
- * @param reportId Report identifier (rpt_-prefixed ULID).
626
- * @param options.flavor XBRL flavor (default ``'xbrl-2.1'``).
627
- */
628
- getReportBundleXbrlZip(graphId: string, reportId: string, options?: {
629
- flavor?: string;
630
- }): Promise<{
631
- blob: Blob;
632
- filename: string;
633
- generationCount: number | null;
634
- }>;
612
+ }): Promise<ReportBundleDownloadResponse | null>;
635
613
  /**
636
614
  * Share a published report to every member of a publish list. Each
637
615
  * target graph receives a snapshot copy of the report's facts.
@@ -768,115 +768,42 @@ class LedgerClient {
768
768
  * Get a short-lived presigned URL for downloading a published
769
769
  * Report's serialization bundle.
770
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.
771
+ * A download is a read, so this resolves through GraphQL
772
+ * (`reportDownloadUrl`) the retired `GET .../reports/{id}/download`
773
+ * REST resource is gone. Every flavor resolves to a presigned S3 URL:
774
+ * JSON-LD is stamped at publish time; XBRL is materialized + cached
775
+ * on first request. The returned `downloadUrl` is valid for
776
+ * `expiresIn` seconds (default 300, max 3600); browser callers
777
+ * navigate to it via `window.location.href` (or an `<a href>` click)
778
+ * to trigger the download — the server-set Content-Disposition forces
779
+ * "attachment" with a versioned filename.
776
780
  *
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.
781
+ * Returns `null` when the report doesn't exist. A report that has
782
+ * never been published surfaces a `REPORT_BUNDLE_NOT_AVAILABLE`
783
+ * GraphQL error (regenerate it to produce a bundle).
783
784
  *
784
785
  * @param graphId Graph identifier owning the Report.
785
786
  * @param reportId Report identifier (rpt_-prefixed ULID).
786
- * @param options.format Serialization flavor — defaults to ``'jsonld'``.
787
+ * @param options.format Serialization flavor — `JSONLD` (default) or `XBRL_2_1`.
787
788
  * @param options.expiresIn Presigned URL lifetime, in seconds.
788
789
  */
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
- }
827
- /**
828
- * Download the Report's serialization bundle as an XBRL 2.1 zip.
829
- *
830
- * Rebuilds the bundle on the server and streams the zip body
831
- * directly — no S3 presigned URL is involved (XBRL is on-demand
832
- * emit, per the serialization spec). The returned ``Blob`` can be
833
- * saved via URL.createObjectURL + a temporary anchor click to
834
- * trigger the browser download dialog.
835
- *
836
- * The zip contains five files: ``instance.xml``, ``report.xsd``,
837
- * ``report-pre.xml``, ``report-cal.xml``, ``report-def.xml``.
838
- *
839
- * @param graphId Graph identifier owning the Report.
840
- * @param reportId Report identifier (rpt_-prefixed ULID).
841
- * @param options.flavor XBRL flavor (default ``'xbrl-2.1'``).
842
- */
843
- async getReportBundleXbrlZip(graphId, reportId, options = {}) {
844
- const flavor = options.flavor ?? 'xbrl-2.1';
845
- const url = `${this.config.baseUrl.replace(/\/$/, '')}` +
846
- `/extensions/roboledger/${encodeURIComponent(graphId)}` +
847
- `/reports/${encodeURIComponent(reportId)}/download` +
848
- `?format=${encodeURIComponent(flavor)}`;
849
- const headers = new Headers({
850
- Accept: 'application/zip',
851
- ...(this.config.headers ?? {}),
852
- });
853
- const token = await this.resolveToken();
854
- if (token) {
855
- if (token.startsWith('rfs')) {
856
- headers.set('X-API-Key', token);
857
- }
858
- else {
859
- headers.set('Authorization', `Bearer ${token}`);
860
- }
861
- }
862
- const response = await fetch(url, {
863
- method: 'GET',
864
- headers,
865
- credentials: this.config.credentials,
790
+ async getReportDownloadUrl(graphId, reportId, options = {}) {
791
+ return this.gqlQuery(graphId, graphql_1.GetLedgerReportDownloadUrlDocument, {
792
+ reportId,
793
+ format: options.format ?? 'JSONLD',
794
+ expiresIn: options.expiresIn ?? 300,
795
+ }, 'Get report download URL', (data) => {
796
+ const node = data.reportDownloadUrl;
797
+ if (!node)
798
+ return null;
799
+ return {
800
+ downloadUrl: node.downloadUrl,
801
+ expiresAt: node.expiresAt,
802
+ contentType: node.contentType,
803
+ format: node.format,
804
+ generationCount: node.generationCount,
805
+ };
866
806
  });
867
- if (!response.ok) {
868
- const body = await response.text();
869
- throw new Error(`Get report bundle XBRL zip failed (${response.status}): ${body}`);
870
- }
871
- const blob = await response.blob();
872
- // Parse Content-Disposition for the server-suggested filename;
873
- // fall back to a sensible default if absent.
874
- const disposition = response.headers.get('Content-Disposition') ?? '';
875
- const filenameMatch = disposition.match(/filename="?([^";]+)"?/i);
876
- const filename = filenameMatch ? filenameMatch[1] : `${reportId}.zip`;
877
- const generationHeader = response.headers.get('X-Bundle-Generation');
878
- const generationCount = generationHeader ? Number.parseInt(generationHeader, 10) : null;
879
- return { blob, filename, generationCount };
880
807
  }
881
808
  /**
882
809
  * Share a published report to every member of a publish list. Each
@@ -136,6 +136,7 @@ import {
136
136
  GetLedgerPeriodDraftsDocument,
137
137
  GetLedgerPublishListDocument,
138
138
  GetLedgerReportDocument,
139
+ GetLedgerReportDownloadUrlDocument,
139
140
  GetLedgerReportingTaxonomyDocument,
140
141
  GetLedgerReportPackageDocument,
141
142
  GetLedgerStatementDocument,
@@ -191,6 +192,7 @@ import {
191
192
  type ListLedgerTransactionsQuery,
192
193
  type ListLedgerUnmappedElementsQuery,
193
194
  type MappingCandidatesQuery,
195
+ type ReportDownloadFormat,
194
196
  } from './graphql/generated/graphql'
195
197
 
196
198
  // ── Friendly types derived from GraphQL codegen ────────────────────────
@@ -283,7 +285,7 @@ export type PublishListMember = PublishListDetail['members'][number]
283
285
  /**
284
286
  * Presigned-URL response for a Report bundle download.
285
287
  *
286
- * Returned by ``LedgerClient.getReportBundleDownloadUrl`` — the
288
+ * Returned by ``LedgerClient.getReportDownloadUrl`` — the
287
289
  * ``downloadUrl`` is a time-limited URL that streams the
288
290
  * serialization artifact directly from object storage. Browser
289
291
  * callers typically follow the URL via ``window.location.href`` or
@@ -296,20 +298,12 @@ export interface ReportBundleDownloadResponse {
296
298
  expiresAt: string
297
299
  /** MIME type of the artifact behind the URL. */
298
300
  contentType: string
299
- /** Serialization flavor — ``jsonld`` is the Phase 1a default. */
301
+ /** Serialization flavor — ``jsonld`` or ``xbrl-2.1``. */
300
302
  format: string
301
303
  /** Bundle generation number stamped on the Report. */
302
304
  generationCount: number
303
305
  }
304
306
 
305
- interface RawReportBundleDownloadResponse {
306
- download_url: string
307
- expires_at: string
308
- content_type: string
309
- format: string
310
- generation_count: number
311
- }
312
-
313
307
  export interface PeriodSpecInput {
314
308
  start: string
315
309
  end: string
@@ -1903,124 +1897,51 @@ export class LedgerClient {
1903
1897
  * Get a short-lived presigned URL for downloading a published
1904
1898
  * Report's serialization bundle.
1905
1899
  *
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.
1900
+ * A download is a read, so this resolves through GraphQL
1901
+ * (`reportDownloadUrl`) the retired `GET .../reports/{id}/download`
1902
+ * REST resource is gone. Every flavor resolves to a presigned S3 URL:
1903
+ * JSON-LD is stamped at publish time; XBRL is materialized + cached
1904
+ * on first request. The returned `downloadUrl` is valid for
1905
+ * `expiresIn` seconds (default 300, max 3600); browser callers
1906
+ * navigate to it via `window.location.href` (or an `<a href>` click)
1907
+ * to trigger the download — the server-set Content-Disposition forces
1908
+ * "attachment" with a versioned filename.
1911
1909
  *
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.
1910
+ * Returns `null` when the report doesn't exist. A report that has
1911
+ * never been published surfaces a `REPORT_BUNDLE_NOT_AVAILABLE`
1912
+ * GraphQL error (regenerate it to produce a bundle).
1918
1913
  *
1919
1914
  * @param graphId Graph identifier owning the Report.
1920
1915
  * @param reportId Report identifier (rpt_-prefixed ULID).
1921
- * @param options.format Serialization flavor — defaults to ``'jsonld'``.
1916
+ * @param options.format Serialization flavor — `JSONLD` (default) or `XBRL_2_1`.
1922
1917
  * @param options.expiresIn Presigned URL lifetime, in seconds.
1923
1918
  */
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
-
1967
- /**
1968
- * Download the Report's serialization bundle as an XBRL 2.1 zip.
1969
- *
1970
- * Rebuilds the bundle on the server and streams the zip body
1971
- * directly — no S3 presigned URL is involved (XBRL is on-demand
1972
- * emit, per the serialization spec). The returned ``Blob`` can be
1973
- * saved via URL.createObjectURL + a temporary anchor click to
1974
- * trigger the browser download dialog.
1975
- *
1976
- * The zip contains five files: ``instance.xml``, ``report.xsd``,
1977
- * ``report-pre.xml``, ``report-cal.xml``, ``report-def.xml``.
1978
- *
1979
- * @param graphId Graph identifier owning the Report.
1980
- * @param reportId Report identifier (rpt_-prefixed ULID).
1981
- * @param options.flavor XBRL flavor (default ``'xbrl-2.1'``).
1982
- */
1983
- async getReportBundleXbrlZip(
1919
+ async getReportDownloadUrl(
1984
1920
  graphId: string,
1985
1921
  reportId: string,
1986
- options: { flavor?: string } = {}
1987
- ): Promise<{ blob: Blob; filename: string; generationCount: number | null }> {
1988
- const flavor = options.flavor ?? 'xbrl-2.1'
1989
- const url =
1990
- `${this.config.baseUrl.replace(/\/$/, '')}` +
1991
- `/extensions/roboledger/${encodeURIComponent(graphId)}` +
1992
- `/reports/${encodeURIComponent(reportId)}/download` +
1993
- `?format=${encodeURIComponent(flavor)}`
1994
- const headers = new Headers({
1995
- Accept: 'application/zip',
1996
- ...(this.config.headers ?? {}),
1997
- })
1998
- const token = await this.resolveToken()
1999
- if (token) {
2000
- if (token.startsWith('rfs')) {
2001
- headers.set('X-API-Key', token)
2002
- } else {
2003
- headers.set('Authorization', `Bearer ${token}`)
1922
+ options: { format?: ReportDownloadFormat; expiresIn?: number } = {}
1923
+ ): Promise<ReportBundleDownloadResponse | null> {
1924
+ return this.gqlQuery(
1925
+ graphId,
1926
+ GetLedgerReportDownloadUrlDocument,
1927
+ {
1928
+ reportId,
1929
+ format: options.format ?? 'JSONLD',
1930
+ expiresIn: options.expiresIn ?? 300,
1931
+ },
1932
+ 'Get report download URL',
1933
+ (data) => {
1934
+ const node = data.reportDownloadUrl
1935
+ if (!node) return null
1936
+ return {
1937
+ downloadUrl: node.downloadUrl,
1938
+ expiresAt: node.expiresAt,
1939
+ contentType: node.contentType,
1940
+ format: node.format,
1941
+ generationCount: node.generationCount,
1942
+ }
2004
1943
  }
2005
- }
2006
- const response = await fetch(url, {
2007
- method: 'GET',
2008
- headers,
2009
- credentials: this.config.credentials,
2010
- })
2011
- if (!response.ok) {
2012
- const body = await response.text()
2013
- throw new Error(`Get report bundle XBRL zip failed (${response.status}): ${body}`)
2014
- }
2015
- const blob = await response.blob()
2016
- // Parse Content-Disposition for the server-suggested filename;
2017
- // fall back to a sensible default if absent.
2018
- const disposition = response.headers.get('Content-Disposition') ?? ''
2019
- const filenameMatch = disposition.match(/filename="?([^";]+)"?/i)
2020
- const filename = filenameMatch ? filenameMatch[1] : `${reportId}.zip`
2021
- const generationHeader = response.headers.get('X-Bundle-Generation')
2022
- const generationCount = generationHeader ? Number.parseInt(generationHeader, 10) : null
2023
- return { blob, filename, generationCount }
1944
+ )
2024
1945
  }
2025
1946
 
2026
1947
  /**
@@ -665,8 +665,8 @@ export type InformationBlockValidation = {
665
665
  * Pass/fail/skip counts for one ``rule_category`` within a block's
666
666
  * verification results.
667
667
  *
668
- * Drives the per-category accordions in the Verification Results panel
669
- * (financial-viewer §7.12). ``category`` is the rule's ``rule_category``
668
+ * Drives the per-category accordions in the Verification Results panel.
669
+ * ``category`` is the rule's ``rule_category``
670
670
  * (one of the cm:VerificationRule subclasses), resolved by joining each
671
671
  * result to its Rule.
672
672
  */
@@ -702,7 +702,7 @@ export type InformationBlockVerificationResult = {
702
702
  * Server-computed aggregate of a block's ``verification_results``.
703
703
  *
704
704
  * Overall counts plus a per-``rule_category`` breakdown, so the viewer
705
- * renders the grouped Verification Results panel (financial-viewer §7.12)
705
+ * renders the grouped Verification Results panel
706
706
  * without a client-side results→rules join. Status closure is
707
707
  * ``pass | fail | error | skipped`` (the ``public.verification_results``
708
708
  * CHECK); ``total`` is their sum.
@@ -1487,6 +1487,7 @@ export type Query = {
1487
1487
  publishList: Maybe<PublishListDetail>;
1488
1488
  publishLists: Maybe<PublishListList>;
1489
1489
  report: Maybe<Report>;
1490
+ reportDownloadUrl: Maybe<ReportBundleDownload>;
1490
1491
  reportPackage: Maybe<ReportPackage>;
1491
1492
  reportingTaxonomy: Maybe<Taxonomy>;
1492
1493
  reports: Maybe<ReportList>;
@@ -1670,6 +1671,11 @@ export type QueryPublishListsArgs = {
1670
1671
  export type QueryReportArgs = {
1671
1672
  reportId: Scalars['String']['input'];
1672
1673
  };
1674
+ export type QueryReportDownloadUrlArgs = {
1675
+ expiresIn?: Scalars['Int']['input'];
1676
+ format?: ReportDownloadFormat;
1677
+ reportId: Scalars['String']['input'];
1678
+ };
1673
1679
  export type QueryReportPackageArgs = {
1674
1680
  reportId: Scalars['String']['input'];
1675
1681
  };
@@ -1784,6 +1790,29 @@ export type Report = {
1784
1790
  /** Taxonomy this report renders against. */
1785
1791
  taxonomyId: Scalars['String']['output'];
1786
1792
  };
1793
+ /**
1794
+ * Presigned-URL response for a published Report's serialization bundle.
1795
+ *
1796
+ * Every flavor resolves to a short-lived presigned URL pointing at the
1797
+ * bundle in S3 — JSON-LD is stamped at publish time, XBRL is
1798
+ * materialized on first download and cached by ``generation_count``.
1799
+ * The client follows ``download_url`` to fetch the artifact directly
1800
+ * from S3 (the API never streams the bytes). Mirrors the
1801
+ * backup-download shape the frontend already consumes.
1802
+ */
1803
+ export type ReportBundleDownload = {
1804
+ /** MIME type of the artifact behind the URL. */
1805
+ contentType: Scalars['String']['output'];
1806
+ /** Presigned URL that streams the bundle directly from S3. */
1807
+ downloadUrl: Scalars['String']['output'];
1808
+ /** UTC timestamp at which the presigned URL stops working. */
1809
+ expiresAt: Scalars['DateTime']['output'];
1810
+ /** Serialization flavor delivered by this URL — one of the ``RdfFlavor`` / ``XbrlFlavor`` values (e.g. ``jsonld``, ``xbrl-2.1``). */
1811
+ format: Scalars['String']['output'];
1812
+ /** Bundle generation number stamped on the Report. */
1813
+ generationCount: Scalars['Int']['output'];
1814
+ };
1815
+ export type ReportDownloadFormat = 'JSONLD' | 'XBRL_2_1';
1787
1816
  /** List of report header summaries (used by report list reads). */
1788
1817
  export type ReportList = {
1789
1818
  /** Report definitions, newest first. */
@@ -2047,6 +2076,7 @@ export type UnmappedElement = {
2047
2076
  code: Maybe<Scalars['String']['output']>;
2048
2077
  externalSource: Maybe<Scalars['String']['output']>;
2049
2078
  id: Scalars['String']['output'];
2079
+ liquidity: Maybe<Scalars['String']['output']>;
2050
2080
  name: Scalars['String']['output'];
2051
2081
  suggestedTargets: Array<SuggestedTarget>;
2052
2082
  trait: Maybe<Scalars['String']['output']>;
@@ -3176,6 +3206,20 @@ export type GetLedgerReportQuery = {
3176
3206
  }>;
3177
3207
  } | null;
3178
3208
  };
3209
+ export type GetLedgerReportDownloadUrlQueryVariables = Exact<{
3210
+ reportId: Scalars['String']['input'];
3211
+ format?: InputMaybe<ReportDownloadFormat>;
3212
+ expiresIn?: InputMaybe<Scalars['Int']['input']>;
3213
+ }>;
3214
+ export type GetLedgerReportDownloadUrlQuery = {
3215
+ reportDownloadUrl: {
3216
+ downloadUrl: string;
3217
+ expiresAt: any;
3218
+ contentType: string;
3219
+ format: string;
3220
+ generationCount: number;
3221
+ } | null;
3222
+ };
3179
3223
  export type GetLedgerReportPackageQueryVariables = Exact<{
3180
3224
  reportId: Scalars['String']['input'];
3181
3225
  }>;
@@ -3875,6 +3919,7 @@ export declare const GetLedgerPeriodDraftsDocument: DocumentNode<GetLedgerPeriod
3875
3919
  export declare const GetLedgerPublishListDocument: DocumentNode<GetLedgerPublishListQuery, GetLedgerPublishListQueryVariables>;
3876
3920
  export declare const ListLedgerPublishListsDocument: DocumentNode<ListLedgerPublishListsQuery, ListLedgerPublishListsQueryVariables>;
3877
3921
  export declare const GetLedgerReportDocument: DocumentNode<GetLedgerReportQuery, GetLedgerReportQueryVariables>;
3922
+ export declare const GetLedgerReportDownloadUrlDocument: DocumentNode<GetLedgerReportDownloadUrlQuery, GetLedgerReportDownloadUrlQueryVariables>;
3878
3923
  export declare const GetLedgerReportPackageDocument: DocumentNode<GetLedgerReportPackageQuery, GetLedgerReportPackageQueryVariables>;
3879
3924
  export declare const GetLedgerReportingTaxonomyDocument: DocumentNode<GetLedgerReportingTaxonomyQuery, GetLedgerReportingTaxonomyQueryVariables>;
3880
3925
  export declare const ListLedgerReportsDocument: DocumentNode<ListLedgerReportsQuery, ListLedgerReportsQueryVariables>;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ListLibraryStructuresDocument = 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 = exports.ListLibraryTaxonomiesDocument = exports.GetLibraryStructureDocument = void 0;
3
+ 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.GetLedgerReportDownloadUrlDocument = 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 = exports.ListLibraryTaxonomiesDocument = exports.GetLibraryStructureDocument = exports.ListLibraryStructuresDocument = void 0;
5
5
  exports.GetInvestorHoldingsDocument = {
6
6
  kind: 'Document',
7
7
  definitions: [
@@ -2928,6 +2928,74 @@ exports.GetLedgerReportDocument = {
2928
2928
  },
2929
2929
  ],
2930
2930
  };
2931
+ exports.GetLedgerReportDownloadUrlDocument = {
2932
+ kind: 'Document',
2933
+ definitions: [
2934
+ {
2935
+ kind: 'OperationDefinition',
2936
+ operation: 'query',
2937
+ name: { kind: 'Name', value: 'GetLedgerReportDownloadUrl' },
2938
+ variableDefinitions: [
2939
+ {
2940
+ kind: 'VariableDefinition',
2941
+ variable: { kind: 'Variable', name: { kind: 'Name', value: 'reportId' } },
2942
+ type: {
2943
+ kind: 'NonNullType',
2944
+ type: { kind: 'NamedType', name: { kind: 'Name', value: 'String' } },
2945
+ },
2946
+ },
2947
+ {
2948
+ kind: 'VariableDefinition',
2949
+ variable: { kind: 'Variable', name: { kind: 'Name', value: 'format' } },
2950
+ type: { kind: 'NamedType', name: { kind: 'Name', value: 'ReportDownloadFormat' } },
2951
+ defaultValue: { kind: 'EnumValue', value: 'JSONLD' },
2952
+ },
2953
+ {
2954
+ kind: 'VariableDefinition',
2955
+ variable: { kind: 'Variable', name: { kind: 'Name', value: 'expiresIn' } },
2956
+ type: { kind: 'NamedType', name: { kind: 'Name', value: 'Int' } },
2957
+ defaultValue: { kind: 'IntValue', value: '300' },
2958
+ },
2959
+ ],
2960
+ selectionSet: {
2961
+ kind: 'SelectionSet',
2962
+ selections: [
2963
+ {
2964
+ kind: 'Field',
2965
+ name: { kind: 'Name', value: 'reportDownloadUrl' },
2966
+ arguments: [
2967
+ {
2968
+ kind: 'Argument',
2969
+ name: { kind: 'Name', value: 'reportId' },
2970
+ value: { kind: 'Variable', name: { kind: 'Name', value: 'reportId' } },
2971
+ },
2972
+ {
2973
+ kind: 'Argument',
2974
+ name: { kind: 'Name', value: 'format' },
2975
+ value: { kind: 'Variable', name: { kind: 'Name', value: 'format' } },
2976
+ },
2977
+ {
2978
+ kind: 'Argument',
2979
+ name: { kind: 'Name', value: 'expiresIn' },
2980
+ value: { kind: 'Variable', name: { kind: 'Name', value: 'expiresIn' } },
2981
+ },
2982
+ ],
2983
+ selectionSet: {
2984
+ kind: 'SelectionSet',
2985
+ selections: [
2986
+ { kind: 'Field', name: { kind: 'Name', value: 'downloadUrl' } },
2987
+ { kind: 'Field', name: { kind: 'Name', value: 'expiresAt' } },
2988
+ { kind: 'Field', name: { kind: 'Name', value: 'contentType' } },
2989
+ { kind: 'Field', name: { kind: 'Name', value: 'format' } },
2990
+ { kind: 'Field', name: { kind: 'Name', value: 'generationCount' } },
2991
+ ],
2992
+ },
2993
+ },
2994
+ ],
2995
+ },
2996
+ },
2997
+ ],
2998
+ };
2931
2999
  exports.GetLedgerReportPackageDocument = {
2932
3000
  kind: 'Document',
2933
3001
  definitions: [