-
Demo Links
+
+
+
setSearchTerm(e.target.value)}
diff --git a/apps/create-next-app/src/app/demo/retrieve-functions-from-collections/get-request-alias/controller.js b/apps/create-next-app/src/app/demo/retrieve-functions-from-collections/get-request-alias/controller.js
new file mode 100644
index 0000000..cdd2b00
--- /dev/null
+++ b/apps/create-next-app/src/app/demo/retrieve-functions-from-collections/get-request-alias/controller.js
@@ -0,0 +1,11 @@
+'use client'
+
+import { ARM } from '@/components/providers/arm-config-provider'
+
+const Controller = () => {
+ return {
+ addresses: ARM.getRequestAlias('customerAddresses'),
+ }
+}
+
+export default Controller
diff --git a/apps/create-next-app/src/app/demo/retrieve-functions-from-collections/get-request-alias/model.js b/apps/create-next-app/src/app/demo/retrieve-functions-from-collections/get-request-alias/model.js
new file mode 100644
index 0000000..f209013
--- /dev/null
+++ b/apps/create-next-app/src/app/demo/retrieve-functions-from-collections/get-request-alias/model.js
@@ -0,0 +1,11 @@
+'use client'
+
+import { ARM } from '@/components/providers/arm-config-provider'
+
+const Model = () => {
+ return {
+ addresses: ARM.findAll('addresses', { alias: 'customerAddresses' }),
+ }
+}
+
+export default Model
diff --git a/apps/create-next-app/src/app/demo/retrieve-functions-from-collections/get-request-alias/page.jsx b/apps/create-next-app/src/app/demo/retrieve-functions-from-collections/get-request-alias/page.jsx
new file mode 100644
index 0000000..7e0487f
--- /dev/null
+++ b/apps/create-next-app/src/app/demo/retrieve-functions-from-collections/get-request-alias/page.jsx
@@ -0,0 +1,52 @@
+'use client'
+
+import { observer } from 'mobx-react'
+import Controller from './controller'
+import Model from './model'
+
+const Page = observer(() => {
+ const controller = Controller()
+ const { isLoading } = Model()
+
+ return (
+
+
+
+ | ADDRESS1 |
+ ADDRESS2 |
+ CITY |
+ POST CODE |
+ LANDMARK |
+ KIND |
+ LABEL |
+ LONGITUDE |
+ LATITUDE |
+
+
+
+ {isLoading && (
+
+ | Loading... |
+
+ )}
+
+ {!isLoading &&
+ controller.addresses?.data.map((address) => (
+
+ | {address.get('attributes.address1')} |
+ {address.get('attributes.address2')} |
+ {address.get('attributes.city')} |
+ {address.get('attributes.post-code')} |
+ {address.get('attributes.landmark')} |
+ {address.get('attributes.kind')} |
+ {address.get('attributes.label')} |
+ {address.get('attributes.longitude')} |
+ {address.get('attributes.latitude')} |
+
+ ))}
+
+
+ )
+})
+
+export default Page
diff --git a/apps/create-next-app/yarn.lock b/apps/create-next-app/yarn.lock
index 729a2bd..4a12b3e 100644
--- a/apps/create-next-app/yarn.lock
+++ b/apps/create-next-app/yarn.lock
@@ -180,14 +180,14 @@
resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.12.2.tgz#bccdf615bcf7b6e8db830ec0b8d21c9a25de597b"
integrity sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==
-"@eslint/config-array@^0.21.1":
- version "0.21.1"
- resolved "https://registry.yarnpkg.com/@eslint/config-array/-/config-array-0.21.1.tgz#7d1b0060fea407f8301e932492ba8c18aff29713"
- integrity sha512-aw1gNayWpdI/jSYVgzN5pL0cfzU02GT3NBpeT/DXbx1/1x7ZKxFPd9bwrzygx/qiwIQiJ1sw/zD8qY/kRvlGHA==
+"@eslint/config-array@^0.21.2":
+ version "0.21.2"
+ resolved "https://registry.yarnpkg.com/@eslint/config-array/-/config-array-0.21.2.tgz#f29e22057ad5316cf23836cee9a34c81fffcb7e6"
+ integrity sha512-nJl2KGTlrf9GjLimgIru+V/mzgSK0ABCDQRvxw5BjURL7WfH5uoWmizbH7QB6MmnMBd8cIC9uceWnezL1VZWWw==
dependencies:
"@eslint/object-schema" "^2.1.7"
debug "^4.3.1"
- minimatch "^3.1.2"
+ minimatch "^3.1.5"
"@eslint/config-helpers@^0.4.2":
version "0.4.2"
@@ -203,10 +203,10 @@
dependencies:
"@types/json-schema" "^7.0.15"
-"@eslint/eslintrc@^3", "@eslint/eslintrc@^3.3.1":
- version "3.3.4"
- resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-3.3.4.tgz#e402b1920f7c1f5a15342caa432b1348cacbb641"
- integrity sha512-4h4MVF8pmBsncB60r0wSJiIeUKTSD4m7FmTFThG8RHlsg9ajqckLm9OraguFGZE4vVdpiI1Q4+hFnisopmG6gQ==
+"@eslint/eslintrc@^3", "@eslint/eslintrc@^3.3.5":
+ version "3.3.5"
+ resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-3.3.5.tgz#c131793cfc1a7b96f24a83e0a8bbd4b881558c60"
+ integrity sha512-4IlJx0X0qftVsN5E+/vGujTRIFtwuLbNsVUe7TO6zYPDR1O6nFwvwhIKEKSrl6dZchmYBITazxKoUYOjdtjlRg==
dependencies:
ajv "^6.14.0"
debug "^4.3.2"
@@ -215,13 +215,13 @@
ignore "^5.2.0"
import-fresh "^3.2.1"
js-yaml "^4.1.1"
- minimatch "^3.1.3"
+ minimatch "^3.1.5"
strip-json-comments "^3.1.1"
-"@eslint/js@9.39.3":
- version "9.39.3"
- resolved "https://registry.yarnpkg.com/@eslint/js/-/js-9.39.3.tgz#c6168736c7e0c43ead49654ed06a4bcb3833363d"
- integrity sha512-1B1VkCq6FuUNlQvlBYb+1jDu/gV297TIs/OeiaSR9l1H27SVW55ONE1e1Vp16NqP683+xEGzxYtv4XCiDPaQiw==
+"@eslint/js@9.39.4":
+ version "9.39.4"
+ resolved "https://registry.yarnpkg.com/@eslint/js/-/js-9.39.4.tgz#a3f83bfc6fd9bf33a853dfacd0b49b398eb596c1"
+ integrity sha512-nE7DEIchvtiFTwBw4Lfbu59PG+kCofhjsKaCWzxTpt4lfRjRMqG6uMBzKXuEcyXhOHoUp9riAm7/aWYGhXZ9cw==
"@eslint/object-schema@^2.1.7":
version "2.1.7"
@@ -260,9 +260,9 @@
integrity sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==
"@img/colour@^1.0.0":
- version "1.0.0"
- resolved "https://registry.yarnpkg.com/@img/colour/-/colour-1.0.0.tgz#d2fabb223455a793bf3bf9c70de3d28526aa8311"
- integrity sha512-A5P/LfWGFSl6nsckYtjw9da+19jB8hkJ6ACTGcDfEJ0aE+l2n2El7dsVM7UVHZQ9s2lmYMWlrS21YLy2IR1LUw==
+ version "1.1.0"
+ resolved "https://registry.yarnpkg.com/@img/colour/-/colour-1.1.0.tgz#b0c2c2fa661adf75effd6b4964497cd80010bb9d"
+ integrity sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ==
"@img/sharp-darwin-arm64@0.34.5":
version "0.34.5"
@@ -686,100 +686,100 @@
dependencies:
csstype "^3.0.2"
-"@typescript-eslint/eslint-plugin@8.56.1":
- version "8.56.1"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.56.1.tgz#b1ce606d87221daec571e293009675992f0aae76"
- integrity sha512-Jz9ZztpB37dNC+HU2HI28Bs9QXpzCz+y/twHOwhyrIRdbuVDxSytJNDl6z/aAKlaRIwC7y8wJdkBv7FxYGgi0A==
+"@typescript-eslint/eslint-plugin@8.57.0":
+ version "8.57.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.57.0.tgz#6e4085604ab63f55b3dcc61ce2c16965b2c36374"
+ integrity sha512-qeu4rTHR3/IaFORbD16gmjq9+rEs9fGKdX0kF6BKSfi+gCuG3RCKLlSBYzn/bGsY9Tj7KE/DAQStbp8AHJGHEQ==
dependencies:
"@eslint-community/regexpp" "^4.12.2"
- "@typescript-eslint/scope-manager" "8.56.1"
- "@typescript-eslint/type-utils" "8.56.1"
- "@typescript-eslint/utils" "8.56.1"
- "@typescript-eslint/visitor-keys" "8.56.1"
+ "@typescript-eslint/scope-manager" "8.57.0"
+ "@typescript-eslint/type-utils" "8.57.0"
+ "@typescript-eslint/utils" "8.57.0"
+ "@typescript-eslint/visitor-keys" "8.57.0"
ignore "^7.0.5"
natural-compare "^1.4.0"
ts-api-utils "^2.4.0"
-"@typescript-eslint/parser@8.56.1":
- version "8.56.1"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-8.56.1.tgz#21d13b3d456ffb08614c1d68bb9a4f8d9237cdc7"
- integrity sha512-klQbnPAAiGYFyI02+znpBRLyjL4/BrBd0nyWkdC0s/6xFLkXYQ8OoRrSkqacS1ddVxf/LDyODIKbQ5TgKAf/Fg==
+"@typescript-eslint/parser@8.57.0":
+ version "8.57.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-8.57.0.tgz#444c57a943e8b04f255cda18a94c8e023b46b08c"
+ integrity sha512-XZzOmihLIr8AD1b9hL9ccNMzEMWt/dE2u7NyTY9jJG6YNiNthaD5XtUHVF2uCXZ15ng+z2hT3MVuxnUYhq6k1g==
dependencies:
- "@typescript-eslint/scope-manager" "8.56.1"
- "@typescript-eslint/types" "8.56.1"
- "@typescript-eslint/typescript-estree" "8.56.1"
- "@typescript-eslint/visitor-keys" "8.56.1"
+ "@typescript-eslint/scope-manager" "8.57.0"
+ "@typescript-eslint/types" "8.57.0"
+ "@typescript-eslint/typescript-estree" "8.57.0"
+ "@typescript-eslint/visitor-keys" "8.57.0"
debug "^4.4.3"
-"@typescript-eslint/project-service@8.56.1":
- version "8.56.1"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/project-service/-/project-service-8.56.1.tgz#65c8d645f028b927bfc4928593b54e2ecd809244"
- integrity sha512-TAdqQTzHNNvlVFfR+hu2PDJrURiwKsUvxFn1M0h95BB8ah5jejas08jUWG4dBA68jDMI988IvtfdAI53JzEHOQ==
+"@typescript-eslint/project-service@8.57.0":
+ version "8.57.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/project-service/-/project-service-8.57.0.tgz#2014ed527bcd0eff8aecb7e44879ae3150604ab3"
+ integrity sha512-pR+dK0BlxCLxtWfaKQWtYr7MhKmzqZxuii+ZjuFlZlIGRZm22HnXFqa2eY+90MUz8/i80YJmzFGDUsi8dMOV5w==
dependencies:
- "@typescript-eslint/tsconfig-utils" "^8.56.1"
- "@typescript-eslint/types" "^8.56.1"
+ "@typescript-eslint/tsconfig-utils" "^8.57.0"
+ "@typescript-eslint/types" "^8.57.0"
debug "^4.4.3"
-"@typescript-eslint/scope-manager@8.56.1":
- version "8.56.1"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-8.56.1.tgz#254df93b5789a871351335dd23e20bc164060f24"
- integrity sha512-YAi4VDKcIZp0O4tz/haYKhmIDZFEUPOreKbfdAN3SzUDMcPhJ8QI99xQXqX+HoUVq8cs85eRKnD+rne2UAnj2w==
+"@typescript-eslint/scope-manager@8.57.0":
+ version "8.57.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-8.57.0.tgz#7d2a2aeaaef2ae70891b21939fadb4cb0b19f840"
+ integrity sha512-nvExQqAHF01lUM66MskSaZulpPL5pgy5hI5RfrxviLgzZVffB5yYzw27uK/ft8QnKXI2X0LBrHJFr1TaZtAibw==
dependencies:
- "@typescript-eslint/types" "8.56.1"
- "@typescript-eslint/visitor-keys" "8.56.1"
+ "@typescript-eslint/types" "8.57.0"
+ "@typescript-eslint/visitor-keys" "8.57.0"
-"@typescript-eslint/tsconfig-utils@8.56.1", "@typescript-eslint/tsconfig-utils@^8.56.1":
- version "8.56.1"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.56.1.tgz#1afa830b0fada5865ddcabdc993b790114a879b7"
- integrity sha512-qOtCYzKEeyr3aR9f28mPJqBty7+DBqsdd63eO0yyDwc6vgThj2UjWfJIcsFeSucYydqcuudMOprZ+x1SpF3ZuQ==
+"@typescript-eslint/tsconfig-utils@8.57.0", "@typescript-eslint/tsconfig-utils@^8.57.0":
+ version "8.57.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.57.0.tgz#cf2f2822af3887d25dd325b6bea6c3f60a83a0b4"
+ integrity sha512-LtXRihc5ytjJIQEH+xqjB0+YgsV4/tW35XKX3GTZHpWtcC8SPkT/d4tqdf1cKtesryHm2bgp6l555NYcT2NLvA==
-"@typescript-eslint/type-utils@8.56.1":
- version "8.56.1"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-8.56.1.tgz#7a6c4fabf225d674644931e004302cbbdd2f2e24"
- integrity sha512-yB/7dxi7MgTtGhZdaHCemf7PuwrHMenHjmzgUW1aJpO+bBU43OycnM3Wn+DdvDO/8zzA9HlhaJ0AUGuvri4oGg==
+"@typescript-eslint/type-utils@8.57.0":
+ version "8.57.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-8.57.0.tgz#2877af4c2e8f0998b93a07dad1c34ce1bb669448"
+ integrity sha512-yjgh7gmDcJ1+TcEg8x3uWQmn8ifvSupnPfjP21twPKrDP/pTHlEQgmKcitzF/rzPSmv7QjJ90vRpN4U+zoUjwQ==
dependencies:
- "@typescript-eslint/types" "8.56.1"
- "@typescript-eslint/typescript-estree" "8.56.1"
- "@typescript-eslint/utils" "8.56.1"
+ "@typescript-eslint/types" "8.57.0"
+ "@typescript-eslint/typescript-estree" "8.57.0"
+ "@typescript-eslint/utils" "8.57.0"
debug "^4.4.3"
ts-api-utils "^2.4.0"
-"@typescript-eslint/types@8.56.1", "@typescript-eslint/types@^8.56.1":
- version "8.56.1"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-8.56.1.tgz#975e5942bf54895291337c91b9191f6eb0632ab9"
- integrity sha512-dbMkdIUkIkchgGDIv7KLUpa0Mda4IYjo4IAMJUZ+3xNoUXxMsk9YtKpTHSChRS85o+H9ftm51gsK1dZReY9CVw==
+"@typescript-eslint/types@8.57.0", "@typescript-eslint/types@^8.57.0":
+ version "8.57.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-8.57.0.tgz#4fa5385ffd1cd161fa5b9dce93e0493d491b8dc6"
+ integrity sha512-dTLI8PEXhjUC7B9Kre+u0XznO696BhXcTlOn0/6kf1fHaQW8+VjJAVHJ3eTI14ZapTxdkOmc80HblPQLaEeJdg==
-"@typescript-eslint/typescript-estree@8.56.1":
- version "8.56.1"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-8.56.1.tgz#3b9e57d8129a860c50864c42188f761bdef3eab0"
- integrity sha512-qzUL1qgalIvKWAf9C1HpvBjif+Vm6rcT5wZd4VoMb9+Km3iS3Cv9DY6dMRMDtPnwRAFyAi7YXJpTIEXLvdfPxg==
+"@typescript-eslint/typescript-estree@8.57.0":
+ version "8.57.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-8.57.0.tgz#e0e4a89bfebb207de314826df876e2dabc7dea04"
+ integrity sha512-m7faHcyVg0BT3VdYTlX8GdJEM7COexXxS6KqGopxdtkQRvBanK377QDHr4W/vIPAR+ah9+B/RclSW5ldVniO1Q==
dependencies:
- "@typescript-eslint/project-service" "8.56.1"
- "@typescript-eslint/tsconfig-utils" "8.56.1"
- "@typescript-eslint/types" "8.56.1"
- "@typescript-eslint/visitor-keys" "8.56.1"
+ "@typescript-eslint/project-service" "8.57.0"
+ "@typescript-eslint/tsconfig-utils" "8.57.0"
+ "@typescript-eslint/types" "8.57.0"
+ "@typescript-eslint/visitor-keys" "8.57.0"
debug "^4.4.3"
minimatch "^10.2.2"
semver "^7.7.3"
tinyglobby "^0.2.15"
ts-api-utils "^2.4.0"
-"@typescript-eslint/utils@8.56.1":
- version "8.56.1"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-8.56.1.tgz#5a86acaf9f1b4c4a85a42effb217f73059f6deb7"
- integrity sha512-HPAVNIME3tABJ61siYlHzSWCGtOoeP2RTIaHXFMPqjrQKCGB9OgUVdiNgH7TJS2JNIQ5qQ4RsAUDuGaGme/KOA==
+"@typescript-eslint/utils@8.57.0":
+ version "8.57.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-8.57.0.tgz#c7193385b44529b788210d20c94c11de79ad3498"
+ integrity sha512-5iIHvpD3CZe06riAsbNxxreP+MuYgVUsV0n4bwLH//VJmgtt54sQeY2GszntJ4BjYCpMzrfVh2SBnUQTtys2lQ==
dependencies:
"@eslint-community/eslint-utils" "^4.9.1"
- "@typescript-eslint/scope-manager" "8.56.1"
- "@typescript-eslint/types" "8.56.1"
- "@typescript-eslint/typescript-estree" "8.56.1"
+ "@typescript-eslint/scope-manager" "8.57.0"
+ "@typescript-eslint/types" "8.57.0"
+ "@typescript-eslint/typescript-estree" "8.57.0"
-"@typescript-eslint/visitor-keys@8.56.1":
- version "8.56.1"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-8.56.1.tgz#50e03475c33a42d123dc99e63acf1841c0231f87"
- integrity sha512-KiROIzYdEV85YygXw6BI/Dx4fnBlFQu6Mq4QE4MOH9fFnhohw6wX/OAvDY2/C+ut0I3RSPKenvZJIVYqJNkhEw==
+"@typescript-eslint/visitor-keys@8.57.0":
+ version "8.57.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-8.57.0.tgz#23aea662279bb66209700854453807a119350f85"
+ integrity sha512-zm6xx8UT/Xy2oSr2ZXD0pZo7Jx2XsCoID2IUh9YSTFRu7z+WdwYTRk6LhUftm1crwqbuoF6I8zAFeCMw0YjwDg==
dependencies:
- "@typescript-eslint/types" "8.56.1"
+ "@typescript-eslint/types" "8.57.0"
eslint-visitor-keys "^5.0.0"
"@unrs/resolver-binding-android-arm-eabi@1.11.1":
@@ -889,7 +889,7 @@ acorn@^8.15.0:
resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.16.0.tgz#4ce79c89be40afe7afe8f3adb902a1f1ce9ac08a"
integrity sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==
-ajv@^6.12.4, ajv@^6.14.0:
+ajv@^6.14.0:
version "6.14.0"
resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.14.0.tgz#fd067713e228210636ebb08c60bd3765d6dbe73a"
integrity sha512-IWrosm/yrn43eiKqkfkHis7QioDleaXQHdDVPKg0FSwwd/DuvyX79TZnFOnYpB7dcsFAMmtFztZuXPDvSePkFw==
@@ -917,7 +917,7 @@ aria-query@^5.3.2:
integrity sha512-COROpnaoap1E2F000S62r6A60uHZnmlvomhfyT2DlTcrY1OrBKn2UhH7qn5wTC9zMvD0AY7csdPSNwKP+7WiQw==
"arm-js-library@file:../../packages":
- version "2.6.2"
+ version "2.6.3"
dependencies:
axios "^1.13.2"
lodash "^4.17.21"
@@ -1045,9 +1045,9 @@ axe-core@^4.10.0:
integrity sha512-BASOg+YwO2C+346x3LZOeoovTIoTrRqEsqMa6fmfAV0P+U9mFr9NsyOEpiYvFjbc64NMrSswhV50WdXzdb/Z5A==
axios@^1.13.2:
- version "1.13.5"
- resolved "https://registry.yarnpkg.com/axios/-/axios-1.13.5.tgz#5e464688fa127e11a660a2c49441c009f6567a43"
- integrity sha512-cz4ur7Vb0xS4/KUN0tPWe44eqxrIu31me+fbang3ijiNscE129POzipJJA6zniq2C/Z6sJCjMimjS8Lc/GAs8Q==
+ version "1.13.6"
+ resolved "https://registry.yarnpkg.com/axios/-/axios-1.13.6.tgz#c3f92da917dc209a15dd29936d20d5089b6b6c98"
+ integrity sha512-ChTCHMouEe2kn713WHbQGcuYrr6fXTBiu460OTwWrWob16g1bXn4vtz07Ope7ewMozJAnEquLk5lWQWtBig9DQ==
dependencies:
follow-redirects "^1.15.11"
form-data "^4.0.5"
@@ -1082,9 +1082,9 @@ brace-expansion@^1.1.7:
concat-map "0.0.1"
brace-expansion@^5.0.2:
- version "5.0.3"
- resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-5.0.3.tgz#6a9c6c268f85b53959ec527aeafe0f7300258eef"
- integrity sha512-fy6KJm2RawA5RcHkLa1z/ScpBeA762UF9KmZQxwIbDtRJrgLzM10depAiEQ+CXYcoiqW1/m96OAAoke2nE9EeA==
+ version "5.0.4"
+ resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-5.0.4.tgz#614daaecd0a688f660bbbc909a8748c3d80d4336"
+ integrity sha512-h+DEnpVvxmfVefa4jFbCf5HdH5YMDXRsmKflpf1pILZWRFlTbJpxeU55nJl4Smt5HQaGzg1o6RHFPJaOqnmBDg==
dependencies:
balanced-match "^4.0.2"
@@ -1138,9 +1138,9 @@ callsites@^3.0.0:
integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==
caniuse-lite@^1.0.30001579, caniuse-lite@^1.0.30001759:
- version "1.0.30001774"
- resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001774.tgz#0e576b6f374063abcd499d202b9ba1301be29b70"
- integrity sha512-DDdwPGz99nmIEv216hKSgLD+D4ikHQHjBC/seF98N9CPqRX4M5mSxT9eTV6oyisnJcuzxtZy4n17yKKQYmYQOA==
+ version "1.0.30001777"
+ resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001777.tgz#028f21e4b2718d138b55e692583e6810ccf60691"
+ integrity sha512-tmN+fJxroPndC74efCdp12j+0rk0RHwV5Jwa1zWaFVyw2ZxAuPeG8ZgWC3Wz7uSjT3qMRQ5XHZ4COgQmsCMJAQ==
chalk@^4.0.0:
version "4.1.2"
@@ -1304,9 +1304,9 @@ dunder-proto@^1.0.0, dunder-proto@^1.0.1:
gopd "^1.2.0"
electron-to-chromium@^1.5.263:
- version "1.5.302"
- resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.302.tgz#032a5802b31f7119269959c69fe2015d8dad5edb"
- integrity sha512-sM6HAN2LyK82IyPBpznDRqlTQAtuSaO+ShzFiWTvoMJLHyZ+Y39r8VMfHzwbU8MVBzQ4Wdn85+wlZl2TLGIlwg==
+ version "1.5.307"
+ resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.307.tgz#09f8973100c39fb0d003b890393cd1d58932b1c8"
+ integrity sha512-5z3uFKBWjiNR44nFcYdkcXjKMbg5KXNdciu7mhTPo9tB7NbqSNP2sSnGR+fqknZSCwKkBN+oxiiajWs4dT6ORg==
emoji-regex@^9.2.2:
version "9.2.2"
@@ -1314,9 +1314,9 @@ emoji-regex@^9.2.2:
integrity sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==
enhanced-resolve@^5.19.0:
- version "5.19.0"
- resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.19.0.tgz#6687446a15e969eaa63c2fa2694510e17ae6d97c"
- integrity sha512-phv3E1Xl4tQOShqSte26C7Fl84EwUdZsyOuSSk9qtAGyyQs2s3jJzComh+Abf4g187lUUAvH+H26omrqia2aGg==
+ version "5.20.0"
+ resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.20.0.tgz#323c2a70d2aa7fb4bdfd6d3c24dfc705c581295d"
+ integrity sha512-/ce7+jQ1PQ6rVXwe+jKEg5hW5ciicHwIQUagZkp6IufBoY3YDgdTTY1azVs0qoRgVmvsNB+rbjLJxDAeHHtwsQ==
dependencies:
graceful-fs "^4.2.4"
tapable "^2.3.0"
@@ -1392,9 +1392,9 @@ es-errors@^1.3.0:
integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==
es-iterator-helpers@^1.2.1:
- version "1.2.2"
- resolved "https://registry.yarnpkg.com/es-iterator-helpers/-/es-iterator-helpers-1.2.2.tgz#d979a9f686e2b0b72f88dbead7229924544720bc"
- integrity sha512-BrUQ0cPTB/IwXj23HtwHjS9n7O4h9FX94b4xc5zlTHxeLgTAdzYUDyy6KdExAl9lbN5rtfe44xpjpmj9grxs5w==
+ version "1.3.0"
+ resolved "https://registry.yarnpkg.com/es-iterator-helpers/-/es-iterator-helpers-1.3.0.tgz#36ff394076e6ab50725bcd2b8cd64c4f5b4ea75b"
+ integrity sha512-04cg8iJFDOxWcYlu0GFFWgs7vtaEPCmr5w1nrj9V3z3axu/48HCMwK6VMp45Zh3ZB+xLP1ifbJfrq86+1ypKKQ==
dependencies:
call-bind "^1.0.8"
call-bound "^1.0.4"
@@ -1411,6 +1411,7 @@ es-iterator-helpers@^1.2.1:
has-symbols "^1.1.0"
internal-slot "^1.1.0"
iterator.prototype "^1.1.5"
+ math-intrinsics "^1.1.0"
safe-array-concat "^1.1.3"
es-object-atoms@^1.0.0, es-object-atoms@^1.1.1:
@@ -1605,23 +1606,23 @@ eslint-visitor-keys@^5.0.0:
integrity sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==
eslint@^9:
- version "9.39.3"
- resolved "https://registry.yarnpkg.com/eslint/-/eslint-9.39.3.tgz#08d63df1533d7743c0907b32a79a7e134e63ee2f"
- integrity sha512-VmQ+sifHUbI/IcSopBCF/HO3YiHQx/AVd3UVyYL6weuwW+HvON9VYn5l6Zl1WZzPWXPNZrSQpxwkkZ/VuvJZzg==
+ version "9.39.4"
+ resolved "https://registry.yarnpkg.com/eslint/-/eslint-9.39.4.tgz#855da1b2e2ad66dc5991195f35e262bcec8117b5"
+ integrity sha512-XoMjdBOwe/esVgEvLmNsD3IRHkm7fbKIUGvrleloJXUZgDHig2IPWNniv+GwjyJXzuNqVjlr5+4yVUZjycJwfQ==
dependencies:
"@eslint-community/eslint-utils" "^4.8.0"
"@eslint-community/regexpp" "^4.12.1"
- "@eslint/config-array" "^0.21.1"
+ "@eslint/config-array" "^0.21.2"
"@eslint/config-helpers" "^0.4.2"
"@eslint/core" "^0.17.0"
- "@eslint/eslintrc" "^3.3.1"
- "@eslint/js" "9.39.3"
+ "@eslint/eslintrc" "^3.3.5"
+ "@eslint/js" "9.39.4"
"@eslint/plugin-kit" "^0.4.1"
"@humanfs/node" "^0.16.6"
"@humanwhocodes/module-importer" "^1.0.1"
"@humanwhocodes/retry" "^0.4.2"
"@types/estree" "^1.0.6"
- ajv "^6.12.4"
+ ajv "^6.14.0"
chalk "^4.0.0"
cross-spawn "^7.0.6"
debug "^4.3.2"
@@ -1640,7 +1641,7 @@ eslint@^9:
is-glob "^4.0.0"
json-stable-stringify-without-jsonify "^1.0.1"
lodash.merge "^4.6.2"
- minimatch "^3.1.2"
+ minimatch "^3.1.5"
natural-compare "^1.4.0"
optionator "^0.9.3"
@@ -1746,9 +1747,9 @@ flat-cache@^4.0.0:
keyv "^4.5.4"
flatted@^3.2.9:
- version "3.3.3"
- resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.3.3.tgz#67c8fad95454a7c7abebf74bb78ee74a44023358"
- integrity sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==
+ version "3.4.1"
+ resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.4.1.tgz#84ccd9579e76e9cc0d246c11d8be0beb019143e6"
+ integrity sha512-IxfVbRFVlV8V/yRaGzk0UVIcsKKHMSfYw66T/u4nTwlWteQePsxe//LjudR1AMX4tZW3WFCh3Zqa/sjlqpbURQ==
follow-redirects@^1.15.11:
version "1.15.11"
@@ -2435,7 +2436,7 @@ minimatch@^10.2.2:
dependencies:
brace-expansion "^5.0.2"
-minimatch@^3.1.2, minimatch@^3.1.3:
+minimatch@^3.1.2, minimatch@^3.1.5:
version "3.1.5"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.5.tgz#580c88f8d5445f2bd6aa8f3cadefa0de79fbd69e"
integrity sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==
@@ -2519,9 +2520,9 @@ node-exports-info@^1.6.0:
semver "^6.3.1"
node-releases@^2.0.27:
- version "2.0.27"
- resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.27.tgz#eedca519205cf20f650f61d56b070db111231e4e"
- integrity sha512-nmh3lCkYZ3grZvqcCH+fjmQ7X+H0OeZgP40OierEaAptX4XofMh5kwNbWh7lBduUzCcV/8kZ+NDLCwm2iorIlA==
+ version "2.0.36"
+ resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.36.tgz#99fd6552aaeda9e17c4713b57a63964a2e325e9d"
+ integrity sha512-TdC8FSgHz8Mwtw9g5L4gR/Sh9XhSP/0DEkQxfEFXOpiul5IiHgHan2VhYYb6agDSfp4KuvltmGApc8HMgUrIkA==
object-assign@^4.1.1:
version "4.1.1"
@@ -2676,9 +2677,9 @@ postcss@8.4.31:
source-map-js "^1.0.2"
postcss@^8.5.6:
- version "8.5.6"
- resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.5.6.tgz#2825006615a619b4f62a9e7426cc120b349a8f3c"
- integrity sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==
+ version "8.5.8"
+ resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.5.8.tgz#6230ecc8fb02e7a0f6982e53990937857e13f399"
+ integrity sha512-OW/rX8O/jXnm82Ey1k44pObPtdblfiuWnrd8X7GJ7emImCOstunGbXUpp7HdBrFQX6rJzn3sPT397Wp5aCwCHg==
dependencies:
nanoid "^3.3.11"
picocolors "^1.1.1"
@@ -3179,14 +3180,14 @@ typed-array-length@^1.0.7:
reflect.getprototypeof "^1.0.6"
typescript-eslint@^8.46.0:
- version "8.56.1"
- resolved "https://registry.yarnpkg.com/typescript-eslint/-/typescript-eslint-8.56.1.tgz#15a9fcc5d2150a0d981772bb36f127a816fe103f"
- integrity sha512-U4lM6pjmBX7J5wk4szltF7I1cGBHXZopnAXCMXb3+fZ3B/0Z3hq3wS/CCUB2NZBNAExK92mCU2tEohWuwVMsDQ==
- dependencies:
- "@typescript-eslint/eslint-plugin" "8.56.1"
- "@typescript-eslint/parser" "8.56.1"
- "@typescript-eslint/typescript-estree" "8.56.1"
- "@typescript-eslint/utils" "8.56.1"
+ version "8.57.0"
+ resolved "https://registry.yarnpkg.com/typescript-eslint/-/typescript-eslint-8.57.0.tgz#82764795d316ed1c72a489727c43c3a87373f100"
+ integrity sha512-W8GcigEMEeB07xEZol8oJ26rigm3+bfPHxHvwbYUlu1fUDsGuQ7Hiskx5xGW/xM4USc9Ephe3jtv7ZYPQntHeA==
+ dependencies:
+ "@typescript-eslint/eslint-plugin" "8.57.0"
+ "@typescript-eslint/parser" "8.57.0"
+ "@typescript-eslint/typescript-estree" "8.57.0"
+ "@typescript-eslint/utils" "8.57.0"
typescript@5.9.3:
version "5.9.3"
diff --git a/packages/dist/arm-js-library.js b/packages/dist/arm-js-library.js
index d7a5a4c..21d1854 100644
--- a/packages/dist/arm-js-library.js
+++ b/packages/dist/arm-js-library.js
@@ -31,7 +31,7 @@ import qs from "qs";
* qs library for query string serialization.
* @see https://www.npmjs.com/package/qs
*/
-const { makeObservable, observable, action, toJS } = mobx;
+const { makeObservable, observable, action, runInAction, toJS } = mobx;
const {
get: getProperty,
set: setProperty,
@@ -134,6 +134,7 @@ class ApiResourceManager {
this.host = typeof window !== "undefined" ? window.location.origin : "";
this.collections = {};
this.aliases = {};
+ this.requestAliases = {};
this.requestHashes = {};
this.rootScope = {};
this.payloadIncludedReference = "type";
@@ -142,12 +143,14 @@ class ApiResourceManager {
makeObservable(this, {
collections: observable,
aliases: observable,
+ requestAliases: observable,
requestHashes: observable,
rootScope: observable,
_pushPayload: action,
_pushRequestHash: action,
_addCollection: action,
_addAlias: action,
+ _addRequestAlias: action,
_unloadCollection: action,
_unloadFromCollection: action,
_unloadFromRequestHashes: action,
@@ -251,6 +254,20 @@ Fix: Try adding ${collectionName} on your ARM config initialization.`;
if (isPlainObject(aliasRecords)) aliasCollectionRecords = aliasRecords || {};
setProperty(this.aliases, aliasName, aliasCollectionRecords);
}
+ /**
+ * Adds a request alias to the request aliases object.
+ *
+ * This method maps a specific `aliasName` to a `requestHashKey` in the
+ * `requestAliases` dictionary. This allows the system to reference a
+ * specific request context using a human-readable alias.
+ *
+ * @private
+ * @param {string} aliasName - The name of the alias for the request.
+ * @param {string} requestHashKey - The unique hash key identifying the request.
+ */
+ _addRequestAlias(aliasName, requestHashKey) {
+ setProperty(this.requestAliases, aliasName, requestHashKey);
+ }
/**
* Generates a hash ID based on the provided object.
*
@@ -1136,6 +1153,20 @@ Fix: Try adding ${collectionName} on your ARM config initialization.`;
this._injectCollectionActions(fallbackRecords);
return getProperty(this.aliases, aliasName) || observable(fallbackRecords);
}
+ /**
+ * Retrieves the request data by resolving a readable alias to its latest request hash.
+ *
+ * The `requestAliases` property acts as a reference map, linking a human-readable
+ * alias to the hash of the most recent request. This method performs a lookup
+ * on that hash to return the actual request data.
+ *
+ * @param {string} aliasName - The readable alias name to resolve.
+ * @returns {Object|null} The request data object if found; otherwise, null.
+ */
+ getRequestAlias(aliasName) {
+ const requestHashKey = getProperty(this.requestAliases, aliasName);
+ return getProperty(this.requestHashes, requestHashKey) || null;
+ }
/**
* Creates a new record in a specified collection.
*
@@ -1189,12 +1220,20 @@ Fix: Try adding ${collectionName} on your ARM config initialization.`;
* @returns {Promise
} A promise that resolves when the request is reloaded.
*/
async _reloadRequest(requestObject, requestHashKey) {
- setProperty(this.requestHashes, [requestHashKey, "isLoading"], true);
- setProperty(requestObject, "resourceConfig.skipId", v1());
- setProperty(requestObject, "resourceConfig.autoResolve", false);
- setProperty(requestObject, "resourceConfig.autoResolveOrigin", "_internal");
+ runInAction(() => {
+ setProperty(this.requestHashes, [requestHashKey, "isLoading"], true);
+ setProperty(requestObject, "resourceConfig.skipId", v1());
+ setProperty(requestObject, "resourceConfig.autoResolve", false);
+ setProperty(
+ requestObject,
+ "resourceConfig.autoResolveOrigin",
+ "_internal"
+ );
+ });
await this._request(requestObject);
- setProperty(this.requestHashes, [requestHashKey, "isLoading"], false);
+ runInAction(() => {
+ setProperty(this.requestHashes, [requestHashKey, "isLoading"], false);
+ });
return getProperty(this.requestHashes, requestHashKey);
}
/**
@@ -1357,7 +1396,7 @@ Fix: Try adding ${collectionName} on your ARM config initialization.`;
resourceResults
);
if (hasResourceAlias)
- this._processRequestAlias(resourceConfig, updatedDataCollectionRecords);
+ this._processRequestAlias(arguments[0], updatedDataCollectionRecords);
if (isResourceMethodPost) this.unloadRecord(resourcePayloadRecord);
if (isResourceMethodDelete)
this.unloadRecord(updatedDataCollectionRecords);
@@ -1423,13 +1462,23 @@ Fix: Try adding ${collectionName} on your ARM config initialization.`;
setProperty(requestOptions, "url", `${resourceName}/${resourceId}`);
}
/**
- * Processes an alias for a request, adding it to the aliases store.
+ * Processes an alias for a request, mapping both the records and the request hash.
+ *
+ * This method extracts the alias name from the request configuration and:
+ * 1. Maps the alias name to the provided collection records in the aliases store.
+ * 2. Maps the alias name to the generated request hash key in the request aliases store.
*
- * @param {Object} resourceConfig - The configuration object for the resource request, containing the alias information.
- * @param {Array|Object} collectionRecords - The records to be aliased. Can be an array or an object.
+ * @private
+ * @param {Object} requestObject - The full request object used to generate the hash ID
+ * and containing the resource configuration.
+ * @param {Array|Object} collectionRecords - The records to be aliased. Can be an array
+ * or a single object.
*/
- _processRequestAlias(resourceConfig, collectionRecords) {
- this._addAlias(getProperty(resourceConfig, "alias"), collectionRecords);
+ _processRequestAlias(requestObject, collectionRecords) {
+ const requestHashKey = this._generateHashId(requestObject);
+ const requestAliasName = getProperty(requestObject, "resourceConfig.alias");
+ this._addAlias(requestAliasName, collectionRecords);
+ this._addRequestAlias(requestAliasName, requestHashKey);
}
/**
* Processes request overrides based on the provided configuration.
diff --git a/packages/src/lib/api-resource-manager.js b/packages/src/lib/api-resource-manager.js
index 842cc7a..9d9276e 100644
--- a/packages/src/lib/api-resource-manager.js
+++ b/packages/src/lib/api-resource-manager.js
@@ -36,7 +36,7 @@ import qs from 'qs'
/**
* Destructured MobX functions.
*/
-const { makeObservable, observable, action, toJS } = mobx
+const { makeObservable, observable, action, runInAction, toJS } = mobx
/**
* Destructured Lodash functions.
@@ -210,6 +210,12 @@ export default class ApiResourceManager {
*/
this.aliases = {}
+ /**
+ * A dictionary to store aliases for requests.
+ * @type {Object}
+ */
+ this.requestAliases = {}
+
/**
* A dictionary to store request hash keys.
* @type {Object}
@@ -246,12 +252,14 @@ export default class ApiResourceManager {
makeObservable(this, {
collections: observable,
aliases: observable,
+ requestAliases: observable,
requestHashes: observable,
rootScope: observable,
_pushPayload: action,
_pushRequestHash: action,
_addCollection: action,
_addAlias: action,
+ _addRequestAlias: action,
_unloadCollection: action,
_unloadFromCollection: action,
_unloadFromRequestHashes: action,
@@ -363,6 +371,21 @@ export default class ApiResourceManager {
setProperty(this.aliases, aliasName, aliasCollectionRecords)
}
+ /**
+ * Adds a request alias to the request aliases object.
+ *
+ * This method maps a specific `aliasName` to a `requestHashKey` in the
+ * `requestAliases` dictionary. This allows the system to reference a
+ * specific request context using a human-readable alias.
+ *
+ * @private
+ * @param {string} aliasName - The name of the alias for the request.
+ * @param {string} requestHashKey - The unique hash key identifying the request.
+ */
+ _addRequestAlias(aliasName, requestHashKey) {
+ setProperty(this.requestAliases, aliasName, requestHashKey)
+ }
+
/**
* Generates a hash ID based on the provided object.
*
@@ -1359,6 +1382,22 @@ export default class ApiResourceManager {
return getProperty(this.aliases, aliasName) || observable(fallbackRecords)
}
+ /**
+ * Retrieves the request data by resolving a readable alias to its latest request hash.
+ *
+ * The `requestAliases` property acts as a reference map, linking a human-readable
+ * alias to the hash of the most recent request. This method performs a lookup
+ * on that hash to return the actual request data.
+ *
+ * @param {string} aliasName - The readable alias name to resolve.
+ * @returns {Object|null} The request data object if found; otherwise, null.
+ */
+ getRequestAlias(aliasName) {
+ const requestHashKey = getProperty(this.requestAliases, aliasName)
+
+ return getProperty(this.requestHashes, requestHashKey) || null
+ }
+
/**
* Creates a new record in a specified collection.
*
@@ -1421,14 +1460,22 @@ export default class ApiResourceManager {
* @returns {Promise} A promise that resolves when the request is reloaded.
*/
async _reloadRequest(requestObject, requestHashKey) {
- setProperty(this.requestHashes, [requestHashKey, 'isLoading'], true)
- setProperty(requestObject, 'resourceConfig.skipId', uuidv1())
- setProperty(requestObject, 'resourceConfig.autoResolve', false)
- setProperty(requestObject, 'resourceConfig.autoResolveOrigin', '_internal')
+ runInAction(() => {
+ setProperty(this.requestHashes, [requestHashKey, 'isLoading'], true)
+ setProperty(requestObject, 'resourceConfig.skipId', uuidv1())
+ setProperty(requestObject, 'resourceConfig.autoResolve', false)
+ setProperty(
+ requestObject,
+ 'resourceConfig.autoResolveOrigin',
+ '_internal',
+ )
+ })
await this._request(requestObject)
- setProperty(this.requestHashes, [requestHashKey, 'isLoading'], false)
+ runInAction(() => {
+ setProperty(this.requestHashes, [requestHashKey, 'isLoading'], false)
+ })
return getProperty(this.requestHashes, requestHashKey)
}
@@ -1671,7 +1718,7 @@ export default class ApiResourceManager {
// Process the alias (if any)
if (hasResourceAlias)
- this._processRequestAlias(resourceConfig, updatedDataCollectionRecords)
+ this._processRequestAlias(arguments[0], updatedDataCollectionRecords)
// Unload the payload record if this was a POST request
if (isResourceMethodPost) this.unloadRecord(resourcePayloadRecord)
@@ -1765,13 +1812,24 @@ export default class ApiResourceManager {
}
/**
- * Processes an alias for a request, adding it to the aliases store.
+ * Processes an alias for a request, mapping both the records and the request hash.
+ *
+ * This method extracts the alias name from the request configuration and:
+ * 1. Maps the alias name to the provided collection records in the aliases store.
+ * 2. Maps the alias name to the generated request hash key in the request aliases store.
*
- * @param {Object} resourceConfig - The configuration object for the resource request, containing the alias information.
- * @param {Array|Object} collectionRecords - The records to be aliased. Can be an array or an object.
+ * @private
+ * @param {Object} requestObject - The full request object used to generate the hash ID
+ * and containing the resource configuration.
+ * @param {Array|Object} collectionRecords - The records to be aliased. Can be an array
+ * or a single object.
*/
- _processRequestAlias(resourceConfig, collectionRecords) {
- this._addAlias(getProperty(resourceConfig, 'alias'), collectionRecords)
+ _processRequestAlias(requestObject, collectionRecords) {
+ const requestHashKey = this._generateHashId(requestObject)
+ const requestAliasName = getProperty(requestObject, 'resourceConfig.alias')
+
+ this._addAlias(requestAliasName, collectionRecords)
+ this._addRequestAlias(requestAliasName, requestHashKey)
}
/**
diff --git a/packages/tests/index.test.js b/packages/tests/index.test.js
index 0579d55..5460c4d 100644
--- a/packages/tests/index.test.js
+++ b/packages/tests/index.test.js
@@ -2,9 +2,9 @@ import startMirage from './mirage'
import ApiResourceManager from '../src'
import execInitTest from './units/init'
import execRequestTest from './units/request'
-import execRetrieveTest from './units/request'
-import execRemoveTest from './units/request'
-import execPushTest from './units/request'
+import execRetrieveTest from './units/retrieve'
+import execRemoveTest from './units/remove'
+import execPushTest from './units/push'
import execCreateTest from './units/create'
import execRecordTest from './units/record'
import execUtilsTest from './units/utils'
diff --git a/packages/tests/units/push.js b/packages/tests/units/push.js
index 52f7423..89d751b 100644
--- a/packages/tests/units/push.js
+++ b/packages/tests/units/push.js
@@ -1,5 +1,3 @@
-import { v1 as uuidv1 } from 'uuid'
-
const execPushTest = (ARM) => {
ARM.setNamespace('api/v1')
diff --git a/packages/tests/units/retrieve.js b/packages/tests/units/retrieve.js
index 352a04f..a7c3de6 100644
--- a/packages/tests/units/retrieve.js
+++ b/packages/tests/units/retrieve.js
@@ -37,6 +37,18 @@ const execRetrieveTest = (ARM) => {
)
expect(ARM.getAlias('customerAddresses')).toHaveLength(5)
})
+
+ test('Verify getRequestAlias functionality', async () => {
+ ARM.clearCollection('addresses')
+ expect(ARM.getCollection('addresses')).toHaveLength(0)
+
+ await ARM.query(
+ 'addresses',
+ { page: { size: 5 } },
+ { autoResolve: false, alias: 'customerAddresses', skipId: uuidv1() },
+ )
+ expect(ARM.getRequestAlias('customerAddresses')?.data).toHaveLength(5)
+ })
})
}