@agility/management-sdk 0.1.32 → 0.1.33

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.
@@ -0,0 +1,275 @@
1
+ # API Methods Documentation Manifest - Modular Structure
2
+
3
+ ## Overview
4
+ Comprehensive documentation restructure for all API method classes in `/src/apiMethods/` folder. This manifest organizes the work into a modular documentation system with separate files for each method class, improving navigation and maintainability.
5
+
6
+ ## New Documentation Structure
7
+
8
+ ### Main README.md
9
+ - **Concise Overview** - Introduction, getting started, authentication
10
+ - **Method Class Index** - Links to individual documentation files
11
+ - **Quick Reference** - Brief description of each method class
12
+ - **Global Examples** - Cross-method workflow examples
13
+
14
+ ### Individual Method Documentation (`./docs/`)
15
+ Each method class gets its own documentation file following this structure:
16
+
17
+ ```
18
+ ./docs/
19
+ ├── asset-methods.md # AssetMethods - File and media management
20
+ ├── batch-methods.md # BatchMethods - Batch workflow operations
21
+ ├── container-methods.md # ContainerMethods - Container management
22
+ ├── content-methods.md # ContentMethods - Content item operations
23
+ ├── instance-methods.md # InstanceMethods - Instance-level operations
24
+ ├── instance-user-methods.md # InstanceUserMethods - Instance user management
25
+ ├── model-methods.md # ModelMethods - Content model operations
26
+ ├── page-methods.md # PageMethods - Page management operations
27
+ ├── server-user-methods.md # ServerUserMethods - Server user operations
28
+ └── webhook-methods.md # WebhookMethods - Webhook management
29
+ ```
30
+
31
+ ### Individual File Structure Template
32
+ ```markdown
33
+ # Agility CMS & Management API TypeScript SDK
34
+
35
+ ## [Method Class Name] Methods
36
+
37
+ [Description of the method class and its purpose]
38
+
39
+ **Important Notes:**
40
+ - Key information about the class
41
+ - Usage patterns and best practices
42
+
43
+ ### Function List
44
+ - [functionName1](#functionname1) - Brief description
45
+ - [functionName2](#functionname2) - Brief description
46
+
47
+ ### [Function Documentation]
48
+ [All function details with examples]
49
+
50
+ ---
51
+
52
+ ## Navigation
53
+ - [← Back to Main Documentation](../README.md)
54
+ - [AssetMethods](./asset-methods.md)
55
+ - [BatchMethods](./batch-methods.md)
56
+ - [ContainerMethods](./container-methods.md)
57
+ - [ContentMethods](./content-methods.md)
58
+ - [InstanceMethods](./instance-methods.md)
59
+ - [InstanceUserMethods](./instance-user-methods.md)
60
+ - [ModelMethods](./model-methods.md)
61
+ - [PageMethods](./page-methods.md)
62
+ - [ServerUserMethods](./server-user-methods.md)
63
+ - [WebhookMethods](./webhook-methods.md)
64
+ ```
65
+
66
+ ## Method Classes Overview
67
+ 1. **AssetMethods** (15 functions) - File and media management operations
68
+ 2. **BatchMethods** (7 functions) - Batch workflow operations
69
+ 3. **ContainerMethods** (8 functions) - Container management operations
70
+ 4. **ContentMethods** (13 functions) - Content item operations
71
+ 5. **InstanceMethods** (1 function) - Instance-level operations
72
+ 6. **InstanceUserMethods** (3 functions) - Instance user management
73
+ 7. **ModelMethods** (6 functions) - Content model operations
74
+ 8. **PageMethods** (17 functions) - Page management operations
75
+ 9. **ServerUserMethods** (2 functions) - Server user operations
76
+ 10. **WebhookMethods** (4 functions) - Webhook management operations
77
+
78
+ ## Benefits of Modular Structure
79
+ - ✅ **Better Navigation** - Easy to find specific method documentation
80
+ - ✅ **Improved Maintainability** - Individual files are easier to update
81
+ - ✅ **Faster Loading** - Users only load documentation they need
82
+ - ✅ **Better GitHub Experience** - Each file has reasonable size for web viewing
83
+ - ✅ **Searchability** - Easier to search within specific method documentation
84
+ - ✅ **Professional Structure** - Follows modern API documentation patterns
85
+
86
+ ## Implementation Phases
87
+
88
+ ### Phase 1: Modular Structure Setup
89
+ - [x] ✅ Create `./docs/` directory structure
90
+ - [x] ✅ Design individual file templates with navigation
91
+ - [x] ✅ Restructure main README to be concise with method index
92
+ - [ ] Set up cross-linking between documentation files
93
+
94
+ ### Phase 2: AssetMethods Documentation (`./docs/asset-methods.md`)
95
+ - [x] ✅ Create asset-methods.md file with 15 functions
96
+ - [x] ✅ Move existing AssetMethods documentation to new file
97
+ - [x] ✅ Add function list table of contents
98
+ - [x] ✅ Add navigation footer
99
+ - Functions: deleteFile, moveFile, getMediaList, getGalleries, getGalleryById, getGalleryByName, getDefaultContainer, saveGallery, deleteGallery, getAssetByID, getAssetByUrl, upload, createFolder, deleteFolder, renameFolder
100
+
101
+ ### Phase 3: BatchMethods Documentation (`./docs/batch-methods.md`)
102
+ - [ ] Create batch-methods.md file with 7 functions
103
+ - [ ] Move existing BatchMethods documentation to new file
104
+ - [ ] Add function list table of contents
105
+ - [ ] Add navigation footer
106
+ - Functions: getBatch, publishBatch, unpublishBatch, approveBatch, declineBatch, requestApprovalBatch, getBatchTypes
107
+
108
+ ### Phase 4: ContainerMethods Documentation (`./docs/container-methods.md`)
109
+ - [ ] Create container-methods.md file with 8 functions
110
+ - [ ] Move existing ContainerMethods documentation to new file
111
+ - [ ] Add function list table of contents
112
+ - [ ] Add navigation footer
113
+ - Functions: getContainerByID, getContainersByModel, getContainerByReferenceName, getContainerSecurity, getContainerList, getNotificationList, saveContainer, deleteContainer
114
+
115
+ ### Phase 5: ContentMethods Documentation (`./docs/content-methods.md`)
116
+ - [ ] Create content-methods.md file with 13 functions
117
+ - [ ] Document all functions with returnBatchId flag support
118
+ - [ ] Add function list table of contents
119
+ - [ ] Add navigation footer
120
+ - Functions: getContentItem, publishContent, unPublishContent, contentRequestApproval, approveContent, declineContent, deleteContent, saveContentItem, saveContentItems, getContentItems, getContentList, getContentHistory, getContentComments
121
+
122
+ ### Phase 6: InstanceMethods Documentation (`./docs/instance-methods.md`)
123
+ - [ ] Create instance-methods.md file with 1 function
124
+ - [ ] Document getLocales function
125
+ - [ ] Add function list table of contents
126
+ - [ ] Add navigation footer
127
+ - Functions: getLocales
128
+
129
+ ### Phase 7: InstanceUserMethods Documentation (`./docs/instance-user-methods.md`)
130
+ - [ ] Create instance-user-methods.md file with 3 functions
131
+ - [ ] Document all user management functions
132
+ - [ ] Add function list table of contents
133
+ - [ ] Add navigation footer
134
+ - Functions: getUsers, saveUser, deleteUser
135
+
136
+ ### Phase 8: ModelMethods Documentation (`./docs/model-methods.md`)
137
+ - [ ] Create model-methods.md file with 6 functions
138
+ - [ ] Document all content model functions
139
+ - [ ] Add function list table of contents
140
+ - [ ] Add navigation footer
141
+ - Functions: getContentModel, getModelByReferenceName, getContentModules, getPageModules, saveModel, deleteModel
142
+
143
+ ### Phase 9: PageMethods Documentation (`./docs/page-methods.md`)
144
+ - [ ] Create page-methods.md file with 17 functions
145
+ - [ ] Document all functions with returnBatchId flag support
146
+ - [ ] Add function list table of contents
147
+ - [ ] Add navigation footer
148
+ - Functions: getSitemap, getPageTemplates, getPageTemplate, getPageTemplateName, deletePageTemplate, getPageItemTemplates, savePageTemplate, getPage, publishPage, unPublishPage, pageRequestApproval, approvePage, declinePage, deletePage, savePage, getPageHistory, getPageComments
149
+
150
+ ### Phase 10: ServerUserMethods Documentation (`./docs/server-user-methods.md`)
151
+ - [ ] Create server-user-methods.md file with 2 functions
152
+ - [ ] Document server user functions
153
+ - [ ] Add function list table of contents
154
+ - [ ] Add navigation footer
155
+ - Functions: me, you
156
+
157
+ ### Phase 11: WebhookMethods Documentation (`./docs/webhook-methods.md`)
158
+ - [ ] Create webhook-methods.md file with 4 functions
159
+ - [ ] Document all webhook functions
160
+ - [ ] Add function list table of contents
161
+ - [ ] Add navigation footer
162
+ - Functions: webhookList, saveWebhook, getWebhook, deleteWebhook
163
+
164
+ ### Phase 12: Final Review & Polish
165
+ - [ ] Review cross-linking between all documentation files
166
+ - [ ] Ensure consistent formatting across all method files
167
+ - [ ] Validate all navigation links work correctly
168
+ - [ ] Test all code examples
169
+ - [ ] Final proofreading across all documentation files
170
+ - [ ] Update main README with final method index
171
+
172
+ ## Documentation Template Standards
173
+
174
+ ### Main README Template
175
+ ```markdown
176
+ # Agility CMS & Management API TypeScript SDK
177
+
178
+ ## Table of Contents
179
+ - [Getting Started](#getting-started)
180
+ - [API Method Classes](#api-method-classes)
181
+ - [Examples](#examples)
182
+
183
+ ## Getting Started
184
+ [Authentication and setup information]
185
+
186
+ ## API Method Classes
187
+ - [AssetMethods](./docs/asset-methods.md) - File and media management (15 functions)
188
+ - [BatchMethods](./docs/batch-methods.md) - Batch workflow operations (7 functions)
189
+ - [ContainerMethods](./docs/container-methods.md) - Container management (8 functions)
190
+ - [ContentMethods](./docs/content-methods.md) - Content item operations (13 functions)
191
+ - [InstanceMethods](./docs/instance-methods.md) - Instance-level operations (1 function)
192
+ - [InstanceUserMethods](./docs/instance-user-methods.md) - Instance user management (3 functions)
193
+ - [ModelMethods](./docs/model-methods.md) - Content model operations (6 functions)
194
+ - [PageMethods](./docs/page-methods.md) - Page management operations (17 functions)
195
+ - [ServerUserMethods](./docs/server-user-methods.md) - Server user operations (2 functions)
196
+ - [WebhookMethods](./docs/webhook-methods.md) - Webhook management (4 functions)
197
+
198
+ ## Examples
199
+ [Cross-method workflow examples]
200
+ ```
201
+
202
+ ### Individual Method File Template
203
+ ```markdown
204
+ # Agility CMS & Management API TypeScript SDK
205
+
206
+ ## [MethodName] Methods
207
+
208
+ Brief description of the method class purpose and scope.
209
+
210
+ **Important Notes:**
211
+ - Key information about the class
212
+ - Usage patterns and best practices
213
+
214
+ ### Function List
215
+ - [functionName1](#functionname1) - Brief description
216
+ - [functionName2](#functionname2) - Brief description
217
+
218
+ ### [functionName]
219
+ Brief description of what this function does.
220
+
221
+ | Parameter | Type | Required | Description |
222
+ |-----------|------|----------|-------------|
223
+ | `param1` | `type` | Yes | Description |
224
+ | `param2` | `type` | No | Description *(Optional)* |
225
+
226
+ **Returns:** `ReturnType` - Description of what is returned
227
+
228
+ **Usage Example:**
229
+ ```typescript
230
+ // Example usage
231
+ const result = await apiClient.methodName.functionName(param1, param2);
232
+ ```
233
+
234
+ **Error Handling:**
235
+ - Throws `Exception` when [condition]
236
+
237
+ ---
238
+
239
+ ## Navigation
240
+ - [← Back to Main Documentation](../README.md)
241
+ - [AssetMethods](./asset-methods.md)
242
+ - [BatchMethods](./batch-methods.md)
243
+ - [ContainerMethods](./container-methods.md)
244
+ - [ContentMethods](./content-methods.md)
245
+ - [InstanceMethods](./instance-methods.md)
246
+ - [InstanceUserMethods](./instance-user-methods.md)
247
+ - [ModelMethods](./model-methods.md)
248
+ - [PageMethods](./page-methods.md)
249
+ - [ServerUserMethods](./server-user-methods.md)
250
+ - [WebhookMethods](./webhook-methods.md)
251
+ ```
252
+
253
+ ### Key Features to Highlight
254
+ - **Modular Structure:** Easy navigation between method documentation
255
+ - **Batch Methods:** Emphasize returnBatchId flags for advanced users
256
+ - **Optional Parameters:** Clear indication of default values
257
+ - **Return Types:** Precise type information
258
+ - **Error Scenarios:** Common error conditions and handling
259
+ - **Navigation:** Consistent cross-linking between all documentation files
260
+
261
+ ## Progress Tracking
262
+ - **Total Functions:** 76 functions across 10 method classes
263
+ - **Total Documentation Files:** 10 individual method documentation files + 1 main README
264
+ - **Completed:** 2 files (Main README restructure + AssetMethods complete)
265
+ - **Remaining:** 9 files (9 method docs remaining)
266
+ - **Current Phase:** Phase 3 (BatchMethods Documentation)
267
+
268
+ ## Success Criteria
269
+ - [ ] All 76 functions documented across 10 individual method files
270
+ - [ ] Consistent formatting and navigation across all documentation files
271
+ - [ ] Main README with clean method index and links to all documentation
272
+ - [ ] Cross-linking navigation between all documentation files
273
+ - [ ] All code examples tested and functional
274
+ - [ ] Improved readability and developer experience with modular structure
275
+ - [ ] Professional documentation structure following modern API documentation patterns
@@ -0,0 +1,111 @@
1
+ # API Functions Analysis - Actual Source Code
2
+
3
+ ## Complete Function Inventory
4
+
5
+ ### 1. AssetMethods (15 functions)
6
+ - `deleteFile(mediaID: number, guid: string)`
7
+ - `moveFile(mediaID: number, newFolder: string, guid: string)`
8
+ - `getMediaList(pageSize: number, recordOffset: number, guid: string)`
9
+ - `getGalleries(guid: string, search: string = null, pageSize: number = null, rowIndex: number = null)`
10
+ - `getGalleryById(guid: string, id: number)`
11
+ - `getGalleryByName(guid: string, galleryName: string)`
12
+ - `getDefaultContainer(guid: string)`
13
+ - `saveGallery(guid: string, gallery: assetMediaGrouping)`
14
+ - `deleteGallery(guid: string, id: number)`
15
+ - `getAssetByID(mediaID: number, guid: string)`
16
+ - `getAssetByUrl(url: string, guid: string)`
17
+ - `upload(formData: any, agilityFolderPath: string, guid: string, groupingID: number = -1)`
18
+ - `createFolder(originKey: string, guid: string)`
19
+ - `deleteFolder(originKey: string, guid: string, mediaID: number = 0)`
20
+ - `renameFolder(folderName: string, newFolderName: string, guid: string, mediaID: number = 0)`
21
+
22
+ ### 2. BatchMethods (7 functions)
23
+ - `getBatch(batchID: number, guid: string, expandItems: boolean = true)`
24
+ - `publishBatch(batchID: number, guid: string, returnBatchId: boolean = false)`
25
+ - `unpublishBatch(batchID: number, guid: string, returnBatchId: boolean = false)`
26
+ - `approveBatch(batchID: number, guid: string, returnBatchId: boolean = false)`
27
+ - `declineBatch(batchID: number, guid: string, returnBatchId: boolean = false)`
28
+ - `requestApprovalBatch(batchID: number, guid: string, returnBatchId: boolean = false)`
29
+ - `getBatchTypes(guid: string)`
30
+
31
+ ### 3. ContainerMethods (8 functions)
32
+ - `getContainerByID(id: number, guid: string)`
33
+ - `getContainersByModel(modelId: number, guid: string)`
34
+ - `getContainerByReferenceName(referenceName: string, guid: string)`
35
+ - `getContainerSecurity(id: number, guid: string)`
36
+ - `getContainerList(guid: string)`
37
+ - `getNotificationList(id: number, guid: string)`
38
+ - `saveContainer(container: Container, guid: string, forceReferenceName: boolean = false)`
39
+ - `deleteContainer(id: number, guid: string)`
40
+
41
+ ### 4. ContentMethods (13 functions)
42
+ - `getContentItem(contentID: number, guid: string, locale: string)`
43
+ - `publishContent(contentID: number, guid: string, locale: string, comments: string = null, returnBatchId: boolean = false)`
44
+ - `unPublishContent(contentID: number, guid: string, locale: string, comments: string = null, returnBatchId: boolean = false)`
45
+ - `contentRequestApproval(contentID: number, guid: string, locale: string, comments: string = null, returnBatchId: boolean = false)`
46
+ - `approveContent(contentID: number, guid: string, locale: string, comments: string = null, returnBatchId: boolean = false)`
47
+ - `declineContent(contentID: number, guid: string, locale: string, comments: string = null, returnBatchId: boolean = false)`
48
+ - `deleteContent(contentID: number, guid: string, locale: string, comments: string = null, returnBatchId: boolean = false)`
49
+ - `saveContentItem(contentItem: ContentItem, guid: string, locale: string, returnBatchId: boolean = false)`
50
+ - `saveContentItems(contentItems: ContentItem[], guid: string, locale: string, returnBatchId: boolean = false)`
51
+ - `getContentItems(referenceName: string, guid: string, locale: string, listParams: ListParams)`
52
+ - `getContentList(referenceName: string, guid: string, locale: string, listParams: ListParams, filterObject: ContentListFilterModel = null)`
53
+ - `getContentHistory(locale: string, guid: string, contentID: number, take: number = 50, skip: number = 0)`
54
+ - `getContentComments(locale: string, guid: string, contentID: number, take: number = 50, skip: number = 0)`
55
+
56
+ ### 5. InstanceMethods (1 function)
57
+ - `getLocales(guid: string)` - **ONLY ONE FUNCTION**
58
+
59
+ ### 6. InstanceUserMethods (3 functions)
60
+ - `getUsers(guid: string)`
61
+ - `saveUser(emailAddress: string, roles: InstanceRole[], guid: string, firstName: string = null, lastName: string = null)`
62
+ - `deleteUser(userId: number, guid: string)`
63
+
64
+ ### 7. ModelMethods (6 functions)
65
+ - `getContentModel(id: number, guid: string)`
66
+ - `getModelByReferenceName(referenceName: string, guid: string)`
67
+ - `getContentModules(includeDefaults: boolean, guid: string, includeModules: boolean = false)`
68
+ - `getPageModules(includeDefault: boolean, guid: string)`
69
+ - `saveModel(model: Model, guid: string)`
70
+ - `deleteModel(id: number, guid: string)`
71
+
72
+ ### 8. PageMethods (17 functions)
73
+ - `getSitemap(guid: string, locale: string)`
74
+ - `getPageTemplates(guid: string, locale: string, includeModuleZones: boolean, searchFilter: string = null)`
75
+ - `getPageTemplate(guid: string, locale: string, pageTemplateId: number)`
76
+ - `getPageTemplateName(guid: string, locale: string, templateName: string)`
77
+ - `deletePageTemplate(guid: string, locale: string, pageTemplateId: number)`
78
+ - `getPageItemTemplates(guid: string, locale: string, id: number)`
79
+ - `savePageTemplate(guid: string, locale: string, pageModel: PageModel)`
80
+ - `getPage(pageID: number, guid: string, locale: string)`
81
+ - `publishPage(pageID: number, guid: string, locale: string, comments: string = null, returnBatchId: boolean = false)`
82
+ - `unPublishPage(pageID: number, guid: string, locale: string, comments: string = null, returnBatchId: boolean = false)`
83
+ - `pageRequestApproval(pageID: number, guid: string, locale: string, comments: string = null, returnBatchId: boolean = false)`
84
+ - `approvePage(pageID: number, guid: string, locale: string, comments: string = null, returnBatchId: boolean = false)`
85
+ - `declinePage(pageID: number, guid: string, locale: string, comments: string = null, returnBatchId: boolean = false)`
86
+ - `deletePage(pageID: number, guid: string, locale: string, comments: string = null, returnBatchId: boolean = false)`
87
+ - `savePage(pageItem: PageItem, guid: string, locale: string, parentPageID: number = -1, placeBeforePageItemID: number = -1, returnBatchId: boolean = false)`
88
+ - `getPageHistory(locale: string, guid: string, pageID: number, take: number = 50, skip: number = 0)`
89
+ - `getPageComments(locale: string, guid: string, pageID: number, take: number = 50, skip: number = 0)`
90
+
91
+ ### 9. ServerUserMethods (2 functions)
92
+ - `me(guid: string)`
93
+ - `you(guid: string, serverUserID: number)`
94
+
95
+ ### 10. WebhookMethods (4 functions)
96
+ - `webhookList(guid: string, take: number = 20, token: string = null)`
97
+ - `saveWebhook(guid: string, webhook: Webhook)`
98
+ - `getWebhook(guid: string, webhookID: string)`
99
+ - `deleteWebhook(guid: string, webhookID: string)`
100
+
101
+ ## Total Functions: 76
102
+
103
+ ## Corrections Needed
104
+ - **ContentMethods**: I hallucinated functions like `getContentItemByLanguageCode`, `getContentItemHistory`, `getContentItemComments`, `getContentListByContainer`, etc.
105
+ - **InstanceMethods**: I hallucinated `getInstanceUsers` when the only function is `getLocales`
106
+ - Several parameter orders and types were incorrect
107
+
108
+ ## Next Steps
109
+ 1. Fix ContentMethods documentation completely
110
+ 2. Fix InstanceMethods documentation completely
111
+ 3. Verify other documentation files match actual source code
@@ -0,0 +1,278 @@
1
+ # Auth Tools Package Breakout Manifest
2
+
3
+ ## Overview
4
+
5
+ Extract authentication-related components from `agility-cms-management-sdk-typescript` into a separate `agilitycms-management-sdk-auth-tools` package to create a focused, reusable authentication toolkit.
6
+
7
+ ## Analysis Summary
8
+
9
+ ### Files to Move
10
+
11
+ #### React Components & Hooks
12
+ - `src/components/auth/AgilityAuth.tsx` (844 lines) - Main auth component
13
+ - `src/components/auth/TokenInfoModal.tsx` (133 lines) - Debug modal
14
+ - `src/components/auth/context/AuthContext.tsx` (266 lines) - Auth context provider
15
+ - `src/components/auth/hooks/useAgilityAuth.ts` (329 lines) - Main auth hook
16
+ - `src/components/auth/hooks/useWebsiteSelection.ts` (150 lines) - Website selection hook
17
+ - `src/components/auth/index.ts` (12 lines) - Component exports
18
+
19
+ #### Authentication Methods
20
+ - `src/clientMethods/authMethods.ts` (507 lines) - OAuth & token management
21
+ - `src/tokenStorage.ts` (305 lines) - Secure token storage
22
+
23
+ #### Models & Types
24
+ - `src/models/authComponent.ts` (102 lines) - Component interfaces
25
+ - `src/models/authConfig.ts` (276 lines) - Configuration interfaces
26
+ - `src/models/authState.ts` (207 lines) - State management types
27
+ - `src/models/authTokens.ts` (80 lines) - OAuth token types
28
+
29
+ #### Dependencies to Keep in Main SDK
30
+ - `src/models/serverUser.ts` - Required by auth but also by main SDK
31
+ - `src/models/websiteListing.ts` - Used by auth components
32
+ - `src/models/options.ts` - Shared configuration
33
+ - `src/models/exception.ts` - Error handling
34
+ - `src/apiMethods/clientInstance.ts` - HTTP client (partial dependency)
35
+
36
+ ---
37
+
38
+ ## Phase Breakdown
39
+
40
+ ### Phase 1: New Package Setup (Parallel Execution)
41
+ **Goal**: Create independent package structure with proper configuration
42
+
43
+ #### Tasks:
44
+ 1. **Package Structure** (Task 1A)
45
+ - Create `../agilitycms-management-sdk-auth-tools/` directory
46
+ - Set up `package.json` with proper dependencies
47
+ - Configure TypeScript (`tsconfig.json`)
48
+ - Set up build scripts and npm configuration
49
+ - Create README and documentation structure
50
+
51
+ 2. **Dependencies Analysis** (Task 1B)
52
+ - Map React dependencies (`react`, `react-dom`, `lucide-react`)
53
+ - Identify shared models that need to be duplicated or abstracted
54
+ - Plan interface contracts between packages
55
+ - Define peer dependency requirements
56
+
57
+ 3. **Build Configuration** (Task 1C)
58
+ - Configure TypeScript compilation
59
+ - Set up ESM/CJS dual build
60
+ - Configure bundling for browser compatibility
61
+ - Set up development build tools
62
+
63
+ ---
64
+
65
+ ### Phase 2: Model & Type Migration (Sequential within, Parallel between)
66
+ **Goal**: Move and adapt all authentication-related types and models
67
+
68
+ #### Tasks:
69
+ 2. **Core Models** (Task 2A) - *Depends on 1A*
70
+ - Move `authComponent.ts`, `authConfig.ts`, `authState.ts`, `authTokens.ts`
71
+ - Create local copies of required shared models (`serverUser.ts`, `exception.ts`)
72
+ - Update import paths within auth models
73
+ - Define external interfaces for main SDK integration
74
+
75
+ 3. **Shared Dependencies** (Task 2B) - *Depends on 2A*
76
+ - Create abstracted interfaces for `Options` integration
77
+ - Define `ClientInstance` interface contract
78
+ - Create minimal `Exception` handling for auth package
79
+ - Plan SDK integration points
80
+
81
+ ---
82
+
83
+ ### Phase 3: Core Authentication Logic (Sequential)
84
+ **Goal**: Move authentication methods and token management
85
+
86
+ #### Tasks:
87
+ 4. **Token Storage** (Task 3A) - *Depends on 2B*
88
+ - Move `tokenStorage.ts` to new package
89
+ - Update keytar dependencies
90
+ - Test cross-platform compatibility
91
+ - Ensure browser/Node.js environment handling
92
+
93
+ 5. **Auth Methods** (Task 3B) - *Depends on 3A*
94
+ - Move `authMethods.ts` to new package
95
+ - Abstract `ClientInstance` dependencies
96
+ - Create OAuth flow handlers
97
+ - Implement token refresh logic
98
+ - Define integration interface for main SDK
99
+
100
+ ---
101
+
102
+ ### Phase 4: React Components Migration (Parallel Execution)
103
+ **Goal**: Move all React components and hooks to new package
104
+
105
+ #### Tasks:
106
+ 6. **Context & State Management** (Task 4A) - *Depends on 2A*
107
+ - Move `AuthContext.tsx` and related hooks
108
+ - Update import paths for new models
109
+ - Test state management isolation
110
+ - Ensure proper React context boundaries
111
+
112
+ 7. **Core Components** (Task 4B) - *Depends on 4A, 3B*
113
+ - Move `AgilityAuth.tsx` main component
114
+ - Move `TokenInfoModal.tsx` debug component
115
+ - Update all imports to new package paths
116
+ - Test component integration with auth methods
117
+
118
+ 8. **Hooks & Utilities** (Task 4C) - *Depends on 4A, 3B*
119
+ - Move `useAgilityAuth.ts` and `useWebsiteSelection.ts`
120
+ - Update hook dependencies and imports
121
+ - Test hook functionality with new auth methods
122
+ - Ensure proper TypeScript integration
123
+
124
+ ---
125
+
126
+ ### Phase 5: Package Integration (Sequential)
127
+ **Goal**: Connect new package back to main SDK and update exports
128
+
129
+ #### Tasks:
130
+ 9. **Main SDK Updates** (Task 5A) - *Depends on 4B, 4C*
131
+ - Remove auth exports from main `src/index.ts`
132
+ - Remove auth components and methods from main package
133
+ - Update `package.json` to include new auth package as dependency
134
+ - Clean up unused files and imports
135
+
136
+ 10. **Integration Interface** (Task 5B) - *Depends on 5A, 3B*
137
+ - Create SDK adapter for auth package integration
138
+ - Implement `ApiClient` auth method delegation
139
+ - Ensure `authMethods` still works from main SDK
140
+ - Maintain backward compatibility for existing users
141
+
142
+ 11. **Export Configuration** (Task 5C) - *Depends on 5B*
143
+ - Configure new package exports (`package.json` exports field)
144
+ - Set up proper TypeScript declaration files
145
+ - Test import/export functionality
146
+ - Document new usage patterns
147
+
148
+ ---
149
+
150
+ ### Phase 6: Testing & Documentation (Parallel Execution)
151
+ **Goal**: Verify functionality and provide comprehensive documentation
152
+
153
+ #### Tasks:
154
+ 12. **Integration Testing** (Task 6A) - *Depends on 5C*
155
+ - Test OAuth flow from new package
156
+ - Verify token storage functionality
157
+ - Test React component integration
158
+ - Ensure cross-platform compatibility (browser/Node.js)
159
+
160
+ 13. **Backward Compatibility** (Task 6B) - *Depends on 5C*
161
+ - Verify existing SDK usage patterns still work
162
+ - Test re-export functionality from main SDK
163
+ - Ensure no breaking changes for current users
164
+ - Create migration guide for advanced users
165
+
166
+ 14. **Documentation** (Task 6C) - *Can run in parallel with other Phase 6 tasks*
167
+ - Create comprehensive README for auth package
168
+ - Document component props and configuration options
169
+ - Create usage examples and tutorials
170
+ - Update main SDK documentation to reference auth package
171
+
172
+ ---
173
+
174
+ ## Key Dependencies & Critical Paths
175
+
176
+ ### Critical Path Analysis:
177
+ 1. **Package Setup** → **Models** → **Auth Methods** → **Components** → **Integration** → **Testing**
178
+ 2. Longest path: ~7 sequential dependencies
179
+ 3. Significant parallelization opportunities in Phases 1, 4, and 6
180
+
181
+ ### Shared Dependencies Resolution:
182
+ - **ServerUser**: Copy interface to auth package, maintain compatibility
183
+ - **Options**: Create abstract interface, implement adapter pattern
184
+ - **ClientInstance**: Extract HTTP interface, implement in both packages
185
+ - **Exception**: Create minimal version for auth package
186
+
187
+ ### Risk Mitigation:
188
+ - **Token Storage**: Test extensively across platforms
189
+ - **React Integration**: Ensure hooks work independently
190
+ - **TypeScript**: Maintain strict type safety across package boundaries
191
+ - **Build System**: Test both development and production builds
192
+
193
+ ---
194
+
195
+ ## Success Criteria
196
+
197
+ ### Phase Completion Criteria:
198
+ 1. ✅ New package builds successfully with all dependencies
199
+ 2. ✅ All authentication components work independently
200
+ 3. ✅ Main SDK maintains backward compatibility
201
+ 4. ✅ OAuth flow works end-to-end from new package
202
+ 5. ✅ Token storage works across all supported platforms
203
+ 6. ✅ TypeScript types are properly exported and imported
204
+ 7. ✅ Documentation is comprehensive and accurate
205
+
206
+ ### Quality Gates:
207
+ - All existing tests pass after migration
208
+ - No breaking changes for current SDK users
209
+ - New package follows semantic versioning
210
+ - All React components render without errors
211
+ - OAuth flow completes successfully in browser environment
212
+ - Token storage works in both Node.js and browser
213
+ - TypeScript compilation succeeds with strict settings
214
+
215
+ ---
216
+
217
+ ## Package Structure Preview
218
+
219
+ ```
220
+ agilitycms-management-sdk-auth-tools/
221
+ ├── package.json # New auth package config
222
+ ├── tsconfig.json # TypeScript configuration
223
+ ├── README.md # Package documentation
224
+ ├── src/
225
+ │ ├── index.ts # Main package exports
226
+ │ ├── components/ # React components
227
+ │ │ ├── AgilityAuth.tsx
228
+ │ │ ├── TokenInfoModal.tsx
229
+ │ │ ├── context/
230
+ │ │ │ └── AuthContext.tsx
231
+ │ │ └── hooks/
232
+ │ │ ├── useAgilityAuth.ts
233
+ │ │ └── useWebsiteSelection.ts
234
+ │ ├── auth/ # Authentication logic
235
+ │ │ ├── authMethods.ts
236
+ │ │ └── tokenStorage.ts
237
+ │ ├── models/ # Type definitions
238
+ │ │ ├── authComponent.ts
239
+ │ │ ├── authConfig.ts
240
+ │ │ ├── authState.ts
241
+ │ │ ├── authTokens.ts
242
+ │ │ ├── serverUser.ts # Local copy
243
+ │ │ └── shared.ts # Shared interfaces
244
+ │ └── adapters/ # SDK integration
245
+ │ └── sdkAdapter.ts
246
+ ├── dist/ # Built package
247
+ └── docs/ # Package documentation
248
+ ```
249
+
250
+ ---
251
+
252
+ ## Execution Strategy
253
+
254
+ ### Development Approach:
255
+ 1. **Create Feature Branch**: `feature/auth-package-breakout`
256
+ 2. **Incremental Development**: Complete phases in order, test at each step
257
+ 3. **Parallel Work**: Leverage task parallelization within phases
258
+ 4. **Quality Gates**: Don't proceed to next phase until current phase passes all criteria
259
+ 5. **Continuous Testing**: Run tests after each major change
260
+
261
+ ### Timeline Estimate:
262
+ - **Phase 1**: 2-3 hours (setup and configuration)
263
+ - **Phase 2**: 1-2 hours (models and types)
264
+ - **Phase 3**: 2-3 hours (auth methods and token storage)
265
+ - **Phase 4**: 3-4 hours (React components)
266
+ - **Phase 5**: 2-3 hours (integration)
267
+ - **Phase 6**: 2-3 hours (testing and documentation)
268
+
269
+ **Total Estimated Time**: 12-18 hours
270
+
271
+ ### Resource Requirements:
272
+ - Single developer can execute most tasks
273
+ - Some testing may benefit from multiple environment validation
274
+ - Documentation can be parallelized if resources available
275
+
276
+ ---
277
+
278
+ *This manifest will be updated as phases complete and new requirements are discovered.*