@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.
- package/.claude/settings.local.json +7 -0
- package/.clavix/outputs/dbos-http-sdk/full-prd.md +142 -0
- package/.clavix/outputs/dbos-http-sdk/quick-prd.md +12 -0
- package/.clavix/outputs/dbos-http-sdk/tasks.md +630 -0
- package/.clavix/outputs/prompts/dbos-http-api-20260110-033219.md +91 -0
- package/.husky/pre-commit +1 -0
- package/.prettierignore +3 -0
- package/.prettierrc +9 -0
- package/CODE_OF_CONDUCT.md +49 -0
- package/CONTRIBUTING.md +47 -0
- package/LICENSE +21 -0
- package/README.md +172 -0
- package/dist/dbos-config.schema.json +132 -0
- package/dist/schemas/system_db_schema.d.ts +73 -0
- package/dist/schemas/system_db_schema.d.ts.map +1 -0
- package/dist/schemas/system_db_schema.js +3 -0
- package/dist/schemas/system_db_schema.js.map +1 -0
- package/dist/src/adminserver.d.ts +79 -0
- package/dist/src/adminserver.d.ts.map +1 -0
- package/dist/src/adminserver.js +495 -0
- package/dist/src/adminserver.js.map +1 -0
- package/dist/src/authdecorators.d.ts +2 -0
- package/dist/src/authdecorators.d.ts.map +1 -0
- package/dist/src/authdecorators.js +48 -0
- package/dist/src/authdecorators.js.map +1 -0
- package/dist/src/cli/cli.d.ts +9 -0
- package/dist/src/cli/cli.d.ts.map +1 -0
- package/dist/src/cli/cli.js +116 -0
- package/dist/src/cli/cli.js.map +1 -0
- package/dist/src/cli/commands.d.ts +3 -0
- package/dist/src/cli/commands.d.ts.map +1 -0
- package/dist/src/cli/commands.js +46 -0
- package/dist/src/cli/commands.js.map +1 -0
- package/dist/src/client.d.ts +85 -0
- package/dist/src/client.d.ts.map +1 -0
- package/dist/src/client.js +186 -0
- package/dist/src/client.js.map +1 -0
- package/dist/src/conductor/conductor.d.ts +28 -0
- package/dist/src/conductor/conductor.d.ts.map +1 -0
- package/dist/src/conductor/conductor.js +376 -0
- package/dist/src/conductor/conductor.js.map +1 -0
- package/dist/src/conductor/protocol.d.ts +238 -0
- package/dist/src/conductor/protocol.d.ts.map +1 -0
- package/dist/src/conductor/protocol.js +353 -0
- package/dist/src/conductor/protocol.js.map +1 -0
- package/dist/src/config.d.ts +91 -0
- package/dist/src/config.d.ts.map +1 -0
- package/dist/src/config.js +199 -0
- package/dist/src/config.js.map +1 -0
- package/dist/src/context.d.ts +62 -0
- package/dist/src/context.d.ts.map +1 -0
- package/dist/src/context.js +118 -0
- package/dist/src/context.js.map +1 -0
- package/dist/src/database_utils.d.ts +17 -0
- package/dist/src/database_utils.d.ts.map +1 -0
- package/dist/src/database_utils.js +53 -0
- package/dist/src/database_utils.js.map +1 -0
- package/dist/src/datasource.d.ts +109 -0
- package/dist/src/datasource.d.ts.map +1 -0
- package/dist/src/datasource.js +204 -0
- package/dist/src/datasource.js.map +1 -0
- package/dist/src/dbos-executor.d.ts +189 -0
- package/dist/src/dbos-executor.d.ts.map +1 -0
- package/dist/src/dbos-executor.js +817 -0
- package/dist/src/dbos-executor.js.map +1 -0
- package/dist/src/dbos.d.ts +519 -0
- package/dist/src/dbos.d.ts.map +1 -0
- package/dist/src/dbos.js +1282 -0
- package/dist/src/dbos.js.map +1 -0
- package/dist/src/debouncer.d.ts +33 -0
- package/dist/src/debouncer.d.ts.map +1 -0
- package/dist/src/debouncer.js +170 -0
- package/dist/src/debouncer.js.map +1 -0
- package/dist/src/debugpoint.d.ts +26 -0
- package/dist/src/debugpoint.d.ts.map +1 -0
- package/dist/src/debugpoint.js +65 -0
- package/dist/src/debugpoint.js.map +1 -0
- package/dist/src/decorators.d.ts +219 -0
- package/dist/src/decorators.d.ts.map +1 -0
- package/dist/src/decorators.js +873 -0
- package/dist/src/decorators.js.map +1 -0
- package/dist/src/error.d.ts +130 -0
- package/dist/src/error.d.ts.map +1 -0
- package/dist/src/error.js +290 -0
- package/dist/src/error.js.map +1 -0
- package/dist/src/http_client.d.ts +82 -0
- package/dist/src/http_client.d.ts.map +1 -0
- package/dist/src/http_client.js +286 -0
- package/dist/src/http_client.js.map +1 -0
- package/dist/src/http_system_database.d.ts +84 -0
- package/dist/src/http_system_database.d.ts.map +1 -0
- package/dist/src/http_system_database.js +429 -0
- package/dist/src/http_system_database.js.map +1 -0
- package/dist/src/index.d.ts +14 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +53 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/scheduler/crontab.d.ts +14 -0
- package/dist/src/scheduler/crontab.d.ts.map +1 -0
- package/dist/src/scheduler/crontab.js +308 -0
- package/dist/src/scheduler/crontab.js.map +1 -0
- package/dist/src/scheduler/scheduler.d.ts +41 -0
- package/dist/src/scheduler/scheduler.d.ts.map +1 -0
- package/dist/src/scheduler/scheduler.js +165 -0
- package/dist/src/scheduler/scheduler.js.map +1 -0
- package/dist/src/serialization.d.ts +57 -0
- package/dist/src/serialization.d.ts.map +1 -0
- package/dist/src/serialization.js +306 -0
- package/dist/src/serialization.js.map +1 -0
- package/dist/src/solidactions-executor.d.ts +177 -0
- package/dist/src/solidactions-executor.d.ts.map +1 -0
- package/dist/src/solidactions-executor.js +817 -0
- package/dist/src/solidactions-executor.js.map +1 -0
- package/dist/src/solidactions.d.ts +519 -0
- package/dist/src/solidactions.d.ts.map +1 -0
- package/dist/src/solidactions.js +1284 -0
- package/dist/src/solidactions.js.map +1 -0
- package/dist/src/step.d.ts +16 -0
- package/dist/src/step.d.ts.map +1 -0
- package/dist/src/step.js +3 -0
- package/dist/src/step.js.map +1 -0
- package/dist/src/system_database.d.ts +141 -0
- package/dist/src/system_database.d.ts.map +1 -0
- package/dist/src/system_database.js +25 -0
- package/dist/src/system_database.js.map +1 -0
- package/dist/src/telemetry/collector.d.ts +13 -0
- package/dist/src/telemetry/collector.d.ts.map +1 -0
- package/dist/src/telemetry/collector.js +63 -0
- package/dist/src/telemetry/collector.js.map +1 -0
- package/dist/src/telemetry/exporters.d.ts +13 -0
- package/dist/src/telemetry/exporters.d.ts.map +1 -0
- package/dist/src/telemetry/exporters.js +101 -0
- package/dist/src/telemetry/exporters.js.map +1 -0
- package/dist/src/telemetry/logs.d.ts +52 -0
- package/dist/src/telemetry/logs.d.ts.map +1 -0
- package/dist/src/telemetry/logs.js +287 -0
- package/dist/src/telemetry/logs.js.map +1 -0
- package/dist/src/telemetry/traces.d.ts +52 -0
- package/dist/src/telemetry/traces.d.ts.map +1 -0
- package/dist/src/telemetry/traces.js +150 -0
- package/dist/src/telemetry/traces.js.map +1 -0
- package/dist/src/utils.d.ts +26 -0
- package/dist/src/utils.d.ts.map +1 -0
- package/dist/src/utils.js +136 -0
- package/dist/src/utils.js.map +1 -0
- package/dist/src/wfqueue.d.ts +64 -0
- package/dist/src/wfqueue.d.ts.map +1 -0
- package/dist/src/wfqueue.js +147 -0
- package/dist/src/wfqueue.js.map +1 -0
- package/dist/src/workflow.d.ts +154 -0
- package/dist/src/workflow.d.ts.map +1 -0
- package/dist/src/workflow.js +99 -0
- package/dist/src/workflow.js.map +1 -0
- package/dist/src/workflow_management.d.ts +15 -0
- package/dist/src/workflow_management.d.ts.map +1 -0
- package/dist/src/workflow_management.js +87 -0
- package/dist/src/workflow_management.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/docs/api-schema.md +1441 -0
- package/docs/migration-guide.md +460 -0
- package/docs/phase-14-changes.md +156 -0
- package/docs/solidsteps-ai-prompt.md +534 -0
- package/eslint.config.cjs +50 -0
- package/package.json +84 -0
- package/solidactions-ai-prompt.md +1504 -0
- package/solidactions-config.schema.json +132 -0
- package/solidactions-test-config.yaml +15 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: dbos-http-api-20260110-033219
|
|
3
|
+
timestamp: 2026-01-10T03:32:19Z
|
|
4
|
+
executed: false
|
|
5
|
+
originalPrompt: "I want to modify the dbos typescript sdk so that it doesn't need direct db access but instead can use an http API (we will use laravel for this). We need to modify this code that is in here. And create the schema documentation for the API endpoints that are needed."
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Optimized Prompt: DBOS SDK HTTP API Conversion
|
|
9
|
+
|
|
10
|
+
## Task
|
|
11
|
+
|
|
12
|
+
Modify the DBOS TypeScript SDK in this repository to replace all direct PostgreSQL database operations with HTTP API calls. Generate comprehensive API schema documentation for the Laravel backend implementation.
|
|
13
|
+
|
|
14
|
+
## Requirements
|
|
15
|
+
|
|
16
|
+
### SDK Modifications
|
|
17
|
+
|
|
18
|
+
1. **Replace all Postgres operations** - Every database read/write becomes an HTTP call
|
|
19
|
+
2. **HTTP-only** - Clean break, no backward compatibility with direct DB mode
|
|
20
|
+
3. **Minimize code changes** - Shape the API to mirror current DB operations, not the other way around
|
|
21
|
+
4. **Auth model** - SDK should only need:
|
|
22
|
+
- API endpoint URL
|
|
23
|
+
- Auth token(s)
|
|
24
|
+
- NO database credentials
|
|
25
|
+
|
|
26
|
+
### API Documentation Output
|
|
27
|
+
|
|
28
|
+
1. **Document all endpoints** needed to support current SDK functionality
|
|
29
|
+
2. **Mirror existing DB operations** - 1:1 replacement, no new features
|
|
30
|
+
3. **Include request/response schemas** for each endpoint
|
|
31
|
+
4. **Note atomicity requirements** - Where current code uses transactions, document that the endpoint must be atomic
|
|
32
|
+
|
|
33
|
+
## Constraints
|
|
34
|
+
|
|
35
|
+
- **No new features** - Only replace transport layer (Postgres → HTTP)
|
|
36
|
+
- **No dual-mode support** - Remove Postgres code entirely
|
|
37
|
+
- **No migration concerns** - Not migrating existing users
|
|
38
|
+
- **Multi-tenancy is Laravel's concern** - SDK just passes auth tokens
|
|
39
|
+
|
|
40
|
+
## Approach
|
|
41
|
+
|
|
42
|
+
1. First, analyze the codebase to identify ALL Postgres read/write operations
|
|
43
|
+
2. Document each operation's purpose, inputs, and outputs
|
|
44
|
+
3. Design HTTP endpoints that mirror these operations
|
|
45
|
+
4. Modify SDK to use HTTP client instead of Postgres client
|
|
46
|
+
5. Generate API schema documentation (OpenAPI/JSON Schema format)
|
|
47
|
+
|
|
48
|
+
## Success Criteria
|
|
49
|
+
|
|
50
|
+
- SDK can execute all current workflows without database credentials
|
|
51
|
+
- All functionality preserved (workflow state, step caching, signals, sleeps)
|
|
52
|
+
- Clear API documentation ready for Laravel implementation
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
# Mini-PRD: DBOS SDK HTTP Conversion
|
|
57
|
+
|
|
58
|
+
## Problem Statement
|
|
59
|
+
|
|
60
|
+
The DBOS TypeScript SDK currently requires direct PostgreSQL database credentials to function. This creates credential management overhead and tight coupling between SDK consumers and the database layer.
|
|
61
|
+
|
|
62
|
+
## Solution
|
|
63
|
+
|
|
64
|
+
Replace all direct database operations in the SDK with HTTP API calls. Laravel will serve as the API backend, owning the database connection. SDK consumers only need an API URL and auth token.
|
|
65
|
+
|
|
66
|
+
## Scope
|
|
67
|
+
|
|
68
|
+
| In Scope | Out of Scope |
|
|
69
|
+
| ----------------------------------------- | ---------------------- |
|
|
70
|
+
| Replace all Postgres operations with HTTP | New features |
|
|
71
|
+
| API schema documentation | Backward compatibility |
|
|
72
|
+
| Minimal SDK refactoring | User migration |
|
|
73
|
+
| Auth via URL + tokens | Multi-tenancy in SDK |
|
|
74
|
+
|
|
75
|
+
## Key Decisions
|
|
76
|
+
|
|
77
|
+
1. **Clean break** - No dual-mode (HTTP + DB), simplifies maintenance
|
|
78
|
+
2. **API mirrors SDK** - Minimize SDK changes by shaping API to current operations
|
|
79
|
+
3. **Laravel handles tenancy** - SDK is tenant-agnostic, just passes auth
|
|
80
|
+
|
|
81
|
+
## Technical Considerations
|
|
82
|
+
|
|
83
|
+
- **Atomicity**: Endpoints must be internally atomic where current code uses transactions
|
|
84
|
+
- **Error mapping**: HTTP errors should map to appropriate SDK exceptions
|
|
85
|
+
- **Idempotency**: Already inherent in DBOS design, should carry over
|
|
86
|
+
|
|
87
|
+
## Deliverables
|
|
88
|
+
|
|
89
|
+
1. Modified SDK with HTTP transport
|
|
90
|
+
2. API schema documentation (for Laravel implementation)
|
|
91
|
+
3. List of removed Postgres dependencies
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
npx lint-staged
|
package/.prettierignore
ADDED
package/.prettierrc
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Code of Conduct
|
|
2
|
+
|
|
3
|
+
As contributors and maintainers of DBOS Transact, we pledge to respect everyone who contributes by posting issues, updating documentation, submitting pull requests, providing feedback in comments, and any other activities.
|
|
4
|
+
|
|
5
|
+
## Our Standards
|
|
6
|
+
|
|
7
|
+
Examples of behavior that contributes to creating a positive environment include:
|
|
8
|
+
|
|
9
|
+
- Using welcoming and inclusive language.
|
|
10
|
+
- Being respectful of differing viewpoints and experiences.
|
|
11
|
+
- Gracefully accepting constructive criticism.
|
|
12
|
+
- Focusing on what is best for the community.
|
|
13
|
+
- Showing empathy towards other community members.
|
|
14
|
+
|
|
15
|
+
Examples of unacceptable behavior by participants include:
|
|
16
|
+
|
|
17
|
+
- The use of sexualized language or imagery and unwelcome sexual attention or advances.
|
|
18
|
+
- Trolling, insulting/derogatory comments, and personal or political attacks.
|
|
19
|
+
- Public or private harassment.
|
|
20
|
+
- Publishing others' private information, such as physical or electronic addresses, without explicit permission.
|
|
21
|
+
- Other conduct which could reasonably be considered inappropriate in a professional setting
|
|
22
|
+
Our Responsibilities.
|
|
23
|
+
- Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
|
24
|
+
|
|
25
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned with this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
|
26
|
+
|
|
27
|
+
## Scope
|
|
28
|
+
|
|
29
|
+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
|
30
|
+
|
|
31
|
+
## Enforcement
|
|
32
|
+
|
|
33
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at
|
|
34
|
+
contact@dbos.dev. All complaints will be reviewed and investigated promptly and fairly.
|
|
35
|
+
|
|
36
|
+
All project team members are obligated to respect the privacy and security of the reporter of any incident.
|
|
37
|
+
|
|
38
|
+
## Enforcement Guidelines
|
|
39
|
+
|
|
40
|
+
Project maintainers will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
|
41
|
+
|
|
42
|
+
- 1st offense: Verbal warning
|
|
43
|
+
- 2nd offense: Written warning
|
|
44
|
+
- 3rd offense: Temporary ban
|
|
45
|
+
- 4th offense: Permanent ban
|
|
46
|
+
|
|
47
|
+
## Attribution
|
|
48
|
+
|
|
49
|
+
This Code of Conduct is adapted from the Contributor Covenant, version 2.0, available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Contributing to DBOS Transact
|
|
2
|
+
|
|
3
|
+
Thank you for considering contributing to DBOS Transact. We welcome contributions from everyone, including bug fixes, feature enhancements, documentation improvements, or any other form of contribution.
|
|
4
|
+
|
|
5
|
+
## How to Contribute
|
|
6
|
+
|
|
7
|
+
To get started with DBOS Transact, please read the [README](README.md).
|
|
8
|
+
|
|
9
|
+
You can contribute in many ways. Some simple ways are:
|
|
10
|
+
|
|
11
|
+
- Use the SDK and open issues to report any bugs, questions, concern with the SDK, samples or documentation.
|
|
12
|
+
- Respond to issues with advice or suggestions.
|
|
13
|
+
- Participate in discussions in our [Discord](https://discord.gg/fMwQjeW5zg) channel.
|
|
14
|
+
- Contribute fixes and improvement to code, samples or documentation.
|
|
15
|
+
|
|
16
|
+
### To contribute code, please follow these steps:
|
|
17
|
+
|
|
18
|
+
1. Fork this github repository to your own account.
|
|
19
|
+
|
|
20
|
+
2. Clone the forked repository to your local machine.
|
|
21
|
+
|
|
22
|
+
3. Create a branch.
|
|
23
|
+
|
|
24
|
+
4. Make the necessary change to code, samples or documentation.
|
|
25
|
+
|
|
26
|
+
5. Write tests.
|
|
27
|
+
|
|
28
|
+
6. Commit the changes to your forked repository.
|
|
29
|
+
|
|
30
|
+
7. Submit a pull request to this repository.
|
|
31
|
+
In the PR description please include:
|
|
32
|
+
|
|
33
|
+
- Description of the fix/feature.
|
|
34
|
+
- Brief description of implementation.
|
|
35
|
+
- Description of how you tested the fix.
|
|
36
|
+
|
|
37
|
+
## Requesting features
|
|
38
|
+
|
|
39
|
+
If you have a feature request or an idea for an enhancement, feel free to open an issue on GitHub. Describe the feature or enhancement you'd like to see and why it would be valuable. Discuss it with the community on the [Discord](https://discord.gg/fMwQjeW5zg) channel.
|
|
40
|
+
|
|
41
|
+
## Discuss with the community
|
|
42
|
+
|
|
43
|
+
If you are stuck, need help, or wondering if a certain contribution will be welcome, please ask! You can reach out to us on [Discord](https://discord.gg/fMwQjeW5zg) or Github discussions.
|
|
44
|
+
|
|
45
|
+
## Code of conduct
|
|
46
|
+
|
|
47
|
+
It is important to us that contributing to DBOS will be a pleasant experience, if necessary, please refer to our [code of conduct](CODE_OF_CONDUCT.md) for participation guidelines.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 DBOS, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# SolidActions SDK
|
|
2
|
+
|
|
3
|
+
Lightweight durable workflows for TypeScript.
|
|
4
|
+
|
|
5
|
+
## What is SolidActions?
|
|
6
|
+
|
|
7
|
+
SolidActions provides lightweight durable workflows built on top of an HTTP API backend.
|
|
8
|
+
Instead of managing your own workflow orchestrator or task queue system, you can use SolidActions to add durable workflows and queues to your program in just a few lines of code.
|
|
9
|
+
|
|
10
|
+
This SDK uses HTTP API calls to communicate with a SolidActions backend server (such as Laravel) that implements the workflow persistence API.
|
|
11
|
+
|
|
12
|
+
## Features
|
|
13
|
+
|
|
14
|
+
- **💾 Durable Workflows** - Checkpoint workflow state to automatically resume from failures
|
|
15
|
+
- **📒 Durable Queues** - Run tasks in the background with guaranteed completion
|
|
16
|
+
- **📅 Durable Scheduling** - Schedule workflows with cron syntax or durable sleep
|
|
17
|
+
- **📫 Durable Notifications** - Pause workflows until signals/notifications arrive
|
|
18
|
+
- **⚙️ Workflow Management** - Query, cancel, resume, or restart workflows programmatically
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install @solidactions/sdk
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Quick Start
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
import { SolidActions } from '@solidactions/sdk';
|
|
30
|
+
|
|
31
|
+
// Register workflow steps
|
|
32
|
+
async function stepOne() {
|
|
33
|
+
SolidActions.logger.info('Step one completed!');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async function stepTwo() {
|
|
37
|
+
SolidActions.logger.info('Step two completed!');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Register the workflow
|
|
41
|
+
async function workflowFunction() {
|
|
42
|
+
await SolidActions.runStep(stepOne);
|
|
43
|
+
await SolidActions.runStep(stepTwo);
|
|
44
|
+
}
|
|
45
|
+
const workflow = SolidActions.registerWorkflow(workflowFunction);
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Configuration
|
|
49
|
+
|
|
50
|
+
Configure via environment variables:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
SOLIDACTIONS_API_URL=https://your-backend.com/api
|
|
54
|
+
SOLIDACTIONS_API_KEY=your-api-key
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Or in code:
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
import { SolidActions } from '@solidactions/sdk';
|
|
61
|
+
|
|
62
|
+
SolidActions.setConfig({
|
|
63
|
+
name: 'my-app',
|
|
64
|
+
api: {
|
|
65
|
+
url: process.env.SOLIDACTIONS_API_URL!,
|
|
66
|
+
key: process.env.SOLIDACTIONS_API_KEY!,
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
await SolidActions.launch();
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Or use a config file (`solidactions-config.yaml`):
|
|
74
|
+
|
|
75
|
+
```yaml
|
|
76
|
+
name: my-app
|
|
77
|
+
api:
|
|
78
|
+
url: https://your-api-backend.com
|
|
79
|
+
key: ${SOLIDACTIONS_API_KEY}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Durable Workflows
|
|
83
|
+
|
|
84
|
+
Workflows checkpoint their state so they can resume from the last completed step after any failure:
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
async function paymentWorkflow(orderId: string) {
|
|
88
|
+
// Step 1: Reserve inventory
|
|
89
|
+
await SolidActions.runStep(() => reserveInventory(orderId));
|
|
90
|
+
|
|
91
|
+
// Step 2: Process payment (if this fails, we resume from step 2)
|
|
92
|
+
await SolidActions.runStep(() => processPayment(orderId));
|
|
93
|
+
|
|
94
|
+
// Step 3: Ship order
|
|
95
|
+
await SolidActions.runStep(() => shipOrder(orderId));
|
|
96
|
+
}
|
|
97
|
+
const workflow = SolidActions.registerWorkflow(paymentWorkflow);
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Durable Queues
|
|
101
|
+
|
|
102
|
+
Run tasks in the background with guaranteed completion:
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
import { SolidActions, WorkflowQueue } from '@solidactions/sdk';
|
|
106
|
+
|
|
107
|
+
const queue = new WorkflowQueue('background_tasks');
|
|
108
|
+
|
|
109
|
+
async function processTask(task: Task) {
|
|
110
|
+
// Process the task...
|
|
111
|
+
}
|
|
112
|
+
const taskWorkflow = SolidActions.registerWorkflow(processTask);
|
|
113
|
+
|
|
114
|
+
// Enqueue work
|
|
115
|
+
await SolidActions.startWorkflow(taskWorkflow, { queueName: queue.name })(task);
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Durable Sleep
|
|
119
|
+
|
|
120
|
+
Sleep for any duration (even days) - workflows resume exactly when the sleep ends:
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
async function reminderWorkflow(email: string) {
|
|
124
|
+
await SolidActions.runStep(() => sendConfirmationEmail(email));
|
|
125
|
+
await SolidActions.sleep(86400000); // Sleep 24 hours
|
|
126
|
+
await SolidActions.runStep(() => sendReminderEmail(email));
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Signals and Events
|
|
131
|
+
|
|
132
|
+
Wait for external signals or emit events:
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
async function approvalWorkflow(requestId: string) {
|
|
136
|
+
// Wait for approval signal (with timeout)
|
|
137
|
+
const approved = await SolidActions.recv<boolean>('approval', 3600);
|
|
138
|
+
|
|
139
|
+
if (approved) {
|
|
140
|
+
await SolidActions.runStep(() => processApproval(requestId));
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Client API
|
|
146
|
+
|
|
147
|
+
Use the client to manage workflows programmatically:
|
|
148
|
+
|
|
149
|
+
```typescript
|
|
150
|
+
import { SolidActionsClient } from '@solidactions/sdk';
|
|
151
|
+
|
|
152
|
+
const client = SolidActionsClient.create();
|
|
153
|
+
|
|
154
|
+
// List workflows
|
|
155
|
+
const workflows = await client.listWorkflows({
|
|
156
|
+
status: 'ERROR',
|
|
157
|
+
startTime: '2025-04-22T03:00:00Z',
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
// Cancel or resume workflows
|
|
161
|
+
await client.cancelWorkflow(workflowId);
|
|
162
|
+
await client.resumeWorkflow(workflowId);
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Documentation
|
|
166
|
+
|
|
167
|
+
See `solidactions-ai-prompt.md` for comprehensive SDK documentation including:
|
|
168
|
+
|
|
169
|
+
- Workflow and step patterns
|
|
170
|
+
- Durable sleep, messaging, and events
|
|
171
|
+
- Queues and concurrency control
|
|
172
|
+
- Recovery and versioning
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "DBOS Config",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"additionalProperties": false,
|
|
6
|
+
"properties": {
|
|
7
|
+
"name": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "The name of your application"
|
|
10
|
+
},
|
|
11
|
+
"language": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"description": "The language used in your application",
|
|
14
|
+
"enum": ["node", "python"]
|
|
15
|
+
},
|
|
16
|
+
"database_url": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"description": "The URL of the application database"
|
|
19
|
+
},
|
|
20
|
+
"system_database_url": {
|
|
21
|
+
"type": "string",
|
|
22
|
+
"description": "The URL of the system database"
|
|
23
|
+
},
|
|
24
|
+
"system_database_schema_name": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"description": "The schema name for DBOS system tables (default: 'dbos')"
|
|
27
|
+
},
|
|
28
|
+
"database": {
|
|
29
|
+
"type": "object",
|
|
30
|
+
"additionalProperties": false,
|
|
31
|
+
"properties": {
|
|
32
|
+
"app_db_name": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"description": "The name of the application database. DEPRECATED: Use database_url instead",
|
|
35
|
+
"deprecated": true
|
|
36
|
+
},
|
|
37
|
+
"migrate": {
|
|
38
|
+
"type": "array",
|
|
39
|
+
"items": {
|
|
40
|
+
"type": "string"
|
|
41
|
+
},
|
|
42
|
+
"description": "Specify a list of user DB migration commands to run"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"telemetry": {
|
|
47
|
+
"type": "object",
|
|
48
|
+
"additionalProperties": false,
|
|
49
|
+
"properties": {
|
|
50
|
+
"logs": {
|
|
51
|
+
"type": "object",
|
|
52
|
+
"additionalProperties": false,
|
|
53
|
+
"properties": {
|
|
54
|
+
"addContextMetadata": {
|
|
55
|
+
"type": "boolean",
|
|
56
|
+
"description": "Adds contextual information, such as workflow UUID, to each log entry"
|
|
57
|
+
},
|
|
58
|
+
"logLevel": {
|
|
59
|
+
"type": "string",
|
|
60
|
+
"description": "A filter on what logs should be printed to the standard output"
|
|
61
|
+
},
|
|
62
|
+
"silent": {
|
|
63
|
+
"type": "boolean",
|
|
64
|
+
"description": "Silences the logger such that nothing is printed to the standard output"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"OTLPExporter": {
|
|
69
|
+
"type": "object",
|
|
70
|
+
"additionalProperties": false,
|
|
71
|
+
"properties": {
|
|
72
|
+
"logsEndpoint": {
|
|
73
|
+
"anyOf": [
|
|
74
|
+
{
|
|
75
|
+
"type": "string"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"type": "array",
|
|
79
|
+
"items": {
|
|
80
|
+
"type": "string"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
],
|
|
84
|
+
"description": "The URL of an OTLP collector to which to export logs"
|
|
85
|
+
},
|
|
86
|
+
"tracesEndpoint": {
|
|
87
|
+
"anyOf": [
|
|
88
|
+
{
|
|
89
|
+
"type": "string"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"type": "array",
|
|
93
|
+
"items": {
|
|
94
|
+
"type": "string"
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
],
|
|
98
|
+
"description": "The URL of an OTLP collector to which to export traces"
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
"runtimeConfig": {
|
|
105
|
+
"type": "object",
|
|
106
|
+
"additionalProperties": false,
|
|
107
|
+
"properties": {
|
|
108
|
+
"admin_port": {
|
|
109
|
+
"type": "number",
|
|
110
|
+
"description": "The port number of the admin server (Default: 3001)"
|
|
111
|
+
},
|
|
112
|
+
"start": {
|
|
113
|
+
"type": "array",
|
|
114
|
+
"items": {
|
|
115
|
+
"type": "string"
|
|
116
|
+
},
|
|
117
|
+
"description": "Commands to start the application"
|
|
118
|
+
},
|
|
119
|
+
"setup": {
|
|
120
|
+
"type": "array",
|
|
121
|
+
"items": {
|
|
122
|
+
"type": "string"
|
|
123
|
+
},
|
|
124
|
+
"description": "Commands to setup the application execution environment"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
"env": {
|
|
129
|
+
"deprecated": true
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
export interface workflow_status {
|
|
2
|
+
workflow_uuid: string;
|
|
3
|
+
status: string;
|
|
4
|
+
name: string;
|
|
5
|
+
class_name?: string;
|
|
6
|
+
config_name?: string;
|
|
7
|
+
authenticated_user: string;
|
|
8
|
+
output: string;
|
|
9
|
+
error: string;
|
|
10
|
+
assumed_role: string;
|
|
11
|
+
authenticated_roles: string;
|
|
12
|
+
request: string;
|
|
13
|
+
executor_id: string;
|
|
14
|
+
application_version?: string;
|
|
15
|
+
queue_name?: string;
|
|
16
|
+
created_at: number;
|
|
17
|
+
updated_at: number;
|
|
18
|
+
application_id: string;
|
|
19
|
+
recovery_attempts: number;
|
|
20
|
+
workflow_timeout_ms: number | null;
|
|
21
|
+
workflow_deadline_epoch_ms: number | null;
|
|
22
|
+
inputs: string;
|
|
23
|
+
started_at_epoch_ms?: number;
|
|
24
|
+
deduplication_id?: string;
|
|
25
|
+
priority?: number;
|
|
26
|
+
queue_partition_key?: string;
|
|
27
|
+
forked_from?: string;
|
|
28
|
+
owner_xid?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface notifications {
|
|
31
|
+
destination_uuid: string;
|
|
32
|
+
topic: string;
|
|
33
|
+
message: string;
|
|
34
|
+
}
|
|
35
|
+
export interface workflow_events {
|
|
36
|
+
workflow_uuid: string;
|
|
37
|
+
key: string;
|
|
38
|
+
value: string;
|
|
39
|
+
}
|
|
40
|
+
export interface operation_outputs {
|
|
41
|
+
workflow_uuid: string;
|
|
42
|
+
function_id: number;
|
|
43
|
+
output: string;
|
|
44
|
+
error: string;
|
|
45
|
+
child_workflow_id: string;
|
|
46
|
+
function_name?: string;
|
|
47
|
+
started_at_epoch_ms?: number;
|
|
48
|
+
completed_at_epoch_ms?: number;
|
|
49
|
+
}
|
|
50
|
+
export interface event_dispatch_kv {
|
|
51
|
+
service_name: string;
|
|
52
|
+
workflow_fn_name: string;
|
|
53
|
+
key: string;
|
|
54
|
+
value?: string;
|
|
55
|
+
update_time?: number;
|
|
56
|
+
update_seq?: bigint;
|
|
57
|
+
}
|
|
58
|
+
export interface streams {
|
|
59
|
+
workflow_uuid: string;
|
|
60
|
+
key: string;
|
|
61
|
+
value: string;
|
|
62
|
+
offset: number;
|
|
63
|
+
}
|
|
64
|
+
export interface step_info {
|
|
65
|
+
function_id: number;
|
|
66
|
+
function_name: string;
|
|
67
|
+
output: unknown;
|
|
68
|
+
error: Error | null;
|
|
69
|
+
child_workflow_id: string | null;
|
|
70
|
+
started_at_epoch_ms?: number;
|
|
71
|
+
completed_at_epoch_ms?: number;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=system_db_schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system_db_schema.d.ts","sourceRoot":"","sources":["../../schemas/system_db_schema.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,0BAA0B,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B,gBAAgB,EAAE,MAAM,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,iBAAiB;IAEhC,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,GAAG,EAAE,MAAM,CAAC;IAGZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,OAAO;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAGD,MAAM,WAAW,SAAS;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system_db_schema.js","sourceRoot":"","sources":["../../schemas/system_db_schema.ts"],"names":[],"mappings":""}
|