@solidactions/sdk 0.1.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 (167) hide show
  1. package/.claude/settings.local.json +7 -0
  2. package/.clavix/outputs/dbos-http-sdk/full-prd.md +142 -0
  3. package/.clavix/outputs/dbos-http-sdk/quick-prd.md +12 -0
  4. package/.clavix/outputs/dbos-http-sdk/tasks.md +630 -0
  5. package/.clavix/outputs/prompts/dbos-http-api-20260110-033219.md +91 -0
  6. package/.husky/pre-commit +1 -0
  7. package/.prettierignore +3 -0
  8. package/.prettierrc +9 -0
  9. package/CODE_OF_CONDUCT.md +49 -0
  10. package/CONTRIBUTING.md +47 -0
  11. package/LICENSE +21 -0
  12. package/README.md +172 -0
  13. package/dist/dbos-config.schema.json +132 -0
  14. package/dist/schemas/system_db_schema.d.ts +73 -0
  15. package/dist/schemas/system_db_schema.d.ts.map +1 -0
  16. package/dist/schemas/system_db_schema.js +3 -0
  17. package/dist/schemas/system_db_schema.js.map +1 -0
  18. package/dist/src/adminserver.d.ts +79 -0
  19. package/dist/src/adminserver.d.ts.map +1 -0
  20. package/dist/src/adminserver.js +495 -0
  21. package/dist/src/adminserver.js.map +1 -0
  22. package/dist/src/authdecorators.d.ts +2 -0
  23. package/dist/src/authdecorators.d.ts.map +1 -0
  24. package/dist/src/authdecorators.js +48 -0
  25. package/dist/src/authdecorators.js.map +1 -0
  26. package/dist/src/cli/cli.d.ts +9 -0
  27. package/dist/src/cli/cli.d.ts.map +1 -0
  28. package/dist/src/cli/cli.js +116 -0
  29. package/dist/src/cli/cli.js.map +1 -0
  30. package/dist/src/cli/commands.d.ts +3 -0
  31. package/dist/src/cli/commands.d.ts.map +1 -0
  32. package/dist/src/cli/commands.js +46 -0
  33. package/dist/src/cli/commands.js.map +1 -0
  34. package/dist/src/client.d.ts +85 -0
  35. package/dist/src/client.d.ts.map +1 -0
  36. package/dist/src/client.js +186 -0
  37. package/dist/src/client.js.map +1 -0
  38. package/dist/src/conductor/conductor.d.ts +28 -0
  39. package/dist/src/conductor/conductor.d.ts.map +1 -0
  40. package/dist/src/conductor/conductor.js +376 -0
  41. package/dist/src/conductor/conductor.js.map +1 -0
  42. package/dist/src/conductor/protocol.d.ts +238 -0
  43. package/dist/src/conductor/protocol.d.ts.map +1 -0
  44. package/dist/src/conductor/protocol.js +353 -0
  45. package/dist/src/conductor/protocol.js.map +1 -0
  46. package/dist/src/config.d.ts +91 -0
  47. package/dist/src/config.d.ts.map +1 -0
  48. package/dist/src/config.js +199 -0
  49. package/dist/src/config.js.map +1 -0
  50. package/dist/src/context.d.ts +62 -0
  51. package/dist/src/context.d.ts.map +1 -0
  52. package/dist/src/context.js +118 -0
  53. package/dist/src/context.js.map +1 -0
  54. package/dist/src/database_utils.d.ts +17 -0
  55. package/dist/src/database_utils.d.ts.map +1 -0
  56. package/dist/src/database_utils.js +53 -0
  57. package/dist/src/database_utils.js.map +1 -0
  58. package/dist/src/datasource.d.ts +109 -0
  59. package/dist/src/datasource.d.ts.map +1 -0
  60. package/dist/src/datasource.js +204 -0
  61. package/dist/src/datasource.js.map +1 -0
  62. package/dist/src/dbos-executor.d.ts +189 -0
  63. package/dist/src/dbos-executor.d.ts.map +1 -0
  64. package/dist/src/dbos-executor.js +817 -0
  65. package/dist/src/dbos-executor.js.map +1 -0
  66. package/dist/src/dbos.d.ts +519 -0
  67. package/dist/src/dbos.d.ts.map +1 -0
  68. package/dist/src/dbos.js +1282 -0
  69. package/dist/src/dbos.js.map +1 -0
  70. package/dist/src/debouncer.d.ts +33 -0
  71. package/dist/src/debouncer.d.ts.map +1 -0
  72. package/dist/src/debouncer.js +170 -0
  73. package/dist/src/debouncer.js.map +1 -0
  74. package/dist/src/debugpoint.d.ts +26 -0
  75. package/dist/src/debugpoint.d.ts.map +1 -0
  76. package/dist/src/debugpoint.js +65 -0
  77. package/dist/src/debugpoint.js.map +1 -0
  78. package/dist/src/decorators.d.ts +219 -0
  79. package/dist/src/decorators.d.ts.map +1 -0
  80. package/dist/src/decorators.js +873 -0
  81. package/dist/src/decorators.js.map +1 -0
  82. package/dist/src/error.d.ts +130 -0
  83. package/dist/src/error.d.ts.map +1 -0
  84. package/dist/src/error.js +290 -0
  85. package/dist/src/error.js.map +1 -0
  86. package/dist/src/http_client.d.ts +82 -0
  87. package/dist/src/http_client.d.ts.map +1 -0
  88. package/dist/src/http_client.js +286 -0
  89. package/dist/src/http_client.js.map +1 -0
  90. package/dist/src/http_system_database.d.ts +84 -0
  91. package/dist/src/http_system_database.d.ts.map +1 -0
  92. package/dist/src/http_system_database.js +429 -0
  93. package/dist/src/http_system_database.js.map +1 -0
  94. package/dist/src/index.d.ts +14 -0
  95. package/dist/src/index.d.ts.map +1 -0
  96. package/dist/src/index.js +53 -0
  97. package/dist/src/index.js.map +1 -0
  98. package/dist/src/scheduler/crontab.d.ts +14 -0
  99. package/dist/src/scheduler/crontab.d.ts.map +1 -0
  100. package/dist/src/scheduler/crontab.js +308 -0
  101. package/dist/src/scheduler/crontab.js.map +1 -0
  102. package/dist/src/scheduler/scheduler.d.ts +41 -0
  103. package/dist/src/scheduler/scheduler.d.ts.map +1 -0
  104. package/dist/src/scheduler/scheduler.js +165 -0
  105. package/dist/src/scheduler/scheduler.js.map +1 -0
  106. package/dist/src/serialization.d.ts +57 -0
  107. package/dist/src/serialization.d.ts.map +1 -0
  108. package/dist/src/serialization.js +306 -0
  109. package/dist/src/serialization.js.map +1 -0
  110. package/dist/src/solidactions-executor.d.ts +177 -0
  111. package/dist/src/solidactions-executor.d.ts.map +1 -0
  112. package/dist/src/solidactions-executor.js +817 -0
  113. package/dist/src/solidactions-executor.js.map +1 -0
  114. package/dist/src/solidactions.d.ts +519 -0
  115. package/dist/src/solidactions.d.ts.map +1 -0
  116. package/dist/src/solidactions.js +1284 -0
  117. package/dist/src/solidactions.js.map +1 -0
  118. package/dist/src/step.d.ts +16 -0
  119. package/dist/src/step.d.ts.map +1 -0
  120. package/dist/src/step.js +3 -0
  121. package/dist/src/step.js.map +1 -0
  122. package/dist/src/system_database.d.ts +141 -0
  123. package/dist/src/system_database.d.ts.map +1 -0
  124. package/dist/src/system_database.js +25 -0
  125. package/dist/src/system_database.js.map +1 -0
  126. package/dist/src/telemetry/collector.d.ts +13 -0
  127. package/dist/src/telemetry/collector.d.ts.map +1 -0
  128. package/dist/src/telemetry/collector.js +63 -0
  129. package/dist/src/telemetry/collector.js.map +1 -0
  130. package/dist/src/telemetry/exporters.d.ts +13 -0
  131. package/dist/src/telemetry/exporters.d.ts.map +1 -0
  132. package/dist/src/telemetry/exporters.js +101 -0
  133. package/dist/src/telemetry/exporters.js.map +1 -0
  134. package/dist/src/telemetry/logs.d.ts +52 -0
  135. package/dist/src/telemetry/logs.d.ts.map +1 -0
  136. package/dist/src/telemetry/logs.js +287 -0
  137. package/dist/src/telemetry/logs.js.map +1 -0
  138. package/dist/src/telemetry/traces.d.ts +52 -0
  139. package/dist/src/telemetry/traces.d.ts.map +1 -0
  140. package/dist/src/telemetry/traces.js +150 -0
  141. package/dist/src/telemetry/traces.js.map +1 -0
  142. package/dist/src/utils.d.ts +26 -0
  143. package/dist/src/utils.d.ts.map +1 -0
  144. package/dist/src/utils.js +136 -0
  145. package/dist/src/utils.js.map +1 -0
  146. package/dist/src/wfqueue.d.ts +64 -0
  147. package/dist/src/wfqueue.d.ts.map +1 -0
  148. package/dist/src/wfqueue.js +147 -0
  149. package/dist/src/wfqueue.js.map +1 -0
  150. package/dist/src/workflow.d.ts +154 -0
  151. package/dist/src/workflow.d.ts.map +1 -0
  152. package/dist/src/workflow.js +99 -0
  153. package/dist/src/workflow.js.map +1 -0
  154. package/dist/src/workflow_management.d.ts +15 -0
  155. package/dist/src/workflow_management.d.ts.map +1 -0
  156. package/dist/src/workflow_management.js +87 -0
  157. package/dist/src/workflow_management.js.map +1 -0
  158. package/dist/tsconfig.tsbuildinfo +1 -0
  159. package/docs/api-schema.md +1441 -0
  160. package/docs/migration-guide.md +460 -0
  161. package/docs/phase-14-changes.md +156 -0
  162. package/docs/solidsteps-ai-prompt.md +534 -0
  163. package/eslint.config.cjs +50 -0
  164. package/package.json +84 -0
  165. package/solidactions-ai-prompt.md +1504 -0
  166. package/solidactions-config.schema.json +132 -0
  167. package/solidactions-test-config.yaml +15 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(git fetch:*)"
5
+ ]
6
+ }
7
+ }
@@ -0,0 +1,142 @@
1
+ # Product Requirements Document: DBOS HTTP SDK Conversion
2
+
3
+ ## Problem & Goal
4
+
5
+ **Problem:** The DBOS TypeScript SDK currently requires direct PostgreSQL database credentials to function. This creates credential management overhead, tight coupling between SDK consumers and the database layer, and security concerns around distributing database access.
6
+
7
+ **Goal:** Replace all direct database operations in the SDK with HTTP API calls. SDK consumers should only need:
8
+
9
+ - An API endpoint URL
10
+ - An API key (auth token)
11
+
12
+ Laravel will serve as the API backend, owning the sole database connection. This decouples SDK users from database infrastructure entirely.
13
+
14
+ ## Requirements
15
+
16
+ ### Must-Have Features
17
+
18
+ 1. **Replace All Postgres Operations with HTTP Calls**
19
+
20
+ - Identify every Postgres read/write operation in the current SDK
21
+ - Create corresponding HTTP endpoints that mirror these operations
22
+ - SDK calls HTTP API instead of direct database queries
23
+ - Preserve all existing functionality (workflow state, step caching, signals, sleeps)
24
+
25
+ 2. **API Schema Documentation**
26
+
27
+ - Document all required HTTP endpoints
28
+ - Include request/response schemas for each endpoint
29
+ - Note atomicity requirements (where current code uses transactions)
30
+ - Format: OpenAPI/Swagger or detailed markdown
31
+
32
+ 3. **Error Handling (Best Practices)**
33
+ | HTTP Status | SDK Behavior |
34
+ |-------------|--------------|
35
+ | 2xx | Success - return data |
36
+ | 400 Bad Request | Throw validation error (don't retry) |
37
+ | 401 Unauthorized | Throw auth error (don't retry) |
38
+ | 404 Not Found | Throw not found error (don't retry) |
39
+ | 409 Conflict | Throw conflict error (don't retry) |
40
+ | 429 Rate Limited | Retry with backoff (respect Retry-After header) |
41
+ | 5xx Server Error | Retry with exponential backoff |
42
+ | Network Error | Retry with exponential backoff |
43
+
44
+ 4. **Retry Logic (Best Practices)**
45
+
46
+ - Exponential backoff with jitter (prevents thundering herd)
47
+ - Maximum 3 retry attempts for transient failures
48
+ - Only retry 5xx errors and network failures (not 4xx client errors)
49
+ - Configurable request timeout
50
+ - Respect `Retry-After` header when present
51
+
52
+ 5. **Authentication**
53
+ - API key authentication via `Authorization: Bearer <key>` header
54
+ - Standard Laravel Sanctum / API token pattern
55
+ - SDK accepts API key in configuration
56
+
57
+ ### Technical Requirements
58
+
59
+ **SDK Side (TypeScript):**
60
+
61
+ - Remove all direct Postgres/pg dependencies
62
+ - Add HTTP client (fetch or axios)
63
+ - Implement retry logic with exponential backoff
64
+ - Map HTTP errors to appropriate SDK exceptions
65
+ - Configuration: API URL + API key (instead of DB connection string)
66
+
67
+ **API Side (Laravel):**
68
+
69
+ - RESTful endpoints mirroring current DB operations
70
+ - API key authentication (Sanctum or custom)
71
+ - Atomic operations where current SDK uses transactions
72
+ - Proper HTTP status codes for all error conditions
73
+ - JSON request/response format
74
+
75
+ **Transport:**
76
+
77
+ - HTTPS only (TLS required)
78
+ - JSON content type
79
+ - Standard REST conventions
80
+
81
+ ## Out of Scope
82
+
83
+ | Excluded | Rationale |
84
+ | ---------------------------------- | ----------------------------------------------- |
85
+ | Backward compatibility (dual-mode) | Clean break - HTTP only, simplifies maintenance |
86
+ | User migration support | Not migrating existing users |
87
+ | New features | 1:1 replacement only, no feature additions |
88
+ | Multi-tenancy in SDK | Laravel handles tenant scoping via API key |
89
+ | WebSocket/real-time support | Not in current SDK, not adding |
90
+ | Batch/bulk operations | Only if already exists in current SDK |
91
+ | SDK-side caching | Keep SDK stateless, caching is server concern |
92
+ | Mobile SDK variants | TypeScript/Node only |
93
+
94
+ ## Success Criteria
95
+
96
+ 1. **Functional:** SDK can execute all current workflows without database credentials
97
+ 2. **Parity:** All existing DBOS functionality works identically over HTTP
98
+ 3. **Documentation:** Complete API schema ready for Laravel implementation
99
+ 4. **Clean:** All Postgres dependencies removed from SDK
100
+ 5. **Robust:** Proper error handling and retry logic for network failures
101
+
102
+ ## Implementation Approach
103
+
104
+ ### Phase 1: Analysis
105
+
106
+ 1. Audit current SDK codebase for all Postgres operations
107
+ 2. Document each operation's purpose, inputs, outputs
108
+ 3. Identify transaction boundaries (atomicity requirements)
109
+ 4. Map current exceptions to HTTP error codes
110
+
111
+ ### Phase 2: API Design
112
+
113
+ 1. Design HTTP endpoints mirroring DB operations
114
+ 2. Create OpenAPI/schema documentation
115
+ 3. Define request/response formats
116
+ 4. Document atomicity requirements for Laravel
117
+
118
+ ### Phase 3: SDK Modification
119
+
120
+ 1. Remove Postgres client dependencies
121
+ 2. Implement HTTP client with retry logic
122
+ 3. Replace all DB calls with HTTP calls
123
+ 4. Update configuration (URL + API key)
124
+ 5. Map HTTP errors to SDK exceptions
125
+
126
+ ### Phase 4: Validation
127
+
128
+ 1. Ensure all existing tests pass (with mocked HTTP)
129
+ 2. Integration testing against Laravel API
130
+ 3. Document removed dependencies
131
+
132
+ ## Deliverables
133
+
134
+ 1. **Modified SDK** - TypeScript SDK with HTTP transport (no Postgres)
135
+ 2. **API Schema Documentation** - Complete endpoint specifications for Laravel
136
+ 3. **Migration Guide** - What changed, new configuration format
137
+ 4. **Removed Dependencies List** - Postgres packages to remove from package.json
138
+
139
+ ---
140
+
141
+ _Generated with Clavix Planning Mode_
142
+ _Generated: 2026-01-10T03:35:00Z_
@@ -0,0 +1,12 @@
1
+ # DBOS HTTP SDK Conversion - Quick PRD
2
+
3
+ **Goal:** Modify the DBOS TypeScript SDK to replace all direct PostgreSQL database operations with HTTP API calls. The SDK should only require an API endpoint URL and API key for authentication - no database credentials. Laravel will serve as the API backend, owning the sole database connection. This is a clean break with no backward compatibility - HTTP transport only.
4
+
5
+ **Core Requirements:** (1) Replace every Postgres read/write operation with an equivalent HTTP call, preserving all existing functionality (workflow state, step caching, signals, sleeps). (2) Generate comprehensive API schema documentation for Laravel implementation, including request/response formats and atomicity requirements where transactions are currently used. (3) Implement error handling best practices: 4xx errors throw immediately without retry, 5xx and network errors retry with exponential backoff + jitter (max 3 attempts), respect Retry-After headers. (4) Authentication via `Authorization: Bearer <api-key>` header (standard Laravel Sanctum pattern).
6
+
7
+ **Boundaries:** No new features - this is a 1:1 transport layer replacement. No dual-mode support, no user migration, no WebSocket/real-time additions. Multi-tenancy is Laravel's concern (SDK just passes API key, Laravel determines tenant). Deliverables: modified SDK with HTTP transport, complete API schema documentation, and list of removed Postgres dependencies.
8
+
9
+ ---
10
+
11
+ _Generated with Clavix Planning Mode_
12
+ _Generated: 2026-01-10T03:35:00Z_