@flowcore/cli-plugin-iam 1.0.0 → 1.2.1

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.
@@ -27,6 +27,8 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
27
27
  description?: string;
28
28
  /** The principal role that can access the resource */
29
29
  principal?: string;
30
+ /** If the policy is managed by flowcore */
31
+ flowcoreManaged?: boolean;
30
32
  } & {
31
33
  /** The id of the policy */
32
34
  id: string;
@@ -58,6 +60,8 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
58
60
  description?: string;
59
61
  /** The principal role that can access the resource */
60
62
  principal?: string;
63
+ /** If the policy is managed by flowcore */
64
+ flowcoreManaged?: boolean;
61
65
  }, params?: RequestParams) => Promise<import("./http-client.js").HttpResponse<object, any>>;
62
66
  /**
63
67
  * @description Get a policy by id
@@ -123,6 +127,8 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
123
127
  name: string;
124
128
  /** Role description */
125
129
  description?: string;
130
+ /** Flowcore managed role */
131
+ flowcoreManaged?: boolean;
126
132
  } & {
127
133
  /** The id of the role */
128
134
  id: string;
@@ -142,6 +148,8 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
142
148
  name: string;
143
149
  /** Role description */
144
150
  description?: string;
151
+ /** Flowcore managed role */
152
+ flowcoreManaged?: boolean;
145
153
  }, params?: RequestParams) => Promise<import("./http-client.js").HttpResponse<object, any>>;
146
154
  /**
147
155
  * @description Get a role by ID
@@ -158,6 +166,8 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
158
166
  name: string;
159
167
  /** Role description */
160
168
  description?: string;
169
+ /** Flowcore managed role */
170
+ flowcoreManaged?: boolean;
161
171
  } & {
162
172
  /** Role ID */
163
173
  id: string;
@@ -213,6 +223,40 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
213
223
  /** The message of the archive role */
214
224
  message: string;
215
225
  }, any>>;
226
+ /**
227
+ * @description Fetch associations for a policy
228
+ *
229
+ * @tags policy-associations
230
+ * @name GetApiV1PolicyAssociationsByPolicyId
231
+ * @request GET:/api/v1/policy-associations/{policyId}
232
+ * @secure
233
+ */
234
+ getApiV1PolicyAssociationsByPolicyId: (policyId: string, params?: RequestParams) => Promise<import("./http-client.js").HttpResponse<{
235
+ keys: {
236
+ /** The ID of the policy */
237
+ policyId: string;
238
+ /** The ID of the organization */
239
+ organizationId: string;
240
+ /** The ID of the key */
241
+ keyId: string;
242
+ }[];
243
+ users: {
244
+ /** The ID of the policy */
245
+ policyId: string;
246
+ /** The ID of the organization */
247
+ organizationId: string;
248
+ /** The ID of the user */
249
+ userId: string;
250
+ }[];
251
+ roles: {
252
+ /** The ID of the policy */
253
+ policyId: string;
254
+ /** The ID of the organization */
255
+ organizationId: string;
256
+ /** The ID of the role */
257
+ roleId: string;
258
+ }[];
259
+ }, any>>;
216
260
  /**
217
261
  * @description Fetch policies for an organization
218
262
  *
@@ -240,6 +284,8 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
240
284
  description?: string;
241
285
  /** The principal role that can access the resource */
242
286
  principal?: string;
287
+ /** If the policy is managed by flowcore */
288
+ flowcoreManaged?: boolean;
243
289
  } & {
244
290
  /** The id of the policy */
245
291
  id: string;
@@ -274,6 +320,8 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
274
320
  description?: string;
275
321
  /** The principal role that can access the resource */
276
322
  principal?: string;
323
+ /** If the policy is managed by flowcore */
324
+ flowcoreManaged?: boolean;
277
325
  } & {
278
326
  /** The id of the policy */
279
327
  id: string;
@@ -345,6 +393,8 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
345
393
  description?: string;
346
394
  /** The principal role that can access the resource */
347
395
  principal?: string;
396
+ /** If the policy is managed by flowcore */
397
+ flowcoreManaged?: boolean;
348
398
  } & {
349
399
  /** The id of the policy */
350
400
  id: string;
@@ -416,6 +466,8 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
416
466
  description?: string;
417
467
  /** The principal role that can access the resource */
418
468
  principal?: string;
469
+ /** If the policy is managed by flowcore */
470
+ flowcoreManaged?: boolean;
419
471
  } & {
420
472
  /** The id of the policy */
421
473
  id: string;
@@ -460,6 +512,32 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
460
512
  /** The ID of the role */
461
513
  roleId: string;
462
514
  }, any>>;
515
+ /**
516
+ * @description Fetch associations for a role
517
+ *
518
+ * @tags role-associations
519
+ * @name GetApiV1RoleAssociationsByRoleId
520
+ * @request GET:/api/v1/role-associations/{roleId}
521
+ * @secure
522
+ */
523
+ getApiV1RoleAssociationsByRoleId: (roleId: string, params?: RequestParams) => Promise<import("./http-client.js").HttpResponse<{
524
+ keys: {
525
+ /** The ID of the role */
526
+ roleId: string;
527
+ /** The ID of the organization */
528
+ organizationId: string;
529
+ /** The ID of the key */
530
+ keyId: string;
531
+ }[];
532
+ users: {
533
+ /** The ID of the role */
534
+ roleId: string;
535
+ /** The ID of the organization */
536
+ organizationId: string;
537
+ /** The ID of the user */
538
+ userId: string;
539
+ }[];
540
+ }, any>>;
463
541
  /**
464
542
  * @description Fetch roles for an organization
465
543
  *
@@ -475,6 +553,8 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
475
553
  name: string;
476
554
  /** Role description */
477
555
  description?: string;
556
+ /** Flowcore managed role */
557
+ flowcoreManaged?: boolean;
478
558
  } & {
479
559
  /** The id of the role */
480
560
  id: string;
@@ -497,6 +577,8 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
497
577
  name: string;
498
578
  /** Role description */
499
579
  description?: string;
580
+ /** Flowcore managed role */
581
+ flowcoreManaged?: boolean;
500
582
  } & {
501
583
  /** Role ID */
502
584
  id: string;
@@ -556,6 +638,8 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
556
638
  name: string;
557
639
  /** Role description */
558
640
  description?: string;
641
+ /** Flowcore managed role */
642
+ flowcoreManaged?: boolean;
559
643
  } & {
560
644
  /** Role ID */
561
645
  id: string;
@@ -168,6 +168,21 @@ export class Api extends HttpClient {
168
168
  format: "json",
169
169
  ...params,
170
170
  });
171
+ /**
172
+ * @description Fetch associations for a policy
173
+ *
174
+ * @tags policy-associations
175
+ * @name GetApiV1PolicyAssociationsByPolicyId
176
+ * @request GET:/api/v1/policy-associations/{policyId}
177
+ * @secure
178
+ */
179
+ getApiV1PolicyAssociationsByPolicyId = (policyId, params = {}) => this.request({
180
+ path: `/api/v1/policy-associations/${policyId}`,
181
+ method: "GET",
182
+ secure: true,
183
+ format: "json",
184
+ ...params,
185
+ });
171
186
  /**
172
187
  * @description Fetch policies for an organization
173
188
  *
@@ -331,6 +346,21 @@ export class Api extends HttpClient {
331
346
  format: "json",
332
347
  ...params,
333
348
  });
349
+ /**
350
+ * @description Fetch associations for a role
351
+ *
352
+ * @tags role-associations
353
+ * @name GetApiV1RoleAssociationsByRoleId
354
+ * @request GET:/api/v1/role-associations/{roleId}
355
+ * @secure
356
+ */
357
+ getApiV1RoleAssociationsByRoleId = (roleId, params = {}) => this.request({
358
+ path: `/api/v1/role-associations/${roleId}`,
359
+ method: "GET",
360
+ secure: true,
361
+ format: "json",
362
+ ...params,
363
+ });
334
364
  /**
335
365
  * @description Fetch roles for an organization
336
366
  *
@@ -25,11 +25,11 @@ export interface ApiConfig<SecurityDataType = unknown> {
25
25
  securityWorker?: (securityData: SecurityDataType | null) => Promise<RequestParams | void> | RequestParams | void;
26
26
  customFetch?: typeof fetch;
27
27
  }
28
- export interface HttpResponse<D, E = unknown> extends Response {
28
+ export interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
29
29
  data: D;
30
30
  error: E;
31
31
  }
32
- type CancelToken = symbol | string | number;
32
+ type CancelToken = Symbol | string | number;
33
33
  export declare enum ContentType {
34
34
  Json = "application/json",
35
35
  FormData = "multipart/form-data",
@@ -48,9 +48,7 @@ export class HttpClient {
48
48
  const query = rawQuery || {};
49
49
  const keys = Object.keys(query).filter((key) => "undefined" !== typeof query[key]);
50
50
  return keys
51
- .map((key) => Array.isArray(query[key])
52
- ? this.addArrayQueryParam(query, key)
53
- : this.addQueryParam(query, key))
51
+ .map((key) => (Array.isArray(query[key]) ? this.addArrayQueryParam(query, key) : this.addQueryParam(query, key)))
54
52
  .join("&");
55
53
  }
56
54
  addQueryParams(rawQuery) {
@@ -58,12 +56,8 @@ export class HttpClient {
58
56
  return queryString ? `?${queryString}` : "";
59
57
  }
60
58
  contentFormatters = {
61
- [ContentType.Json]: (input) => input !== null && (typeof input === "object" || typeof input === "string")
62
- ? JSON.stringify(input)
63
- : input,
64
- [ContentType.Text]: (input) => input !== null && typeof input !== "string"
65
- ? JSON.stringify(input)
66
- : input,
59
+ [ContentType.Json]: (input) => input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input,
60
+ [ContentType.Text]: (input) => (input !== null && typeof input !== "string" ? JSON.stringify(input) : input),
67
61
  [ContentType.FormData]: (input) => Object.keys(input || {}).reduce((formData, key) => {
68
62
  const property = input[key];
69
63
  formData.append(key, property instanceof Blob
@@ -119,16 +113,10 @@ export class HttpClient {
119
113
  ...requestParams,
120
114
  headers: {
121
115
  ...(requestParams.headers || {}),
122
- ...(type && type !== ContentType.FormData
123
- ? { "Content-Type": type }
124
- : {}),
116
+ ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}),
125
117
  },
126
- signal: (cancelToken
127
- ? this.createAbortSignal(cancelToken)
128
- : requestParams.signal) || null,
129
- body: typeof body === "undefined" || body === null
130
- ? null
131
- : payloadFormatter(body),
118
+ signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null,
119
+ body: typeof body === "undefined" || body === null ? null : payloadFormatter(body),
132
120
  }).then(async (response) => {
133
121
  const r = response.clone();
134
122
  r.data = null;
@@ -9,7 +9,6 @@ export const FetchManifestUtil = {
9
9
  const contents = [];
10
10
  for (const file of files) {
11
11
  if (file === "-") {
12
- // eslint-disable-next-line no-await-in-loop
13
12
  contents.push(await readPipe() || "");
14
13
  }
15
14
  else if (fs.existsSync(file)) {
@@ -1,5 +1,127 @@
1
1
  {
2
2
  "commands": {
3
+ "delete:policy": {
4
+ "aliases": [],
5
+ "args": {
6
+ "NAME": {
7
+ "description": "name",
8
+ "name": "NAME",
9
+ "required": true
10
+ }
11
+ },
12
+ "description": "Delete a policy",
13
+ "examples": [],
14
+ "flags": {
15
+ "profile": {
16
+ "description": "Specify the configuration profile to use",
17
+ "name": "profile",
18
+ "hasDynamicHelp": false,
19
+ "multiple": false,
20
+ "type": "option"
21
+ },
22
+ "json": {
23
+ "char": "j",
24
+ "description": "json output",
25
+ "name": "json",
26
+ "required": false,
27
+ "allowNo": false,
28
+ "type": "boolean"
29
+ },
30
+ "tenant": {
31
+ "char": "t",
32
+ "description": "tenant",
33
+ "name": "tenant",
34
+ "required": true,
35
+ "hasDynamicHelp": false,
36
+ "multiple": false,
37
+ "type": "option"
38
+ },
39
+ "yes": {
40
+ "char": "y",
41
+ "description": "yes to all",
42
+ "name": "yes",
43
+ "required": false,
44
+ "allowNo": false,
45
+ "type": "boolean"
46
+ }
47
+ },
48
+ "hasDynamicHelp": false,
49
+ "hiddenAliases": [],
50
+ "id": "delete:policy",
51
+ "pluginAlias": "@flowcore/cli-plugin-iam",
52
+ "pluginName": "@flowcore/cli-plugin-iam",
53
+ "pluginType": "core",
54
+ "strict": true,
55
+ "enableJsonFlag": false,
56
+ "isESM": true,
57
+ "relativePath": [
58
+ "dist",
59
+ "commands",
60
+ "delete",
61
+ "policy.js"
62
+ ]
63
+ },
64
+ "delete:role": {
65
+ "aliases": [],
66
+ "args": {
67
+ "NAME": {
68
+ "description": "name",
69
+ "name": "NAME",
70
+ "required": true
71
+ }
72
+ },
73
+ "description": "Delete a role",
74
+ "examples": [],
75
+ "flags": {
76
+ "profile": {
77
+ "description": "Specify the configuration profile to use",
78
+ "name": "profile",
79
+ "hasDynamicHelp": false,
80
+ "multiple": false,
81
+ "type": "option"
82
+ },
83
+ "json": {
84
+ "char": "j",
85
+ "description": "json output",
86
+ "name": "json",
87
+ "required": false,
88
+ "allowNo": false,
89
+ "type": "boolean"
90
+ },
91
+ "tenant": {
92
+ "char": "t",
93
+ "description": "tenant",
94
+ "name": "tenant",
95
+ "required": true,
96
+ "hasDynamicHelp": false,
97
+ "multiple": false,
98
+ "type": "option"
99
+ },
100
+ "yes": {
101
+ "char": "y",
102
+ "description": "yes to all",
103
+ "name": "yes",
104
+ "required": false,
105
+ "allowNo": false,
106
+ "type": "boolean"
107
+ }
108
+ },
109
+ "hasDynamicHelp": false,
110
+ "hiddenAliases": [],
111
+ "id": "delete:role",
112
+ "pluginAlias": "@flowcore/cli-plugin-iam",
113
+ "pluginName": "@flowcore/cli-plugin-iam",
114
+ "pluginType": "core",
115
+ "strict": true,
116
+ "enableJsonFlag": false,
117
+ "isESM": true,
118
+ "relativePath": [
119
+ "dist",
120
+ "commands",
121
+ "delete",
122
+ "role.js"
123
+ ]
124
+ },
3
125
  "get:policy": {
4
126
  "aliases": [],
5
127
  "args": {
@@ -123,5 +245,5 @@
123
245
  ]
124
246
  }
125
247
  },
126
- "version": "1.0.0"
248
+ "version": "1.2.1"
127
249
  }
package/package.json CHANGED
@@ -5,19 +5,23 @@
5
5
  },
6
6
  "dependencies": {
7
7
  "@flowcore/cli-plugin-config": "^2.2.1",
8
- "@flowcore/cli-plugin-core": "^4.0.3",
8
+ "@flowcore/cli-plugin-core": "^4.6.0",
9
9
  "@oclif/core": "^4.0.21",
10
10
  "@oclif/plugin-help": "^6",
11
11
  "@oclif/plugin-plugins": "^5.4.7",
12
+ "@opentf/obj-diff": "^0.12.0",
13
+ "add": "^2.0.6",
12
14
  "dayjs": "^1.11.10",
13
15
  "deepmerge": "^4.3.1",
14
16
  "enquirer": "^2.4.1",
15
17
  "graphql": "^16.8.1",
16
18
  "graphql-request": "^6.1.0",
17
19
  "js-yaml": "^4.1.0",
20
+ "json-diff": "^1.0.6",
18
21
  "lodash": "^4.17.21",
19
22
  "radash": "^12.1.0",
20
23
  "uuid": "^9.0.1",
24
+ "yarn": "^1.22.22",
21
25
  "zod": "^3.22.4"
22
26
  },
23
27
  "description": "Flowcore CLI plugin for managing the IAM of the Flowcore Platform",
@@ -27,6 +31,7 @@
27
31
  "@types/chai": "^4",
28
32
  "@types/deepmerge": "^2.2.0",
29
33
  "@types/js-yaml": "^4.0.9",
34
+ "@types/json-diff": "^1.0.3",
30
35
  "@types/lodash": "^4.14.202",
31
36
  "@types/mocha": "^10",
32
37
  "@types/node": "^18",
@@ -63,6 +68,9 @@
63
68
  "@oclif/plugin-plugins",
64
69
  "@flowcore/cli-plugin-config"
65
70
  ],
71
+ "hooks": {
72
+ "register-api": "./dist/hooks/register-apply"
73
+ },
66
74
  "topicSeparator": " ",
67
75
  "topics": {
68
76
  "iam": {
@@ -82,7 +90,7 @@
82
90
  "version": "oclif readme && git add README.md",
83
91
  "update-schema": "rover graph introspect https://graph.api.flowcore.io/graphql -o schema.gql"
84
92
  },
85
- "version": "1.0.0",
93
+ "version": "1.2.1",
86
94
  "bugs": "https://github.com/flowcore-io/cli-plugin-iam/issues",
87
95
  "keywords": [
88
96
  "oclif"