@superblocksteam/shared 0.9589.5 → 0.9590.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 (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 +5 -0
  22. package/dist/types/rbac/index.d.ts.map +1 -1
  23. package/dist/types/rbac/index.js +5 -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 +5 -0
  57. package/dist-esm/types/rbac/index.d.ts.map +1 -1
  58. package/dist-esm/types/rbac/index.js +5 -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 +5 -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
@@ -150,6 +150,7 @@ export enum ResourceTypeEnum {
150
150
  // ORGANIZATION_REQUESTS = 'org.requests',
151
151
  ORGANIZATION_USERS = 'org.users',
152
152
  ORG_KNOWLEDGE = 'org_knowledge',
153
+ POLICY_AGENTS = 'policy_agents',
153
154
  PROFILES = 'profiles',
154
155
  REPOSITORIES = 'repos',
155
156
  ROLES = 'roles',
@@ -222,6 +223,10 @@ export const ActionTypeByResourceType = {
222
223
  PROFILES: {
223
224
  MANAGE: ActionTypeEnum.MANAGE
224
225
  },
226
+ POLICY_AGENTS: {
227
+ MANAGE: ActionTypeEnum.MANAGE,
228
+ VIEW: ActionTypeEnum.VIEW
229
+ },
225
230
  ROLES: {
226
231
  READ: ActionTypeEnum.READ,
227
232
  MANAGE: ActionTypeEnum.MANAGE
@@ -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 (