amplifyquery 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/service.js +11 -2
  2. package/package.json +19 -7
package/dist/service.js CHANGED
@@ -488,7 +488,7 @@ function createAmplifyService(modelName, queryMap, defaultAuthMode = "userPool")
488
488
  }),
489
489
  // Batch get items
490
490
  list: (...args_1) => __awaiter(this, [...args_1], void 0, function* (options = { filter: undefined, forceRefresh: false }) {
491
- var _a;
491
+ var _a, _b, _c, _d;
492
492
  try {
493
493
  // Determine query key
494
494
  const queryKey = options.filter
@@ -511,6 +511,12 @@ function createAmplifyService(modelName, queryMap, defaultAuthMode = "userPool")
511
511
  // Try query call
512
512
  try {
513
513
  console.log(`🍬 ${modelName} list API call`, queryKey, `by ${ownerQueryName}`, `[Auth: ${authMode}]`);
514
+ // Debug: Check if model and query exist
515
+ const client = (0, client_1.getClient)();
516
+ console.log(`🍬 Debug - client.models exists:`, !!client.models);
517
+ console.log(`🍬 Debug - client.models[${modelName}] exists:`, !!client.models[modelName]);
518
+ console.log(`🍬 Debug - client.models[${modelName}][${ownerQueryName}] exists:`, !!((_a = client.models[modelName]) === null || _a === void 0 ? void 0 : _a[ownerQueryName]));
519
+ console.log(`🍬 Debug - Available methods for ${modelName}:`, Object.keys(client.models[modelName] || {}));
514
520
  // Execute owner query
515
521
  const { data: result } = yield (0, client_1.getClient)().models[modelName][ownerQueryName]({ owner, authMode }, authModeParams);
516
522
  // Extract result data + filter null values
@@ -552,7 +558,10 @@ function createAmplifyService(modelName, queryMap, defaultAuthMode = "userPool")
552
558
  return filteredItems;
553
559
  }
554
560
  catch (error) {
555
- if ((_a = error === null || error === void 0 ? void 0 : error.message) === null || _a === void 0 ? void 0 : _a.includes("not found")) {
561
+ // Check if the error is because the owner query doesn't exist
562
+ if (((_b = error === null || error === void 0 ? void 0 : error.message) === null || _b === void 0 ? void 0 : _b.includes("not found")) ||
563
+ ((_c = error === null || error === void 0 ? void 0 : error.message) === null || _c === void 0 ? void 0 : _c.includes("is not a function")) ||
564
+ ((_d = error === null || error === void 0 ? void 0 : error.message) === null || _d === void 0 ? void 0 : _d.includes("is undefined"))) {
556
565
  console.warn(`🍬 ${ownerQueryName} query not found. Trying default list query...`);
557
566
  // Try default list query if owner query not found
558
567
  const { data: result } = yield (0, client_1.getClient)().models[modelName].list({}, authModeParams);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "amplifyquery",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Amplify+Query",
5
5
  "keywords": [
6
6
  "Amplify",
@@ -24,13 +24,17 @@
24
24
  "dist"
25
25
  ],
26
26
  "scripts": {
27
- "build": "tsc",
28
- "clean": "rm -rf dist",
29
- "dev": "tsc --watch",
30
- "prepare": "npm run build",
31
- "test": "echo \"Error: no test specified\" && exit 1"
27
+ "build": "expo-module build",
28
+ "clean": "expo-module clean",
29
+ "dev": "expo-module build --watch",
30
+ "lint": "expo-module lint",
31
+ "typecheck": "expo-module typecheck",
32
+ "prepare": "expo-module prepare",
33
+ "prepublishOnly": "expo-module prepublishOnly",
34
+ "publish": "npm publish",
35
+ "test": "expo-module test"
32
36
  },
33
- "dependencies": {
37
+ "devDependencies": {
34
38
  "@aws-amplify/api": "^6.3.11",
35
39
  "@aws-amplify/core": "^6.11.4",
36
40
  "@aws-amplify/datastore": "^5.0.82",
@@ -44,10 +48,18 @@
44
48
  "expo": "^53.0.9",
45
49
  "expo-crypto": "^14.1.4",
46
50
  "expo-file-system": "^18.1.10",
51
+ "expo-module-scripts": "^4.1.7",
47
52
  "react": "^19.1.0",
48
53
  "react-native": "^0.79.2",
49
54
  "react-native-mmkv": "^3.2.0",
50
55
  "typescript": "^5.8.3",
51
56
  "zustand": "^5.0.4"
57
+ },
58
+ "peerDependencies": {
59
+ "expo": ">=49",
60
+ "react": ">=19.1.0",
61
+ "react-native": ">=0.79.2",
62
+ "react-native-mmkv": "^3.2.0",
63
+ "zustand": "^5.0.4"
52
64
  }
53
65
  }