@tinycloud/sdk-core 2.2.0-beta.4 → 2.2.0-beta.6
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/index.cjs +24 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +39 -39
- package/dist/index.d.ts +39 -39
- package/dist/index.js +24 -22
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -2789,12 +2789,6 @@ var DEFAULT_STANDARD_ENTRIES = [
|
|
|
2789
2789
|
space: DEFAULT_MANIFEST_SPACE,
|
|
2790
2790
|
path: "/",
|
|
2791
2791
|
actions: ["read", "write"]
|
|
2792
|
-
},
|
|
2793
|
-
{
|
|
2794
|
-
service: "tinycloud.capabilities",
|
|
2795
|
-
space: DEFAULT_MANIFEST_SPACE,
|
|
2796
|
-
path: "/",
|
|
2797
|
-
actions: ["read"]
|
|
2798
2792
|
}
|
|
2799
2793
|
];
|
|
2800
2794
|
var DEFAULT_ADMIN_ENTRIES = [
|
|
@@ -2809,12 +2803,6 @@ var DEFAULT_ADMIN_ENTRIES = [
|
|
|
2809
2803
|
space: DEFAULT_MANIFEST_SPACE,
|
|
2810
2804
|
path: "/",
|
|
2811
2805
|
actions: ["read", "write", "ddl"]
|
|
2812
|
-
},
|
|
2813
|
-
{
|
|
2814
|
-
service: "tinycloud.capabilities",
|
|
2815
|
-
space: DEFAULT_MANIFEST_SPACE,
|
|
2816
|
-
path: "/",
|
|
2817
|
-
actions: ["read", "admin"]
|
|
2818
2806
|
}
|
|
2819
2807
|
];
|
|
2820
2808
|
var DEFAULT_ALL_ENTRIES = [
|
|
@@ -2835,12 +2823,6 @@ var DEFAULT_ALL_ENTRIES = [
|
|
|
2835
2823
|
space: DEFAULT_MANIFEST_SPACE,
|
|
2836
2824
|
path: "/",
|
|
2837
2825
|
actions: ["read", "write"]
|
|
2838
|
-
},
|
|
2839
|
-
{
|
|
2840
|
-
service: "tinycloud.capabilities",
|
|
2841
|
-
space: DEFAULT_MANIFEST_SPACE,
|
|
2842
|
-
path: "/",
|
|
2843
|
-
actions: ["read", "admin"]
|
|
2844
2826
|
}
|
|
2845
2827
|
];
|
|
2846
2828
|
function parseExpiry(duration) {
|
|
@@ -2990,7 +2972,8 @@ function defaultEntriesForTier(tier) {
|
|
|
2990
2972
|
service: e.service,
|
|
2991
2973
|
space: e.space,
|
|
2992
2974
|
path: e.path,
|
|
2993
|
-
actions: [...e.actions]
|
|
2975
|
+
actions: [...e.actions],
|
|
2976
|
+
...e.skipPrefix !== void 0 ? { skipPrefix: e.skipPrefix } : {}
|
|
2994
2977
|
}));
|
|
2995
2978
|
}
|
|
2996
2979
|
function resolveManifest(input) {
|
|
@@ -3003,8 +2986,8 @@ function resolveManifest(input) {
|
|
|
3003
2986
|
const defaultEntries = defaultEntriesForTier(tier);
|
|
3004
2987
|
const explicitEntries = manifest.permissions ?? [];
|
|
3005
2988
|
const allEntries = [...defaultEntries, ...explicitEntries];
|
|
3006
|
-
const resources =
|
|
3007
|
-
(entry) => resolveEntry(entry, prefix, expiryMs, space)
|
|
2989
|
+
const resources = withCapabilitiesReadForSpaces(
|
|
2990
|
+
allEntries.map((entry) => resolveEntry(entry, prefix, expiryMs, space))
|
|
3008
2991
|
);
|
|
3009
2992
|
const additionalDelegates = manifest.did === void 0 ? [] : [
|
|
3010
2993
|
{
|
|
@@ -3087,6 +3070,24 @@ function dedupeResources(resources) {
|
|
|
3087
3070
|
}
|
|
3088
3071
|
return [...byKey.values()];
|
|
3089
3072
|
}
|
|
3073
|
+
function capabilitiesReadPermission(space) {
|
|
3074
|
+
return {
|
|
3075
|
+
service: "tinycloud.capabilities",
|
|
3076
|
+
space,
|
|
3077
|
+
path: "",
|
|
3078
|
+
actions: ["tinycloud.capabilities/read"]
|
|
3079
|
+
};
|
|
3080
|
+
}
|
|
3081
|
+
function withCapabilitiesReadForSpaces(resources) {
|
|
3082
|
+
if (resources.length === 0) {
|
|
3083
|
+
return [];
|
|
3084
|
+
}
|
|
3085
|
+
const spaces = new Set(resources.map((resource) => resource.space));
|
|
3086
|
+
return dedupeResources([
|
|
3087
|
+
...resources,
|
|
3088
|
+
...[...spaces].map(capabilitiesReadPermission)
|
|
3089
|
+
]);
|
|
3090
|
+
}
|
|
3090
3091
|
function accountRegistryPermission() {
|
|
3091
3092
|
return {
|
|
3092
3093
|
service: "tinycloud.kv",
|
|
@@ -3114,6 +3115,7 @@ function composeManifestRequest(inputs, options = {}) {
|
|
|
3114
3115
|
if (includeAccountRegistryPermissions) {
|
|
3115
3116
|
resources.push(accountRegistryPermission());
|
|
3116
3117
|
}
|
|
3118
|
+
const resourcesWithImplicitCapabilities = withCapabilitiesReadForSpaces(resources);
|
|
3117
3119
|
const manifestsByAppId = /* @__PURE__ */ new Map();
|
|
3118
3120
|
for (const manifest of manifests) {
|
|
3119
3121
|
const current = manifestsByAppId.get(manifest.app_id);
|
|
@@ -3133,7 +3135,7 @@ function composeManifestRequest(inputs, options = {}) {
|
|
|
3133
3135
|
})) : [];
|
|
3134
3136
|
return {
|
|
3135
3137
|
manifests,
|
|
3136
|
-
resources:
|
|
3138
|
+
resources: resourcesWithImplicitCapabilities,
|
|
3137
3139
|
delegationTargets,
|
|
3138
3140
|
registryRecords,
|
|
3139
3141
|
expiryMs: Math.max(...resolved.map((entry) => entry.expiryMs)),
|