@granular-software/sdk 0.4.61 → 0.4.62
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/README.md +8 -0
- package/dist/agent-evals.d.mts +2 -2
- package/dist/agent-evals.d.ts +2 -2
- package/dist/agent-evals.js +51 -18
- package/dist/agent-evals.js.map +1 -1
- package/dist/agent-evals.mjs +51 -18
- package/dist/agent-evals.mjs.map +1 -1
- package/dist/cli/index.js +51 -18
- package/dist/{client-BzgQvNyG.d.ts → client-Bx5jIDGB.d.ts} +6 -4
- package/dist/{client-DSkGcmmX.d.mts → client-Dg0I_5B_.d.mts} +6 -4
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +51 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +51 -18
- package/dist/index.mjs.map +1 -1
- package/dist/{spend-CNe-Ff6U.d.mts → spend-C8OQnF6E.d.mts} +15 -3
- package/dist/{spend-CNe-Ff6U.d.ts → spend-C8OQnF6E.d.ts} +15 -3
- package/dist/spend.d.mts +1 -1
- package/dist/spend.d.ts +1 -1
- package/package.json +1 -1
package/dist/agent-evals.mjs
CHANGED
|
@@ -14736,6 +14736,15 @@ var stateMachineMetamodelPackage = defineMetamodelPackage({
|
|
|
14736
14736
|
is_final: Boolean!
|
|
14737
14737
|
history: [StateMachineTransitionEvent!]!
|
|
14738
14738
|
instances_in_state(state: String!): [Model!]!
|
|
14739
|
+
instance_population(state: String!, page: Int = 1, per_page: Int = 50): StateMachineInstancePopulation!
|
|
14740
|
+
}
|
|
14741
|
+
|
|
14742
|
+
type StateMachineInstancePopulation {
|
|
14743
|
+
count: Int!
|
|
14744
|
+
instances: [Model!]!
|
|
14745
|
+
page: Int!
|
|
14746
|
+
per_page: Int!
|
|
14747
|
+
has_more: Boolean!
|
|
14739
14748
|
}
|
|
14740
14749
|
|
|
14741
14750
|
type StateMachineState {
|
|
@@ -14944,6 +14953,13 @@ var stateMachineMetamodelPackage = defineMetamodelPackage({
|
|
|
14944
14953
|
value.model.target || value.model,
|
|
14945
14954
|
value.name,
|
|
14946
14955
|
state
|
|
14956
|
+
),
|
|
14957
|
+
instance_population: async (value, { state, page, per_page }) => await stateMachines.instancePopulation(
|
|
14958
|
+
value.model.target || value.model,
|
|
14959
|
+
value.name,
|
|
14960
|
+
state,
|
|
14961
|
+
page,
|
|
14962
|
+
per_page
|
|
14947
14963
|
)
|
|
14948
14964
|
}
|
|
14949
14965
|
};
|
|
@@ -17880,11 +17896,16 @@ var Granular = class _Granular {
|
|
|
17880
17896
|
`${methodName}() requires at least one permission so the SDK can ensure assignments for new users.`
|
|
17881
17897
|
);
|
|
17882
17898
|
}
|
|
17883
|
-
|
|
17884
|
-
|
|
17885
|
-
|
|
17886
|
-
|
|
17899
|
+
const permissionProfileIds = [];
|
|
17900
|
+
for (const profileReference of user.permissions) {
|
|
17901
|
+
permissionProfileIds.push(
|
|
17902
|
+
await this.ensurePermissionProfile(
|
|
17903
|
+
sandbox.sandboxId,
|
|
17904
|
+
profileReference
|
|
17905
|
+
)
|
|
17887
17906
|
);
|
|
17907
|
+
}
|
|
17908
|
+
for (const profileId of permissionProfileIds) {
|
|
17888
17909
|
await this.ensureAssignment(
|
|
17889
17910
|
user.granularId,
|
|
17890
17911
|
sandbox.sandboxId,
|
|
@@ -18889,25 +18910,37 @@ var Granular = class _Granular {
|
|
|
18889
18910
|
}
|
|
18890
18911
|
}
|
|
18891
18912
|
/**
|
|
18892
|
-
*
|
|
18893
|
-
*
|
|
18894
|
-
*
|
|
18913
|
+
* Resolve an existing permission profile by exact name or ID.
|
|
18914
|
+
*
|
|
18915
|
+
* `allow-all` is the sole compatibility profile that the SDK may provision
|
|
18916
|
+
* automatically. Every other missing reference fails closed so a typo or
|
|
18917
|
+
* untrusted role value cannot become an allow-default profile.
|
|
18895
18918
|
*/
|
|
18896
|
-
async ensurePermissionProfile(sandboxId,
|
|
18897
|
-
|
|
18898
|
-
|
|
18899
|
-
|
|
18900
|
-
|
|
18901
|
-
|
|
18902
|
-
|
|
18903
|
-
|
|
18919
|
+
async ensurePermissionProfile(sandboxId, profileReference) {
|
|
18920
|
+
const normalizedReference = typeof profileReference === "string" ? profileReference.trim() : "";
|
|
18921
|
+
if (!normalizedReference) {
|
|
18922
|
+
throw new Error(
|
|
18923
|
+
"Permission profile references must be non-empty names or IDs."
|
|
18924
|
+
);
|
|
18925
|
+
}
|
|
18926
|
+
const profiles = await this.permissionProfiles.list(sandboxId);
|
|
18927
|
+
const existing = profiles.find(
|
|
18928
|
+
(profile) => profile.name === normalizedReference || profile.permissionProfileId === normalizedReference
|
|
18929
|
+
);
|
|
18930
|
+
if (existing) {
|
|
18931
|
+
return existing.permissionProfileId;
|
|
18932
|
+
}
|
|
18933
|
+
if (normalizedReference !== "allow-all") {
|
|
18934
|
+
throw new Error(
|
|
18935
|
+
`Permission profile "${normalizedReference}" was not found in sandbox ${sandboxId}. Provision it with granular build or granular deploy before calling openEnvironment(). Only the reserved "allow-all" profile can be created automatically.`
|
|
18936
|
+
);
|
|
18904
18937
|
}
|
|
18905
18938
|
const created = await this.permissionProfiles.create(sandboxId, {
|
|
18906
|
-
name:
|
|
18939
|
+
name: normalizedReference,
|
|
18907
18940
|
rules: {
|
|
18908
18941
|
schemaVersion: 1,
|
|
18909
|
-
name:
|
|
18910
|
-
description:
|
|
18942
|
+
name: normalizedReference,
|
|
18943
|
+
description: "Every declared action is visible unless a manifest policy denies it.",
|
|
18911
18944
|
defaults: { actionPolicy: "allow" },
|
|
18912
18945
|
actions: []
|
|
18913
18946
|
}
|