@awsless/awsless 0.0.110 → 0.0.111
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.
- package/dist/bin.js +1 -0
- package/dist/features/cognito-client-secret/bundle.zip +0 -0
- package/dist/features/delete-bucket/bundle.zip +0 -0
- package/dist/features/delete-hosted-zone/bundle.zip +0 -0
- package/dist/features/global-exports/bundle.zip +0 -0
- package/dist/features/invalidate-cache/bundle.zip +0 -0
- package/dist/features/upload-bucket-asset/bundle.zip +0 -0
- package/dist/index.js +18 -4
- package/package.json +4 -3
package/dist/bin.js
CHANGED
|
@@ -1672,6 +1672,7 @@ type Func = (...args: any[]) => any
|
|
|
1672
1672
|
type Invoke<Name extends string, F extends Func> = {
|
|
1673
1673
|
readonly name: Name
|
|
1674
1674
|
readonly async: (payload: Parameters<F>[0], options?: Omit<InvokeOptions, 'name' | 'payload' | 'type'>) => InvokeResponse<F>
|
|
1675
|
+
readonly cached: (payload: Parameters<F>[0], options?: Omit<InvokeOptions, 'name' | 'payload' | 'type'>) => InvokeResponse<F>
|
|
1675
1676
|
(payload: Parameters<F>[0], options?: Omit<InvokeOptions, 'name' | 'payload'>): InvokeResponse<F>
|
|
1676
1677
|
}
|
|
1677
1678
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/index.js
CHANGED
|
@@ -19,18 +19,20 @@ import { invoke } from "@awsless/lambda";
|
|
|
19
19
|
|
|
20
20
|
// src/node/util.ts
|
|
21
21
|
var createProxy = /* @__NO_SIDE_EFFECTS__ */ (cb) => {
|
|
22
|
-
const
|
|
22
|
+
const cache2 = /* @__PURE__ */ new Map();
|
|
23
23
|
return new Proxy({}, {
|
|
24
24
|
get(_, name) {
|
|
25
|
-
if (!
|
|
26
|
-
|
|
25
|
+
if (!cache2.has(name)) {
|
|
26
|
+
cache2.set(name, cb(name));
|
|
27
27
|
}
|
|
28
|
-
return
|
|
28
|
+
return cache2.get(name);
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
// src/node/function.ts
|
|
34
|
+
import { WeakCache } from "@awsless/weak-cache";
|
|
35
|
+
var cache = new WeakCache();
|
|
34
36
|
var getFunctionName = (stack, name) => {
|
|
35
37
|
return getLocalResourceName(name, stack);
|
|
36
38
|
};
|
|
@@ -55,6 +57,18 @@ var Function = /* @__PURE__ */ createProxy((stackName) => {
|
|
|
55
57
|
payload
|
|
56
58
|
});
|
|
57
59
|
};
|
|
60
|
+
call.cached = async (payload, options = {}) => {
|
|
61
|
+
const cacheKey = JSON.stringify({ name, payload, options });
|
|
62
|
+
if (!cache.has(cacheKey)) {
|
|
63
|
+
const result = await invoke({
|
|
64
|
+
...options,
|
|
65
|
+
name,
|
|
66
|
+
payload
|
|
67
|
+
});
|
|
68
|
+
cache.set(cacheKey, result);
|
|
69
|
+
}
|
|
70
|
+
return cache.get(cacheKey);
|
|
71
|
+
};
|
|
58
72
|
return call;
|
|
59
73
|
});
|
|
60
74
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awsless/awsless",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.111",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -24,12 +24,13 @@
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
|
-
"@awsless/lambda": "^0.0.13",
|
|
28
27
|
"@awsless/redis": "^0.0.8",
|
|
28
|
+
"@awsless/lambda": "^0.0.13",
|
|
29
29
|
"@awsless/sns": "^0.0.7",
|
|
30
30
|
"@awsless/sqs": "^0.0.7",
|
|
31
31
|
"@awsless/ssm": "^0.0.7",
|
|
32
|
-
"@awsless/validate": "^0.0.7"
|
|
32
|
+
"@awsless/validate": "^0.0.7",
|
|
33
|
+
"@awsless/weak-cache": "^0.0.1"
|
|
33
34
|
},
|
|
34
35
|
"dependencies": {
|
|
35
36
|
"@aws-appsync/utils": "^1.5.0",
|