@diagonal-hq/cli 0.33.6 → 0.33.8
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 +2 -2
- package/dist/cli.mjs +8 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -454,7 +454,7 @@ The build reads `Permissions.<Name>.uid` and `SystemPermissions.<Name>.uid` like
|
|
|
454
454
|
|
|
455
455
|
Page code reads one member of `Permissions` at a time, such as `Permissions.ManageBookings.uid`. The build replaces each member reference with its value. A page cannot use `Permissions` as a whole, for example in `Object.keys(Permissions)` or `Object.values(Permissions)`. A dynamic import of `@app/generated/permissions` and a re-export of `Permissions` also fail the build. To list some permissions, write an array of member references, such as `[Permissions.ManageBookings.uid, Permissions.ManageEvents.uid]`.
|
|
456
456
|
|
|
457
|
-
The deploy writes every system permission and each permission of `permissions/` as the records of the platform Permissions resource, each with its uid as its record id. Then the resource is locked
|
|
457
|
+
The deploy writes every system permission and each permission of `permissions/` as the records of the platform Permissions resource, each with its uid as its record id. Then the resource is locked, so only the deploy writes the records. The Security admin, the record API, and the AI record plans create, edit, delete, and restore a custom permission by committing to its file and deploying it. A new system permission appears on the next deploy with no change to the files. The System Administrator role holds every permission. A deploy that removes a permission that a role other than System Administrator grants is refused: remove the grant first.
|
|
458
458
|
|
|
459
459
|
The first deploy of a workspace matches each seeded system permission by its slug. It changes the id of the stored record to the uid and rewrites the role grants, so the roles keep their permissions. The deploy does not take over a custom permission that the workspace created. A declared permission whose slug a stored record already has blocks the deploy: delete that record, or remove the declaration. A stored custom permission that `permissions/` does not declare also blocks that deploy: declare it with its current record id as its `uid`, or delete it first. To get the record id, open the actions of the permission in the Security admin and select **Copy Permission ID**. Declare the permission with that `uid` in the file of its current slug, so it keeps its id and its role grants. Do not let `diagonal check` generate a new uid for it, because a new uid blocks the deploy.
|
|
460
460
|
|
|
@@ -489,7 +489,7 @@ export default defineRole({
|
|
|
489
489
|
- `@diagonal-hq/cli` exports `SystemRoles`. The platform declares `SystemRoles.SystemAdministrator`, with a fixed `uid`. That role holds every permission, declared and system, so `roles/` cannot declare or change it.
|
|
490
490
|
- A `roles.ts` file at the root is an error: move each role to `roles/<slug>.ts`.
|
|
491
491
|
|
|
492
|
-
The deploy writes each role of `roles/` and System Administrator as the records of the platform Roles resource, each with its uid as its record id. Then the resource is locked
|
|
492
|
+
The deploy writes each role of `roles/` and System Administrator as the records of the platform Roles resource, each with its uid as its record id. Then the resource is locked, so only the deploy writes the records. The Security admin, the record API, and the AI record plans change a role and its grants by committing to its file and deploying it; only a person with `access_system_admin` can make a role grant `access_system_admin`. The assignment of roles to people stays data, so the Security admin still assigns them.
|
|
493
493
|
|
|
494
494
|
## Workflow references
|
|
495
495
|
|
package/dist/cli.mjs
CHANGED
|
@@ -308518,11 +308518,8 @@ function buildRedirects(ast, domains) {
|
|
|
308518
308518
|
const { value, nodes } = staticObject(definition, { domains });
|
|
308519
308519
|
return Object.entries(value).map(([key, redirect]) => {
|
|
308520
308520
|
const node = nodes[key];
|
|
308521
|
-
if (
|
|
308522
|
-
throw new SourceError(
|
|
308523
|
-
`The redirect key "${key}" must start with a lower-case letter and contain only letters and digits, at most ${KEY_MAX_LENGTH2} characters, such as oldMembers`,
|
|
308524
|
-
node.key
|
|
308525
|
-
);
|
|
308521
|
+
if (!isRedirectKey(key)) {
|
|
308522
|
+
throw new SourceError(redirectKeyMessage(key), node.key);
|
|
308526
308523
|
}
|
|
308527
308524
|
if (!isPlainObject2(redirect)) {
|
|
308528
308525
|
throw new SourceError(`The redirect "${key}" must be an object with "from", "to", and "status"`, node);
|
|
@@ -308626,6 +308623,12 @@ function refuseUnknownOptions(value, options, node, owner) {
|
|
|
308626
308623
|
}
|
|
308627
308624
|
}
|
|
308628
308625
|
}
|
|
308626
|
+
function isRedirectKey(key) {
|
|
308627
|
+
return key.length <= KEY_MAX_LENGTH2 && KEY_PATTERN2.test(key);
|
|
308628
|
+
}
|
|
308629
|
+
function redirectKeyMessage(key) {
|
|
308630
|
+
return `The redirect key "${key}" must start with a lower-case letter and contain only letters and digits, at most ${KEY_MAX_LENGTH2} characters, such as oldMembers`;
|
|
308631
|
+
}
|
|
308629
308632
|
|
|
308630
308633
|
// scripts/lib/runtime-build/migrations.mjs
|
|
308631
308634
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|