@inf-monkeys-tech/monkeys-cli 0.12.13 → 0.12.14
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 +10 -0
- package/README.zh.md +10 -0
- package/dist/command/metadata.d.ts.map +1 -1
- package/dist/command/metadata.js +13 -0
- package/dist/command/metadata.js.map +1 -1
- package/dist/commands/group/create.d.ts +21 -0
- package/dist/commands/group/create.d.ts.map +1 -0
- package/dist/commands/group/create.js +31 -0
- package/dist/commands/group/create.js.map +1 -0
- package/dist/commands/group/delete.d.ts +22 -0
- package/dist/commands/group/delete.d.ts.map +1 -0
- package/dist/commands/group/delete.js +30 -0
- package/dist/commands/group/delete.js.map +1 -0
- package/dist/commands/group/get.d.ts +14 -0
- package/dist/commands/group/get.d.ts.map +1 -0
- package/dist/commands/group/get.js +20 -0
- package/dist/commands/group/get.js.map +1 -0
- package/dist/commands/group/list.d.ts +16 -0
- package/dist/commands/group/list.d.ts.map +1 -0
- package/dist/commands/group/list.js +18 -0
- package/dist/commands/group/list.js.map +1 -0
- package/dist/commands/group/member/add.d.ts +26 -0
- package/dist/commands/group/member/add.d.ts.map +1 -0
- package/dist/commands/group/member/add.js +29 -0
- package/dist/commands/group/member/add.js.map +1 -0
- package/dist/commands/group/member/list.d.ts +20 -0
- package/dist/commands/group/member/list.d.ts.map +1 -0
- package/dist/commands/group/member/list.js +21 -0
- package/dist/commands/group/member/list.js.map +1 -0
- package/dist/commands/group/member/remove.d.ts +27 -0
- package/dist/commands/group/member/remove.d.ts.map +1 -0
- package/dist/commands/group/member/remove.js +33 -0
- package/dist/commands/group/member/remove.js.map +1 -0
- package/dist/commands/group/permission/list.d.ts +19 -0
- package/dist/commands/group/permission/list.d.ts.map +1 -0
- package/dist/commands/group/permission/list.js +28 -0
- package/dist/commands/group/permission/list.js.map +1 -0
- package/dist/commands/group/permission/set.d.ts +24 -0
- package/dist/commands/group/permission/set.d.ts.map +1 -0
- package/dist/commands/group/permission/set.js +33 -0
- package/dist/commands/group/permission/set.js.map +1 -0
- package/dist/commands/group/update.d.ts +24 -0
- package/dist/commands/group/update.d.ts.map +1 -0
- package/dist/commands/group/update.js +33 -0
- package/dist/commands/group/update.js.map +1 -0
- package/dist/commands/permission/list.d.ts +16 -0
- package/dist/commands/permission/list.d.ts.map +1 -0
- package/dist/commands/permission/list.js +18 -0
- package/dist/commands/permission/list.js.map +1 -0
- package/dist/commands/user/get.d.ts +14 -0
- package/dist/commands/user/get.d.ts.map +1 -0
- package/dist/commands/user/get.js +20 -0
- package/dist/commands/user/get.js.map +1 -0
- package/dist/commands/user/group/add.d.ts +26 -0
- package/dist/commands/user/group/add.d.ts.map +1 -0
- package/dist/commands/user/group/add.js +29 -0
- package/dist/commands/user/group/add.js.map +1 -0
- package/dist/commands/user/group/list.d.ts +19 -0
- package/dist/commands/user/group/list.d.ts.map +1 -0
- package/dist/commands/user/group/list.js +38 -0
- package/dist/commands/user/group/list.js.map +1 -0
- package/dist/commands/user/group/remove.d.ts +26 -0
- package/dist/commands/user/group/remove.d.ts.map +1 -0
- package/dist/commands/user/group/remove.js +29 -0
- package/dist/commands/user/group/remove.js.map +1 -0
- package/dist/commands/user/list.d.ts +18 -0
- package/dist/commands/user/list.d.ts.map +1 -0
- package/dist/commands/user/list.js +27 -0
- package/dist/commands/user/list.js.map +1 -0
- package/dist/identity-governance/client.d.ts +217 -0
- package/dist/identity-governance/client.d.ts.map +1 -0
- package/dist/identity-governance/client.js +185 -0
- package/dist/identity-governance/client.js.map +1 -0
- package/dist/identity-governance/contracts.d.ts +142 -0
- package/dist/identity-governance/contracts.d.ts.map +1 -0
- package/dist/identity-governance/contracts.js +109 -0
- package/dist/identity-governance/contracts.js.map +1 -0
- package/dist/identity-governance/definitions.d.ts +54 -0
- package/dist/identity-governance/definitions.d.ts.map +1 -0
- package/dist/identity-governance/definitions.js +25 -0
- package/dist/identity-governance/definitions.js.map +1 -0
- package/dist/identity-governance/files.d.ts +5 -0
- package/dist/identity-governance/files.d.ts.map +1 -0
- package/dist/identity-governance/files.js +75 -0
- package/dist/identity-governance/files.js.map +1 -0
- package/dist/identity-governance/flags.d.ts +43 -0
- package/dist/identity-governance/flags.d.ts.map +1 -0
- package/dist/identity-governance/flags.js +52 -0
- package/dist/identity-governance/flags.js.map +1 -0
- package/dist/identity-governance/group-mutation.d.ts +165 -0
- package/dist/identity-governance/group-mutation.d.ts.map +1 -0
- package/dist/identity-governance/group-mutation.js +160 -0
- package/dist/identity-governance/group-mutation.js.map +1 -0
- package/dist/identity-governance/membership.d.ts +145 -0
- package/dist/identity-governance/membership.d.ts.map +1 -0
- package/dist/identity-governance/membership.js +264 -0
- package/dist/identity-governance/membership.js.map +1 -0
- package/dist/identity-governance/runtime.d.ts +16 -0
- package/dist/identity-governance/runtime.d.ts.map +1 -0
- package/dist/identity-governance/runtime.js +30 -0
- package/dist/identity-governance/runtime.js.map +1 -0
- package/oclif.manifest.json +2585 -560
- package/package.json +11 -2
- package/skills/monkeys-shared/SKILL.md +2 -1
- package/skills/monkeys-shared/references/identity-governance.md +47 -0
- package/skills/monkeys-shared/references/platform-overview.md +2 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { CliError, EXIT_CODES } from '../errors/cli-error.js';
|
|
3
|
+
export const MAX_MEMBERSHIP_TARGETS = 10_000;
|
|
4
|
+
export const idSchema = z
|
|
5
|
+
.string()
|
|
6
|
+
.trim()
|
|
7
|
+
.min(1)
|
|
8
|
+
.max(128)
|
|
9
|
+
.refine((value) => value !== '.' && value !== '..', 'Dot path segments are not IDs.')
|
|
10
|
+
.regex(/^[^\s\u0000-\u001f\u007f]+$/u);
|
|
11
|
+
const text = z.string();
|
|
12
|
+
const nullableText = text.nullable().optional();
|
|
13
|
+
const timestamp = z.union([z.number().finite(), z.string().regex(/^\d+$/)]).optional();
|
|
14
|
+
export const groupRefSchema = z.object({ id: idSchema, code: text, name: text });
|
|
15
|
+
export const membershipGroupSchema = groupRefSchema.extend({ protected: z.boolean() });
|
|
16
|
+
export const permissionSchema = z.object({
|
|
17
|
+
id: idSchema,
|
|
18
|
+
code: text,
|
|
19
|
+
name: text,
|
|
20
|
+
resource: text,
|
|
21
|
+
action: text,
|
|
22
|
+
description: nullableText,
|
|
23
|
+
createdTimestamp: timestamp,
|
|
24
|
+
updatedTimestamp: timestamp,
|
|
25
|
+
});
|
|
26
|
+
export const groupSchema = groupRefSchema.extend({
|
|
27
|
+
description: nullableText,
|
|
28
|
+
isSystem: z.boolean(),
|
|
29
|
+
membershipEditable: z.boolean(),
|
|
30
|
+
permissions: z.array(permissionSchema),
|
|
31
|
+
createdTimestamp: timestamp,
|
|
32
|
+
updatedTimestamp: timestamp,
|
|
33
|
+
});
|
|
34
|
+
export const userSchema = z.object({
|
|
35
|
+
id: idSchema,
|
|
36
|
+
name: nullableText,
|
|
37
|
+
email: nullableText,
|
|
38
|
+
nickname: nullableText,
|
|
39
|
+
departmentName: nullableText,
|
|
40
|
+
verified: z.boolean().nullable().optional(),
|
|
41
|
+
isBlocked: z.boolean().optional(),
|
|
42
|
+
blockStateVersion: text.optional(),
|
|
43
|
+
blockReasons: z.array(z.object({ code: text })).optional(),
|
|
44
|
+
groups: z.array(groupRefSchema),
|
|
45
|
+
createdTimestamp: timestamp,
|
|
46
|
+
updatedTimestamp: timestamp,
|
|
47
|
+
});
|
|
48
|
+
export const userGroupsSchema = z.object({
|
|
49
|
+
userId: idSchema,
|
|
50
|
+
direct: z.array(membershipGroupSchema),
|
|
51
|
+
mapped: z.array(membershipGroupSchema),
|
|
52
|
+
});
|
|
53
|
+
export const memberSchema = z.object({ id: idSchema, name: text, email: text, source: z.literal('direct') });
|
|
54
|
+
export const scopeSchema = z.object({ kind: z.enum(['user', 'group']), id: idSchema }).strict();
|
|
55
|
+
export const changeSchema = z.object({ userId: idSchema, groupId: idSchema, action: z.enum(['add', 'remove']) }).strict();
|
|
56
|
+
export const membershipResultSchema = z.object({ changed: z.number().int().min(0).max(200), scope: scopeSchema });
|
|
57
|
+
export const groupCreateSchema = z
|
|
58
|
+
.object({
|
|
59
|
+
code: text
|
|
60
|
+
.trim()
|
|
61
|
+
.min(1)
|
|
62
|
+
.max(128)
|
|
63
|
+
.transform((v) => v.toLowerCase()),
|
|
64
|
+
name: text.trim().min(1).max(512),
|
|
65
|
+
description: text.trim().max(4096).optional(),
|
|
66
|
+
})
|
|
67
|
+
.strict();
|
|
68
|
+
export const groupUpdateSchema = groupCreateSchema
|
|
69
|
+
.partial()
|
|
70
|
+
.refine((v) => Object.keys(v).length > 0, 'Provide at least one metadata field.');
|
|
71
|
+
export const permissionSetSchema = z.object({ permissionIds: z.array(idSchema).max(MAX_MEMBERSHIP_TARGETS) }).strict();
|
|
72
|
+
export function fail(code, message, exitCode = EXIT_CODES.validation, safeDetails) {
|
|
73
|
+
throw new CliError(message, { code, exitCode, ...(safeDetails === undefined ? {} : { safeDetails }) });
|
|
74
|
+
}
|
|
75
|
+
export function parse(schema, value, response = false) {
|
|
76
|
+
const result = schema.safeParse(value);
|
|
77
|
+
if (!result.success)
|
|
78
|
+
fail(response ? 'IDENTITY_RESPONSE_INCOMPATIBLE' : 'IDENTITY_INPUT_INVALID', response ? 'The identity response does not match the supported contract.' : 'Invalid identity-management input.', response ? EXIT_CODES.compatibility : EXIT_CODES.validation, {
|
|
79
|
+
issues: result.error.issues.slice(0, 20).map((issue) => ({ code: issue.code, path: issue.path.join('.') })),
|
|
80
|
+
});
|
|
81
|
+
return result.data;
|
|
82
|
+
}
|
|
83
|
+
export function pageSchema(item) {
|
|
84
|
+
return z
|
|
85
|
+
.object({
|
|
86
|
+
items: z.array(item).max(1000),
|
|
87
|
+
pageInfo: z.object({
|
|
88
|
+
hasMore: z.boolean(),
|
|
89
|
+
nextPageToken: text.min(1).optional(),
|
|
90
|
+
pageSize: z.number().int().min(1).max(1000),
|
|
91
|
+
returned: z.number().int().nonnegative(),
|
|
92
|
+
total: z.number().int().nonnegative().optional(),
|
|
93
|
+
}),
|
|
94
|
+
})
|
|
95
|
+
.superRefine((value, context) => {
|
|
96
|
+
if (value.pageInfo.hasMore !== Boolean(value.pageInfo.nextPageToken) ||
|
|
97
|
+
value.pageInfo.returned !== value.items.length ||
|
|
98
|
+
value.items.length > value.pageInfo.pageSize) {
|
|
99
|
+
context.addIssue({ code: 'custom', message: 'Inconsistent pagination metadata.', path: ['pageInfo'] });
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
export function requireCustomGroup(group) {
|
|
104
|
+
if (group.isSystem || ['member', 'platform_admin', 'super_admin'].includes(group.code))
|
|
105
|
+
fail('IDENTITY_GROUP_PROTECTED', 'System group definitions and permissions cannot be changed.', EXIT_CODES.authorization, {
|
|
106
|
+
groupId: group.id,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=contracts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../src/identity-governance/contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAiB,MAAM,wBAAwB,CAAC;AAE7E,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC;AAC7C,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC;KACtB,MAAM,EAAE;KACR,IAAI,EAAE;KACN,GAAG,CAAC,CAAC,CAAC;KACN,GAAG,CAAC,GAAG,CAAC;KACR,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,GAAG,IAAI,KAAK,KAAK,IAAI,EAAE,gCAAgC,CAAC;KACpF,KAAK,CAAC,8BAA8B,CAAC,CAAC;AACzC,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC;AACxB,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAA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
|
2
|
+
import type { SemanticCommandDefinition } from '../api-operation/types.js';
|
|
3
|
+
export declare const IDENTITY_OPERATIONS: {
|
|
4
|
+
users: SemanticCommandDefinition & {
|
|
5
|
+
method: HttpMethod;
|
|
6
|
+
permissions: string[];
|
|
7
|
+
};
|
|
8
|
+
user: SemanticCommandDefinition & {
|
|
9
|
+
method: HttpMethod;
|
|
10
|
+
permissions: string[];
|
|
11
|
+
};
|
|
12
|
+
userGroups: SemanticCommandDefinition & {
|
|
13
|
+
method: HttpMethod;
|
|
14
|
+
permissions: string[];
|
|
15
|
+
};
|
|
16
|
+
groups: SemanticCommandDefinition & {
|
|
17
|
+
method: HttpMethod;
|
|
18
|
+
permissions: string[];
|
|
19
|
+
};
|
|
20
|
+
group: SemanticCommandDefinition & {
|
|
21
|
+
method: HttpMethod;
|
|
22
|
+
permissions: string[];
|
|
23
|
+
};
|
|
24
|
+
members: SemanticCommandDefinition & {
|
|
25
|
+
method: HttpMethod;
|
|
26
|
+
permissions: string[];
|
|
27
|
+
};
|
|
28
|
+
permissions: SemanticCommandDefinition & {
|
|
29
|
+
method: HttpMethod;
|
|
30
|
+
permissions: string[];
|
|
31
|
+
};
|
|
32
|
+
change: SemanticCommandDefinition & {
|
|
33
|
+
method: HttpMethod;
|
|
34
|
+
permissions: string[];
|
|
35
|
+
};
|
|
36
|
+
create: SemanticCommandDefinition & {
|
|
37
|
+
method: HttpMethod;
|
|
38
|
+
permissions: string[];
|
|
39
|
+
};
|
|
40
|
+
update: SemanticCommandDefinition & {
|
|
41
|
+
method: HttpMethod;
|
|
42
|
+
permissions: string[];
|
|
43
|
+
};
|
|
44
|
+
delete: SemanticCommandDefinition & {
|
|
45
|
+
method: HttpMethod;
|
|
46
|
+
permissions: string[];
|
|
47
|
+
};
|
|
48
|
+
setPermissions: SemanticCommandDefinition & {
|
|
49
|
+
method: HttpMethod;
|
|
50
|
+
permissions: string[];
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
export type IdentityOperation = keyof typeof IDENTITY_OPERATIONS;
|
|
54
|
+
//# sourceMappingURL=definitions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../src/identity-governance/definitions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAgB3E,eAAO,MAAM,mBAAmB;IAC9B,KAAK;gBAXkC,UAAU;qBAAe,MAAM,EAAE;;IAYxE,IAAI;;;;IACJ,UAAU;;;;IACV,MAAM;;;;IACN,KAAK;;;;IACL,OAAO;;;;IACP,WAAW;;;;IACX,MAAM;;;;IACN,MAAM;;;;IACN,MAAM;;;;IACN,MAAM;;;;IACN,cAAc;;;;CACf,CAAC;AACF,MAAM,MAAM,iBAAiB,GAAG,MAAM,OAAO,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
function define(id, method, permissions) {
|
|
2
|
+
return {
|
|
3
|
+
id,
|
|
4
|
+
method,
|
|
5
|
+
permissions,
|
|
6
|
+
command: id.split('.'),
|
|
7
|
+
risk: method === 'GET' ? 'read' : 'privileged',
|
|
8
|
+
apiBindings: [{ apiOperationId: id, adapter: 'kernel-identity-v1' }],
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export const IDENTITY_OPERATIONS = {
|
|
12
|
+
users: define('kernel.user.list', 'GET', ['user:read']),
|
|
13
|
+
user: define('kernel.user.get', 'GET', ['user:read']),
|
|
14
|
+
userGroups: define('kernel.user.group.list', 'GET', ['user:read', 'permission:read']),
|
|
15
|
+
groups: define('kernel.group.list', 'GET', ['permission:read']),
|
|
16
|
+
group: define('kernel.group.get', 'GET', ['permission:read']),
|
|
17
|
+
members: define('kernel.group.member.list', 'GET', ['user:read', 'permission:read']),
|
|
18
|
+
permissions: define('kernel.permission.list', 'GET', ['permission:read']),
|
|
19
|
+
change: define('kernel.group-membership.change', 'PATCH', ['user:read', 'permission:read', 'permission:write']),
|
|
20
|
+
create: define('kernel.group.create', 'POST', ['permission:write']),
|
|
21
|
+
update: define('kernel.group.update', 'PUT', ['permission:write']),
|
|
22
|
+
delete: define('kernel.group.delete', 'DELETE', ['permission:write']),
|
|
23
|
+
setPermissions: define('kernel.group.permission.set', 'PUT', ['permission:write']),
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=definitions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/identity-governance/definitions.ts"],"names":[],"mappings":"AAGA,SAAS,MAAM,CACb,EAAU,EACV,MAAkB,EAClB,WAAqB;IAErB,OAAO;QACL,EAAE;QACF,MAAM;QACN,WAAW;QACX,OAAO,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC;QACtB,IAAI,EAAE,MAAM,KAAK,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY;QAC9C,WAAW,EAAE,CAAC,EAAE,cAAc,EAAE,EAAE,EAAE,OAAO,EAAE,oBAAoB,EAAE,CAAC;KACrE,CAAC;AACJ,CAAC;AACD,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,KAAK,EAAE,MAAM,CAAC,kBAAkB,EAAE,KAAK,EAAE,CAAC,WAAW,CAAC,CAAC;IACvD,IAAI,EAAE,MAAM,CAAC,iBAAiB,EAAE,KAAK,EAAE,CAAC,WAAW,CAAC,CAAC;IACrD,UAAU,EAAE,MAAM,CAAC,wBAAwB,EAAE,KAAK,EAAE,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAC;IACrF,MAAM,EAAE,MAAM,CAAC,mBAAmB,EAAE,KAAK,EAAE,CAAC,iBAAiB,CAAC,CAAC;IAC/D,KAAK,EAAE,MAAM,CAAC,kBAAkB,EAAE,KAAK,EAAE,CAAC,iBAAiB,CAAC,CAAC;IAC7D,OAAO,EAAE,MAAM,CAAC,0BAA0B,EAAE,KAAK,EAAE,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAC;IACpF,WAAW,EAAE,MAAM,CAAC,wBAAwB,EAAE,KAAK,EAAE,CAAC,iBAAiB,CAAC,CAAC;IACzE,MAAM,EAAE,MAAM,CAAC,gCAAgC,EAAE,OAAO,EAAE,CAAC,WAAW,EAAE,iBAAiB,EAAE,kBAAkB,CAAC,CAAC;IAC/G,MAAM,EAAE,MAAM,CAAC,qBAAqB,EAAE,MAAM,EAAE,CAAC,kBAAkB,CAAC,CAAC;IACnE,MAAM,EAAE,MAAM,CAAC,qBAAqB,EAAE,KAAK,EAAE,CAAC,kBAAkB,CAAC,CAAC;IAClE,MAAM,EAAE,MAAM,CAAC,qBAAqB,EAAE,QAAQ,EAAE,CAAC,kBAAkB,CAAC,CAAC;IACrE,cAAc,EAAE,MAAM,CAAC,6BAA6B,EAAE,KAAK,EAAE,CAAC,kBAAkB,CAAC,CAAC;CACnF,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const MAX_IDENTITY_FILE_BYTES: number;
|
|
2
|
+
export declare function digest(value: unknown): string;
|
|
3
|
+
export declare function readJson(path: string): Promise<unknown>;
|
|
4
|
+
export declare function writeArtifact(value: unknown, requestedPath?: string, label?: string): Promise<string>;
|
|
5
|
+
//# sourceMappingURL=files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/identity-governance/files.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,uBAAuB,QAAmB,CAAC;AAExD,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAa7C;AAED,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAwB7D;AAED,wBAAsB,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,aAAa,CAAC,EAAE,MAAM,EAAE,KAAK,SAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAqB/G"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { createHash, randomUUID } from 'node:crypto';
|
|
2
|
+
import { mkdir, open } from 'node:fs/promises';
|
|
3
|
+
import { dirname, resolve } from 'node:path';
|
|
4
|
+
import { CliError, EXIT_CODES } from '../errors/cli-error.js';
|
|
5
|
+
export const MAX_IDENTITY_FILE_BYTES = 10 * 1024 * 1024;
|
|
6
|
+
export function digest(value) {
|
|
7
|
+
function canonical(input) {
|
|
8
|
+
if (Array.isArray(input))
|
|
9
|
+
return input.map(canonical);
|
|
10
|
+
if (!input || typeof input !== 'object')
|
|
11
|
+
return input;
|
|
12
|
+
return Object.fromEntries(Object.entries(input)
|
|
13
|
+
.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))
|
|
14
|
+
.map(([key, child]) => [key, canonical(child)]));
|
|
15
|
+
}
|
|
16
|
+
return createHash('sha256')
|
|
17
|
+
.update(JSON.stringify(canonical(value)))
|
|
18
|
+
.digest('hex');
|
|
19
|
+
}
|
|
20
|
+
export async function readJson(path) {
|
|
21
|
+
let handle;
|
|
22
|
+
try {
|
|
23
|
+
handle = await open(resolve(path), 'r');
|
|
24
|
+
const stat = await handle.stat();
|
|
25
|
+
if (!stat.isFile() || stat.size > MAX_IDENTITY_FILE_BYTES)
|
|
26
|
+
throw new Error('Input must be a bounded regular file.');
|
|
27
|
+
const buffer = Buffer.alloc(MAX_IDENTITY_FILE_BYTES + 1);
|
|
28
|
+
let length = 0;
|
|
29
|
+
while (length < buffer.length) {
|
|
30
|
+
const { bytesRead } = await handle.read(buffer, length, buffer.length - length, null);
|
|
31
|
+
if (!bytesRead)
|
|
32
|
+
break;
|
|
33
|
+
length += bytesRead;
|
|
34
|
+
}
|
|
35
|
+
if (length > MAX_IDENTITY_FILE_BYTES)
|
|
36
|
+
throw new Error('Input exceeds 10 MiB.');
|
|
37
|
+
return JSON.parse(buffer.subarray(0, length).toString('utf8'));
|
|
38
|
+
}
|
|
39
|
+
catch (cause) {
|
|
40
|
+
throw new CliError('Cannot read a valid identity-management JSON file (maximum 10 MiB).', {
|
|
41
|
+
cause,
|
|
42
|
+
code: 'IDENTITY_FILE_INVALID',
|
|
43
|
+
exitCode: EXIT_CODES.validation,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
finally {
|
|
47
|
+
await handle?.close();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
export async function writeArtifact(value, requestedPath, label = 'snapshot') {
|
|
51
|
+
const path = resolve(requestedPath ?? `.monkeys-identity/${label}-${randomUUID()}.json`);
|
|
52
|
+
let handle;
|
|
53
|
+
try {
|
|
54
|
+
const serialized = `${JSON.stringify(value, null, 2)}\n`;
|
|
55
|
+
if (Buffer.byteLength(serialized) > MAX_IDENTITY_FILE_BYTES)
|
|
56
|
+
throw new Error('Artifact exceeds 10 MiB.');
|
|
57
|
+
await mkdir(dirname(path), { recursive: true, mode: 0o700 });
|
|
58
|
+
handle = await open(path, 'wx', 0o600);
|
|
59
|
+
await handle.writeFile(serialized);
|
|
60
|
+
await handle.sync();
|
|
61
|
+
return path;
|
|
62
|
+
}
|
|
63
|
+
catch (cause) {
|
|
64
|
+
throw new CliError('Cannot create the non-overwriting identity-management artifact.', {
|
|
65
|
+
cause,
|
|
66
|
+
code: 'IDENTITY_ARTIFACT_WRITE_FAILED',
|
|
67
|
+
exitCode: EXIT_CODES.configuration,
|
|
68
|
+
safeDetails: { path },
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
finally {
|
|
72
|
+
await handle?.close();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.js","sourceRoot":"","sources":["../../src/identity-governance/files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EA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G,OAAO,CAAC,aAAa,IAAI,qBAAqB,KAAK,IAAI,UAAU,EAAE,OAAO,CAAC,CAAC;IACzF,IAAI,MAAM,CAAC;IACX,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;QACzD,IAAI,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,GAAG,uBAAuB;YAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;QACzG,MAAM,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QAC7D,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;QACvC,MAAM,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QACnC,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,QAAQ,CAAC,iEAAiE,EAAE;YACpF,KAAK;YACL,IAAI,EAAE,gCAAgC;YACtC,QAAQ,EAAE,UAAU,CAAC,aAAa;YAClC,WAAW,EAAE,EAAE,IAAI,EAAE;SACtB,CAAC,CAAC;IACL,CAAC;YAAS,CAAC;QACT,MAAM,MAAM,EAAE,KAAK,EAAE,CAAC;IACxB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export declare function identityFlags(): {
|
|
2
|
+
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
3
|
+
subscription: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
4
|
+
refresh: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
5
|
+
};
|
|
6
|
+
export declare function mutationFlags(): {
|
|
7
|
+
'page-all': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
'page-delay': import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
'page-limit': import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
'page-size': import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
'page-token': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
subscription: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
refresh: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
15
|
+
'dry-run': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
16
|
+
yes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
17
|
+
};
|
|
18
|
+
export declare function membershipFlags(): {
|
|
19
|
+
'page-all': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
20
|
+
'page-delay': import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
|
+
'page-limit': import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
22
|
+
'page-size': import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
23
|
+
'page-token': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
24
|
+
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
25
|
+
subscription: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
26
|
+
refresh: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
27
|
+
'dry-run': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
28
|
+
yes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
29
|
+
ids: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
30
|
+
'ids-file': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
31
|
+
'plan-file': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
32
|
+
'plan-out': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
33
|
+
report: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
34
|
+
};
|
|
35
|
+
export declare function bodyFlags(): {
|
|
36
|
+
'input-json': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
37
|
+
'input-file': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
38
|
+
};
|
|
39
|
+
export declare function readBody(flags: {
|
|
40
|
+
'input-json'?: string | undefined;
|
|
41
|
+
'input-file'?: string | undefined;
|
|
42
|
+
}): Promise<unknown>;
|
|
43
|
+
//# sourceMappingURL=flags.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flags.d.ts","sourceRoot":"","sources":["../../src/identity-governance/flags.ts"],"names":[],"mappings":"AAMA,wBAAgB,aAAa;IAEzB,MAAM;IACN,YAAY;IACZ,OAAO;EAEV;AACD,wBAAgB,aAAa;;;;;;;;;;;EAO5B;AACD,wBAAgB,eAAe;;;;;;;;;;;;;;;;EAS9B;AACD,wBAAgB,SAAS;IAErB,YAAY;IACZ,YAAY;EAEf;AACD,wBAAsB,QAAQ,CAAC,KAAK,EAAE;IAAE,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAWhI"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { localOutputFlag } from '../config/local-command.js';
|
|
3
|
+
import { paginationFlags } from '../pagination/index.js';
|
|
4
|
+
import { fail } from './contracts.js';
|
|
5
|
+
import { MAX_IDENTITY_FILE_BYTES, readJson } from './files.js';
|
|
6
|
+
export function identityFlags() {
|
|
7
|
+
return {
|
|
8
|
+
output: localOutputFlag,
|
|
9
|
+
subscription: Flags.string({ required: true, summary: 'Explicit Kernel Subscription name (global scope, no Team)' }),
|
|
10
|
+
refresh: Flags.boolean({ default: false, summary: 'Refresh the published API contract' }),
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export function mutationFlags() {
|
|
14
|
+
return {
|
|
15
|
+
...identityFlags(),
|
|
16
|
+
...paginationFlags({ defaultPageSize: 100 }),
|
|
17
|
+
'dry-run': Flags.boolean({ default: false, exclusive: ['yes'], summary: 'Preview only; send no mutation request' }),
|
|
18
|
+
yes: Flags.boolean({ char: 'y', default: false, exclusive: ['dry-run'], summary: 'Confirm this privileged operation' }),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export function membershipFlags() {
|
|
22
|
+
return {
|
|
23
|
+
...mutationFlags(),
|
|
24
|
+
ids: Flags.string({ multiple: true, summary: 'Exact counterpart IDs: group IDs for user scope, user IDs for group scope' }),
|
|
25
|
+
'ids-file': Flags.string({ summary: 'JSON array of exact counterpart IDs' }),
|
|
26
|
+
'plan-file': Flags.string({ summary: 'Reviewed frozen plan; required for bulk execution' }),
|
|
27
|
+
'plan-out': Flags.string({ summary: 'New file for the dry-run frozen plan (never overwritten)' }),
|
|
28
|
+
report: Flags.string({ summary: 'New file for the initial recovery report; receipt paths are returned' }),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export function bodyFlags() {
|
|
32
|
+
return {
|
|
33
|
+
'input-json': Flags.string({ exclusive: ['input-file'], summary: 'Explicit strict JSON request body' }),
|
|
34
|
+
'input-file': Flags.string({ exclusive: ['input-json'], summary: 'JSON request body file (maximum 10 MiB)' }),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export async function readBody(flags) {
|
|
38
|
+
if ((flags['input-json'] !== undefined) === (flags['input-file'] !== undefined))
|
|
39
|
+
fail('IDENTITY_INPUT_REQUIRED', 'Specify exactly one of --input-json or --input-file.');
|
|
40
|
+
if (flags['input-file'] !== undefined)
|
|
41
|
+
return readJson(flags['input-file']);
|
|
42
|
+
const input = flags['input-json'];
|
|
43
|
+
if (Buffer.byteLength(input) > MAX_IDENTITY_FILE_BYTES)
|
|
44
|
+
fail('IDENTITY_INPUT_INVALID', 'Input exceeds 10 MiB.');
|
|
45
|
+
try {
|
|
46
|
+
return JSON.parse(input);
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
return fail('IDENTITY_INPUT_INVALID', 'Input must be valid JSON.');
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=flags.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flags.js","sourceRoot":"","sources":["../../src/identity-governance/flags.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,uBAAuB,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE/D,MAAM,UAAU,aAAa;IAC3B,OAAO;QACL,MAAM,EAAE,eAAe;QACvB,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,QAAQ,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S,EAAE,CAAC,YAAY,CAAC,EAAE,OAAO,EAAE,mCAAmC,EAAE,CAAC;QACvG,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,YAAY,CAAC,EAAE,OAAO,EAAE,yCAAyC,EAAE,CAAC;KAC9G,CAAC;AACJ,CAAC;AACD,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,KAA+E;IAC5G,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,SAAS,CAAC;QAC7E,IAAI,CAAC,yBAAyB,EAAE,sDAAsD,CAAC,CAAC;IAC1F,IAAI,KAAK,CAAC,YAAY,CAAC,KAAK,SAAS;QAAE,OAAO,QAAQ,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;IAC5E,MAAM,KAAK,GAAG,KAAK,CAAC,YAAY,CAAE,CAAC;IACnC,IAAI,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,uBAAuB;QAAE,IAAI,CAAC,wBAAwB,EAAE,uBAAuB,CAAC,CAAC;IAChH,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAY,CAAC;IACtC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC,wBAAwB,EAAE,2BAA2B,CAAC,CAAC;IACrE,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import type { PaginationInput } from '../pagination/index.js';
|
|
2
|
+
import { IdentityClient } from './client.js';
|
|
3
|
+
export interface GroupMutationInput {
|
|
4
|
+
client: IdentityClient;
|
|
5
|
+
action: 'create' | 'update' | 'delete' | 'setPermissions';
|
|
6
|
+
id?: string | undefined;
|
|
7
|
+
body?: unknown;
|
|
8
|
+
dryRun: boolean;
|
|
9
|
+
yes: boolean;
|
|
10
|
+
snapshot?: string | undefined;
|
|
11
|
+
pagination: PaginationInput;
|
|
12
|
+
}
|
|
13
|
+
export declare function executeGroupMutation(input: GroupMutationInput): Promise<{
|
|
14
|
+
authSurface: string;
|
|
15
|
+
teamMode: string;
|
|
16
|
+
subscription: string;
|
|
17
|
+
deployment: string;
|
|
18
|
+
tenant: string;
|
|
19
|
+
principalId: string;
|
|
20
|
+
contextFingerprint: string;
|
|
21
|
+
schemaDigest: string | undefined;
|
|
22
|
+
action: "create" | "delete" | "setPermissions" | "update";
|
|
23
|
+
groupId: string | undefined;
|
|
24
|
+
before: {
|
|
25
|
+
id: string;
|
|
26
|
+
code: string;
|
|
27
|
+
name: string;
|
|
28
|
+
description?: string | null | undefined;
|
|
29
|
+
isSystem: boolean;
|
|
30
|
+
membershipEditable: boolean;
|
|
31
|
+
permissions: {
|
|
32
|
+
id: string;
|
|
33
|
+
code: string;
|
|
34
|
+
name: string;
|
|
35
|
+
resource: string;
|
|
36
|
+
action: string;
|
|
37
|
+
description?: string | null | undefined;
|
|
38
|
+
createdTimestamp?: string | number | undefined;
|
|
39
|
+
updatedTimestamp?: string | number | undefined;
|
|
40
|
+
}[];
|
|
41
|
+
createdTimestamp?: string | number | undefined;
|
|
42
|
+
updatedTimestamp?: string | number | undefined;
|
|
43
|
+
} | undefined;
|
|
44
|
+
after: {
|
|
45
|
+
code?: string | undefined;
|
|
46
|
+
name?: string | undefined;
|
|
47
|
+
description?: string | undefined;
|
|
48
|
+
} | {
|
|
49
|
+
permissionIds: string[];
|
|
50
|
+
} | undefined;
|
|
51
|
+
warnings: string[];
|
|
52
|
+
dryRun: boolean;
|
|
53
|
+
writeRequestSent: boolean;
|
|
54
|
+
serverValidated: boolean;
|
|
55
|
+
} | ({
|
|
56
|
+
authSurface: string;
|
|
57
|
+
teamMode: string;
|
|
58
|
+
subscription: string;
|
|
59
|
+
deployment: string;
|
|
60
|
+
tenant: string;
|
|
61
|
+
principalId: string;
|
|
62
|
+
contextFingerprint: string;
|
|
63
|
+
schemaDigest: string | undefined;
|
|
64
|
+
action: "create" | "delete" | "setPermissions" | "update";
|
|
65
|
+
groupId: string | undefined;
|
|
66
|
+
before: {
|
|
67
|
+
id: string;
|
|
68
|
+
code: string;
|
|
69
|
+
name: string;
|
|
70
|
+
description?: string | null | undefined;
|
|
71
|
+
isSystem: boolean;
|
|
72
|
+
membershipEditable: boolean;
|
|
73
|
+
permissions: {
|
|
74
|
+
id: string;
|
|
75
|
+
code: string;
|
|
76
|
+
name: string;
|
|
77
|
+
resource: string;
|
|
78
|
+
action: string;
|
|
79
|
+
description?: string | null | undefined;
|
|
80
|
+
createdTimestamp?: string | number | undefined;
|
|
81
|
+
updatedTimestamp?: string | number | undefined;
|
|
82
|
+
}[];
|
|
83
|
+
createdTimestamp?: string | number | undefined;
|
|
84
|
+
updatedTimestamp?: string | number | undefined;
|
|
85
|
+
} | undefined;
|
|
86
|
+
after: {
|
|
87
|
+
code?: string | undefined;
|
|
88
|
+
name?: string | undefined;
|
|
89
|
+
description?: string | undefined;
|
|
90
|
+
} | {
|
|
91
|
+
permissionIds: string[];
|
|
92
|
+
} | undefined;
|
|
93
|
+
warnings: string[];
|
|
94
|
+
dryRun: boolean;
|
|
95
|
+
writeRequestSent: boolean;
|
|
96
|
+
snapshot: string;
|
|
97
|
+
requestId: string | undefined;
|
|
98
|
+
verification: {
|
|
99
|
+
absent: boolean;
|
|
100
|
+
};
|
|
101
|
+
} & {
|
|
102
|
+
finalReport: string;
|
|
103
|
+
}) | ({
|
|
104
|
+
authSurface: string;
|
|
105
|
+
teamMode: string;
|
|
106
|
+
subscription: string;
|
|
107
|
+
deployment: string;
|
|
108
|
+
tenant: string;
|
|
109
|
+
principalId: string;
|
|
110
|
+
contextFingerprint: string;
|
|
111
|
+
schemaDigest: string | undefined;
|
|
112
|
+
action: "create" | "delete" | "setPermissions" | "update";
|
|
113
|
+
before: {
|
|
114
|
+
id: string;
|
|
115
|
+
code: string;
|
|
116
|
+
name: string;
|
|
117
|
+
description?: string | null | undefined;
|
|
118
|
+
isSystem: boolean;
|
|
119
|
+
membershipEditable: boolean;
|
|
120
|
+
permissions: {
|
|
121
|
+
id: string;
|
|
122
|
+
code: string;
|
|
123
|
+
name: string;
|
|
124
|
+
resource: string;
|
|
125
|
+
action: string;
|
|
126
|
+
description?: string | null | undefined;
|
|
127
|
+
createdTimestamp?: string | number | undefined;
|
|
128
|
+
updatedTimestamp?: string | number | undefined;
|
|
129
|
+
}[];
|
|
130
|
+
createdTimestamp?: string | number | undefined;
|
|
131
|
+
updatedTimestamp?: string | number | undefined;
|
|
132
|
+
} | undefined;
|
|
133
|
+
warnings: string[];
|
|
134
|
+
dryRun: boolean;
|
|
135
|
+
writeRequestSent: boolean;
|
|
136
|
+
snapshot: string;
|
|
137
|
+
requestId: string | undefined;
|
|
138
|
+
groupId: string;
|
|
139
|
+
after: {
|
|
140
|
+
id: string;
|
|
141
|
+
code: string;
|
|
142
|
+
name: string;
|
|
143
|
+
description?: string | null | undefined;
|
|
144
|
+
isSystem: boolean;
|
|
145
|
+
membershipEditable: boolean;
|
|
146
|
+
permissions: {
|
|
147
|
+
id: string;
|
|
148
|
+
code: string;
|
|
149
|
+
name: string;
|
|
150
|
+
resource: string;
|
|
151
|
+
action: string;
|
|
152
|
+
description?: string | null | undefined;
|
|
153
|
+
createdTimestamp?: string | number | undefined;
|
|
154
|
+
updatedTimestamp?: string | number | undefined;
|
|
155
|
+
}[];
|
|
156
|
+
createdTimestamp?: string | number | undefined;
|
|
157
|
+
updatedTimestamp?: string | number | undefined;
|
|
158
|
+
};
|
|
159
|
+
verification: {
|
|
160
|
+
matches: boolean;
|
|
161
|
+
};
|
|
162
|
+
} & {
|
|
163
|
+
finalReport: string;
|
|
164
|
+
})>;
|
|
165
|
+
//# sourceMappingURL=group-mutation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"group-mutation.d.ts","sourceRoot":"","sources":["../../src/identity-governance/group-mutation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAmB,MAAM,aAAa,CAAC;AAe9D,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,cAAc,CAAC;IACvB,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,gBAAgB,CAAC;IAC1D,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,GAAG,EAAE,OAAO,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,UAAU,EAAE,eAAe,CAAC;CAC7B;AAED,wBAAsB,oBAAoB,CAAC,KAAK,EAAE,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA0EkD,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAmBtG,OAAO;;;;IA2B5B"}
|