Skip to content

Commit 5259891

Browse files
releases/v2.6.3
- [2fec90b][michaeljymsgutierrez]: Updated release version from v2.6.2 to v2.6.3 - 2026-02-26 23:38:46 - [4fa060f][Chael Gutierrez]: fixes/inject-request-hash-action (#230) - 2026-02-26 23:36:27
1 parent 2d39b2f commit 5259891

25 files changed

Lines changed: 1055 additions & 960 deletions

File tree

DOCS.md

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,12 @@ enabling convenient interactions with the record, including:</p>
171171
<li>Retrieval of related collections</li>
172172
</ul>
173173
</dd>
174-
<dt><a href="#_injectRequestHashActions">_injectRequestHashActions(requestObject, requestHashKey)</a> ℗</dt>
175-
<dd><p>Injects actions into a request hash.</p>
176-
<p>This method adds a <code>reload</code> action to the specified request hash, allowing
177-
it to be reloaded using the <code>_reloadRequest</code> method.</p>
174+
<dt><a href="#_injectRequestHashActions">_injectRequestHashActions(requestObject, responseObject, requestHashKey)</a> ℗</dt>
175+
<dd><p>Decorates the response object with actionable methods.</p>
176+
<ul>
177+
<li>Attaches a <code>reload</code> method to the <code>responseObject</code> that, when invoked,
178+
triggers a re-fetch of the original request using the stored hash key.</li>
179+
</ul>
178180
</dd>
179181
<dt><a href="#_injectCollectionReferenceKeys">_injectCollectionReferenceKeys(collectionName, collectionRecord, [collectionRecordHashId])</a> ℗</dt>
180182
<dd><p>Injects reference keys into a collection record.</p>
@@ -252,15 +254,18 @@ a single object) and performs the following actions:</p>
252254
</ol>
253255
</dd>
254256
<dt><a href="#_pushRequestHash">_pushRequestHash(requestObject, responseObject)</a> ⇒ <code>Object</code> ℗</dt>
255-
<dd><p>Pushes a request and its corresponding response to the request hash store.</p>
256-
<p>This method adds or updates a request hash in the <code>requestHashes</code> object.
257-
It generates a unique <code>requestHashKey</code> using the <code>_generateHashId</code>
258-
method based on the <code>requestObject</code>.</p>
259-
<p>If a request hash with the same key already exists and the <code>responseObject</code>
260-
is marked as <code>isNew</code>, it updates the existing hash&#39;s <code>isNew</code> flag to
261-
<code>false</code>. Otherwise, it adds a new request hash with the given key and
262-
<code>responseObject</code>. Additionally, it injects request hash actions using
263-
the <code>_injectRequestHashActions</code> method, enabling features like reload.</p>
257+
<dd><p>Caches a request/response pair in the internal hash store.</p>
258+
<ul>
259+
<li>Generates a unique key based on the request and performs one of two actions:</li>
260+
</ul>
261+
<ol>
262+
<li>If the key exists and the new response is marked <code>isNew</code>, it toggles the
263+
existing entry&#39;s <code>isNew</code> flag to <code>false</code>.</li>
264+
<li>Otherwise, it stores the new response object under that key.</li>
265+
</ol>
266+
<ul>
267+
<li>Also injects contextual actions (e.g., reload) into the response object.</li>
268+
</ul>
264269
</dd>
265270
<dt><a href="#setHost">setHost(host)</a></dt>
266271
<dd><p>Sets the host URL for the client and initializes the Axios configuration.</p>
@@ -922,19 +927,19 @@ enabling convenient interactions with the record, including:
922927

923928
<a name="_injectRequestHashActions"></a>
924929

925-
## \_injectRequestHashActions(requestObject, requestHashKey) ℗
926-
Injects actions into a request hash.
927-
928-
This method adds a `reload` action to the specified request hash, allowing
929-
it to be reloaded using the `_reloadRequest` method.
930+
## \_injectRequestHashActions(requestObject, responseObject, requestHashKey) ℗
931+
Decorates the response object with actionable methods.
932+
* Attaches a `reload` method to the `responseObject` that, when invoked,
933+
triggers a re-fetch of the original request using the stored hash key.
930934

931935
**Kind**: global function
932936
**Access**: private
933937

934938
| Param | Type | Description |
935939
| --- | --- | --- |
936-
| requestObject | <code>Object</code> | The request object associated with the hash. |
937-
| requestHashKey | <code>string</code> | The key of the request hash to inject actions into. |
940+
| requestObject | <code>Object</code> | The original request configuration. |
941+
| responseObject | <code>Object</code> | The object to be decorated with actions. |
942+
| requestHashKey | <code>string</code> | The unique identifier for the request in the store. |
938943

939944
<a name="_injectCollectionReferenceKeys"></a>
940945

@@ -1083,26 +1088,21 @@ a single object) and performs the following actions:
10831088
<a name="_pushRequestHash"></a>
10841089

10851090
## \_pushRequestHash(requestObject, responseObject) ⇒ <code>Object</code> ℗
1086-
Pushes a request and its corresponding response to the request hash store.
1087-
1088-
This method adds or updates a request hash in the `requestHashes` object.
1089-
It generates a unique `requestHashKey` using the `_generateHashId`
1090-
method based on the `requestObject`.
1091-
1092-
If a request hash with the same key already exists and the `responseObject`
1093-
is marked as `isNew`, it updates the existing hash's `isNew` flag to
1094-
`false`. Otherwise, it adds a new request hash with the given key and
1095-
`responseObject`. Additionally, it injects request hash actions using
1096-
the `_injectRequestHashActions` method, enabling features like reload.
1091+
Caches a request/response pair in the internal hash store.
1092+
* Generates a unique key based on the request and performs one of two actions:
1093+
1. If the key exists and the new response is marked `isNew`, it toggles the
1094+
existing entry's `isNew` flag to `false`.
1095+
2. Otherwise, it stores the new response object under that key.
1096+
* Also injects contextual actions (e.g., reload) into the response object.
10971097

10981098
**Kind**: global function
1099-
**Returns**: <code>Object</code> - The updated or created request hash object.
1099+
**Returns**: <code>Object</code> - The stored request hash entry.
11001100
**Access**: private
11011101

11021102
| Param | Type | Description |
11031103
| --- | --- | --- |
1104-
| requestObject | <code>Object</code> | The request object used to generate the hash key. |
1105-
| responseObject | <code>Object</code> | The response object associated with the request. |
1104+
| requestObject | <code>Object</code> | The source object used to generate the hash key. |
1105+
| responseObject | <code>Object</code> | The data/state to be stored. |
11061106

11071107
<a name="setHost"></a>
11081108

README.md

Lines changed: 7 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.6.2-blue" alt="npm-badge-logo" />
12+
<img src="https://img.shields.io/badge/npm_version-2.6.3-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" />
@@ -42,6 +42,7 @@
4242
- [Data Retrieval and Manipulation](#data-retrieval-and-manipulation)
4343
- [Data Validation and Comparison](#data-validation-and-comparison)
4444
- [Credits](#credits)
45+
- [License](#license)
4546

4647
## Overview
4748

@@ -587,7 +588,7 @@ See example [here](https://github.com/michaeljymsgutierrez/arm-js-library/tree/m
587588
"type": "addresses",
588589
"attributes": {
589590
"address1": "Test Address 1",
590-
"address2": "171872.6.2222",
591+
"address2": "171872.6.3222",
591592
"kind": "office",
592593
"label": "Anabu Hills",
593594
"latitude": "14.394261",
@@ -1059,3 +1060,7 @@ const addresses = [
10591060
alt="Dickson Palomeras"
10601061
height="40" width="40" />
10611062
</a>
1063+
1064+
## License
1065+
1066+
This project is licensed under the MIT License.
Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
/** @type {import('next').NextConfig} */
2-
const nextConfig = {};
2+
const nextConfig = {
3+
async redirects() {
4+
return [
5+
{
6+
source: '/',
7+
destination: '/demo',
8+
permanent: true,
9+
},
10+
]
11+
},
12+
}
313

4-
export default nextConfig;
14+
export default nextConfig

apps/create-next-app/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@
2323
"eslint-config-next": "^16.1.4",
2424
"tailwindcss": "^4",
2525
"typescript": "5.9.3"
26-
}
26+
},
27+
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
2728
}

apps/create-next-app/src/app/api/v1/addresses/[id]/route.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export async function PUT(request) {
3232
headers: {
3333
'Content-Type': 'application/json',
3434
},
35-
}
35+
},
3636
)
3737
}
3838

@@ -47,6 +47,6 @@ export async function DELETE(request) {
4747
headers: {
4848
'Content-Type': 'application/json',
4949
},
50-
}
50+
},
5151
)
5252
}

apps/create-next-app/src/app/api/v1/addresses/route.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export async function GET(request) {
1515
headers: {
1616
'Content-Type': 'application/json',
1717
},
18-
}
18+
},
1919
)
2020
}
2121

@@ -26,7 +26,7 @@ export async function GET(request) {
2626
headers: {
2727
'Content-Type': 'application/json',
2828
},
29-
}
29+
},
3030
)
3131
}
3232

@@ -41,6 +41,6 @@ export async function POST(request) {
4141
headers: {
4242
'Content-Type': 'application/json',
4343
},
44-
}
44+
},
4545
)
4646
}

apps/create-next-app/src/app/api/v1/route.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ export async function GET(request) {
1010
headers: {
1111
'Content-Type': 'application/json',
1212
},
13-
}
13+
},
1414
)
1515
}

apps/create-next-app/src/app/api/v1/users/route.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ export async function GET(request) {
1111
headers: {
1212
'Content-Type': 'application/json',
1313
},
14-
}
14+
},
1515
)
1616
}

apps/create-next-app/src/app/demo/collection-records/getter-setter-functions/page.jsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,15 @@ const Page = observer(() => {
7373
className="blue-btn"
7474
onClick={() => {
7575
alert(address.get('attributes.address1'))
76-
}}
77-
>
76+
}}>
7877
Get (Address1)
7978
</button>
8079

8180
<button
8281
className="blue-btn"
8382
onClick={() =>
8483
address.set('attributes.landmark', 'New landmark')
85-
}
86-
>
84+
}>
8785
Set (Landmark)
8886
</button>
8987

@@ -96,8 +94,7 @@ const Page = observer(() => {
9694
'post-code': '1226',
9795
},
9896
})
99-
}
100-
>
97+
}>
10198
Set Properties (Landmark and Post Code)
10299
</button>
103100
</p>

apps/create-next-app/src/app/demo/collection-records/state-properties/page.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ const Page = observer(() => {
7373
className="blue-btn"
7474
onClick={() =>
7575
address.set('attributes.landmark', 'New landmark')
76-
}
77-
>
76+
}>
7877
Modify (Landmark)
7978
</button>
8079
</p>

0 commit comments

Comments
 (0)