Skip to content

Commit 5952d5f

Browse files
authored
Merge pull request #485 from PermanentOrg/noissue-fix-stela-time-conversions
Don't reformat stela timestamps
2 parents b4f7e75 + 5b0f19a commit 5952d5f

File tree

8 files changed

+7223
-22
lines changed

8 files changed

+7223
-22
lines changed

CHANGELOG.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,53 +7,56 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.9.1] - 2025-03-13
11+
12+
### Fixed
13+
14+
- Stela endpoint response dates are no longer being incorrectly modified by the SDK.
15+
1016
## [0.9.0] - 2025-03-12
1117

12-
## Added
18+
### Added
1319

1420
- ClientConfiguration now accepts a `stelaBaseUrl`
1521

16-
## Changed
22+
### Changed
1723

1824
- BREAKING CHANGE: Dropped support for Node 18.
1925
- BREAKING CHANGE: getFolder() now uses stela endpoints, which uses `stelaBaseUrl`.
2026
- Added optional failOnDuplicateName parameters to createFolder and createArchiveRecord
2127

2228
## [0.8.0] - 2024-08-28
2329

24-
## Changed
30+
### Changed
2531

2632
- BREAKING CHANGE: All functions now take either one or two arguments. The first argument is always the `ClientConfig`
2733
object. The second argument, if it is present, is always an object containing the rest of the parameters for the
2834
function. Documentation describing each function and its inputs has been added in API.md.
2935

3036
## [0.7.0] - 2024-02-23
3137

32-
## Added
38+
### Added
3339

3440
- The `updateShareLink` function now exists
35-
36-
## Added
37-
3841
- The `createShareLink` function now exists
3942

40-
## Changed
43+
### Changed
4144

4245
- This package no longer supports Node v14.
4346
- The `deleteFolder` and `deleteArchiveRecord` SDK methods now return void (was boolean).
4447
- All SDK methods now throw if the server responds with a non-OK status.
4548

46-
## Added
49+
### Added
4750

4851
- The `HttpResponseError` type now exists.
4952

5053
## [0.6.0] - 2023-05-18
5154

52-
## Changed
55+
### Changed
5356

5457
- The `createArchiveRecord` function no longer uploads files, clients must use the new `uploadFile` function for this.
5558

56-
## Added
59+
### Added
5760

5861
- The `uploadFile` function now exists.
5962

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@permanentorg/sdk",
3-
"version": "0.9.0",
3+
"version": "0.9.1",
44
"description": "Functional Node.js SDK for Permanent.org",
55
"module": "dist/esm/index.js",
66
"main": "dist/cjs/index.js",

src/sdk/__tests__/__snapshots__/getFolder.test.ts.snap

Lines changed: 2800 additions & 0 deletions
Large diffs are not rendered by default.

src/sdk/__tests__/fixtures/getFolder/stelaChildrenPageOne.json

Lines changed: 4400 additions & 0 deletions
Large diffs are not rendered by default.

src/sdk/__tests__/getFolder.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe('getFolder', () => {
1919
const firstChildrenPage = nock('https://api.permanent.local')
2020
.get('/api/v2/folder/7457/children')
2121
.query({
22-
pageSize: 20,
22+
pageSize: 100,
2323
})
2424
.replyWithFile(
2525
200,
@@ -32,7 +32,7 @@ describe('getFolder', () => {
3232
const secondChildrenPage = nock('https://api.permanent.local')
3333
.get('/api/v2/folder/7457/children')
3434
.query({
35-
pageSize: 20,
35+
pageSize: 100,
3636
cursor: '1575064',
3737
})
3838
.replyWithFile(

src/sdk/getFolder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export interface GetFolderParams {
1717
folderId: number;
1818
}
1919

20-
const LOAD_CHILDREN_PAGE_SIZE = 20;
20+
const LOAD_CHILDREN_PAGE_SIZE = 100;
2121

2222
const loadAllStelaChildrenForFolder = async (
2323
clientConfiguration: ClientConfiguration,

src/utils/stelaFileToFile.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import {
22
DerivativeType,
33
isDerivativeType,
44
} from '../types';
5-
import { formatTimestampAsUtc } from './formatTimestampAsUtc';
65
import type {
76
File,
87
StelaFile,
@@ -20,6 +19,6 @@ export const stelaFileToFile = (stelaFile: StelaFile): File => ({
2019
downloadUrl: stelaFile.downloadUrl,
2120
checksum: '',
2221
size: stelaFile.size,
23-
createdAt: new Date(formatTimestampAsUtc(stelaFile.createdAt)),
24-
updatedAt: new Date(formatTimestampAsUtc(stelaFile.updatedAt)),
22+
createdAt: new Date(stelaFile.createdAt),
23+
updatedAt: new Date(stelaFile.updatedAt),
2524
});

src/utils/stelaFolderToFolder.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { formatTimestampAsUtc } from './formatTimestampAsUtc';
21
import type {
32
StelaFolder,
43
Folder,
@@ -10,11 +9,11 @@ export const stelaFolderToFolder = (stelaFolder: StelaFolder): Folder => ({
109
name: stelaFolder.displayName,
1110
fileSystemCompatibleName: stelaFolder.downloadName,
1211
size: stelaFolder.size ?? 0,
13-
createdAt: new Date(formatTimestampAsUtc(stelaFolder.createdAt)),
14-
updatedAt: new Date(formatTimestampAsUtc(stelaFolder.updatedAt)),
12+
createdAt: new Date(stelaFolder.createdAt),
13+
updatedAt: new Date(stelaFolder.updatedAt),
1514
displayDate: stelaFolder.displayTimestamp === null || stelaFolder.displayTimestamp === undefined
1615
? null
17-
: new Date(formatTimestampAsUtc(stelaFolder.displayTimestamp)),
16+
: new Date(stelaFolder.displayTimestamp),
1817
folders: [],
1918
archiveRecords: [],
2019
});

0 commit comments

Comments
 (0)