@blokjs/runner 0.6.21 → 0.7.0

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.
Files changed (167) hide show
  1. package/dist/Blok.d.ts +2 -0
  2. package/dist/Blok.js +42 -110
  3. package/dist/Blok.js.map +1 -1
  4. package/dist/DefaultLogger.d.ts +13 -0
  5. package/dist/DefaultLogger.js +25 -0
  6. package/dist/DefaultLogger.js.map +1 -1
  7. package/dist/RunnerSteps.d.ts +23 -0
  8. package/dist/RunnerSteps.js +128 -87
  9. package/dist/RunnerSteps.js.map +1 -1
  10. package/dist/SubworkflowNode.js +19 -0
  11. package/dist/SubworkflowNode.js.map +1 -1
  12. package/dist/TriggerBase.d.ts +12 -0
  13. package/dist/TriggerBase.js +216 -181
  14. package/dist/TriggerBase.js.map +1 -1
  15. package/dist/adapters/grpc/GrpcRuntimeAdapter.d.ts +9 -0
  16. package/dist/adapters/grpc/GrpcRuntimeAdapter.js +76 -6
  17. package/dist/adapters/grpc/GrpcRuntimeAdapter.js.map +1 -1
  18. package/dist/index.d.ts +4 -39
  19. package/dist/index.js +7 -32
  20. package/dist/index.js.map +1 -1
  21. package/dist/monitoring/JanitorMetrics.d.ts +3 -0
  22. package/dist/monitoring/JanitorMetrics.js +11 -0
  23. package/dist/monitoring/JanitorMetrics.js.map +1 -1
  24. package/dist/monitoring/ProcessErrorMetrics.d.ts +32 -0
  25. package/dist/monitoring/ProcessErrorMetrics.js +43 -0
  26. package/dist/monitoring/ProcessErrorMetrics.js.map +1 -0
  27. package/dist/monitoring/PrometheusMetricsBridge.d.ts +7 -0
  28. package/dist/monitoring/PrometheusMetricsBridge.js +8 -2
  29. package/dist/monitoring/PrometheusMetricsBridge.js.map +1 -1
  30. package/dist/monitoring/SubworkflowMetrics.d.ts +25 -0
  31. package/dist/monitoring/SubworkflowMetrics.js +38 -0
  32. package/dist/monitoring/SubworkflowMetrics.js.map +1 -0
  33. package/dist/observability/ErrorSink.d.ts +23 -0
  34. package/dist/observability/ErrorSink.js +32 -0
  35. package/dist/observability/ErrorSink.js.map +1 -0
  36. package/dist/observability/SentryIntegration.d.ts +9 -0
  37. package/dist/observability/SentryIntegration.js +31 -0
  38. package/dist/observability/SentryIntegration.js.map +1 -0
  39. package/dist/scheduling/DebounceCoordinator.d.ts +7 -53
  40. package/dist/scheduling/DebounceCoordinator.js +8 -207
  41. package/dist/scheduling/DebounceCoordinator.js.map +1 -1
  42. package/dist/tracing/InMemoryRunStore.d.ts +5 -1
  43. package/dist/tracing/InMemoryRunStore.js +14 -0
  44. package/dist/tracing/InMemoryRunStore.js.map +1 -1
  45. package/dist/tracing/Janitor.js +3 -0
  46. package/dist/tracing/Janitor.js.map +1 -1
  47. package/dist/tracing/PostgresRunStore.d.ts +4 -1
  48. package/dist/tracing/PostgresRunStore.js +73 -3
  49. package/dist/tracing/PostgresRunStore.js.map +1 -1
  50. package/dist/tracing/RunStore.d.ts +17 -1
  51. package/dist/tracing/RunTracker.d.ts +13 -34
  52. package/dist/tracing/RunTracker.js +62 -32
  53. package/dist/tracing/RunTracker.js.map +1 -1
  54. package/dist/tracing/SqliteRunStore.d.ts +4 -1
  55. package/dist/tracing/SqliteRunStore.js +60 -0
  56. package/dist/tracing/SqliteRunStore.js.map +1 -1
  57. package/dist/tracing/TraceRouter.d.ts +13 -0
  58. package/dist/tracing/TraceRouter.js +43 -11
  59. package/dist/tracing/TraceRouter.js.map +1 -1
  60. package/dist/tracing/TracingLogger.js +22 -0
  61. package/dist/tracing/TracingLogger.js.map +1 -1
  62. package/dist/tracing/createStore.js +51 -22
  63. package/dist/tracing/createStore.js.map +1 -1
  64. package/dist/tracing/types.d.ts +22 -0
  65. package/dist/types/GlobalOptions.d.ts +5 -7
  66. package/dist/workflow/WorkflowNormalizer.js +63 -0
  67. package/dist/workflow/WorkflowNormalizer.js.map +1 -1
  68. package/package.json +7 -4
  69. package/dist/cache/NodeResultCache.d.ts +0 -286
  70. package/dist/cache/NodeResultCache.js +0 -506
  71. package/dist/cache/NodeResultCache.js.map +0 -1
  72. package/dist/cache/index.d.ts +0 -1
  73. package/dist/cache/index.js +0 -2
  74. package/dist/cache/index.js.map +0 -1
  75. package/dist/concurrency/ConcurrencyBackend.d.ts +0 -61
  76. package/dist/concurrency/ConcurrencyBackend.js +0 -20
  77. package/dist/concurrency/ConcurrencyBackend.js.map +0 -1
  78. package/dist/concurrency/NatsKvConcurrencyBackend.d.ts +0 -64
  79. package/dist/concurrency/NatsKvConcurrencyBackend.js +0 -310
  80. package/dist/concurrency/NatsKvConcurrencyBackend.js.map +0 -1
  81. package/dist/concurrency/RedisConcurrencyBackend.d.ts +0 -64
  82. package/dist/concurrency/RedisConcurrencyBackend.js +0 -374
  83. package/dist/concurrency/RedisConcurrencyBackend.js.map +0 -1
  84. package/dist/concurrency/createConcurrencyBackend.d.ts +0 -24
  85. package/dist/concurrency/createConcurrencyBackend.js +0 -38
  86. package/dist/concurrency/createConcurrencyBackend.js.map +0 -1
  87. package/dist/graphql/GraphQLSchemaGenerator.d.ts +0 -129
  88. package/dist/graphql/GraphQLSchemaGenerator.js +0 -425
  89. package/dist/graphql/GraphQLSchemaGenerator.js.map +0 -1
  90. package/dist/integrations/APMIntegration.d.ts +0 -141
  91. package/dist/integrations/APMIntegration.js +0 -212
  92. package/dist/integrations/APMIntegration.js.map +0 -1
  93. package/dist/integrations/AzureMonitorIntegration.d.ts +0 -118
  94. package/dist/integrations/AzureMonitorIntegration.js +0 -254
  95. package/dist/integrations/AzureMonitorIntegration.js.map +0 -1
  96. package/dist/integrations/CloudWatchIntegration.d.ts +0 -135
  97. package/dist/integrations/CloudWatchIntegration.js +0 -293
  98. package/dist/integrations/CloudWatchIntegration.js.map +0 -1
  99. package/dist/integrations/SentryIntegration.d.ts +0 -153
  100. package/dist/integrations/SentryIntegration.js +0 -200
  101. package/dist/integrations/SentryIntegration.js.map +0 -1
  102. package/dist/integrations/index.d.ts +0 -19
  103. package/dist/integrations/index.js +0 -16
  104. package/dist/integrations/index.js.map +0 -1
  105. package/dist/marketplace/RuntimeAutoScaler.d.ts +0 -148
  106. package/dist/marketplace/RuntimeAutoScaler.js +0 -366
  107. package/dist/marketplace/RuntimeAutoScaler.js.map +0 -1
  108. package/dist/marketplace/RuntimeCatalog.d.ts +0 -180
  109. package/dist/marketplace/RuntimeCatalog.js +0 -339
  110. package/dist/marketplace/RuntimeCatalog.js.map +0 -1
  111. package/dist/marketplace/RuntimeDiscovery.d.ts +0 -86
  112. package/dist/marketplace/RuntimeDiscovery.js +0 -231
  113. package/dist/marketplace/RuntimeDiscovery.js.map +0 -1
  114. package/dist/marketplace/RuntimeHealthMonitor.d.ts +0 -100
  115. package/dist/marketplace/RuntimeHealthMonitor.js +0 -241
  116. package/dist/marketplace/RuntimeHealthMonitor.js.map +0 -1
  117. package/dist/marketplace/RuntimeMetricsDashboard.d.ts +0 -113
  118. package/dist/marketplace/RuntimeMetricsDashboard.js +0 -293
  119. package/dist/marketplace/RuntimeMetricsDashboard.js.map +0 -1
  120. package/dist/openapi/OpenAPIGenerator.d.ts +0 -192
  121. package/dist/openapi/OpenAPIGenerator.js +0 -378
  122. package/dist/openapi/OpenAPIGenerator.js.map +0 -1
  123. package/dist/openapi/index.d.ts +0 -20
  124. package/dist/openapi/index.js +0 -20
  125. package/dist/openapi/index.js.map +0 -1
  126. package/dist/scheduling/DebounceBackend.d.ts +0 -108
  127. package/dist/scheduling/DebounceBackend.js +0 -23
  128. package/dist/scheduling/DebounceBackend.js.map +0 -1
  129. package/dist/scheduling/NatsKvDebounceBackend.d.ts +0 -53
  130. package/dist/scheduling/NatsKvDebounceBackend.js +0 -334
  131. package/dist/scheduling/NatsKvDebounceBackend.js.map +0 -1
  132. package/dist/scheduling/RedisDebounceBackend.d.ts +0 -49
  133. package/dist/scheduling/RedisDebounceBackend.js +0 -356
  134. package/dist/scheduling/RedisDebounceBackend.js.map +0 -1
  135. package/dist/scheduling/createDebounceBackend.d.ts +0 -25
  136. package/dist/scheduling/createDebounceBackend.js +0 -39
  137. package/dist/scheduling/createDebounceBackend.js.map +0 -1
  138. package/dist/security/ABAC.d.ts +0 -224
  139. package/dist/security/ABAC.js +0 -380
  140. package/dist/security/ABAC.js.map +0 -1
  141. package/dist/security/AuditLogger.d.ts +0 -242
  142. package/dist/security/AuditLogger.js +0 -317
  143. package/dist/security/AuditLogger.js.map +0 -1
  144. package/dist/security/AuthMiddleware.d.ts +0 -162
  145. package/dist/security/AuthMiddleware.js +0 -289
  146. package/dist/security/AuthMiddleware.js.map +0 -1
  147. package/dist/security/EncryptionAtRest.d.ts +0 -206
  148. package/dist/security/EncryptionAtRest.js +0 -236
  149. package/dist/security/EncryptionAtRest.js.map +0 -1
  150. package/dist/security/OAuthProvider.d.ts +0 -334
  151. package/dist/security/OAuthProvider.js +0 -719
  152. package/dist/security/OAuthProvider.js.map +0 -1
  153. package/dist/security/PIIDetector.d.ts +0 -233
  154. package/dist/security/PIIDetector.js +0 -354
  155. package/dist/security/PIIDetector.js.map +0 -1
  156. package/dist/security/RBAC.d.ts +0 -143
  157. package/dist/security/RBAC.js +0 -285
  158. package/dist/security/RBAC.js.map +0 -1
  159. package/dist/security/SecretManager.d.ts +0 -652
  160. package/dist/security/SecretManager.js +0 -1147
  161. package/dist/security/SecretManager.js.map +0 -1
  162. package/dist/security/TLSConfig.d.ts +0 -305
  163. package/dist/security/TLSConfig.js +0 -550
  164. package/dist/security/TLSConfig.js.map +0 -1
  165. package/dist/security/index.d.ts +0 -81
  166. package/dist/security/index.js +0 -82
  167. package/dist/security/index.js.map +0 -1
@@ -1,143 +0,0 @@
1
- /**
2
- * Role-Based Access Control (RBAC) for Blok
3
- *
4
- * Provides fine-grained access control for workflow execution:
5
- * - Role definitions with permissions
6
- * - Resource-based access control
7
- * - Hierarchical roles with inheritance
8
- * - Workflow-level and node-level access control
9
- *
10
- * @example
11
- * ```typescript
12
- * const rbac = new RBAC();
13
- *
14
- * // Define roles
15
- * rbac.addRole({
16
- * name: "admin",
17
- * permissions: [
18
- * { resource: "workflow", actions: ["*"] },
19
- * { resource: "node", actions: ["*"] },
20
- * ],
21
- * });
22
- *
23
- * rbac.addRole({
24
- * name: "developer",
25
- * permissions: [
26
- * { resource: "workflow", actions: ["read", "execute"] },
27
- * { resource: "node", actions: ["read", "execute"] },
28
- * ],
29
- * inherits: ["viewer"],
30
- * });
31
- *
32
- * rbac.addRole({
33
- * name: "viewer",
34
- * permissions: [
35
- * { resource: "workflow", actions: ["read"] },
36
- * ],
37
- * });
38
- *
39
- * // Check permissions
40
- * rbac.can("admin", "workflow", "delete"); // true
41
- * rbac.can("developer", "workflow", "execute"); // true
42
- * rbac.can("viewer", "workflow", "execute"); // false
43
- * ```
44
- */
45
- export type Action = "read" | "create" | "update" | "delete" | "execute" | "admin" | "*";
46
- export interface Permission {
47
- /** Resource type (e.g., "workflow", "node", "trigger", "runtime") */
48
- resource: string;
49
- /** Allowed actions on this resource */
50
- actions: Action[];
51
- /** Optional: restrict to specific resource instances by pattern */
52
- resourcePattern?: string;
53
- /** Optional: conditions that must be met (e.g., { "env": "staging" }) */
54
- conditions?: Record<string, unknown>;
55
- }
56
- export interface RoleDefinition {
57
- /** Unique role name */
58
- name: string;
59
- /** Human-readable description */
60
- description?: string;
61
- /** Permissions granted to this role */
62
- permissions: Permission[];
63
- /** Roles this role inherits from */
64
- inherits?: string[];
65
- }
66
- export interface AccessCheckResult {
67
- allowed: boolean;
68
- role: string;
69
- resource: string;
70
- action: Action;
71
- reason?: string;
72
- matchedPermission?: Permission;
73
- }
74
- export interface RBACPolicy {
75
- /** Named resource access policies */
76
- workflows?: Record<string, {
77
- allowedRoles: string[];
78
- actions?: Action[];
79
- }>;
80
- /** Default policy when no specific policy matches */
81
- defaultPolicy?: "allow" | "deny";
82
- }
83
- export declare class RBAC {
84
- private roles;
85
- private policies;
86
- private roleCache;
87
- /**
88
- * Add a role definition
89
- */
90
- addRole(role: RoleDefinition): void;
91
- /**
92
- * Remove a role
93
- */
94
- removeRole(name: string): void;
95
- /**
96
- * Get a role definition
97
- */
98
- getRole(name: string): RoleDefinition | undefined;
99
- /**
100
- * Get all defined roles
101
- */
102
- getRoles(): RoleDefinition[];
103
- /**
104
- * Add a resource-specific policy
105
- */
106
- addPolicy(resourceId: string, policy: RBACPolicy): void;
107
- /**
108
- * Check if a role has permission to perform an action on a resource
109
- */
110
- can(roleName: string, resource: string, action: Action, resourceId?: string): AccessCheckResult;
111
- /**
112
- * Check if any of the given roles has permission
113
- */
114
- canAny(roles: string[], resource: string, action: Action, resourceId?: string): AccessCheckResult;
115
- /**
116
- * Check workflow-specific access
117
- */
118
- canAccessWorkflow(roles: string[], workflowPath: string, action?: Action): AccessCheckResult;
119
- /**
120
- * Get all effective permissions for a role (including inherited)
121
- */
122
- getEffectivePermissions(roleName: string, visited?: Set<string>): Permission[];
123
- /**
124
- * Export current RBAC configuration as JSON
125
- */
126
- toJSON(): {
127
- roles: RoleDefinition[];
128
- policies: Record<string, RBACPolicy>;
129
- };
130
- /**
131
- * Load RBAC configuration from JSON
132
- */
133
- fromJSON(config: {
134
- roles: RoleDefinition[];
135
- policies?: Record<string, RBACPolicy>;
136
- }): void;
137
- private matchesPermission;
138
- private matchesPattern;
139
- }
140
- /**
141
- * Create a preconfigured RBAC instance with common roles
142
- */
143
- export declare function createDefaultRBAC(): RBAC;
@@ -1,285 +0,0 @@
1
- /**
2
- * Role-Based Access Control (RBAC) for Blok
3
- *
4
- * Provides fine-grained access control for workflow execution:
5
- * - Role definitions with permissions
6
- * - Resource-based access control
7
- * - Hierarchical roles with inheritance
8
- * - Workflow-level and node-level access control
9
- *
10
- * @example
11
- * ```typescript
12
- * const rbac = new RBAC();
13
- *
14
- * // Define roles
15
- * rbac.addRole({
16
- * name: "admin",
17
- * permissions: [
18
- * { resource: "workflow", actions: ["*"] },
19
- * { resource: "node", actions: ["*"] },
20
- * ],
21
- * });
22
- *
23
- * rbac.addRole({
24
- * name: "developer",
25
- * permissions: [
26
- * { resource: "workflow", actions: ["read", "execute"] },
27
- * { resource: "node", actions: ["read", "execute"] },
28
- * ],
29
- * inherits: ["viewer"],
30
- * });
31
- *
32
- * rbac.addRole({
33
- * name: "viewer",
34
- * permissions: [
35
- * { resource: "workflow", actions: ["read"] },
36
- * ],
37
- * });
38
- *
39
- * // Check permissions
40
- * rbac.can("admin", "workflow", "delete"); // true
41
- * rbac.can("developer", "workflow", "execute"); // true
42
- * rbac.can("viewer", "workflow", "execute"); // false
43
- * ```
44
- */
45
- export class RBAC {
46
- roles = new Map();
47
- policies = new Map();
48
- roleCache = new Map();
49
- /**
50
- * Add a role definition
51
- */
52
- addRole(role) {
53
- this.roles.set(role.name, role);
54
- // Invalidate cache for this role and any role that inherits from it
55
- this.roleCache.clear();
56
- }
57
- /**
58
- * Remove a role
59
- */
60
- removeRole(name) {
61
- this.roles.delete(name);
62
- this.roleCache.clear();
63
- }
64
- /**
65
- * Get a role definition
66
- */
67
- getRole(name) {
68
- return this.roles.get(name);
69
- }
70
- /**
71
- * Get all defined roles
72
- */
73
- getRoles() {
74
- return Array.from(this.roles.values());
75
- }
76
- /**
77
- * Add a resource-specific policy
78
- */
79
- addPolicy(resourceId, policy) {
80
- this.policies.set(resourceId, policy);
81
- }
82
- /**
83
- * Check if a role has permission to perform an action on a resource
84
- */
85
- can(roleName, resource, action, resourceId) {
86
- const permissions = this.getEffectivePermissions(roleName);
87
- for (const perm of permissions) {
88
- if (this.matchesPermission(perm, resource, action, resourceId)) {
89
- return {
90
- allowed: true,
91
- role: roleName,
92
- resource,
93
- action,
94
- matchedPermission: perm,
95
- };
96
- }
97
- }
98
- return {
99
- allowed: false,
100
- role: roleName,
101
- resource,
102
- action,
103
- reason: `Role '${roleName}' does not have '${action}' permission on '${resource}'`,
104
- };
105
- }
106
- /**
107
- * Check if any of the given roles has permission
108
- */
109
- canAny(roles, resource, action, resourceId) {
110
- for (const role of roles) {
111
- const result = this.can(role, resource, action, resourceId);
112
- if (result.allowed)
113
- return result;
114
- }
115
- return {
116
- allowed: false,
117
- role: roles.join(","),
118
- resource,
119
- action,
120
- reason: `None of roles [${roles.join(", ")}] have '${action}' permission on '${resource}'`,
121
- };
122
- }
123
- /**
124
- * Check workflow-specific access
125
- */
126
- canAccessWorkflow(roles, workflowPath, action = "execute") {
127
- // Check resource-specific policy first
128
- const policy = this.policies.get(workflowPath);
129
- if (policy?.workflows) {
130
- for (const [pattern, config] of Object.entries(policy.workflows)) {
131
- if (this.matchesPattern(workflowPath, pattern)) {
132
- const allowedActions = config.actions || ["execute"];
133
- if (!allowedActions.includes(action) && !allowedActions.includes("*")) {
134
- return {
135
- allowed: false,
136
- role: roles.join(","),
137
- resource: workflowPath,
138
- action,
139
- reason: `Action '${action}' not allowed on workflow '${workflowPath}'`,
140
- };
141
- }
142
- const hasAllowedRole = roles.some((r) => config.allowedRoles.includes(r));
143
- if (hasAllowedRole) {
144
- return {
145
- allowed: true,
146
- role: roles.find((r) => config.allowedRoles.includes(r)) || roles[0],
147
- resource: workflowPath,
148
- action,
149
- };
150
- }
151
- }
152
- }
153
- }
154
- // Fall back to general RBAC check
155
- return this.canAny(roles, "workflow", action, workflowPath);
156
- }
157
- /**
158
- * Get all effective permissions for a role (including inherited)
159
- */
160
- getEffectivePermissions(roleName, visited = new Set()) {
161
- // Check cache
162
- const cached = this.roleCache.get(roleName);
163
- if (cached)
164
- return cached;
165
- // Guard against circular inheritance
166
- if (visited.has(roleName))
167
- return [];
168
- visited.add(roleName);
169
- const role = this.roles.get(roleName);
170
- if (!role)
171
- return [];
172
- const permissions = [...role.permissions];
173
- // Resolve inherited permissions
174
- if (role.inherits) {
175
- for (const parentRole of role.inherits) {
176
- const inherited = this.getEffectivePermissions(parentRole, visited);
177
- permissions.push(...inherited);
178
- }
179
- }
180
- // Cache results
181
- this.roleCache.set(roleName, permissions);
182
- return permissions;
183
- }
184
- /**
185
- * Export current RBAC configuration as JSON
186
- */
187
- toJSON() {
188
- return {
189
- roles: Array.from(this.roles.values()),
190
- policies: Object.fromEntries(this.policies),
191
- };
192
- }
193
- /**
194
- * Load RBAC configuration from JSON
195
- */
196
- fromJSON(config) {
197
- this.roles.clear();
198
- this.policies.clear();
199
- this.roleCache.clear();
200
- for (const role of config.roles) {
201
- this.addRole(role);
202
- }
203
- if (config.policies) {
204
- for (const [id, policy] of Object.entries(config.policies)) {
205
- this.addPolicy(id, policy);
206
- }
207
- }
208
- }
209
- matchesPermission(perm, resource, action, resourceId) {
210
- // Check resource type
211
- if (perm.resource !== resource && perm.resource !== "*")
212
- return false;
213
- // Check action
214
- if (!perm.actions.includes(action) && !perm.actions.includes("*"))
215
- return false;
216
- // Check resource pattern if specified
217
- if (perm.resourcePattern && resourceId) {
218
- if (!this.matchesPattern(resourceId, perm.resourcePattern))
219
- return false;
220
- }
221
- return true;
222
- }
223
- matchesPattern(value, pattern) {
224
- // Support wildcards: "workflow/*", "workflow/user-*"
225
- if (pattern === "*")
226
- return true;
227
- const regexStr = pattern.replace(/\*/g, ".*").replace(/\?/g, ".");
228
- const regex = new RegExp(`^${regexStr}$`);
229
- return regex.test(value);
230
- }
231
- }
232
- /**
233
- * Create a preconfigured RBAC instance with common roles
234
- */
235
- export function createDefaultRBAC() {
236
- const rbac = new RBAC();
237
- rbac.addRole({
238
- name: "admin",
239
- description: "Full access to all resources",
240
- permissions: [{ resource: "*", actions: ["*"] }],
241
- });
242
- rbac.addRole({
243
- name: "developer",
244
- description: "Can read, create, and execute workflows and nodes",
245
- permissions: [
246
- { resource: "workflow", actions: ["read", "create", "update", "execute"] },
247
- { resource: "node", actions: ["read", "create", "update", "execute"] },
248
- { resource: "trigger", actions: ["read"] },
249
- { resource: "runtime", actions: ["read", "execute"] },
250
- ],
251
- inherits: ["viewer"],
252
- });
253
- rbac.addRole({
254
- name: "operator",
255
- description: "Can execute and monitor workflows",
256
- permissions: [
257
- { resource: "workflow", actions: ["read", "execute"] },
258
- { resource: "node", actions: ["read", "execute"] },
259
- { resource: "trigger", actions: ["read"] },
260
- { resource: "runtime", actions: ["read"] },
261
- { resource: "metrics", actions: ["read"] },
262
- { resource: "health", actions: ["read"] },
263
- ],
264
- });
265
- rbac.addRole({
266
- name: "viewer",
267
- description: "Read-only access to workflows and nodes",
268
- permissions: [
269
- { resource: "workflow", actions: ["read"] },
270
- { resource: "node", actions: ["read"] },
271
- { resource: "metrics", actions: ["read"] },
272
- { resource: "health", actions: ["read"] },
273
- ],
274
- });
275
- rbac.addRole({
276
- name: "service",
277
- description: "Machine-to-machine service account",
278
- permissions: [
279
- { resource: "workflow", actions: ["execute"] },
280
- { resource: "node", actions: ["execute"] },
281
- ],
282
- });
283
- return rbac;
284
- }
285
- //# sourceMappingURL=RBAC.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RBAC.js","sourceRoot":"","sources":["../../src/security/RBAC.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AA0CH,MAAM,OAAO,IAAI;IACR,KAAK,GAAgC,IAAI,GAAG,EAAE,CAAC;IAC/C,QAAQ,GAA4B,IAAI,GAAG,EAAE,CAAC;IAC9C,SAAS,GAA8B,IAAI,GAAG,EAAE,CAAC;IAEzD;;OAEG;IACH,OAAO,CAAC,IAAoB;QAC3B,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAChC,oEAAoE;QACpE,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,UAAU,CAAC,IAAY;QACtB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACxB,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,OAAO,CAAC,IAAY;QACnB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,QAAQ;QACP,OAAO,KAAK,CAAC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