@superblocksteam/shared 0.9589.6 → 0.9590.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.
Files changed (82) hide show
  1. package/dist/database-lifecycle/index.d.ts +60 -1
  2. package/dist/database-lifecycle/index.d.ts.map +1 -1
  3. package/dist/database-lifecycle/index.js +34 -0
  4. package/dist/database-lifecycle/index.js.map +1 -1
  5. package/dist/types/application/index.d.ts +1 -1
  6. package/dist/types/application/index.d.ts.map +1 -1
  7. package/dist/types/application/index.js.map +1 -1
  8. package/dist/types/audit/ocsf.d.ts.map +1 -1
  9. package/dist/types/audit/ocsf.js +8 -1
  10. package/dist/types/audit/ocsf.js.map +1 -1
  11. package/dist/types/plugin/form.d.ts +7 -0
  12. package/dist/types/plugin/form.d.ts.map +1 -1
  13. package/dist/types/plugin/form.js +22 -1
  14. package/dist/types/plugin/form.js.map +1 -1
  15. package/dist/types/plugin/form.test.d.ts +2 -0
  16. package/dist/types/plugin/form.test.d.ts.map +1 -0
  17. package/dist/types/plugin/form.test.js +156 -0
  18. package/dist/types/plugin/form.test.js.map +1 -0
  19. package/dist/types/policyGate/index.d.ts +21 -1
  20. package/dist/types/policyGate/index.d.ts.map +1 -1
  21. package/dist/types/rbac/index.d.ts +9 -0
  22. package/dist/types/rbac/index.d.ts.map +1 -1
  23. package/dist/types/rbac/index.js +9 -0
  24. package/dist/types/rbac/index.js.map +1 -1
  25. package/dist/types/reviewPolicy/index.d.ts +35 -0
  26. package/dist/types/reviewPolicy/index.d.ts.map +1 -1
  27. package/dist/types/user/index.d.ts +2 -0
  28. package/dist/types/user/index.d.ts.map +1 -1
  29. package/dist/types/user/index.js.map +1 -1
  30. package/dist/utils/string.d.ts +2 -0
  31. package/dist/utils/string.d.ts.map +1 -1
  32. package/dist/utils/string.js +13 -1
  33. package/dist/utils/string.js.map +1 -1
  34. package/dist/utils/string.test.js +28 -0
  35. package/dist/utils/string.test.js.map +1 -1
  36. package/dist-esm/database-lifecycle/index.d.ts +60 -1
  37. package/dist-esm/database-lifecycle/index.d.ts.map +1 -1
  38. package/dist-esm/database-lifecycle/index.js +32 -0
  39. package/dist-esm/database-lifecycle/index.js.map +1 -1
  40. package/dist-esm/types/application/index.d.ts +1 -1
  41. package/dist-esm/types/application/index.d.ts.map +1 -1
  42. package/dist-esm/types/application/index.js.map +1 -1
  43. package/dist-esm/types/audit/ocsf.d.ts.map +1 -1
  44. package/dist-esm/types/audit/ocsf.js +8 -1
  45. package/dist-esm/types/audit/ocsf.js.map +1 -1
  46. package/dist-esm/types/plugin/form.d.ts +7 -0
  47. package/dist-esm/types/plugin/form.d.ts.map +1 -1
  48. package/dist-esm/types/plugin/form.js +20 -0
  49. package/dist-esm/types/plugin/form.js.map +1 -1
  50. package/dist-esm/types/plugin/form.test.d.ts +2 -0
  51. package/dist-esm/types/plugin/form.test.d.ts.map +1 -0
  52. package/dist-esm/types/plugin/form.test.js +154 -0
  53. package/dist-esm/types/plugin/form.test.js.map +1 -0
  54. package/dist-esm/types/policyGate/index.d.ts +21 -1
  55. package/dist-esm/types/policyGate/index.d.ts.map +1 -1
  56. package/dist-esm/types/rbac/index.d.ts +9 -0
  57. package/dist-esm/types/rbac/index.d.ts.map +1 -1
  58. package/dist-esm/types/rbac/index.js +9 -0
  59. package/dist-esm/types/rbac/index.js.map +1 -1
  60. package/dist-esm/types/reviewPolicy/index.d.ts +35 -0
  61. package/dist-esm/types/reviewPolicy/index.d.ts.map +1 -1
  62. package/dist-esm/types/user/index.d.ts +2 -0
  63. package/dist-esm/types/user/index.d.ts.map +1 -1
  64. package/dist-esm/types/user/index.js.map +1 -1
  65. package/dist-esm/utils/string.d.ts +2 -0
  66. package/dist-esm/utils/string.d.ts.map +1 -1
  67. package/dist-esm/utils/string.js +11 -0
  68. package/dist-esm/utils/string.js.map +1 -1
  69. package/dist-esm/utils/string.test.js +29 -1
  70. package/dist-esm/utils/string.test.js.map +1 -1
  71. package/package.json +2 -2
  72. package/src/database-lifecycle/index.ts +156 -1
  73. package/src/types/application/index.ts +5 -0
  74. package/src/types/audit/ocsf.ts +8 -1
  75. package/src/types/plugin/form.test.ts +161 -0
  76. package/src/types/plugin/form.ts +22 -0
  77. package/src/types/policyGate/index.ts +26 -1
  78. package/src/types/rbac/index.ts +9 -0
  79. package/src/types/reviewPolicy/index.ts +34 -3
  80. package/src/types/user/index.ts +2 -0
  81. package/src/utils/string.test.ts +32 -1
  82. package/src/utils/string.ts +12 -0
@@ -14,14 +14,39 @@ export type PolicyGateReadinessFindingSummary = {
14
14
  suppressed: number;
15
15
  };
16
16
 
17
+ export type PolicyGateReadinessFinding = {
18
+ blocking: boolean;
19
+ severity: 'critical' | 'high' | 'info' | 'low' | 'medium';
20
+ title: string;
21
+ };
22
+
23
+ export type PolicyGateScanPhaseName = 'built_asset' | 'dependency_audit' | 'source';
24
+
25
+ export type PolicyGateScanPhaseState = 'complete' | 'failed' | 'pending' | 'running' | 'skipped';
26
+
27
+ export type PolicyGateScanPhaseProgress = {
28
+ completedAt?: string;
29
+ durationMs?: number;
30
+ startedAt?: string;
31
+ state: PolicyGateScanPhaseState;
32
+ };
33
+
34
+ export type PolicyGateScanProgress = {
35
+ phases: Partial<Record<PolicyGateScanPhaseName, PolicyGateScanPhaseProgress>>;
36
+ requiredPhases: PolicyGateScanPhaseName[];
37
+ };
38
+
17
39
  export type PolicyGateReadinessItem = {
18
40
  actions: PolicyGateReadinessAction[];
41
+ displayName?: string;
42
+ findings?: PolicyGateReadinessFinding[];
19
43
  findingSummary: PolicyGateReadinessFindingSummary;
20
44
  itemId: string;
21
45
  itemType: 'security_agent' | 'security_scan';
22
46
  mode: 'advisory' | 'approval' | 'blocking' | 'report_only';
23
47
  policyId: string;
24
48
  policyVersionId: string;
49
+ progress?: PolicyGateScanProgress;
25
50
  reviewRunId?: string;
26
51
  staleReason?: string;
27
52
  status: PolicyGateReadinessItemStatus;
@@ -43,7 +68,7 @@ export type PolicyGateReadinessResponse = {
43
68
  target: PolicyGateReadinessTarget;
44
69
  };
45
70
 
46
- export type PolicyGateReadinessStatus = 'allowed' | 'approval_required' | 'blocked' | 'failed' | 'running' | 'stale';
71
+ export type PolicyGateReadinessStatus = 'allowed' | 'approval_required' | 'blocked' | 'disabled' | 'failed' | 'running' | 'stale';
47
72
 
48
73
  export type PolicyGateReadinessTarget = {
49
74
  applicationId: string;
@@ -146,10 +146,12 @@ export enum ResourceTypeEnum {
146
146
  INTEGRATIONS_DEFAULT_AI = 'integrations.default_ai',
147
147
  LOGS = 'logs',
148
148
  LOGS_STREAMS = 'logs.streams',
149
+ NPM_REGISTRY = 'npm_registry',
149
150
  ORGANIZATION = 'org',
150
151
  // ORGANIZATION_REQUESTS = 'org.requests',
151
152
  ORGANIZATION_USERS = 'org.users',
152
153
  ORG_KNOWLEDGE = 'org_knowledge',
154
+ POLICY_AGENTS = 'policy_agents',
153
155
  PROFILES = 'profiles',
154
156
  REPOSITORIES = 'repos',
155
157
  ROLES = 'roles',
@@ -222,6 +224,10 @@ export const ActionTypeByResourceType = {
222
224
  PROFILES: {
223
225
  MANAGE: ActionTypeEnum.MANAGE
224
226
  },
227
+ POLICY_AGENTS: {
228
+ MANAGE: ActionTypeEnum.MANAGE,
229
+ VIEW: ActionTypeEnum.VIEW
230
+ },
225
231
  ROLES: {
226
232
  READ: ActionTypeEnum.READ,
227
233
  MANAGE: ActionTypeEnum.MANAGE
@@ -277,6 +283,9 @@ export const ActionTypeByResourceType = {
277
283
  MANAGE: ActionTypeEnum.MANAGE,
278
284
  READ: ActionTypeEnum.READ
279
285
  },
286
+ NPM_REGISTRY: {
287
+ MANAGE: ActionTypeEnum.MANAGE
288
+ },
280
289
  SCHEDULED_JOBS: {
281
290
  CREATE: ActionTypeEnum.CREATE,
282
291
  DELETE: ActionTypeEnum.DELETE,
@@ -112,6 +112,35 @@ export interface ReviewPolicyRunDto {
112
112
  errorMessage: string | null;
113
113
  }
114
114
 
115
+ export interface ReviewFindingDto {
116
+ id: string;
117
+ sourceTool: string;
118
+ sourceRuleId: string | null;
119
+ sourcePolicyId: string | null;
120
+ sourcePhase: ReviewFindingSourcePhase | null;
121
+ category: ReviewFindingCategory;
122
+ findingType: string | null;
123
+ severity: ReviewFindingSeverity;
124
+ confidence: ReviewFindingConfidence | null;
125
+ blocking: boolean;
126
+ blockingReason: string | null;
127
+ title: string;
128
+ humanSummary: string | null;
129
+ technicalSummary: string | null;
130
+ evidence: Record<string, unknown>;
131
+ locations: unknown[];
132
+ remediationHint: Record<string, unknown>;
133
+ clarkRemediable: boolean;
134
+ adminOnly: boolean;
135
+ created: string;
136
+ }
137
+
138
+ export interface ReviewPolicyRunReportDto {
139
+ policy: ReviewPolicyDto;
140
+ run: ReviewPolicyRunDto;
141
+ findings: ReviewFindingDto[];
142
+ }
143
+
115
144
  export interface ReviewPolicyRunsDto {
116
145
  policy: ReviewPolicyDto;
117
146
  runs: ReviewPolicyRunDto[];
@@ -125,8 +154,10 @@ export interface ReviewPolicySummaryDto {
125
154
  }
126
155
 
127
156
  export type CreateReviewPolicyBody =
128
- | { policyType: 'built_in_security_scan' }
129
- | { policyType: 'security_agent'; name: string; prompt: string };
157
+ | { policyType: 'built_in_security_scan'; mode?: ReviewPolicyMode }
158
+ | { policyType: 'security_agent'; mode: ReviewPolicyMode; name: string; prompt: string };
130
159
 
131
160
  export type UpdateReviewPolicyBody = { status: AiAgentStatus };
132
- export type UpdateReviewPolicyConfigBody = { activeVersionId: string; name: string; prompt: string };
161
+ export type UpdateReviewPolicyConfigBody =
162
+ | { activeVersionId: string; policyType: 'built_in_security_scan'; mode: ReviewPolicyMode }
163
+ | { activeVersionId: string; policyType: 'security_agent'; mode: ReviewPolicyMode; name: string; prompt: string };
@@ -47,12 +47,14 @@ export type GetOrganizationGeneralResponseBody = {
47
47
  name: string;
48
48
  allowedDomains: Domain[];
49
49
  roleSettings: RoleSettingsDto;
50
+ npmAllowInstallScripts?: boolean;
50
51
  };
51
52
 
52
53
  export type PatchOrganizationGeneralResponseBody = {
53
54
  name?: string;
54
55
  allowedDomains?: string[];
55
56
  roleSettings?: RoleSettingsDto;
57
+ npmAllowInstallScripts?: boolean;
56
58
  };
57
59
 
58
60
  export type DataTreeUser = {
@@ -1,6 +1,6 @@
1
1
  import { describe, test, expect } from 'vitest';
2
2
 
3
- import { camelCaseToDisplay, getNextEntityName, validateEmail } from './string.js';
3
+ import { camelCaseToDisplay, getNextEntityName, isUuid, validateEmail } from './string.js';
4
4
 
5
5
  describe('camel case to display', () => {
6
6
  test('can convert camel case to display', () => {
@@ -19,6 +19,37 @@ describe('validate email', () => {
19
19
  });
20
20
  });
21
21
 
22
+ describe('isUuid', () => {
23
+ test('accepts canonical RFC 4122-style UUIDs (case-insensitive)', () => {
24
+ expect(isUuid('a1b2c3d4-e5f6-7890-abcd-1234567890ab')).toBe(true);
25
+ expect(isUuid('A1B2C3D4-E5F6-7890-ABCD-1234567890AB')).toBe(true);
26
+ expect(isUuid('00000000-0000-0000-0000-000000000000')).toBe(true);
27
+ });
28
+
29
+ test('rejects non-UUID strings without throwing', () => {
30
+ // Strictness is the contract — these are the shapes PostgreSQL would
31
+ // reject with `invalid input syntax for type uuid` if forwarded to a
32
+ // UUID column.
33
+ expect(isUuid('not-a-uuid')).toBe(false);
34
+ expect(isUuid('unknown agent id')).toBe(false);
35
+ // Near-miss: first segment is 7 chars instead of 8.
36
+ expect(isUuid('1234567-1234-1234-1234-123456789abc')).toBe(false);
37
+ // Too many segments.
38
+ expect(isUuid('a1b2c3d4-e5f6-7890-abcd-1234567890ab-extra')).toBe(false);
39
+ // Non-hex character.
40
+ expect(isUuid('a1b2c3d4-e5f6-7890-abcd-1234567890zz')).toBe(false);
41
+ // Empty string.
42
+ expect(isUuid('')).toBe(false);
43
+ });
44
+
45
+ test('rejects non-string inputs', () => {
46
+ expect(isUuid(null)).toBe(false);
47
+ expect(isUuid(undefined)).toBe(false);
48
+ expect(isUuid(123)).toBe(false);
49
+ expect(isUuid({})).toBe(false);
50
+ });
51
+ });
52
+
22
53
  describe('getNextEntityName', () => {
23
54
  test('get next name with underscore', async () => {
24
55
  expect(getNextEntityName('Tabs_', ['Tabs_1', 'Tabs_2', 'Tabs_3'])).toEqual('Tabs_4');
@@ -18,6 +18,18 @@ export const validateEmail = (email: string): boolean => {
18
18
  return EmailRegexComplete.test(email);
19
19
  };
20
20
 
21
+ // Matches canonical RFC 4122-style UUIDs (8-4-4-4-12 hex, case-insensitive).
22
+ // Intentionally strict: we want to reject inputs that PostgreSQL would later
23
+ // reject with `invalid input syntax for type uuid`, surfacing the boundary as
24
+ // a 4xx in our own validators instead of a 500 from the DB driver. Do NOT
25
+ // loosen this to a partial match or a "looks UUID-ish" regex — the strictness
26
+ // is the contract.
27
+ export const UUID_REGEX_STRING = '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}';
28
+ const UuidRegexComplete = new RegExp(`^${UUID_REGEX_STRING}$`, 'i');
29
+ export const isUuid = (value: unknown): value is string => {
30
+ return typeof value === 'string' && UuidRegexComplete.test(value);
31
+ };
32
+
21
33
  export const getNextEntityName = (prefix: string, existingNames: string[], separator = '_') => {
22
34
  const cleanName = (name: string) => {
23
35
  return (