@sudobility/types 1.9.41 → 1.9.43
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/CLAUDE.md +29 -17
- package/dist/types/entity/entity.cjs +8 -5
- package/dist/types/entity/entity.d.ts +15 -9
- package/dist/types/entity/entity.d.ts.map +1 -1
- package/dist/types/entity/entity.js +8 -5
- package/dist/types/entity/entity.js.map +1 -1
- package/dist/types/entity/permissions.cjs +14 -12
- package/dist/types/entity/permissions.d.ts.map +1 -1
- package/dist/types/entity/permissions.js +14 -12
- package/dist/types/entity/permissions.js.map +1 -1
- package/package.json +1 -1
package/CLAUDE.md
CHANGED
|
@@ -56,44 +56,56 @@ src/
|
|
|
56
56
|
└── index.ts # Main export file
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
+
## Package Manager
|
|
60
|
+
|
|
61
|
+
**This project uses Bun as the package manager.** Always use `bun` commands instead of `npm`:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# Install dependencies
|
|
65
|
+
bun install
|
|
66
|
+
|
|
67
|
+
# Run any script
|
|
68
|
+
bun run <script-name>
|
|
69
|
+
```
|
|
70
|
+
|
|
59
71
|
## Essential Commands
|
|
60
72
|
|
|
61
73
|
### Development Commands
|
|
62
74
|
```bash
|
|
63
75
|
# Build the project (dual ESM/CJS output)
|
|
64
|
-
|
|
76
|
+
bun run build
|
|
65
77
|
|
|
66
78
|
# Watch mode for development
|
|
67
|
-
|
|
79
|
+
bun run dev
|
|
68
80
|
|
|
69
81
|
# Run all 219 tests
|
|
70
|
-
|
|
82
|
+
bun test
|
|
71
83
|
|
|
72
84
|
# Type checking
|
|
73
|
-
|
|
85
|
+
bun run typecheck
|
|
74
86
|
|
|
75
87
|
# Linting (ESLint v9)
|
|
76
|
-
|
|
88
|
+
bun run lint
|
|
77
89
|
|
|
78
90
|
# Fix linting issues
|
|
79
|
-
|
|
91
|
+
bun run lint:fix
|
|
80
92
|
|
|
81
93
|
# Format code (Prettier)
|
|
82
|
-
|
|
94
|
+
bun run format
|
|
83
95
|
|
|
84
96
|
# Check formatting
|
|
85
|
-
|
|
97
|
+
bun run format:check
|
|
86
98
|
|
|
87
99
|
# Clean build artifacts
|
|
88
|
-
|
|
100
|
+
bun run clean
|
|
89
101
|
|
|
90
102
|
# Full verification (build + test + lint + typecheck)
|
|
91
|
-
|
|
103
|
+
bun run verify
|
|
92
104
|
|
|
93
105
|
# AI development tools
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
106
|
+
bun run ai:analyze # Analyze type structure
|
|
107
|
+
bun run ai:validate # Validate exports
|
|
108
|
+
bun run ai:docs # Generate AI documentation
|
|
97
109
|
```
|
|
98
110
|
|
|
99
111
|
## Testing Strategy
|
|
@@ -173,19 +185,19 @@ npm run ai:docs # Generate AI documentation
|
|
|
173
185
|
### Testing New Code
|
|
174
186
|
```bash
|
|
175
187
|
# Run tests in watch mode during development
|
|
176
|
-
|
|
188
|
+
bun run test:watch
|
|
177
189
|
|
|
178
190
|
# Run specific test file
|
|
179
|
-
|
|
191
|
+
bun test -- path/to/test.file.ts
|
|
180
192
|
|
|
181
193
|
# Generate coverage report
|
|
182
|
-
|
|
194
|
+
bun run test:coverage
|
|
183
195
|
```
|
|
184
196
|
|
|
185
197
|
## AI Assistant Specific Notes
|
|
186
198
|
|
|
187
199
|
### When Working on This Project:
|
|
188
|
-
1. **Always run verification after changes**: `
|
|
200
|
+
1. **Always run verification after changes**: `bun run verify`
|
|
189
201
|
2. **Maintain zero dependencies**: Don't add runtime dependencies
|
|
190
202
|
3. **Keep utilities pure**: No side effects in utility functions
|
|
191
203
|
4. **Follow naming conventions**: Established patterns for consistency
|
|
@@ -21,15 +21,18 @@ var EntityType;
|
|
|
21
21
|
/**
|
|
22
22
|
* Role of a user within an entity.
|
|
23
23
|
* Determines permissions for various operations.
|
|
24
|
+
* - OWNER: Only for organizations. Full access including user management.
|
|
25
|
+
* - ADMIN: Can manage projects and endpoints. Used for personal entities.
|
|
26
|
+
* - MEMBER: Read-only access to projects and endpoints.
|
|
24
27
|
*/
|
|
25
28
|
var EntityRole;
|
|
26
29
|
(function (EntityRole) {
|
|
27
|
-
/**
|
|
30
|
+
/** Organization owner: full access including invite users, change roles, manage projects/endpoints */
|
|
31
|
+
EntityRole["OWNER"] = "owner";
|
|
32
|
+
/** Can manage projects and endpoints, but cannot manage users. Default role for personal entities. */
|
|
28
33
|
EntityRole["ADMIN"] = "admin";
|
|
29
|
-
/**
|
|
30
|
-
EntityRole["
|
|
31
|
-
/** Read-only access to projects and API keys */
|
|
32
|
-
EntityRole["VIEWER"] = "viewer";
|
|
34
|
+
/** Read-only access to projects and endpoints */
|
|
35
|
+
EntityRole["MEMBER"] = "member";
|
|
33
36
|
})(EntityRole || (exports.EntityRole = EntityRole = {}));
|
|
34
37
|
/**
|
|
35
38
|
* Status of an entity invitation.
|
|
@@ -14,14 +14,17 @@ export declare enum EntityType {
|
|
|
14
14
|
/**
|
|
15
15
|
* Role of a user within an entity.
|
|
16
16
|
* Determines permissions for various operations.
|
|
17
|
+
* - OWNER: Only for organizations. Full access including user management.
|
|
18
|
+
* - ADMIN: Can manage projects and endpoints. Used for personal entities.
|
|
19
|
+
* - MEMBER: Read-only access to projects and endpoints.
|
|
17
20
|
*/
|
|
18
21
|
export declare enum EntityRole {
|
|
19
|
-
/**
|
|
22
|
+
/** Organization owner: full access including invite users, change roles, manage projects/endpoints */
|
|
23
|
+
OWNER = "owner",
|
|
24
|
+
/** Can manage projects and endpoints, but cannot manage users. Default role for personal entities. */
|
|
20
25
|
ADMIN = "admin",
|
|
21
|
-
/**
|
|
22
|
-
|
|
23
|
-
/** Read-only access to projects and API keys */
|
|
24
|
-
VIEWER = "viewer"
|
|
26
|
+
/** Read-only access to projects and endpoints */
|
|
27
|
+
MEMBER = "member"
|
|
25
28
|
}
|
|
26
29
|
/**
|
|
27
30
|
* Status of an entity invitation.
|
|
@@ -39,6 +42,8 @@ export declare enum InvitationStatus {
|
|
|
39
42
|
/**
|
|
40
43
|
* An entity represents a workspace that can own projects and API keys.
|
|
41
44
|
* Can be either a personal workspace (one per user) or an organization (shared).
|
|
45
|
+
* - Personal entities: User has 'admin' role (no user management needed).
|
|
46
|
+
* - Organizations: Creator has 'owner' role (can manage users, projects, endpoints).
|
|
42
47
|
*/
|
|
43
48
|
export interface Entity {
|
|
44
49
|
/** Unique identifier (UUID) */
|
|
@@ -53,8 +58,6 @@ export interface Entity {
|
|
|
53
58
|
description: string | null;
|
|
54
59
|
/** Optional avatar URL */
|
|
55
60
|
avatarUrl: string | null;
|
|
56
|
-
/** User ID of the entity owner/creator */
|
|
57
|
-
ownerUserId: string;
|
|
58
61
|
/** ISO 8601 timestamp of creation */
|
|
59
62
|
createdAt: string;
|
|
60
63
|
/** ISO 8601 timestamp of last update */
|
|
@@ -81,16 +84,19 @@ export interface EntityMemberUser {
|
|
|
81
84
|
}
|
|
82
85
|
/**
|
|
83
86
|
* A membership record linking a user to an entity with a specific role.
|
|
87
|
+
* This table manages all user-entity roles including organization ownership.
|
|
84
88
|
*/
|
|
85
89
|
export interface EntityMember {
|
|
86
90
|
/** Unique identifier (UUID) */
|
|
87
91
|
id: string;
|
|
88
92
|
/** Entity this membership belongs to */
|
|
89
93
|
entityId: string;
|
|
90
|
-
/** User who is a member */
|
|
94
|
+
/** User who is a member (firebase_uid) */
|
|
91
95
|
userId: string;
|
|
92
|
-
/** User's role in the entity */
|
|
96
|
+
/** User's role in the entity (owner, admin, member) */
|
|
93
97
|
role: EntityRole;
|
|
98
|
+
/** Whether this membership is active (false = soft deleted) */
|
|
99
|
+
isActive: boolean;
|
|
94
100
|
/** ISO 8601 timestamp when user joined */
|
|
95
101
|
joinedAt: string;
|
|
96
102
|
/** ISO 8601 timestamp of record creation */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../../src/types/entity/entity.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;;;;GAI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|
/**
|
|
22
22
|
* Role of a user within an entity.
|
|
23
23
|
* Determines permissions for various operations.
|
|
24
|
+
* - OWNER: Only for organizations. Full access including user management.
|
|
25
|
+
* - ADMIN: Can manage projects and endpoints. Used for personal entities.
|
|
26
|
+
* - MEMBER: Read-only access to projects and endpoints.
|
|
24
27
|
*/
|
|
25
28
|
var EntityRole;
|
|
26
29
|
(function (EntityRole) {
|
|
27
|
-
/**
|
|
30
|
+
/** Organization owner: full access including invite users, change roles, manage projects/endpoints */
|
|
31
|
+
EntityRole["OWNER"] = "owner";
|
|
32
|
+
/** Can manage projects and endpoints, but cannot manage users. Default role for personal entities. */
|
|
28
33
|
EntityRole["ADMIN"] = "admin";
|
|
29
|
-
/**
|
|
30
|
-
EntityRole["
|
|
31
|
-
/** Read-only access to projects and API keys */
|
|
32
|
-
EntityRole["VIEWER"] = "viewer";
|
|
34
|
+
/** Read-only access to projects and endpoints */
|
|
35
|
+
EntityRole["MEMBER"] = "member";
|
|
33
36
|
})(EntityRole || (exports.EntityRole = EntityRole = {}));
|
|
34
37
|
/**
|
|
35
38
|
* Status of an entity invitation.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity.js","sourceRoot":"","sources":["../../../src/types/entity/entity.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2CAA2C;AAC3C,QAAQ;AACR,2CAA2C;AAE3C;;;;GAIG;AACH,IAAY,UAGX;AAHD,WAAY,UAAU;IACpB,mCAAqB,CAAA;IACrB,2CAA6B,CAAA;AAC/B,CAAC,EAHW,UAAU,0BAAV,UAAU,QAGrB;AAED
|
|
1
|
+
{"version":3,"file":"entity.js","sourceRoot":"","sources":["../../../src/types/entity/entity.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2CAA2C;AAC3C,QAAQ;AACR,2CAA2C;AAE3C;;;;GAIG;AACH,IAAY,UAGX;AAHD,WAAY,UAAU;IACpB,mCAAqB,CAAA;IACrB,2CAA6B,CAAA;AAC/B,CAAC,EAHW,UAAU,0BAAV,UAAU,QAGrB;AAED;;;;;;GAMG;AACH,IAAY,UAOX;AAPD,WAAY,UAAU;IACpB,sGAAsG;IACtG,6BAAe,CAAA;IACf,sGAAsG;IACtG,6BAAe,CAAA;IACf,iDAAiD;IACjD,+BAAiB,CAAA;AACnB,CAAC,EAPW,UAAU,0BAAV,UAAU,QAOrB;AAED;;GAEG;AACH,IAAY,gBASX;AATD,WAAY,gBAAgB;IAC1B,yCAAyC;IACzC,uCAAmB,CAAA;IACnB,gDAAgD;IAChD,yCAAqB,CAAA;IACrB,yCAAyC;IACzC,yCAAqB,CAAA;IACrB,0DAA0D;IAC1D,uCAAmB,CAAA;AACrB,CAAC,EATW,gBAAgB,gCAAhB,gBAAgB,QAS3B"}
|
|
@@ -12,10 +12,11 @@ const entity_1 = require("./entity");
|
|
|
12
12
|
// ROLE PERMISSION MAPPINGS
|
|
13
13
|
// ========================================
|
|
14
14
|
/**
|
|
15
|
-
* Permission set for the
|
|
16
|
-
* Full access
|
|
15
|
+
* Permission set for the Owner role (organizations only).
|
|
16
|
+
* Full access including user management, project and endpoint management.
|
|
17
|
+
* Organizations have exactly one owner; personal entities don't use this role.
|
|
17
18
|
*/
|
|
18
|
-
const
|
|
19
|
+
const OWNER_PERMISSIONS = {
|
|
19
20
|
canViewEntity: true,
|
|
20
21
|
canEditEntity: true,
|
|
21
22
|
canDeleteEntity: true,
|
|
@@ -28,12 +29,13 @@ const ADMIN_PERMISSIONS = {
|
|
|
28
29
|
canViewApiKeys: true,
|
|
29
30
|
};
|
|
30
31
|
/**
|
|
31
|
-
* Permission set for the
|
|
32
|
-
* Can manage projects and
|
|
32
|
+
* Permission set for the Admin role.
|
|
33
|
+
* Can manage projects and endpoints, but cannot manage users.
|
|
34
|
+
* This is the default role for personal entities.
|
|
33
35
|
*/
|
|
34
|
-
const
|
|
36
|
+
const ADMIN_PERMISSIONS = {
|
|
35
37
|
canViewEntity: true,
|
|
36
|
-
canEditEntity:
|
|
38
|
+
canEditEntity: true,
|
|
37
39
|
canDeleteEntity: false,
|
|
38
40
|
canManageMembers: false,
|
|
39
41
|
canInviteMembers: false,
|
|
@@ -44,10 +46,10 @@ const MANAGER_PERMISSIONS = {
|
|
|
44
46
|
canViewApiKeys: true,
|
|
45
47
|
};
|
|
46
48
|
/**
|
|
47
|
-
* Permission set for the
|
|
48
|
-
* Read-only access to projects and
|
|
49
|
+
* Permission set for the Member role.
|
|
50
|
+
* Read-only access to projects and endpoints.
|
|
49
51
|
*/
|
|
50
|
-
const
|
|
52
|
+
const MEMBER_PERMISSIONS = {
|
|
51
53
|
canViewEntity: true,
|
|
52
54
|
canEditEntity: false,
|
|
53
55
|
canDeleteEntity: false,
|
|
@@ -64,9 +66,9 @@ const VIEWER_PERMISSIONS = {
|
|
|
64
66
|
* Used by permission checking utilities.
|
|
65
67
|
*/
|
|
66
68
|
exports.ROLE_PERMISSIONS = {
|
|
69
|
+
[entity_1.EntityRole.OWNER]: OWNER_PERMISSIONS,
|
|
67
70
|
[entity_1.EntityRole.ADMIN]: ADMIN_PERMISSIONS,
|
|
68
|
-
[entity_1.EntityRole.
|
|
69
|
-
[entity_1.EntityRole.VIEWER]: VIEWER_PERMISSIONS,
|
|
71
|
+
[entity_1.EntityRole.MEMBER]: MEMBER_PERMISSIONS,
|
|
70
72
|
};
|
|
71
73
|
// ========================================
|
|
72
74
|
// UTILITY FUNCTIONS
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../../src/types/entity/permissions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAMtC;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,2CAA2C;IAC3C,aAAa,EAAE,OAAO,CAAC;IACvB,gDAAgD;IAChD,aAAa,EAAE,OAAO,CAAC;IACvB,iDAAiD;IACjD,eAAe,EAAE,OAAO,CAAC;IACzB,mDAAmD;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ChB,UAAU,EAAE,MAAM,iBAAiB,GAClC,OAAO,CAET"}
|
|
@@ -12,10 +12,11 @@ const entity_1 = require("./entity");
|
|
|
12
12
|
// ROLE PERMISSION MAPPINGS
|
|
13
13
|
// ========================================
|
|
14
14
|
/**
|
|
15
|
-
* Permission set for the
|
|
16
|
-
* Full access
|
|
15
|
+
* Permission set for the Owner role (organizations only).
|
|
16
|
+
* Full access including user management, project and endpoint management.
|
|
17
|
+
* Organizations have exactly one owner; personal entities don't use this role.
|
|
17
18
|
*/
|
|
18
|
-
const
|
|
19
|
+
const OWNER_PERMISSIONS = {
|
|
19
20
|
canViewEntity: true,
|
|
20
21
|
canEditEntity: true,
|
|
21
22
|
canDeleteEntity: true,
|
|
@@ -28,12 +29,13 @@ const ADMIN_PERMISSIONS = {
|
|
|
28
29
|
canViewApiKeys: true,
|
|
29
30
|
};
|
|
30
31
|
/**
|
|
31
|
-
* Permission set for the
|
|
32
|
-
* Can manage projects and
|
|
32
|
+
* Permission set for the Admin role.
|
|
33
|
+
* Can manage projects and endpoints, but cannot manage users.
|
|
34
|
+
* This is the default role for personal entities.
|
|
33
35
|
*/
|
|
34
|
-
const
|
|
36
|
+
const ADMIN_PERMISSIONS = {
|
|
35
37
|
canViewEntity: true,
|
|
36
|
-
canEditEntity:
|
|
38
|
+
canEditEntity: true,
|
|
37
39
|
canDeleteEntity: false,
|
|
38
40
|
canManageMembers: false,
|
|
39
41
|
canInviteMembers: false,
|
|
@@ -44,10 +46,10 @@ const MANAGER_PERMISSIONS = {
|
|
|
44
46
|
canViewApiKeys: true,
|
|
45
47
|
};
|
|
46
48
|
/**
|
|
47
|
-
* Permission set for the
|
|
48
|
-
* Read-only access to projects and
|
|
49
|
+
* Permission set for the Member role.
|
|
50
|
+
* Read-only access to projects and endpoints.
|
|
49
51
|
*/
|
|
50
|
-
const
|
|
52
|
+
const MEMBER_PERMISSIONS = {
|
|
51
53
|
canViewEntity: true,
|
|
52
54
|
canEditEntity: false,
|
|
53
55
|
canDeleteEntity: false,
|
|
@@ -64,9 +66,9 @@ const VIEWER_PERMISSIONS = {
|
|
|
64
66
|
* Used by permission checking utilities.
|
|
65
67
|
*/
|
|
66
68
|
exports.ROLE_PERMISSIONS = {
|
|
69
|
+
[entity_1.EntityRole.OWNER]: OWNER_PERMISSIONS,
|
|
67
70
|
[entity_1.EntityRole.ADMIN]: ADMIN_PERMISSIONS,
|
|
68
|
-
[entity_1.EntityRole.
|
|
69
|
-
[entity_1.EntityRole.VIEWER]: VIEWER_PERMISSIONS,
|
|
71
|
+
[entity_1.EntityRole.MEMBER]: MEMBER_PERMISSIONS,
|
|
70
72
|
};
|
|
71
73
|
// ========================================
|
|
72
74
|
// UTILITY FUNCTIONS
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions.js","sourceRoot":"","sources":["../../../src/types/entity/permissions.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;
|
|
1
|
+
{"version":3,"file":"permissions.js","sourceRoot":"","sources":["../../../src/types/entity/permissions.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AA+GH,sDAEC;AAQD,sCAKC;AA5HD,qCAAsC;AAiCtC,2CAA2C;AAC3C,2BAA2B;AAC3B,2CAA2C;AAE3C;;;;GAIG;AACH,MAAM,iBAAiB,GAAsB;IAC3C,aAAa,EAAE,IAAI;IACnB,aAAa,EAAE,IAAI;IACnB,eAAe,EAAE,IAAI;IACrB,gBAAgB,EAAE,IAAI;IACtB,gBAAgB,EAAE,IAAI;IACtB,iBAAiB,EAAE,IAAI;IACvB,iBAAiB,EAAE,IAAI;IACvB,eAAe,EAAE,IAAI;IACrB,gBAAgB,EAAE,IAAI;IACtB,cAAc,EAAE,IAAI;CACrB,CAAC;AAEF;;;;GAIG;AACH,MAAM,iBAAiB,GAAsB;IAC3C,aAAa,EAAE,IAAI;IACnB,aAAa,EAAE,IAAI;IACnB,eAAe,EAAE,KAAK;IACtB,gBAAgB,EAAE,KAAK;IACvB,gBAAgB,EAAE,KAAK;IACvB,iBAAiB,EAAE,IAAI;IACvB,iBAAiB,EAAE,IAAI;IACvB,eAAe,EAAE,IAAI;IACrB,gBAAgB,EAAE,IAAI;IACtB,cAAc,EAAE,IAAI;CACrB,CAAC;AAEF;;;GAGG;AACH,MAAM,kBAAkB,GAAsB;IAC5C,aAAa,EAAE,IAAI;IACnB,aAAa,EAAE,KAAK;IACpB,eAAe,EAAE,KAAK;IACtB,gBAAgB,EAAE,KAAK;IACvB,gBAAgB,EAAE,KAAK;IACvB,iBAAiB,EAAE,KAAK;IACxB,iBAAiB,EAAE,KAAK;IACxB,eAAe,EAAE,IAAI;IACrB,gBAAgB,EAAE,KAAK;IACvB,cAAc,EAAE,IAAI;CACrB,CAAC;AAEF;;;GAGG;AACU,QAAA,gBAAgB,GAA0C;IACrE,CAAC,mBAAU,CAAC,KAAK,CAAC,EAAE,iBAAiB;IACrC,CAAC,mBAAU,CAAC,KAAK,CAAC,EAAE,iBAAiB;IACrC,CAAC,mBAAU,CAAC,MAAM,CAAC,EAAE,kBAAkB;CACxC,CAAC;AAEF,2CAA2C;AAC3C,oBAAoB;AACpB,2CAA2C;AAE3C;;;;GAIG;AACH,SAAgB,qBAAqB,CAAC,IAAgB;IACpD,OAAO,wBAAgB,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC;AAED;;;;;GAKG;AACH,SAAgB,aAAa,CAC3B,IAAgB,EAChB,UAAmC;IAEnC,OAAO,wBAAgB,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,CAAC;AAC5C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sudobility/types",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.43",
|
|
4
4
|
"description": "Comprehensive TypeScript types, interfaces, and utilities for Web3 email applications - optimized for AI-assisted development",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|