Skip to content

Conversation

@wagnert
Copy link
Member

@wagnert wagnert commented Nov 30, 2025

Summary

  • Factory Injection Pattern for dependency injection and testing support
  • Schema Introspection Methods for direct access to table/field definitions
  • Breaking Changes: Constructor signatures, runAsUserEmail now required

Changes

Factory Injection (#6)

  • AppSheetClientFactory / MockAppSheetClientFactory for DI
  • SchemaManager and ConnectionManager accept factory in constructor
  • Easy testing without mocking axios or network calls

Schema Introspection (#7)

  • getTableDefinition(connection, table) → TableDefinition
  • getFieldDefinition(connection, table, field) → FieldDefinition
  • getAllowedValues(connection, table, field) → string[] for Enum/EnumList

Breaking Changes

  • AppSheetClient: New constructor (connectionDef, runAsUserEmail)
  • SchemaManager: New constructor (clientFactory, schema)
  • runAsUserEmail is now required (not optional)

Test plan

  • All 221 tests passing
  • Build successful
  • Lint passes (0 errors)
  • Documentation updated (CHANGELOG, README, MIGRATION, CLAUDE.md)

Closes #6
Closes #7

🤖 Generated with Claude Code

wagnert and others added 6 commits November 30, 2025 18:35
…port

Add comprehensive concept document for breaking changes in v3.0.0:
- Factory pattern for AppSheetClient creation (DI support)
- AppSheetClient now accepts full ConnectionDefinition with getTable()
- DynamicTableFactory delegates to client.getTable() for TableDefinition
- ConnectionManager redesign with factory injection
- SchemaManager delegates to factories
- Per-request user context (runAsUserEmail) now required
- Schema validation flow documented (unchanged in DynamicTable)
- All examples use JSON format
- 7-phase implementation plan with 21 files to modify

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
…able()

BREAKING CHANGES:
- AppSheetClient constructor now takes (connectionDef, runAsUserEmail)
  instead of single config object
- MockAppSheetClient constructor signature also updated
- runAsUserEmail is now a required parameter (previously optional)
- Removed getConfig() method, replaced with getTable()

Changes:
- AppSheetClient: New constructor (ConnectionDefinition, runAsUserEmail)
- MockAppSheetClient: New constructor with optional MockDataProvider
- AppSheetClientInterface: Added getTable() method
- DynamicTable: Now accepts AppSheetClientInterface (enables DI)

This enables:
- Dependency injection with interface-based clients
- Easy testing with MockAppSheetClient
- Factory pattern support (Phase 2)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
New types:
- AppSheetClientFactoryInterface: Factory for creating clients
- DynamicTableFactoryInterface: Factory for creating tables

New factory classes:
- AppSheetClientFactory: Creates real AppSheetClient instances
- MockAppSheetClientFactory: Creates mock clients for testing
- DynamicTableFactory: Creates DynamicTable instances from schema

These factories enable:
- Dependency injection in ConnectionManager and SchemaManager
- Easy testing by swapping real factory with mock factory
- Pre-seeded test data via MockDataProvider

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
BREAKING CHANGES:
- AppSheetClient: new constructor(connectionDef, runAsUserEmail)
- MockAppSheetClient: new constructor(connectionDef, runAsUserEmail, dataProvider?)
- ConnectionManager: new constructor(clientFactory, schema) + get(name, userEmail)
- SchemaManager: new constructor(clientFactory, schema) + table(conn, table, userEmail)
- runAsUserEmail is now required (not optional)
- Removed: getConfig(), register(), remove(), clear(), ping(), healthCheck(),
  reload(), getConnectionManager()
- Added: getTable(), list(), has(), hasConnection(), hasTable()

Added:
- AppSheetClientFactory: Creates real AppSheetClient instances
- MockAppSheetClientFactory: Creates MockAppSheetClient instances for testing
- DynamicTableFactory: Creates DynamicTable instances from schema
- AppSheetClientFactoryInterface: Interface for custom factory implementations
- DynamicTableFactoryInterface: Interface for custom table factory implementations

Migration:
- Old: new AppSheetClient({ appId, applicationAccessKey, runAsUserEmail? })
- New: new AppSheetClient(connectionDef, runAsUserEmail)

- Old: new SchemaManager(schema) + table('conn', 'table')
- New: new SchemaManager(factory, schema) + table('conn', 'table', userEmail)

Test coverage: 205 tests across 8 test suites

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Add convenience methods to access schema metadata directly:
- getTableDefinition(connection, table): Returns TableDefinition
- getFieldDefinition(connection, table, field): Returns FieldDefinition
- getAllowedValues(connection, table, field): Returns string[] for Enum/EnumList

Use cases: Zod schema generation, OpenAPI spec, UI dropdowns, validation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- CHANGELOG.md: Add schema introspection methods (#7), update test count
- README.md: Update examples for v3.0.0 factory pattern and required userEmail
- MIGRATION.md: Add v2.x → v3.0.0 migration guide with breaking changes
- SOSO-249 concept: Add implementation status and schema introspection section

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@wagnert wagnert merged commit e783852 into develop Nov 30, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants