@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.
- package/dist/database-lifecycle/index.d.ts +60 -1
- package/dist/database-lifecycle/index.d.ts.map +1 -1
- package/dist/database-lifecycle/index.js +34 -0
- package/dist/database-lifecycle/index.js.map +1 -1
- package/dist/types/application/index.d.ts +1 -1
- package/dist/types/application/index.d.ts.map +1 -1
- package/dist/types/application/index.js.map +1 -1
- package/dist/types/audit/ocsf.d.ts.map +1 -1
- package/dist/types/audit/ocsf.js +8 -1
- package/dist/types/audit/ocsf.js.map +1 -1
- package/dist/types/plugin/form.d.ts +7 -0
- package/dist/types/plugin/form.d.ts.map +1 -1
- package/dist/types/plugin/form.js +22 -1
- package/dist/types/plugin/form.js.map +1 -1
- package/dist/types/plugin/form.test.d.ts +2 -0
- package/dist/types/plugin/form.test.d.ts.map +1 -0
- package/dist/types/plugin/form.test.js +156 -0
- package/dist/types/plugin/form.test.js.map +1 -0
- package/dist/types/policyGate/index.d.ts +21 -1
- package/dist/types/policyGate/index.d.ts.map +1 -1
- package/dist/types/rbac/index.d.ts +9 -0
- package/dist/types/rbac/index.d.ts.map +1 -1
- package/dist/types/rbac/index.js +9 -0
- package/dist/types/rbac/index.js.map +1 -1
- package/dist/types/reviewPolicy/index.d.ts +35 -0
- package/dist/types/reviewPolicy/index.d.ts.map +1 -1
- package/dist/types/user/index.d.ts +2 -0
- package/dist/types/user/index.d.ts.map +1 -1
- package/dist/types/user/index.js.map +1 -1
- package/dist/utils/string.d.ts +2 -0
- package/dist/utils/string.d.ts.map +1 -1
- package/dist/utils/string.js +13 -1
- package/dist/utils/string.js.map +1 -1
- package/dist/utils/string.test.js +28 -0
- package/dist/utils/string.test.js.map +1 -1
- package/dist-esm/database-lifecycle/index.d.ts +60 -1
- package/dist-esm/database-lifecycle/index.d.ts.map +1 -1
- package/dist-esm/database-lifecycle/index.js +32 -0
- package/dist-esm/database-lifecycle/index.js.map +1 -1
- package/dist-esm/types/application/index.d.ts +1 -1
- package/dist-esm/types/application/index.d.ts.map +1 -1
- package/dist-esm/types/application/index.js.map +1 -1
- package/dist-esm/types/audit/ocsf.d.ts.map +1 -1
- package/dist-esm/types/audit/ocsf.js +8 -1
- package/dist-esm/types/audit/ocsf.js.map +1 -1
- package/dist-esm/types/plugin/form.d.ts +7 -0
- package/dist-esm/types/plugin/form.d.ts.map +1 -1
- package/dist-esm/types/plugin/form.js +20 -0
- package/dist-esm/types/plugin/form.js.map +1 -1
- package/dist-esm/types/plugin/form.test.d.ts +2 -0
- package/dist-esm/types/plugin/form.test.d.ts.map +1 -0
- package/dist-esm/types/plugin/form.test.js +154 -0
- package/dist-esm/types/plugin/form.test.js.map +1 -0
- package/dist-esm/types/policyGate/index.d.ts +21 -1
- package/dist-esm/types/policyGate/index.d.ts.map +1 -1
- package/dist-esm/types/rbac/index.d.ts +9 -0
- package/dist-esm/types/rbac/index.d.ts.map +1 -1
- package/dist-esm/types/rbac/index.js +9 -0
- package/dist-esm/types/rbac/index.js.map +1 -1
- package/dist-esm/types/reviewPolicy/index.d.ts +35 -0
- package/dist-esm/types/reviewPolicy/index.d.ts.map +1 -1
- package/dist-esm/types/user/index.d.ts +2 -0
- package/dist-esm/types/user/index.d.ts.map +1 -1
- package/dist-esm/types/user/index.js.map +1 -1
- package/dist-esm/utils/string.d.ts +2 -0
- package/dist-esm/utils/string.d.ts.map +1 -1
- package/dist-esm/utils/string.js +11 -0
- package/dist-esm/utils/string.js.map +1 -1
- package/dist-esm/utils/string.test.js +29 -1
- package/dist-esm/utils/string.test.js.map +1 -1
- package/package.json +2 -2
- package/src/database-lifecycle/index.ts +156 -1
- package/src/types/application/index.ts +5 -0
- package/src/types/audit/ocsf.ts +8 -1
- package/src/types/plugin/form.test.ts +161 -0
- package/src/types/plugin/form.ts +22 -0
- package/src/types/policyGate/index.ts +26 -1
- package/src/types/rbac/index.ts +9 -0
- package/src/types/reviewPolicy/index.ts +34 -3
- package/src/types/user/index.ts +2 -0
- package/src/utils/string.test.ts +32 -1
- 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;
|
package/src/types/rbac/index.ts
CHANGED
|
@@ -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 =
|
|
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 };
|
package/src/types/user/index.ts
CHANGED
|
@@ -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 = {
|
package/src/utils/string.test.ts
CHANGED
|
@@ -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');
|
package/src/utils/string.ts
CHANGED
|
@@ -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 (
|