Skip to content

Commit 708a131

Browse files
committed
ci: change supported node versions
1 parent c7dd9e1 commit 708a131

File tree

5 files changed

+3320
-6282
lines changed

5 files changed

+3320
-6282
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
runs-on: ubuntu-latest
1919
strategy:
2020
matrix:
21-
node-version: [18.x, 20.x]
21+
node-version: [20.x, 22.x]
2222
steps:
2323
- uses: actions/checkout@v4
2424
- name: Use Node.js ${{ matrix.node-version }}
@@ -30,7 +30,7 @@ jobs:
3030
name: Install pnpm
3131
id: pnpm-install
3232
with:
33-
version: 8
33+
version: 10
3434
run_install: true
3535

3636
- run: pnpm run build
@@ -49,7 +49,7 @@ jobs:
4949
name: Install pnpm
5050
id: pnpm-install
5151
with:
52-
version: 8
52+
version: 10
5353
run_install: true
5454
- run: pnpm run build
5555
- name: publish alpha

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"@typescript-eslint/eslint-plugin": "^6.7.2",
2323
"@typescript-eslint/parser": "^6.19.1",
2424
"@vitest/coverage-c8": "^0.33.0",
25-
"eslint": "^8.56.0",
25+
"eslint": "8.56.0",
2626
"eslint-config-prettier": "^9.1.0",
2727
"eslint-config-standard": "17.1.0",
2828
"eslint-plugin-custom-elements": "^0.0.8",

packages/resource-jsonapi/src/serialization/document.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ export class DocumentSerializer {
129129
};
130130
}
131131

132-
private makeUniqueIncludedIdForResource(r: Resource) {
132+
// eslint-disable-next-line class-methods-use-this
133+
private makeUniqueIncludedIdForResource (r: Resource) {
133134
return `${r.resourceType}_${r.id}`;
134135
}
135136
}

packages/resource-jsonapi/tests/unit/resources/serialization/serialize-same-ids.test.ts

Lines changed: 120 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
/* eslint-disable max-statements */
12
import { readFile } from 'fs/promises';
23
import { JsonApiResourceSerializer, ResourcesRegistryImpl } from '../../../../src/index.js';
34
import { describe, expect, it, beforeEach } from 'vitest';
4-
import { container } from '@triptyk/nfw-core';
55

66
describe('JsonApiResourceSerializer', () => {
77
let resources: any[];
@@ -11,118 +11,117 @@ describe('JsonApiResourceSerializer', () => {
1111
resources = JSON.parse(await readFile(`${__dirname}../../../fixtures/resources.json`, 'utf-8'));
1212
});
1313

14-
function setupRegistry(registry: ResourcesRegistryImpl) {
15-
const certificateRegistration = {
16-
serializer: {} as never,
17-
deserializer: {} as never,
18-
schema: {
19-
resourceType: 'certificates',
20-
attributes: {
21-
firstname: {
22-
serialize: true,
23-
deserialize: false,
24-
type: 'string'
25-
}
26-
},
27-
relationships: {
28-
patientCertificate: {
29-
type: 'patient-certificates',
30-
cardinality: 'belongs-to',
31-
serialize: true,
32-
deserialize: true
33-
}
34-
}
35-
}
36-
} as const;
14+
function setupRegistry (registry: ResourcesRegistryImpl) {
15+
const certificateRegistration = {
16+
serializer: {} as never,
17+
deserializer: {} as never,
18+
schema: {
19+
resourceType: 'certificates',
20+
attributes: {
21+
firstname: {
22+
serialize: true,
23+
deserialize: false,
24+
type: 'string',
25+
},
26+
},
27+
relationships: {
28+
patientCertificate: {
29+
type: 'patient-certificates',
30+
cardinality: 'belongs-to',
31+
serialize: true,
32+
deserialize: true,
33+
},
34+
},
35+
},
36+
} as const;
3737

38-
39-
registry.register('certificates', certificateRegistration);
40-
registry.register('patients', {
41-
serializer: {} as never,
42-
deserializer: {} as never,
43-
schema: {
44-
resourceType: 'patients',
45-
attributes: {
46-
firstname: {
47-
serialize: true,
48-
deserialize: false,
49-
type: 'string'
50-
}
51-
},
52-
relationships: {
53-
company: {
54-
type: 'companies',
55-
cardinality: 'belongs-to',
56-
serialize: true,
57-
deserialize: true
58-
},
59-
patientCertificates: {
60-
type: 'patient-certificates',
61-
cardinality: 'has-many',
62-
serialize: true,
63-
deserialize: true
64-
}
65-
}
66-
}
67-
});
68-
registry.register('companies', {
69-
serializer: {} as never,
70-
deserializer: {} as never,
71-
schema: {
72-
resourceType: 'companies',
73-
attributes: {
74-
name: {
75-
serialize: true,
76-
deserialize: false,
77-
type: 'string'
78-
}
79-
},
80-
relationships: {
81-
patients: {
82-
type: 'patients',
83-
cardinality: 'has-many',
84-
serialize: true,
85-
deserialize: true
86-
}
87-
}
88-
}
89-
});
90-
registry.register('patient-certificates', {
91-
serializer: {} as never,
92-
deserializer: {} as never,
93-
schema: {
94-
resourceType: 'patient-certificates',
95-
attributes: {
96-
address: {
97-
serialize: true,
98-
deserialize: false,
99-
type: 'string'
100-
}
101-
},
102-
relationships: {
103-
certificate: {
104-
type: 'certificates',
105-
cardinality: 'has-many',
106-
serialize: true,
107-
deserialize: true
108-
},
109-
patient: {
110-
type: 'patients',
111-
cardinality: 'belongs-to',
112-
serialize: true,
113-
deserialize: true
114-
}
115-
}
116-
}
117-
});
118-
}
38+
registry.register('certificates', certificateRegistration);
39+
registry.register('patients', {
40+
serializer: {} as never,
41+
deserializer: {} as never,
42+
schema: {
43+
resourceType: 'patients',
44+
attributes: {
45+
firstname: {
46+
serialize: true,
47+
deserialize: false,
48+
type: 'string',
49+
},
50+
},
51+
relationships: {
52+
company: {
53+
type: 'companies',
54+
cardinality: 'belongs-to',
55+
serialize: true,
56+
deserialize: true,
57+
},
58+
patientCertificates: {
59+
type: 'patient-certificates',
60+
cardinality: 'has-many',
61+
serialize: true,
62+
deserialize: true,
63+
},
64+
},
65+
},
66+
});
67+
registry.register('companies', {
68+
serializer: {} as never,
69+
deserializer: {} as never,
70+
schema: {
71+
resourceType: 'companies',
72+
attributes: {
73+
name: {
74+
serialize: true,
75+
deserialize: false,
76+
type: 'string',
77+
},
78+
},
79+
relationships: {
80+
patients: {
81+
type: 'patients',
82+
cardinality: 'has-many',
83+
serialize: true,
84+
deserialize: true,
85+
},
86+
},
87+
},
88+
});
89+
registry.register('patient-certificates', {
90+
serializer: {} as never,
91+
deserializer: {} as never,
92+
schema: {
93+
resourceType: 'patient-certificates',
94+
attributes: {
95+
address: {
96+
serialize: true,
97+
deserialize: false,
98+
type: 'string',
99+
},
100+
},
101+
relationships: {
102+
certificate: {
103+
type: 'certificates',
104+
cardinality: 'has-many',
105+
serialize: true,
106+
deserialize: true,
107+
},
108+
patient: {
109+
type: 'patients',
110+
cardinality: 'belongs-to',
111+
serialize: true,
112+
deserialize: true,
113+
},
114+
},
115+
},
116+
});
117+
}
119118

120119
it('Serialize resources with the same ids', async () => {
121120
const registry = new ResourcesRegistryImpl();
122121

123122
registry.setConfig({
124-
host: 'http://localhost:3000'
125-
})
123+
host: 'http://localhost:3000',
124+
});
126125

127126
setupRegistry(registry);
128127

@@ -131,23 +130,23 @@ describe('JsonApiResourceSerializer', () => {
131130
);
132131

133132
const result = await serializer.serializeMany(resources, {
134-
include: [
133+
include: [
134+
{
135+
relationName: 'patientCertificate',
136+
nested: [
135137
{
136-
relationName: 'patientCertificate',
137-
nested: [
138-
{
139-
relationName: 'patient',
140-
nested: [{
141-
relationName: 'company',
142-
nested: []
143-
}]
144-
}
145-
]
146-
}
147-
]
138+
relationName: 'patient',
139+
nested: [{
140+
relationName: 'company',
141+
nested: [],
142+
}],
143+
},
144+
],
145+
},
146+
],
148147
}, {
149148
endpointURL: '/test',
150-
149+
151150
});
152151

153152
expect(result.included?.some((doc) => doc.type === 'patients' && doc.id === '99999999')).toBe(true);

0 commit comments

Comments
 (0)