iom-sdk 0.2.1 → 0.2.4

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.
@@ -62,7 +62,14 @@ export declare class FileStorageServiceClient {
62
62
  */
63
63
  softDelete(fileReference: string, opts?: RequestOptions): Promise<void>;
64
64
  getPreviewUrl(fileReference: string, opts?: RequestOptions): Promise<PreviewUrlResponse>;
65
- getDownloadUrl(fileReference: string): DownloadUrlResponse;
65
+ /**
66
+ * Authenticated GET that returns a presigned S3 download URL as JSON
67
+ * (`{ url, expiresAt }`). The JWT is attached to this request by the axios
68
+ * interceptor; the consumer then navigates the browser to `url`, so the JWT
69
+ * never reaches S3. The presigned URL has `Content-Disposition: attachment`
70
+ * baked in by the server. Twin of `getPreviewUrl`.
71
+ */
72
+ getDownloadUrl(fileReference: string, opts?: RequestOptions): Promise<DownloadUrlResponse>;
66
73
  uploadFile(input: UploadFileInput): Promise<FileStorageCompleteResponseDTO>;
67
74
  private runMultipart;
68
75
  }
@@ -1,5 +1,5 @@
1
1
  export interface Sha256Hasher {
2
- /** Full-file SHA-256 as lowercase hex (for `InitUploadRequest.sha256`). */
2
+ /** Full-file SHA-256 as lowercase hex (for `FileStorageInitDTO.sha256`). */
3
3
  hashFullFile(blob: Blob, signal?: AbortSignal): Promise<string>;
4
4
  /** Per-part SHA-256 as base64 (for `x-amz-checksum-sha256` header). */
5
5
  hashPart(blob: Blob, signal?: AbortSignal): Promise<string>;
@@ -1,7 +1,7 @@
1
1
  import { AxiosInstance } from 'axios';
2
2
  import { ServiceConfig, ErrorHandlingConfig } from '../../config';
3
3
  import { RegistryServiceClient } from '../registry/registry-client';
4
- import { UUID, UUObjectDTO, UUPropertyDTO, UUPropertyValueDTO, UUStatementDTO, UUFileDTO, UUAddressDTO, QueryParams, NodeFindRequestDTO, UUStatementsAccessFindDTO, AggregateCreateDTO, AggregateEntity, AggregateFindDTO, PageAggregateEntity, ApiResponse, RequestOptions, GroupCreateDTO, GroupAddRecordsDTO, GroupListParams, PageImplGroupFullDTO, PageImplGroupRecord, UUMathFormulaDTO, UUMathFormulaCalcDTO, UUMathFormulaFindDTO, UUMathFormulaCalcFindDTO, PageUUMathFormula } from '../../types';
4
+ import { UUID, UUObjectDTO, UUPropertyDTO, UUPropertyValueDTO, UUStatementDTO, UUFileDTO, UUAddressDTO, QueryParams, NodeFindRequestDTO, UUStatementsAccessFindDTO, AggregateCreateDTO, AggregateEntity, AggregateFindDTO, PageAggregateEntity, ApiResponse, RequestOptions, GroupCreateDTO, GroupAddRecordsDTO, GroupListParams, PageImplGroupFullDTO, PageImplGroupRecord, UUMathFormulaDTO, UUMathFormulaCalcDTO, UUMathFormulaCalcFindDTO, NodeFindDTO, PageUUMathFormula } from '../../types';
5
5
  export declare class NodeServiceClient {
6
6
  private errorHandling;
7
7
  private axios;
@@ -137,7 +137,7 @@ export declare class NodeServiceClient {
137
137
  * envelope. Access `result.content` for the rows; pagination + audit
138
138
  * fields live alongside.
139
139
  */
140
- searchMathFormulas(body: UUMathFormulaFindDTO, params?: {
140
+ searchMathFormulas(body: NodeFindDTO, params?: {
141
141
  page?: number;
142
142
  size?: number;
143
143
  }, options?: RequestOptions): Promise<PageUUMathFormula>;
@@ -18,49 +18,6 @@ export interface AggregateFindDTO {
18
18
  searchTerm?: string;
19
19
  searchBy?: Record<string, any>;
20
20
  }
21
- /**
22
- * Aggregate file entity with metadata
23
- */
24
- export interface AggregateFile {
25
- createdAt?: string;
26
- createdBy?: AuditUser;
27
- lastUpdatedAt?: string;
28
- lastUpdatedBy?: AuditUser;
29
- softDeletedAt?: string;
30
- softDeleteBy?: AuditUser;
31
- softDeleted?: boolean;
32
- uuid?: string;
33
- fileName?: string;
34
- fileReference?: string;
35
- label?: string;
36
- contentType?: string;
37
- size?: number;
38
- }
39
- /**
40
- * Aggregate property entity with optional values
41
- */
42
- export interface AggregateProperty {
43
- createdAt?: string;
44
- createdBy?: AuditUser;
45
- lastUpdatedAt?: string;
46
- lastUpdatedBy?: AuditUser;
47
- softDeletedAt?: string;
48
- softDeleteBy?: AuditUser;
49
- softDeleted?: boolean;
50
- uuid?: string;
51
- key?: string;
52
- version?: string;
53
- label?: string;
54
- description?: string;
55
- type?: string;
56
- inputType?: string;
57
- formula?: string;
58
- inputOrderPosition?: number;
59
- processingOrderPosition?: number;
60
- viewOrderPosition?: number;
61
- values?: AggregateUUPropertyValue[];
62
- files?: AggregateUUFile[];
63
- }
64
21
  /**
65
22
  * Aggregate address entity with metadata
66
23
  */
@@ -1,11 +1,6 @@
1
1
  /**
2
2
  * Authentication-related types
3
3
  */
4
- export interface JWTToken {
5
- token: string;
6
- expiresAt: Date;
7
- issuedAt: Date;
8
- }
9
4
  export interface JWTAuthResponse {
10
5
  token: string;
11
6
  expiresIn: number;
@@ -13,18 +8,6 @@ export interface JWTAuthResponse {
13
8
  user?: AuthResponse;
14
9
  refreshToken: string;
15
10
  }
16
- export interface TokenRefreshConfig {
17
- refreshThresholdMinutes?: number;
18
- maxRetries?: number;
19
- retryDelayMs?: number;
20
- }
21
- export interface AuthState {
22
- token?: JWTToken;
23
- user?: AuthResponse;
24
- isAuthenticated: boolean;
25
- isRefreshing: boolean;
26
- lastAuthError?: string;
27
- }
28
11
  /**
29
12
  * User details returned from mTLS authentication endpoint
30
13
  * Based on actual API response structure with certificate information
@@ -64,15 +47,6 @@ export interface AuthRefreshTokenResponse {
64
47
  export interface RefreshTokenRequest {
65
48
  refreshToken: string;
66
49
  }
67
- /**
68
- * Refresh token error response (403 when expired)
69
- */
70
- export interface RefreshTokenError {
71
- detail: string;
72
- status: number;
73
- title: string;
74
- errors: Record<string, any>;
75
- }
76
50
  /**
77
51
  * Email/password registration request
78
52
  */
@@ -137,23 +137,22 @@ export interface PreviewUrlResponseDTO {
137
137
  /** ISO-8601. */
138
138
  expiresAt: string;
139
139
  }
140
- export type InitUploadRequest = FileStorageInitDTO;
141
- export type InitUploadResponse = FileStorageInitResponseDTO;
142
- export type RefreshUrlsRequest = FileStorageRefreshDTO;
143
140
  export type CompletedPart = PartETag;
144
- export type CompleteUploadRequest = FileStorageCompleteDTO;
145
- export type CompleteUploadResponse = FileStorageCompleteResponseDTO;
146
- export type FileMetadata = FileMetadataResponseDTO;
147
141
  export type PreviewUrlResponse = PreviewUrlResponseDTO;
148
142
  /**
149
- * URL of `GET /api/FileStorage/{fileReference}/download` — unauthenticated
150
- * endpoint that 302-redirects to a presigned S3 URL with
151
- * `Content-Disposition: attachment` baked in. The SDK builds this synchronously;
152
- * the browser navigates and S3 serves the download.
143
+ * Response from `GET /api/FileStorage/{fileReference}/download`.
144
+ *
145
+ * An authenticated GET (the SDK attaches the JWT) returns this JSON — a
146
+ * presigned S3 URL with `Content-Disposition: attachment` baked in by the
147
+ * server. The consumer navigates the browser to `url`; the JWT never reaches
148
+ * S3. Shape mirrors `PreviewUrlResponseDTO`.
153
149
  */
154
- export interface DownloadUrlResponse {
150
+ export interface DownloadUrlResponseDTO {
155
151
  url: string;
152
+ /** ISO-8601. */
153
+ expiresAt: string;
156
154
  }
155
+ export type DownloadUrlResponse = DownloadUrlResponseDTO;
157
156
  /**
158
157
  * Typed errors thrown by `FileStorageServiceClient`. Map RFC 7807 ProblemDetails
159
158
  * from the backend + S3-side errors into one of these kinds.
@@ -7,36 +7,3 @@
7
7
  * @returns Expiry duration in seconds (defaults to 3600 if parsing fails)
8
8
  */
9
9
  export declare function calculateJWTExpiresIn(tokenString: string): number;
10
- /**
11
- * Decode JWT token payload without verification
12
- * @param token - JWT token string
13
- * @returns Decoded payload or null if invalid
14
- */
15
- export declare function decodeJWTPayload(token: string): {
16
- userUUID?: string;
17
- credentials?: string;
18
- createdAt?: number;
19
- authorities?: string[];
20
- certificateInfo?: {
21
- certificateSha256: string;
22
- subjectFields: {
23
- CN: string;
24
- [key: string]: string;
25
- };
26
- issuerFields: {
27
- CN: string;
28
- [key: string]: string;
29
- };
30
- serialNumber: string;
31
- validFrom: number;
32
- validTo: number;
33
- subjectAlternativeNames: string[];
34
- };
35
- enabled?: boolean;
36
- accountNonExpired?: boolean;
37
- credentialsNonExpired?: boolean;
38
- accountNonLocked?: boolean;
39
- iat?: number;
40
- exp?: number;
41
- [key: string]: any;
42
- } | null;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.2.1",
2
+ "version": "0.2.4",
3
3
  "name": "iom-sdk",
4
4
  "author": "MaEconomy Org",
5
5
  "description": "TypeScript SDK for Internet of Materials (IoM) - A client library for interacting with UUProtocol-based building/material management systems",