@elevasis/sdk 1.48.0 → 1.49.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/dist/cli.cjs +742 -231
- package/dist/index.d.ts +685 -47
- package/dist/index.js +274 -40
- package/dist/node/index.d.ts +108 -24
- package/dist/test-utils/index.d.ts +647 -34
- package/dist/test-utils/index.js +240 -38
- package/dist/worker/index.d.ts +663 -39
- package/dist/worker/index.js +115 -6
- package/package.json +4 -4
- package/reference/_navigation.md +4 -4
- package/reference/_reference-manifest.json +1 -1
- package/reference/core/index.mdx +6 -4
- package/reference/index.mdx +11 -5
- package/reference/packages/core/src/README.md +46 -44
- package/reference/packages/core/src/content/README.md +13 -12
- package/reference/rules/ui.md +1 -1
- package/reference/rules/vibe-intents.md +2 -2
- package/reference/rules/vibe.md +30 -10
- package/reference/scaffold/recipes/extend-content.md +82 -3
- package/reference/sdk/cli-management.mdx +184 -41
- package/reference/sdk/cli.mdx +103 -64
- package/reference/sdk/define-builders.mdx +1 -1
- package/reference/sdk/deployment/command-center.mdx +2 -2
- package/reference/sdk/deployment/index.mdx +1 -1
- package/reference/sdk/exports.mdx +4 -4
- package/reference/sdk/framework/agent.mdx +4 -3
- package/reference/sdk/framework/index.mdx +1 -1
- package/reference/sdk/framework/project-structure.mdx +34 -23
- package/reference/sdk/framework/tutorial-system.mdx +1 -1
- package/reference/sdk/getting-started.mdx +25 -52
- package/reference/sdk/index.mdx +3 -3
- package/reference/sdk/platform-tools/adapters-integration.mdx +1 -1
- package/reference/sdk/platform-tools/adapters-platform.mdx +1 -1
- package/reference/sdk/platform-tools/type-safety.mdx +1 -1
- package/reference/sdk/resources/patterns.mdx +10 -11
- package/reference/sdk/resources/types.mdx +15 -9
- package/reference/sdk/templates/data-enrichment.mdx +1 -1
- package/reference/sdk/templates/email-sender.mdx +1 -1
- package/reference/sdk/templates/index.mdx +47 -47
- package/reference/sdk/templates/lead-scorer.mdx +1 -1
- package/reference/sdk/templates/pdf-generator.mdx +42 -24
- package/reference/sdk/templates/recurring-job.mdx +20 -15
- package/reference/sdk/templates/text-classifier.mdx +1 -1
- package/reference/sdk/templates/web-scraper.mdx +9 -5
- package/reference/ui/exports.mdx +1 -1
- package/reference/ui/index.mdx +2 -2
|
@@ -18,8 +18,8 @@ loadWhen: "Applying the recurring-job workflow template"
|
|
|
18
18
|
|
|
19
19
|
Two-part pattern for recurring jobs:
|
|
20
20
|
|
|
21
|
-
1. **Setup workflow** (`recurring-job-setup`): Creates a schedule entry that triggers the main job workflow on a recurring basis. Run once to activate.
|
|
22
|
-
2. **Main job workflow** (`recurring-job`): The actual work executed on each scheduled trigger.
|
|
21
|
+
1. **Setup workflow** (`recurring-job-setup-workflow`): Creates a schedule entry that triggers the main job workflow on a recurring basis. Run once to activate.
|
|
22
|
+
2. **Main job workflow** (`recurring-job-workflow`): The actual work executed on each scheduled trigger.
|
|
23
23
|
|
|
24
24
|
The job workflow and setup workflow share a schedule key for idempotent schedule management.
|
|
25
25
|
|
|
@@ -43,8 +43,7 @@ z.object({
|
|
|
43
43
|
|
|
44
44
|
```typescript
|
|
45
45
|
z.object({
|
|
46
|
-
|
|
47
|
-
jobInput: z.record(z.string(), z.unknown()).optional(), // Passed through from schedule creation
|
|
46
|
+
jobInput: z.record(z.string(), z.unknown()).optional(), // Passed through as scheduleConfig.payload at setup time
|
|
48
47
|
})
|
|
49
48
|
```
|
|
50
49
|
|
|
@@ -72,7 +71,7 @@ import { z } from 'zod'
|
|
|
72
71
|
// Setup workflow -- run once to create the schedule
|
|
73
72
|
export const recurringJobSetup: WorkflowDefinition = {
|
|
74
73
|
config: {
|
|
75
|
-
resourceId: 'recurring-job-setup',
|
|
74
|
+
resourceId: 'recurring-job-setup-workflow',
|
|
76
75
|
name: 'Recurring Job Setup',
|
|
77
76
|
type: 'workflow',
|
|
78
77
|
description: 'Creates or updates the schedule for the recurring job',
|
|
@@ -104,10 +103,15 @@ export const recurringJobSetup: WorkflowDefinition = {
|
|
|
104
103
|
tool: 'scheduler',
|
|
105
104
|
method: 'createSchedule',
|
|
106
105
|
params: {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
106
|
+
organizationId: context.organizationId, // ignored -- the platform re-scopes this from execution context
|
|
107
|
+
name: 'Recurring Job Schedule',
|
|
108
|
+
target: { resourceType: 'workflow', resourceId: 'recurring-job-workflow' },
|
|
109
|
+
scheduleConfig: {
|
|
110
|
+
type: 'recurring',
|
|
111
|
+
cron: cronExpression,
|
|
112
|
+
timezone: timezone ?? 'UTC',
|
|
113
|
+
payload: { jobInput: jobInput ?? {} },
|
|
114
|
+
},
|
|
111
115
|
idempotencyKey: 'recurring-job-schedule',
|
|
112
116
|
},
|
|
113
117
|
}) as { id: string }
|
|
@@ -124,7 +128,7 @@ export const recurringJobSetup: WorkflowDefinition = {
|
|
|
124
128
|
// Main job workflow -- triggered by the scheduler on each run
|
|
125
129
|
export const recurringJob: WorkflowDefinition = {
|
|
126
130
|
config: {
|
|
127
|
-
resourceId: 'recurring-job',
|
|
131
|
+
resourceId: 'recurring-job-workflow',
|
|
128
132
|
name: 'Recurring Job',
|
|
129
133
|
type: 'workflow',
|
|
130
134
|
description: 'Executes on each scheduled trigger',
|
|
@@ -133,7 +137,6 @@ export const recurringJob: WorkflowDefinition = {
|
|
|
133
137
|
},
|
|
134
138
|
contract: {
|
|
135
139
|
inputSchema: z.object({
|
|
136
|
-
scheduledAt: z.string(),
|
|
137
140
|
jobInput: z.record(z.string(), z.unknown()).optional(),
|
|
138
141
|
}),
|
|
139
142
|
outputSchema: z.object({
|
|
@@ -147,12 +150,12 @@ export const recurringJob: WorkflowDefinition = {
|
|
|
147
150
|
id: 'run',
|
|
148
151
|
name: 'Run Job',
|
|
149
152
|
description: 'Execute the recurring job logic',
|
|
150
|
-
inputSchema: z.object({
|
|
153
|
+
inputSchema: z.object({ jobInput: z.record(z.string(), z.unknown()).optional() }),
|
|
151
154
|
outputSchema: z.object({ completed: z.boolean(), processedAt: z.string(), summary: z.string() }),
|
|
152
155
|
handler: async (input, context) => {
|
|
153
|
-
const {
|
|
156
|
+
const { jobInput } = input as { jobInput?: Record<string, unknown> }
|
|
154
157
|
|
|
155
|
-
context.logger.info(`Recurring job started at ${
|
|
158
|
+
context.logger.info(`Recurring job started at ${new Date().toISOString()}`)
|
|
156
159
|
|
|
157
160
|
// === REPLACE THIS SECTION WITH THE ACTUAL JOB LOGIC ===
|
|
158
161
|
// Example: fetch data, process it, send a report
|
|
@@ -186,9 +189,11 @@ export const recurringJob: WorkflowDefinition = {
|
|
|
186
189
|
## Adaptation Notes
|
|
187
190
|
|
|
188
191
|
- **Job logic:** Replace the placeholder comment in the `run` handler with the actual job logic. Ask the user what the job should do before generating the full workflow.
|
|
189
|
-
- **Both workflows needed:** Remind the user to add both `recurringJob` and `recurringJobSetup` to their `src/index.ts` registry. Run `setup` once to activate; only `recurring-job` runs automatically thereafter.
|
|
192
|
+
- **Both workflows needed:** Remind the user to add both `recurringJob` and `recurringJobSetup` to their `src/index.ts` registry. Run `setup` once to activate; only `recurring-job-workflow` runs automatically thereafter.
|
|
190
193
|
- **Idempotency key:** The `recurring-job-schedule` key ensures re-running setup does not create duplicate schedules.
|
|
191
194
|
- **Timezone:** Always ask the user their preferred timezone. Defaults to UTC which may cause unexpected run times.
|
|
195
|
+
- **`organizationId` in `createSchedule` params:** The platform always re-scopes this from the execution context server-side, so the value passed here is ignored -- it exists only because the field is required by the scheduler's type.
|
|
196
|
+
- **Execution input on each run:** The job workflow receives `scheduleConfig.payload` as its input, with a `_scheduleMetadata` object (`scheduleId`, `scheduleName`, `scheduleStep`) merged in automatically. Extra fields are not part of the validated `inputSchema` and are silently dropped by Zod's default parsing.
|
|
192
197
|
|
|
193
198
|
---
|
|
194
199
|
|
|
@@ -70,7 +70,7 @@ type Input = z.infer<typeof inputSchema>
|
|
|
70
70
|
|
|
71
71
|
export const textClassifier: WorkflowDefinition = {
|
|
72
72
|
config: {
|
|
73
|
-
resourceId: 'text-classifier',
|
|
73
|
+
resourceId: 'text-classifier-workflow',
|
|
74
74
|
name: 'Text Classifier',
|
|
75
75
|
type: 'workflow',
|
|
76
76
|
description: 'Classifies text into predefined categories using an LLM',
|
|
@@ -72,7 +72,7 @@ type Input = z.infer<typeof inputSchema>
|
|
|
72
72
|
|
|
73
73
|
export const webScraper: WorkflowDefinition = {
|
|
74
74
|
config: {
|
|
75
|
-
resourceId: 'web-scraper',
|
|
75
|
+
resourceId: 'web-scraper-workflow',
|
|
76
76
|
name: 'Web Scraper',
|
|
77
77
|
type: 'workflow',
|
|
78
78
|
description: 'Scrapes structured data via Apify and stores in Supabase',
|
|
@@ -86,16 +86,20 @@ export const webScraper: WorkflowDefinition = {
|
|
|
86
86
|
name: 'Run Apify Actor',
|
|
87
87
|
description: 'Execute the Apify actor and collect results',
|
|
88
88
|
inputSchema,
|
|
89
|
-
outputSchema: z.object({ items: z.array(z.unknown()), runId: z.string() }),
|
|
89
|
+
outputSchema: z.object({ items: z.array(z.unknown()), runId: z.string(), tableName: z.string() }),
|
|
90
90
|
handler: async (input) => {
|
|
91
|
-
const { actorId, startUrls, maxItems } = input as Input
|
|
91
|
+
const { actorId, startUrls, tableName, maxItems } = input as Input
|
|
92
92
|
const result = await platform.call({
|
|
93
93
|
tool: 'apify',
|
|
94
94
|
method: 'runActor',
|
|
95
95
|
credential: 'apify',
|
|
96
|
-
params: {
|
|
96
|
+
params: {
|
|
97
|
+
actorId,
|
|
98
|
+
input: { startUrls: startUrls.map(url => ({ url })) },
|
|
99
|
+
maxItems: maxItems ?? 100,
|
|
100
|
+
},
|
|
97
101
|
}) as { items: unknown[]; runId: string }
|
|
98
|
-
return { items: result.items, runId: result.runId }
|
|
102
|
+
return { items: result.items, runId: result.runId, tableName }
|
|
99
103
|
},
|
|
100
104
|
next: { type: StepType.LINEAR, target: 'store' },
|
|
101
105
|
},
|
package/reference/ui/exports.mdx
CHANGED
|
@@ -44,7 +44,7 @@ description: "Auto-generated catalog of all published @elevasis/ui subpath expor
|
|
|
44
44
|
| `@elevasis/ui/layout` | Layout | Components | Published layout component entry for downstream applications. |
|
|
45
45
|
| `@elevasis/ui/charts` | Charts | Components | Published chart component entry for downstream applications. |
|
|
46
46
|
| `@elevasis/ui/theme` | Theme | Visual | Published theme entry for downstream applications. |
|
|
47
|
-
| `@elevasis/ui/theme/presets` | Theme Presets | Visual |
|
|
47
|
+
| `@elevasis/ui/theme/presets` | Theme Presets | Visual | Published THEME_PRESETS tuple, ThemePresetName union, and ThemePresetEnum Zod enum, defined locally and kept manually aligned with the canonical list in packages/core/src/auth/multi-tenancy/theme-presets.ts. |
|
|
48
48
|
| `@elevasis/ui/api` | API | Foundation | Published API client entry for downstream applications. |
|
|
49
49
|
| `@elevasis/ui/utils` | Utils | Foundation | Published utility entry for downstream applications. |
|
|
50
50
|
| `@elevasis/ui/graph` | Graph | Visual | Published graph helper and visualization entry. |
|
package/reference/ui/index.mdx
CHANGED
|
@@ -77,6 +77,6 @@ You do not need `@elevasis/ui` if you are only writing backend workflows and age
|
|
|
77
77
|
|
|
78
78
|
`@elevasis/ui` uses `@elevasis/core` internally for entity schemas, org-model types, and auth contracts. Installing `@elevasis/ui` will pull in `@elevasis/core` as a dependency. You do not need to install `@elevasis/core` separately unless you need direct access to its subpaths.
|
|
79
79
|
|
|
80
|
-
##
|
|
80
|
+
## Documentation
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
- [Export Catalog](exports.mdx) - Generated table of all published subpath exports derived from the reference manifest
|