reqon-dsl 0.2.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 +31 -0
- package/.claude/skills/api-integration.md +125 -0
- package/.claude/skills/database-schema.md +51 -0
- package/.claude/skills/dsl-design.md +80 -0
- package/.claude/skills/property-testing.md +143 -0
- package/.claude/skills/reqon/SKILL.md +44 -0
- package/.claude/skills/reqon/references/examples.md +206 -0
- package/.claude/skills/reqon/references/syntax.md +263 -0
- package/.claude/skills/vscode-extension.md +113 -0
- package/.github/dependabot.yml +32 -0
- package/.github/pull_request_template.md +21 -0
- package/.github/workflows/ci.yml +174 -0
- package/.github/workflows/release.yml +73 -0
- package/CLAUDE.md +72 -0
- package/CONTRIBUTING.md +161 -0
- package/README.md +235 -0
- package/TODO.md +51 -0
- package/dist/ast/index.d.ts +1 -0
- package/dist/ast/index.js +1 -0
- package/dist/ast/nodes.d.ts +237 -0
- package/dist/ast/nodes.js +12 -0
- package/dist/auth/auth.test.d.ts +1 -0
- package/dist/auth/auth.test.js +255 -0
- package/dist/auth/circuit-breaker.d.ts +115 -0
- package/dist/auth/circuit-breaker.js +267 -0
- package/dist/auth/credentials.d.ts +91 -0
- package/dist/auth/credentials.js +169 -0
- package/dist/auth/index.d.ts +5 -0
- package/dist/auth/index.js +8 -0
- package/dist/auth/oauth2-provider.d.ts +41 -0
- package/dist/auth/oauth2-provider.js +131 -0
- package/dist/auth/rate-limiter.d.ts +61 -0
- package/dist/auth/rate-limiter.js +380 -0
- package/dist/auth/token-store.d.ts +30 -0
- package/dist/auth/token-store.js +148 -0
- package/dist/auth/types.d.ts +142 -0
- package/dist/auth/types.js +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +270 -0
- package/dist/errors/errors.test.d.ts +1 -0
- package/dist/errors/errors.test.js +165 -0
- package/dist/errors/index.d.ts +83 -0
- package/dist/errors/index.js +159 -0
- package/dist/execution/execution.test.d.ts +1 -0
- package/dist/execution/execution.test.js +246 -0
- package/dist/execution/index.d.ts +4 -0
- package/dist/execution/index.js +2 -0
- package/dist/execution/state.d.ts +136 -0
- package/dist/execution/state.js +82 -0
- package/dist/execution/store.d.ts +52 -0
- package/dist/execution/store.js +120 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +57 -0
- package/dist/integration.test.d.ts +1 -0
- package/dist/integration.test.js +168 -0
- package/dist/interpreter/context.d.ts +15 -0
- package/dist/interpreter/context.js +29 -0
- package/dist/interpreter/evaluator.d.ts +5 -0
- package/dist/interpreter/evaluator.js +223 -0
- package/dist/interpreter/evaluator.test.d.ts +1 -0
- package/dist/interpreter/evaluator.test.js +512 -0
- package/dist/interpreter/executor.d.ts +131 -0
- package/dist/interpreter/executor.js +663 -0
- package/dist/interpreter/fetch-handler.d.ts +43 -0
- package/dist/interpreter/fetch-handler.js +203 -0
- package/dist/interpreter/http.d.ts +57 -0
- package/dist/interpreter/http.js +210 -0
- package/dist/interpreter/http.test.d.ts +1 -0
- package/dist/interpreter/http.test.js +299 -0
- package/dist/interpreter/index.d.ts +7 -0
- package/dist/interpreter/index.js +7 -0
- package/dist/interpreter/pagination.d.ts +63 -0
- package/dist/interpreter/pagination.js +155 -0
- package/dist/interpreter/progress.test.d.ts +1 -0
- package/dist/interpreter/progress.test.js +216 -0
- package/dist/interpreter/schema-matcher.d.ts +16 -0
- package/dist/interpreter/schema-matcher.js +136 -0
- package/dist/interpreter/schema-matcher.test.d.ts +1 -0
- package/dist/interpreter/schema-matcher.test.js +122 -0
- package/dist/interpreter/signals.d.ts +57 -0
- package/dist/interpreter/signals.js +73 -0
- package/dist/interpreter/step-handlers/for-handler.d.ts +17 -0
- package/dist/interpreter/step-handlers/for-handler.js +51 -0
- package/dist/interpreter/step-handlers/index.d.ts +8 -0
- package/dist/interpreter/step-handlers/index.js +8 -0
- package/dist/interpreter/step-handlers/map-handler.d.ts +10 -0
- package/dist/interpreter/step-handlers/map-handler.js +20 -0
- package/dist/interpreter/step-handlers/match-handler.d.ts +27 -0
- package/dist/interpreter/step-handlers/match-handler.js +61 -0
- package/dist/interpreter/step-handlers/store-handler.d.ts +13 -0
- package/dist/interpreter/step-handlers/store-handler.js +66 -0
- package/dist/interpreter/step-handlers/types.d.ts +15 -0
- package/dist/interpreter/step-handlers/types.js +1 -0
- package/dist/interpreter/step-handlers/validate-handler.d.ts +10 -0
- package/dist/interpreter/step-handlers/validate-handler.js +26 -0
- package/dist/interpreter/step-handlers/webhook-handler.d.ts +36 -0
- package/dist/interpreter/step-handlers/webhook-handler.js +104 -0
- package/dist/lexer/index.d.ts +10 -0
- package/dist/lexer/index.js +12 -0
- package/dist/lexer/lexer.d.ts +24 -0
- package/dist/lexer/lexer.js +264 -0
- package/dist/lexer/lexer.test.d.ts +1 -0
- package/dist/lexer/lexer.test.js +259 -0
- package/dist/lexer/tokens.d.ts +69 -0
- package/dist/lexer/tokens.js +146 -0
- package/dist/loader/index.d.ts +36 -0
- package/dist/loader/index.js +220 -0
- package/dist/loader/loader.test.d.ts +1 -0
- package/dist/loader/loader.test.js +287 -0
- package/dist/oas/index.d.ts +4 -0
- package/dist/oas/index.js +2 -0
- package/dist/oas/loader.d.ts +21 -0
- package/dist/oas/loader.js +82 -0
- package/dist/oas/oas.test.d.ts +1 -0
- package/dist/oas/oas.test.js +218 -0
- package/dist/oas/validator.d.ts +12 -0
- package/dist/oas/validator.js +227 -0
- package/dist/parser/base.d.ts +33 -0
- package/dist/parser/base.js +97 -0
- package/dist/parser/expressions.d.ts +27 -0
- package/dist/parser/expressions.js +248 -0
- package/dist/parser/expressions.test.d.ts +1 -0
- package/dist/parser/expressions.test.js +378 -0
- package/dist/parser/index.d.ts +3 -0
- package/dist/parser/index.js +3 -0
- package/dist/parser/match.test.d.ts +1 -0
- package/dist/parser/match.test.js +254 -0
- package/dist/parser/parser.d.ts +68 -0
- package/dist/parser/parser.js +1229 -0
- package/dist/parser/parser.test.d.ts +1 -0
- package/dist/parser/parser.test.js +333 -0
- package/dist/parser/schedule.test.d.ts +1 -0
- package/dist/parser/schedule.test.js +241 -0
- package/dist/plugin.d.ts +35 -0
- package/dist/plugin.js +68 -0
- package/dist/scheduler/cron-parser.d.ts +32 -0
- package/dist/scheduler/cron-parser.js +198 -0
- package/dist/scheduler/cron-parser.test.d.ts +1 -0
- package/dist/scheduler/cron-parser.test.js +188 -0
- package/dist/scheduler/index.d.ts +3 -0
- package/dist/scheduler/index.js +2 -0
- package/dist/scheduler/scheduler.d.ts +81 -0
- package/dist/scheduler/scheduler.js +376 -0
- package/dist/scheduler/types.d.ts +65 -0
- package/dist/scheduler/types.js +1 -0
- package/dist/stores/factory.d.ts +36 -0
- package/dist/stores/factory.js +73 -0
- package/dist/stores/file.d.ts +60 -0
- package/dist/stores/file.js +173 -0
- package/dist/stores/file.test.d.ts +1 -0
- package/dist/stores/file.test.js +165 -0
- package/dist/stores/index.d.ts +6 -0
- package/dist/stores/index.js +5 -0
- package/dist/stores/memory.d.ts +19 -0
- package/dist/stores/memory.js +51 -0
- package/dist/stores/memory.test.d.ts +1 -0
- package/dist/stores/memory.test.js +157 -0
- package/dist/stores/postgrest.d.ts +55 -0
- package/dist/stores/postgrest.js +217 -0
- package/dist/stores/stores.test.d.ts +1 -0
- package/dist/stores/stores.test.js +158 -0
- package/dist/stores/types.d.ts +31 -0
- package/dist/stores/types.js +26 -0
- package/dist/sync/index.d.ts +4 -0
- package/dist/sync/index.js +2 -0
- package/dist/sync/state.d.ts +69 -0
- package/dist/sync/state.js +66 -0
- package/dist/sync/store.d.ts +49 -0
- package/dist/sync/store.js +93 -0
- package/dist/sync/sync.test.d.ts +1 -0
- package/dist/sync/sync.test.js +221 -0
- package/dist/utils/async.d.ts +7 -0
- package/dist/utils/async.js +9 -0
- package/dist/utils/file.d.ts +38 -0
- package/dist/utils/file.js +92 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.js +4 -0
- package/dist/utils/logger.d.ts +34 -0
- package/dist/utils/logger.js +39 -0
- package/dist/utils/path.d.ts +12 -0
- package/dist/utils/path.js +41 -0
- package/dist/webhook/index.d.ts +8 -0
- package/dist/webhook/index.js +7 -0
- package/dist/webhook/server.d.ts +84 -0
- package/dist/webhook/server.js +319 -0
- package/dist/webhook/store.d.ts +67 -0
- package/dist/webhook/store.js +193 -0
- package/dist/webhook/types.d.ts +88 -0
- package/dist/webhook/types.js +6 -0
- package/docusaurus/README.md +41 -0
- package/docusaurus/docs/advanced/execution-state.md +283 -0
- package/docusaurus/docs/advanced/extending-reqon.md +388 -0
- package/docusaurus/docs/advanced/multi-file-missions.md +250 -0
- package/docusaurus/docs/advanced/parallel-execution.md +353 -0
- package/docusaurus/docs/api-reference.md +443 -0
- package/docusaurus/docs/authentication/api-key.md +339 -0
- package/docusaurus/docs/authentication/basic.md +276 -0
- package/docusaurus/docs/authentication/bearer.md +282 -0
- package/docusaurus/docs/authentication/oauth2.md +317 -0
- package/docusaurus/docs/authentication/overview.md +251 -0
- package/docusaurus/docs/cli.md +229 -0
- package/docusaurus/docs/core-concepts/actions.md +286 -0
- package/docusaurus/docs/core-concepts/missions.md +264 -0
- package/docusaurus/docs/core-concepts/schemas.md +353 -0
- package/docusaurus/docs/core-concepts/sources.md +339 -0
- package/docusaurus/docs/core-concepts/stores.md +332 -0
- package/docusaurus/docs/dsl-syntax/expressions.md +361 -0
- package/docusaurus/docs/dsl-syntax/fetch.md +293 -0
- package/docusaurus/docs/dsl-syntax/for-loops.md +324 -0
- package/docusaurus/docs/dsl-syntax/map.md +345 -0
- package/docusaurus/docs/dsl-syntax/match.md +387 -0
- package/docusaurus/docs/dsl-syntax/pipelines.md +397 -0
- package/docusaurus/docs/dsl-syntax/validate.md +401 -0
- package/docusaurus/docs/error-handling/dead-letter-queues.md +399 -0
- package/docusaurus/docs/error-handling/flow-control.md +337 -0
- package/docusaurus/docs/error-handling/retry-strategies.md +368 -0
- package/docusaurus/docs/examples.md +488 -0
- package/docusaurus/docs/getting-started.md +256 -0
- package/docusaurus/docs/http/circuit-breaker.md +401 -0
- package/docusaurus/docs/http/incremental-sync.md +394 -0
- package/docusaurus/docs/http/pagination.md +361 -0
- package/docusaurus/docs/http/rate-limiting.md +383 -0
- package/docusaurus/docs/http/requests.md +328 -0
- package/docusaurus/docs/http/retry.md +402 -0
- package/docusaurus/docs/intro.md +90 -0
- package/docusaurus/docs/openapi/loading-specs.md +305 -0
- package/docusaurus/docs/openapi/operation-calls.md +314 -0
- package/docusaurus/docs/openapi/overview.md +212 -0
- package/docusaurus/docs/openapi/response-validation.md +344 -0
- package/docusaurus/docs/scheduling/cron.md +305 -0
- package/docusaurus/docs/scheduling/daemon-mode.md +317 -0
- package/docusaurus/docs/scheduling/intervals.md +289 -0
- package/docusaurus/docs/scheduling/overview.md +231 -0
- package/docusaurus/docs/stores/custom-adapters.md +376 -0
- package/docusaurus/docs/stores/file.md +236 -0
- package/docusaurus/docs/stores/memory.md +193 -0
- package/docusaurus/docs/stores/overview.md +274 -0
- package/docusaurus/docs/stores/postgrest.md +316 -0
- package/docusaurus/docusaurus.config.ts +148 -0
- package/docusaurus/package-lock.json +18029 -0
- package/docusaurus/package.json +47 -0
- package/docusaurus/sidebars.ts +155 -0
- package/docusaurus/src/components/HomepageFeatures/index.tsx +105 -0
- package/docusaurus/src/components/HomepageFeatures/styles.module.css +12 -0
- package/docusaurus/src/css/custom.css +169 -0
- package/docusaurus/src/pages/index.module.css +48 -0
- package/docusaurus/src/pages/index.tsx +110 -0
- package/docusaurus/src/pages/markdown-page.md +7 -0
- package/docusaurus/static/.nojekyll +0 -0
- package/docusaurus/static/img/docusaurus-social-card.jpg +0 -0
- package/docusaurus/static/img/docusaurus.png +0 -0
- package/docusaurus/static/img/favicon.ico +0 -0
- package/docusaurus/static/img/logo.svg +10 -0
- package/docusaurus/static/img/undraw_docusaurus_mountain.svg +171 -0
- package/docusaurus/static/img/undraw_docusaurus_react.svg +170 -0
- package/docusaurus/static/img/undraw_docusaurus_tree.svg +40 -0
- package/docusaurus/tsconfig.json +8 -0
- package/examples/README.md +112 -0
- package/examples/error-handling/README.md +150 -0
- package/examples/error-handling/payment-processor.vague +287 -0
- package/examples/github-sync/README.md +74 -0
- package/examples/github-sync/fetch-issues.vague +47 -0
- package/examples/github-sync/fetch-prs.vague +40 -0
- package/examples/github-sync/mission.vague +101 -0
- package/examples/github-sync/normalize.vague +70 -0
- package/examples/jsonplaceholder/README.md +28 -0
- package/examples/jsonplaceholder/posts.vague +48 -0
- package/examples/petstore/README.md +35 -0
- package/examples/petstore/openapi.yaml +97 -0
- package/examples/petstore/sync.vague +52 -0
- package/examples/temporal-comparison/README.md +297 -0
- package/examples/temporal-comparison/reconciliation.vague +355 -0
- package/examples/temporal-comparison/temporal/activities/index.ts +8 -0
- package/examples/temporal-comparison/temporal/activities/shipstation.ts +225 -0
- package/examples/temporal-comparison/temporal/activities/shopify.ts +257 -0
- package/examples/temporal-comparison/temporal/activities/storage.ts +198 -0
- package/examples/temporal-comparison/temporal/activities/stripe.ts +169 -0
- package/examples/temporal-comparison/temporal/activities/validation.ts +205 -0
- package/examples/temporal-comparison/temporal/client/schedule.ts +218 -0
- package/examples/temporal-comparison/temporal/config/retry.ts +63 -0
- package/examples/temporal-comparison/temporal/types/index.ts +129 -0
- package/examples/temporal-comparison/temporal/workers/main.ts +130 -0
- package/examples/temporal-comparison/temporal/workflows/orderReconciliation.ts +262 -0
- package/examples/xero/README.md +88 -0
- package/examples/xero/invoices.vague +189 -0
- package/package.json +40 -0
- package/src/api-integration.test.ts +954 -0
- package/src/ast/index.ts +1 -0
- package/src/ast/nodes.ts +310 -0
- package/src/auth/auth.test.ts +326 -0
- package/src/auth/circuit-breaker.test.ts +390 -0
- package/src/auth/circuit-breaker.ts +379 -0
- package/src/auth/credentials.test.ts +273 -0
- package/src/auth/credentials.ts +246 -0
- package/src/auth/index.ts +40 -0
- package/src/auth/oauth2-provider.ts +177 -0
- package/src/auth/rate-limiter.ts +459 -0
- package/src/auth/token-store.ts +177 -0
- package/src/auth/types.ts +159 -0
- package/src/benchmark/e2e.bench.ts +288 -0
- package/src/benchmark/evaluator.bench.ts +331 -0
- package/src/benchmark/fixtures.ts +295 -0
- package/src/benchmark/index.ts +108 -0
- package/src/benchmark/lexer.bench.ts +69 -0
- package/src/benchmark/parser.bench.ts +103 -0
- package/src/benchmark/resilience.bench.ts +193 -0
- package/src/benchmark/store.bench.ts +147 -0
- package/src/benchmark/utils.ts +230 -0
- package/src/cli.ts +313 -0
- package/src/errors/errors.test.ts +234 -0
- package/src/errors/index.ts +223 -0
- package/src/execution/execution.test.ts +307 -0
- package/src/execution/index.ts +21 -0
- package/src/execution/state.ts +207 -0
- package/src/execution/store.ts +188 -0
- package/src/index.ts +169 -0
- package/src/integration.test.ts +192 -0
- package/src/interpreter/context.ts +57 -0
- package/src/interpreter/evaluator.test.ts +796 -0
- package/src/interpreter/evaluator.ts +245 -0
- package/src/interpreter/executor.ts +946 -0
- package/src/interpreter/fetch-handler.ts +302 -0
- package/src/interpreter/http.test.ts +423 -0
- package/src/interpreter/http.ts +308 -0
- package/src/interpreter/index.ts +32 -0
- package/src/interpreter/pagination.ts +207 -0
- package/src/interpreter/progress.test.ts +276 -0
- package/src/interpreter/schema-matcher.test.ts +160 -0
- package/src/interpreter/schema-matcher.ts +168 -0
- package/src/interpreter/signals.ts +73 -0
- package/src/interpreter/step-handlers/for-handler.ts +65 -0
- package/src/interpreter/step-handlers/index.ts +17 -0
- package/src/interpreter/step-handlers/map-handler.ts +24 -0
- package/src/interpreter/step-handlers/match-handler.ts +101 -0
- package/src/interpreter/step-handlers/store-handler.ts +78 -0
- package/src/interpreter/step-handlers/types.ts +17 -0
- package/src/interpreter/step-handlers/validate-handler.ts +30 -0
- package/src/interpreter/step-handlers/webhook-handler.ts +142 -0
- package/src/lexer/index.ts +18 -0
- package/src/lexer/lexer.test.ts +316 -0
- package/src/lexer/tokens.ts +179 -0
- package/src/loader/index.ts +288 -0
- package/src/loader/loader.test.ts +360 -0
- package/src/oas/index.ts +4 -0
- package/src/oas/loader.ts +126 -0
- package/src/oas/oas.test.ts +254 -0
- package/src/oas/validator.ts +299 -0
- package/src/parser/base.ts +124 -0
- package/src/parser/expressions.test.ts +525 -0
- package/src/parser/expressions.ts +314 -0
- package/src/parser/index.ts +3 -0
- package/src/parser/match.test.ts +296 -0
- package/src/parser/parser.test.ts +739 -0
- package/src/parser/parser.ts +1469 -0
- package/src/parser/schedule.test.ts +287 -0
- package/src/parser/webhook.test.ts +248 -0
- package/src/plugin.ts +83 -0
- package/src/scheduler/cron-parser.test.ts +236 -0
- package/src/scheduler/cron-parser.ts +236 -0
- package/src/scheduler/index.ts +10 -0
- package/src/scheduler/scheduler.ts +443 -0
- package/src/scheduler/types.ts +71 -0
- package/src/stores/factory.ts +104 -0
- package/src/stores/file.test.ts +276 -0
- package/src/stores/file.ts +211 -0
- package/src/stores/index.ts +6 -0
- package/src/stores/memory.test.ts +238 -0
- package/src/stores/memory.ts +63 -0
- package/src/stores/postgrest.test.ts +488 -0
- package/src/stores/postgrest.ts +263 -0
- package/src/stores/stores.test.ts +197 -0
- package/src/stores/types.ts +58 -0
- package/src/sync/index.ts +16 -0
- package/src/sync/state.ts +126 -0
- package/src/sync/store.ts +139 -0
- package/src/sync/sync.test.ts +271 -0
- package/src/utils/async.ts +10 -0
- package/src/utils/file.ts +106 -0
- package/src/utils/index.ts +14 -0
- package/src/utils/logger.ts +53 -0
- package/src/utils/path.ts +47 -0
- package/src/webhook/index.ts +15 -0
- package/src/webhook/server.test.ts +253 -0
- package/src/webhook/server.ts +389 -0
- package/src/webhook/store.ts +239 -0
- package/src/webhook/types.ts +93 -0
- package/tsconfig.json +17 -0
- package/vitest.config.ts +39 -0
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
---
|
|
2
|
+
sidebar_position: 3
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Interval Scheduling
|
|
6
|
+
|
|
7
|
+
Interval scheduling runs missions at fixed time intervals.
|
|
8
|
+
|
|
9
|
+
## Syntax
|
|
10
|
+
|
|
11
|
+
```vague
|
|
12
|
+
schedule: every N units
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Time Units
|
|
16
|
+
|
|
17
|
+
| Unit | Examples |
|
|
18
|
+
|------|----------|
|
|
19
|
+
| `seconds` | `every 30 seconds` |
|
|
20
|
+
| `minutes` | `every 15 minutes` |
|
|
21
|
+
| `hours` | `every 6 hours` |
|
|
22
|
+
| `days` | `every 1 day` |
|
|
23
|
+
| `weeks` | `every 1 week` |
|
|
24
|
+
|
|
25
|
+
## Examples
|
|
26
|
+
|
|
27
|
+
### Seconds
|
|
28
|
+
|
|
29
|
+
```vague
|
|
30
|
+
// Every 30 seconds (for real-time sync)
|
|
31
|
+
schedule: every 30 seconds
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Minutes
|
|
35
|
+
|
|
36
|
+
```vague
|
|
37
|
+
// Every 5 minutes
|
|
38
|
+
schedule: every 5 minutes
|
|
39
|
+
|
|
40
|
+
// Every 15 minutes
|
|
41
|
+
schedule: every 15 minutes
|
|
42
|
+
|
|
43
|
+
// Every 30 minutes
|
|
44
|
+
schedule: every 30 minutes
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Hours
|
|
48
|
+
|
|
49
|
+
```vague
|
|
50
|
+
// Hourly
|
|
51
|
+
schedule: every 1 hour
|
|
52
|
+
|
|
53
|
+
// Every 2 hours
|
|
54
|
+
schedule: every 2 hours
|
|
55
|
+
|
|
56
|
+
// Every 6 hours
|
|
57
|
+
schedule: every 6 hours
|
|
58
|
+
|
|
59
|
+
// Every 12 hours
|
|
60
|
+
schedule: every 12 hours
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Days
|
|
64
|
+
|
|
65
|
+
```vague
|
|
66
|
+
// Daily
|
|
67
|
+
schedule: every 1 day
|
|
68
|
+
|
|
69
|
+
// Every 2 days
|
|
70
|
+
schedule: every 2 days
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Weeks
|
|
74
|
+
|
|
75
|
+
```vague
|
|
76
|
+
// Weekly
|
|
77
|
+
schedule: every 1 week
|
|
78
|
+
|
|
79
|
+
// Bi-weekly
|
|
80
|
+
schedule: every 2 weeks
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Interval vs Cron
|
|
84
|
+
|
|
85
|
+
### Interval
|
|
86
|
+
|
|
87
|
+
- Runs at fixed intervals from start time
|
|
88
|
+
- Simpler to configure
|
|
89
|
+
- Less precise timing
|
|
90
|
+
|
|
91
|
+
```vague
|
|
92
|
+
schedule: every 6 hours
|
|
93
|
+
// Runs at: start, start+6h, start+12h, ...
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Cron
|
|
97
|
+
|
|
98
|
+
- Runs at specific times
|
|
99
|
+
- More control
|
|
100
|
+
- Predictable times
|
|
101
|
+
|
|
102
|
+
```vague
|
|
103
|
+
schedule: cron "0 */6 * * *"
|
|
104
|
+
// Runs at: 0:00, 6:00, 12:00, 18:00
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Start Time
|
|
108
|
+
|
|
109
|
+
Intervals start from:
|
|
110
|
+
1. Daemon start time (for new missions)
|
|
111
|
+
2. Last run time (for existing missions)
|
|
112
|
+
|
|
113
|
+
### First Run Behavior
|
|
114
|
+
|
|
115
|
+
```vague
|
|
116
|
+
mission ImmediateStart {
|
|
117
|
+
schedule: every 1 hour
|
|
118
|
+
runImmediately: true // Run once at start
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
mission DelayedStart {
|
|
122
|
+
schedule: every 1 hour
|
|
123
|
+
runImmediately: false // Wait for first interval
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Combining with Options
|
|
128
|
+
|
|
129
|
+
### With Retry
|
|
130
|
+
|
|
131
|
+
```vague
|
|
132
|
+
mission RobustSync {
|
|
133
|
+
schedule: every 15 minutes
|
|
134
|
+
|
|
135
|
+
retryOnFailure: {
|
|
136
|
+
maxAttempts: 3,
|
|
137
|
+
backoff: exponential
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### With Concurrency Control
|
|
143
|
+
|
|
144
|
+
```vague
|
|
145
|
+
mission ControlledSync {
|
|
146
|
+
schedule: every 5 minutes
|
|
147
|
+
skipIfRunning: true // Don't overlap
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### With Timeout
|
|
152
|
+
|
|
153
|
+
```vague
|
|
154
|
+
mission TimedSync {
|
|
155
|
+
schedule: every 1 hour
|
|
156
|
+
timeout: 1800000 // 30 minute timeout
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Use Cases
|
|
161
|
+
|
|
162
|
+
### Real-Time Sync
|
|
163
|
+
|
|
164
|
+
```vague
|
|
165
|
+
mission RealtimeSync {
|
|
166
|
+
schedule: every 30 seconds
|
|
167
|
+
|
|
168
|
+
action Sync {
|
|
169
|
+
get "/events" { since: lastSync }
|
|
170
|
+
store response -> events { key: .id }
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Hourly Updates
|
|
176
|
+
|
|
177
|
+
```vague
|
|
178
|
+
mission HourlySync {
|
|
179
|
+
schedule: every 1 hour
|
|
180
|
+
|
|
181
|
+
action Sync {
|
|
182
|
+
get "/data"
|
|
183
|
+
store response -> data { key: .id }
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Daily Reports
|
|
189
|
+
|
|
190
|
+
```vague
|
|
191
|
+
mission DailyReport {
|
|
192
|
+
schedule: every 1 day
|
|
193
|
+
|
|
194
|
+
action Generate {
|
|
195
|
+
get "/stats/daily"
|
|
196
|
+
store response -> reports { key: formatDate(now(), "YYYY-MM-DD") }
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### Weekly Cleanup
|
|
202
|
+
|
|
203
|
+
```vague
|
|
204
|
+
mission WeeklyCleanup {
|
|
205
|
+
schedule: every 1 week
|
|
206
|
+
|
|
207
|
+
action Cleanup {
|
|
208
|
+
for item in oldData where .createdAt < addDays(now(), -30) {
|
|
209
|
+
delete oldData[item.id]
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## Best Practices
|
|
216
|
+
|
|
217
|
+
### Choose Appropriate Intervals
|
|
218
|
+
|
|
219
|
+
| Data Type | Recommended Interval |
|
|
220
|
+
|-----------|---------------------|
|
|
221
|
+
| Real-time events | 30 seconds - 5 minutes |
|
|
222
|
+
| Transactional data | 5-15 minutes |
|
|
223
|
+
| Reference data | 1-6 hours |
|
|
224
|
+
| Reports | Daily |
|
|
225
|
+
| Cleanup jobs | Weekly |
|
|
226
|
+
|
|
227
|
+
### Account for Execution Time
|
|
228
|
+
|
|
229
|
+
```vague
|
|
230
|
+
// If sync takes 10 minutes
|
|
231
|
+
schedule: every 15 minutes // Good: 5 minute buffer
|
|
232
|
+
|
|
233
|
+
// Not:
|
|
234
|
+
schedule: every 5 minutes // Risk: overlapping runs
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### Use skipIfRunning
|
|
238
|
+
|
|
239
|
+
```vague
|
|
240
|
+
mission SafeSync {
|
|
241
|
+
schedule: every 5 minutes
|
|
242
|
+
skipIfRunning: true
|
|
243
|
+
|
|
244
|
+
action Sync {
|
|
245
|
+
// Long-running sync
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### Add Jitter for Distributed Systems
|
|
251
|
+
|
|
252
|
+
```vague
|
|
253
|
+
mission JitteredSync {
|
|
254
|
+
schedule: every 1 hour
|
|
255
|
+
jitter: 300000 // +/- 5 minutes random delay
|
|
256
|
+
}
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
## Troubleshooting
|
|
260
|
+
|
|
261
|
+
### Runs Too Frequently
|
|
262
|
+
|
|
263
|
+
Check interval unit:
|
|
264
|
+
|
|
265
|
+
```vague
|
|
266
|
+
// This runs every 30 SECONDS
|
|
267
|
+
schedule: every 30 seconds
|
|
268
|
+
|
|
269
|
+
// This runs every 30 MINUTES
|
|
270
|
+
schedule: every 30 minutes
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### Runs Overlapping
|
|
274
|
+
|
|
275
|
+
Add skipIfRunning:
|
|
276
|
+
|
|
277
|
+
```vague
|
|
278
|
+
schedule: every 5 minutes
|
|
279
|
+
skipIfRunning: true
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### Missed Runs
|
|
283
|
+
|
|
284
|
+
Intervals don't backfill. If daemon was down for 2 hours with 30-minute interval, you won't get 4 runs.
|
|
285
|
+
|
|
286
|
+
Consider:
|
|
287
|
+
- Using `runImmediately: true`
|
|
288
|
+
- Adding catch-up logic
|
|
289
|
+
- Using incremental sync with `since: lastSync`
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
---
|
|
2
|
+
sidebar_position: 1
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Scheduling Overview
|
|
6
|
+
|
|
7
|
+
Reqon supports scheduling missions to run automatically at specified intervals or times.
|
|
8
|
+
|
|
9
|
+
## Schedule Types
|
|
10
|
+
|
|
11
|
+
| Type | Syntax | Example |
|
|
12
|
+
|------|--------|---------|
|
|
13
|
+
| Interval | `every N units` | `every 6 hours` |
|
|
14
|
+
| Cron | `cron "expression"` | `cron "0 */6 * * *"` |
|
|
15
|
+
| One-time | `at "datetime"` | `at "2024-01-20 09:00 UTC"` |
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
```vague
|
|
20
|
+
mission DailySync {
|
|
21
|
+
schedule: every 1 day
|
|
22
|
+
|
|
23
|
+
source API { auth: bearer, base: "https://api.example.com" }
|
|
24
|
+
store data: file("data")
|
|
25
|
+
|
|
26
|
+
action Sync {
|
|
27
|
+
get "/data" { since: lastSync }
|
|
28
|
+
store response -> data { key: .id }
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
run Sync
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Running Scheduled Missions
|
|
36
|
+
|
|
37
|
+
### Daemon Mode
|
|
38
|
+
|
|
39
|
+
Run continuously:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
reqon ./missions/ --daemon
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### One-Shot Mode
|
|
46
|
+
|
|
47
|
+
Run once and exit:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
reqon ./missions/ --once
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Interval Scheduling
|
|
54
|
+
|
|
55
|
+
```vague
|
|
56
|
+
// Every N minutes
|
|
57
|
+
schedule: every 15 minutes
|
|
58
|
+
|
|
59
|
+
// Every N hours
|
|
60
|
+
schedule: every 6 hours
|
|
61
|
+
|
|
62
|
+
// Every N days
|
|
63
|
+
schedule: every 1 day
|
|
64
|
+
|
|
65
|
+
// Every N weeks
|
|
66
|
+
schedule: every 1 week
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Cron Scheduling
|
|
70
|
+
|
|
71
|
+
Full cron expression support:
|
|
72
|
+
|
|
73
|
+
```vague
|
|
74
|
+
// Every day at midnight
|
|
75
|
+
schedule: cron "0 0 * * *"
|
|
76
|
+
|
|
77
|
+
// Every hour
|
|
78
|
+
schedule: cron "0 * * * *"
|
|
79
|
+
|
|
80
|
+
// Every 6 hours
|
|
81
|
+
schedule: cron "0 */6 * * *"
|
|
82
|
+
|
|
83
|
+
// Weekdays at 9am
|
|
84
|
+
schedule: cron "0 9 * * 1-5"
|
|
85
|
+
|
|
86
|
+
// First of month at 6am
|
|
87
|
+
schedule: cron "0 6 1 * *"
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## One-Time Scheduling
|
|
91
|
+
|
|
92
|
+
```vague
|
|
93
|
+
// Specific datetime
|
|
94
|
+
schedule: at "2024-12-25 00:00 UTC"
|
|
95
|
+
|
|
96
|
+
// ISO format
|
|
97
|
+
schedule: at "2024-01-20T09:00:00Z"
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Schedule Options
|
|
101
|
+
|
|
102
|
+
```vague
|
|
103
|
+
mission ConfiguredSync {
|
|
104
|
+
schedule: every 1 hour
|
|
105
|
+
|
|
106
|
+
// Concurrency control
|
|
107
|
+
maxConcurrency: 5
|
|
108
|
+
|
|
109
|
+
// Skip if already running
|
|
110
|
+
skipIfRunning: true
|
|
111
|
+
|
|
112
|
+
// Retry on failure
|
|
113
|
+
retryOnFailure: {
|
|
114
|
+
maxAttempts: 3,
|
|
115
|
+
backoff: exponential
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Multiple Missions
|
|
121
|
+
|
|
122
|
+
Each mission has its own schedule:
|
|
123
|
+
|
|
124
|
+
```vague
|
|
125
|
+
mission FrequentSync {
|
|
126
|
+
schedule: every 15 minutes
|
|
127
|
+
// ...
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
mission DailyReport {
|
|
131
|
+
schedule: every 1 day
|
|
132
|
+
// ...
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
mission WeeklyCleanup {
|
|
136
|
+
schedule: cron "0 0 * * 0" // Sundays at midnight
|
|
137
|
+
// ...
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Execution Context
|
|
142
|
+
|
|
143
|
+
### Last Run Time
|
|
144
|
+
|
|
145
|
+
Access when mission last ran:
|
|
146
|
+
|
|
147
|
+
```vague
|
|
148
|
+
action IncrementalSync {
|
|
149
|
+
get "/data" {
|
|
150
|
+
since: lastSync // Uses last successful completion time
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Scheduled vs Manual
|
|
156
|
+
|
|
157
|
+
Detect if running on schedule:
|
|
158
|
+
|
|
159
|
+
```vague
|
|
160
|
+
action FlexibleSync {
|
|
161
|
+
match env("REQON_SCHEDULED") {
|
|
162
|
+
"true" -> get "/data" { since: lastSync },
|
|
163
|
+
_ -> get "/data" // Full sync for manual runs
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Best Practices
|
|
169
|
+
|
|
170
|
+
### Use Incremental Sync
|
|
171
|
+
|
|
172
|
+
```vague
|
|
173
|
+
mission EfficientSync {
|
|
174
|
+
schedule: every 15 minutes
|
|
175
|
+
|
|
176
|
+
action Sync {
|
|
177
|
+
get "/data" { since: lastSync } // Only fetch changes
|
|
178
|
+
store response -> data { key: .id, upsert: true }
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Add Error Handling
|
|
184
|
+
|
|
185
|
+
```vague
|
|
186
|
+
mission RobustSync {
|
|
187
|
+
schedule: every 1 hour
|
|
188
|
+
|
|
189
|
+
retryOnFailure: {
|
|
190
|
+
maxAttempts: 3,
|
|
191
|
+
backoff: exponential
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
action Sync {
|
|
195
|
+
get "/data"
|
|
196
|
+
|
|
197
|
+
match response {
|
|
198
|
+
{ error: _ } -> abort "Sync failed",
|
|
199
|
+
_ -> store response -> data { key: .id }
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Monitor Execution
|
|
206
|
+
|
|
207
|
+
```vague
|
|
208
|
+
mission MonitoredSync {
|
|
209
|
+
schedule: every 1 hour
|
|
210
|
+
|
|
211
|
+
store syncLog: file("sync-log")
|
|
212
|
+
|
|
213
|
+
action Sync {
|
|
214
|
+
store { started: now() } -> syncLog
|
|
215
|
+
|
|
216
|
+
get "/data"
|
|
217
|
+
store response -> data { key: .id }
|
|
218
|
+
|
|
219
|
+
store {
|
|
220
|
+
completed: now(),
|
|
221
|
+
itemCount: length(response)
|
|
222
|
+
} -> syncLog
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## Next Steps
|
|
228
|
+
|
|
229
|
+
- [Cron Expressions](./cron) - Detailed cron syntax
|
|
230
|
+
- [Intervals](./intervals) - Interval scheduling
|
|
231
|
+
- [Daemon Mode](./daemon-mode) - Running as a service
|