@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/index.mjs
CHANGED
|
@@ -14761,6 +14761,15 @@ var stateMachineMetamodelPackage = defineMetamodelPackage({
|
|
|
14761
14761
|
is_final: Boolean!
|
|
14762
14762
|
history: [StateMachineTransitionEvent!]!
|
|
14763
14763
|
instances_in_state(state: String!): [Model!]!
|
|
14764
|
+
instance_population(state: String!, page: Int = 1, per_page: Int = 50): StateMachineInstancePopulation!
|
|
14765
|
+
}
|
|
14766
|
+
|
|
14767
|
+
type StateMachineInstancePopulation {
|
|
14768
|
+
count: Int!
|
|
14769
|
+
instances: [Model!]!
|
|
14770
|
+
page: Int!
|
|
14771
|
+
per_page: Int!
|
|
14772
|
+
has_more: Boolean!
|
|
14764
14773
|
}
|
|
14765
14774
|
|
|
14766
14775
|
type StateMachineState {
|
|
@@ -14969,6 +14978,13 @@ var stateMachineMetamodelPackage = defineMetamodelPackage({
|
|
|
14969
14978
|
value.model.target || value.model,
|
|
14970
14979
|
value.name,
|
|
14971
14980
|
state
|
|
14981
|
+
),
|
|
14982
|
+
instance_population: async (value, { state, page, per_page }) => await stateMachines.instancePopulation(
|
|
14983
|
+
value.model.target || value.model,
|
|
14984
|
+
value.name,
|
|
14985
|
+
state,
|
|
14986
|
+
page,
|
|
14987
|
+
per_page
|
|
14972
14988
|
)
|
|
14973
14989
|
}
|
|
14974
14990
|
};
|
|
@@ -18003,11 +18019,16 @@ var Granular = class _Granular {
|
|
|
18003
18019
|
`${methodName}() requires at least one permission so the SDK can ensure assignments for new users.`
|
|
18004
18020
|
);
|
|
18005
18021
|
}
|
|
18006
|
-
|
|
18007
|
-
|
|
18008
|
-
|
|
18009
|
-
|
|
18022
|
+
const permissionProfileIds = [];
|
|
18023
|
+
for (const profileReference of user.permissions) {
|
|
18024
|
+
permissionProfileIds.push(
|
|
18025
|
+
await this.ensurePermissionProfile(
|
|
18026
|
+
sandbox.sandboxId,
|
|
18027
|
+
profileReference
|
|
18028
|
+
)
|
|
18010
18029
|
);
|
|
18030
|
+
}
|
|
18031
|
+
for (const profileId of permissionProfileIds) {
|
|
18011
18032
|
await this.ensureAssignment(
|
|
18012
18033
|
user.granularId,
|
|
18013
18034
|
sandbox.sandboxId,
|
|
@@ -19012,25 +19033,37 @@ var Granular = class _Granular {
|
|
|
19012
19033
|
}
|
|
19013
19034
|
}
|
|
19014
19035
|
/**
|
|
19015
|
-
*
|
|
19016
|
-
*
|
|
19017
|
-
*
|
|
19036
|
+
* Resolve an existing permission profile by exact name or ID.
|
|
19037
|
+
*
|
|
19038
|
+
* `allow-all` is the sole compatibility profile that the SDK may provision
|
|
19039
|
+
* automatically. Every other missing reference fails closed so a typo or
|
|
19040
|
+
* untrusted role value cannot become an allow-default profile.
|
|
19018
19041
|
*/
|
|
19019
|
-
async ensurePermissionProfile(sandboxId,
|
|
19020
|
-
|
|
19021
|
-
|
|
19022
|
-
|
|
19023
|
-
|
|
19024
|
-
|
|
19025
|
-
|
|
19026
|
-
|
|
19042
|
+
async ensurePermissionProfile(sandboxId, profileReference) {
|
|
19043
|
+
const normalizedReference = typeof profileReference === "string" ? profileReference.trim() : "";
|
|
19044
|
+
if (!normalizedReference) {
|
|
19045
|
+
throw new Error(
|
|
19046
|
+
"Permission profile references must be non-empty names or IDs."
|
|
19047
|
+
);
|
|
19048
|
+
}
|
|
19049
|
+
const profiles = await this.permissionProfiles.list(sandboxId);
|
|
19050
|
+
const existing = profiles.find(
|
|
19051
|
+
(profile) => profile.name === normalizedReference || profile.permissionProfileId === normalizedReference
|
|
19052
|
+
);
|
|
19053
|
+
if (existing) {
|
|
19054
|
+
return existing.permissionProfileId;
|
|
19055
|
+
}
|
|
19056
|
+
if (normalizedReference !== "allow-all") {
|
|
19057
|
+
throw new Error(
|
|
19058
|
+
`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.`
|
|
19059
|
+
);
|
|
19027
19060
|
}
|
|
19028
19061
|
const created = await this.permissionProfiles.create(sandboxId, {
|
|
19029
|
-
name:
|
|
19062
|
+
name: normalizedReference,
|
|
19030
19063
|
rules: {
|
|
19031
19064
|
schemaVersion: 1,
|
|
19032
|
-
name:
|
|
19033
|
-
description:
|
|
19065
|
+
name: normalizedReference,
|
|
19066
|
+
description: "Every declared action is visible unless a manifest policy denies it.",
|
|
19034
19067
|
defaults: { actionPolicy: "allow" },
|
|
19035
19068
|
actions: []
|
|
19036
19069
|
}
|