Skip to content

Commit 8e847ae

Browse files
releases/v2.9.2
- [e2a8700][michaeljymsgutierrez]: Updated release version from v2.9.1 to v2.9.2 - 2026-07-02 09:29:18 - [e1eb16b][Chael Gutierrez]: fix(record): remove Number() coercion in reload and destroyRecord to support string ids (#246) - 2026-07-02 09:24:07
1 parent 418c72a commit 8e847ae

6 files changed

Lines changed: 48 additions & 13 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<img src="https://github.com/michaeljymsgutierrez/arm-js-library/actions/workflows/ci-cd.yml/badge.svg" alt="cicd-badge-logo" />
1010
</a>
1111
<a href="https://www.npmjs.com/package/arm-js-library">
12-
<img src="https://img.shields.io/badge/npm_version-2.9.1-blue" alt="npm-badge-logo" />
12+
<img src="https://img.shields.io/badge/npm_version-2.9.2-blue" alt="npm-badge-logo" />
1313
</a>
1414
<a href="https://github.com/michaeljymsgutierrez/arm-js-library?tab=MIT-1-ov-file">
1515
<img src="https://img.shields.io/badge/license-MIT-green" alt="license-badge-logo" />
@@ -605,7 +605,7 @@ See example [here](https://github.com/michaeljymsgutierrez/arm-js-library/tree/m
605605
"type": "addresses",
606606
"attributes": {
607607
"address1": "Test Address 1",
608-
"address2": "171872.9.1222",
608+
"address2": "171872.9.2222",
609609
"kind": "office",
610610
"label": "Anabu Hills",
611611
"latitude": "14.394261",

packages/dist/arm-js-library.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import qs from "qs";
77
/**
88
* ARM JavaScript Library
99
*
10-
* Version: 2.9.1
10+
* Version: 2.9.2
1111
* Date: 2024-05-09 2:19PM GMT+8
1212
*
1313
* @author Michael Jyms Gutierrez
@@ -175,7 +175,7 @@ class ApiResourceManager {
175175
setProperty(
176176
axios,
177177
["defaults", "headers", "common", "X-Powered-By"],
178-
"ARM JS Library/2.9.1"
178+
"ARM JS Library/2.9.2"
179179
);
180180
}
181181
/**
@@ -572,7 +572,7 @@ Fix: Try adding ${collectionName} on your ARM config initialization.`;
572572
return this._request({
573573
resourceMethod: "delete",
574574
resourceName: getProperty(currentRecord, "collectionName"),
575-
resourceId: Number(getProperty(currentRecord, "id")),
575+
resourceId: getProperty(currentRecord, "id"),
576576
resourceParams: {},
577577
resourcePayload: null,
578578
resourceFallback: {},
@@ -593,7 +593,7 @@ Fix: Try adding ${collectionName} on your ARM config initialization.`;
593593
return this._request({
594594
resourceMethod: "get",
595595
resourceName: getProperty(currentRecord, "collectionName"),
596-
resourceId: Number(getProperty(currentRecord, "id")),
596+
resourceId: getProperty(currentRecord, "id"),
597597
resourceParams: {},
598598
resourcePayload: null,
599599
resourceFallback: {},

packages/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "arm-js-library",
3-
"version": "2.9.1",
3+
"version": "2.9.2",
44
"description": "API Resource Manager",
55
"type": "module",
66
"files": [

packages/src/lib/api-resource-manager.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* ARM JavaScript Library
33
*
4-
* Version: 2.9.1
4+
* Version: 2.9.2
55
* Date: 2024-05-09 2:19PM GMT+8
66
*
77
* @author Michael Jyms Gutierrez
@@ -285,7 +285,7 @@ export default class ApiResourceManager {
285285
setProperty(
286286
axios,
287287
['defaults', 'headers', 'common', 'X-Powered-By'],
288-
'ARM JS Library/2.9.1',
288+
'ARM JS Library/2.9.2',
289289
)
290290
}
291291

@@ -715,7 +715,7 @@ export default class ApiResourceManager {
715715
return this._request({
716716
resourceMethod: 'delete',
717717
resourceName: getProperty(currentRecord, 'collectionName'),
718-
resourceId: Number(getProperty(currentRecord, 'id')),
718+
resourceId: getProperty(currentRecord, 'id'),
719719
resourceParams: {},
720720
resourcePayload: null,
721721
resourceFallback: {},
@@ -737,7 +737,7 @@ export default class ApiResourceManager {
737737
return this._request({
738738
resourceMethod: 'get',
739739
resourceName: getProperty(currentRecord, 'collectionName'),
740-
resourceId: Number(getProperty(currentRecord, 'id')),
740+
resourceId: getProperty(currentRecord, 'id'),
741741
resourceParams: {},
742742
resourcePayload: null,
743743
resourceFallback: {},

packages/tests/mirage/index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,11 @@ export default function () {
4646
: request.requestBody
4747
})
4848

49-
this.delete('/addresses/:id', () => {
50-
return { data: addresses.data[1] }
49+
this.delete('/addresses/:id', (schema, request) => {
50+
const { id } = request.params
51+
return isNaN(Number(id))
52+
? { data: { id, type: 'addresses', attributes: {} } }
53+
: { data: addresses.data[1] }
5154
})
5255
},
5356
})

packages/tests/units/record.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,22 @@ const execRecordTest = (ARM) => {
158158
expect(record.get('attributes.address1')).toBe('Anabu Hills Test 4')
159159
})
160160

161+
test('Verify reload with string collection record id', async () => {
162+
ARM.pushPayload('addresses', [
163+
{
164+
id: 'JO-26181S4VPU65',
165+
type: 'addresses',
166+
attributes: { address1: 'String ID Address', kind: 'office' },
167+
},
168+
])
169+
const record = ARM.peekRecord('addresses', 'JO-26181S4VPU65')
170+
expect(record).toBeDefined()
171+
172+
const result = await record.reload()
173+
expect(result).toBeDefined()
174+
expect(record.get('isError')).toBe(false)
175+
})
176+
161177
test('Verify rollbackAttributes functionality', async () => {
162178
await ARM.findRecord('addresses', 2518368, null, {
163179
autoResolve: false,
@@ -204,6 +220,22 @@ const execRecordTest = (ARM) => {
204220
expect(ARM.peekRecord('addresses', 2518368)).toBeUndefined()
205221
})
206222

223+
test('Verify destroyRecord with string collection record id', async () => {
224+
ARM.pushPayload('addresses', [
225+
{
226+
id: 'JO-26181S4VPU65',
227+
type: 'addresses',
228+
attributes: { address1: 'String ID Address', kind: 'office' },
229+
},
230+
])
231+
const record = ARM.peekRecord('addresses', 'JO-26181S4VPU65')
232+
expect(record).toBeDefined()
233+
234+
const result = await record.destroyRecord()
235+
expect(result).toBeDefined()
236+
expect(ARM.peekRecord('addresses', 'JO-26181S4VPU65')).toBeUndefined()
237+
})
238+
207239
test('Verify getCollection functionality', async () => {
208240
await ARM.query(
209241
'addresses',

0 commit comments

Comments
 (0)