@loxtep/sdk 0.7.21 → 0.7.24
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/CHANGELOG.md +42 -0
- package/README.md +17 -13
- package/dist/cli/commands/config-cmd.js +1 -1
- package/dist/cli/commands/connectors-cmd.d.ts +23 -0
- package/dist/cli/commands/connectors-cmd.d.ts.map +1 -0
- package/dist/cli/commands/connectors-cmd.js +32 -0
- package/dist/cli/commands/connectors-cmd.js.map +1 -0
- package/dist/cli/commands/deploy-cmd.d.ts +5 -1
- package/dist/cli/commands/deploy-cmd.d.ts.map +1 -1
- package/dist/cli/commands/deploy-cmd.js +25 -2
- package/dist/cli/commands/deploy-cmd.js.map +1 -1
- package/dist/cli/commands/ingest-cmd.d.ts +7 -2
- package/dist/cli/commands/ingest-cmd.d.ts.map +1 -1
- package/dist/cli/commands/ingest-cmd.js +120 -31
- package/dist/cli/commands/ingest-cmd.js.map +1 -1
- package/dist/cli/commands/lint-cmd.d.ts +17 -0
- package/dist/cli/commands/lint-cmd.d.ts.map +1 -0
- package/dist/cli/commands/lint-cmd.js +61 -0
- package/dist/cli/commands/lint-cmd.js.map +1 -0
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +11 -6
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/index.js +24 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/client/connectors.d.ts.map +1 -1
- package/dist/client/connectors.js +7 -1
- package/dist/client/connectors.js.map +1 -1
- package/dist/errors/parse-http.d.ts.map +1 -1
- package/dist/errors/parse-http.js +33 -10
- package/dist/errors/parse-http.js.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/entity-json-schemas/ajv-loader.cjs +17 -0
- package/dist/lib/entity-json-schemas/index.d.ts +5 -0
- package/dist/lib/entity-json-schemas/index.d.ts.map +1 -0
- package/dist/lib/entity-json-schemas/index.js +3 -0
- package/dist/lib/entity-json-schemas/index.js.map +1 -0
- package/dist/lib/entity-json-schemas/types.d.ts +21 -0
- package/dist/lib/entity-json-schemas/types.d.ts.map +1 -0
- package/dist/lib/entity-json-schemas/types.js +32 -0
- package/dist/lib/entity-json-schemas/types.js.map +1 -0
- package/dist/lib/entity-json-schemas/validate-entity.d.ts +39 -0
- package/dist/lib/entity-json-schemas/validate-entity.d.ts.map +1 -0
- package/dist/lib/entity-json-schemas/validate-entity.js +143 -0
- package/dist/lib/entity-json-schemas/validate-entity.js.map +1 -0
- package/dist/lib/sdk-ingest-bundle.d.ts +60 -4
- package/dist/lib/sdk-ingest-bundle.d.ts.map +1 -1
- package/dist/lib/sdk-ingest-bundle.js +144 -51
- package/dist/lib/sdk-ingest-bundle.js.map +1 -1
- package/dist/lib/workspace-lint.d.ts +28 -0
- package/dist/lib/workspace-lint.d.ts.map +1 -0
- package/dist/lib/workspace-lint.js +199 -0
- package/dist/lib/workspace-lint.js.map +1 -0
- package/docs/getting-started.md +6 -16
- package/docs/quick-reference.md +9 -9
- package/docs/sdk-first-ingest.md +64 -227
- package/package.json +6 -2
- package/schemas/entity-json-schemas/SCHEMA_SYNC.md +18 -0
- package/schemas/entity-json-schemas/connection.json +310 -0
- package/schemas/entity-json-schemas/connector.json +188 -0
- package/schemas/entity-json-schemas/container.json +71 -0
- package/schemas/entity-json-schemas/contract.json +228 -0
- package/schemas/entity-json-schemas/data-product.json +163 -0
- package/schemas/entity-json-schemas/domain.json +74 -0
- package/schemas/entity-json-schemas/export.json +126 -0
- package/schemas/entity-json-schemas/odps-product.json +150 -0
- package/schemas/entity-json-schemas/quality-rule.json +115 -0
- package/schemas/entity-json-schemas/schema.json +206 -0
- package/schemas/entity-json-schemas/transformation.json +166 -0
- package/schemas/entity-json-schemas/validation.json +152 -0
- package/schemas/entity-json-schemas/workflow-graph.json +116 -0
- package/schemas/entity-json-schemas/workflow.json +193 -0
- package/docs/examples/generate-ingest-bundle.mjs +0 -133
- package/docs/examples/write-events.mjs +0 -54
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "https://loxtep.io/schemas/entity/validation.json",
|
|
4
|
+
"title": "Validation Entity",
|
|
5
|
+
"description": "JSON Schema for Validation entity in customer workspace. Validations are rules that assert data quality and reject invalid events within a workflow flow. Each validation references its workflow via workflow_id and the upstream entity it applies to via upstream_entity_id.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": [
|
|
8
|
+
"validation_id",
|
|
9
|
+
"organization_id",
|
|
10
|
+
"project_id",
|
|
11
|
+
"workflow_id",
|
|
12
|
+
"name",
|
|
13
|
+
"validation_type",
|
|
14
|
+
"rules",
|
|
15
|
+
"severity",
|
|
16
|
+
"created_at",
|
|
17
|
+
"updated_at"
|
|
18
|
+
],
|
|
19
|
+
"properties": {
|
|
20
|
+
"validation_id": {
|
|
21
|
+
"type": "string",
|
|
22
|
+
"format": "uuid",
|
|
23
|
+
"description": "Unique identifier for the validation"
|
|
24
|
+
},
|
|
25
|
+
"organization_id": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"format": "uuid",
|
|
28
|
+
"description": "Organization that owns this validation"
|
|
29
|
+
},
|
|
30
|
+
"project_id": {
|
|
31
|
+
"type": "string",
|
|
32
|
+
"format": "uuid",
|
|
33
|
+
"description": "Project that contains this validation"
|
|
34
|
+
},
|
|
35
|
+
"workflow_id": {
|
|
36
|
+
"type": "string",
|
|
37
|
+
"format": "uuid",
|
|
38
|
+
"description": "Workflow this validation belongs to"
|
|
39
|
+
},
|
|
40
|
+
"upstream_entity_id": {
|
|
41
|
+
"type": ["string", "null"],
|
|
42
|
+
"format": "uuid",
|
|
43
|
+
"description": "Reference to the upstream entity this validation applies to (connection, transformation, or data product)"
|
|
44
|
+
},
|
|
45
|
+
"upstream_entity_type": {
|
|
46
|
+
"type": ["string", "null"],
|
|
47
|
+
"enum": ["connections", "transformations", "data-products", null],
|
|
48
|
+
"description": "Entity type of the upstream entity"
|
|
49
|
+
},
|
|
50
|
+
"name": {
|
|
51
|
+
"type": "string",
|
|
52
|
+
"minLength": 1,
|
|
53
|
+
"maxLength": 255,
|
|
54
|
+
"description": "Validation name"
|
|
55
|
+
},
|
|
56
|
+
"description": {
|
|
57
|
+
"type": ["string", "null"],
|
|
58
|
+
"maxLength": 1000,
|
|
59
|
+
"description": "Validation description"
|
|
60
|
+
},
|
|
61
|
+
"validation_type": {
|
|
62
|
+
"type": "string",
|
|
63
|
+
"enum": [
|
|
64
|
+
"schema",
|
|
65
|
+
"business_rule",
|
|
66
|
+
"data_quality",
|
|
67
|
+
"pii_check",
|
|
68
|
+
"completeness",
|
|
69
|
+
"format"
|
|
70
|
+
],
|
|
71
|
+
"description": "Type of validation"
|
|
72
|
+
},
|
|
73
|
+
"schema_id": {
|
|
74
|
+
"type": "string",
|
|
75
|
+
"format": "uuid",
|
|
76
|
+
"description": "Org domain schema reference; deploy resolves latest active version into rules.schema when rules.schema is empty"
|
|
77
|
+
},
|
|
78
|
+
"schema_version_id": {
|
|
79
|
+
"type": "string",
|
|
80
|
+
"format": "uuid",
|
|
81
|
+
"description": "Pinned org domain schema version; deploy resolves definition into rules.schema when rules.schema is empty"
|
|
82
|
+
},
|
|
83
|
+
"rules": {
|
|
84
|
+
"type": "object",
|
|
85
|
+
"additionalProperties": true,
|
|
86
|
+
"description": "Validation rules (structure depends on validation_type). For validation_type schema, rules.schema holds the JSON Schema; rules.schema_id may reference org registry instead.",
|
|
87
|
+
"examples": [
|
|
88
|
+
{
|
|
89
|
+
"schema": {
|
|
90
|
+
"type": "object",
|
|
91
|
+
"description": "JSON Schema for validation"
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"condition": "field > 100",
|
|
96
|
+
"message": "Field must be greater than 100"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"required_fields": ["email", "name"],
|
|
100
|
+
"completeness_threshold": 0.95
|
|
101
|
+
}
|
|
102
|
+
]
|
|
103
|
+
},
|
|
104
|
+
"severity": {
|
|
105
|
+
"type": "string",
|
|
106
|
+
"enum": ["error", "warning", "info"],
|
|
107
|
+
"description": "Severity level when validation fails"
|
|
108
|
+
},
|
|
109
|
+
"error_message": {
|
|
110
|
+
"type": ["string", "null"],
|
|
111
|
+
"maxLength": 500,
|
|
112
|
+
"description": "Custom error message when validation fails"
|
|
113
|
+
},
|
|
114
|
+
"order": {
|
|
115
|
+
"type": ["integer", "null"],
|
|
116
|
+
"minimum": 0,
|
|
117
|
+
"description": "Default execution order when used in workflows (lower = earlier)"
|
|
118
|
+
},
|
|
119
|
+
"metadata": {
|
|
120
|
+
"type": "object",
|
|
121
|
+
"additionalProperties": true,
|
|
122
|
+
"default": {},
|
|
123
|
+
"description": "Additional metadata for the validation"
|
|
124
|
+
},
|
|
125
|
+
"created_by": {
|
|
126
|
+
"type": ["string", "null"],
|
|
127
|
+
"format": "uuid",
|
|
128
|
+
"description": "User ID who created the validation"
|
|
129
|
+
},
|
|
130
|
+
"updated_by": {
|
|
131
|
+
"type": ["string", "null"],
|
|
132
|
+
"format": "uuid",
|
|
133
|
+
"description": "User ID who last updated the validation"
|
|
134
|
+
},
|
|
135
|
+
"created_at": {
|
|
136
|
+
"type": "string",
|
|
137
|
+
"format": "date-time",
|
|
138
|
+
"description": "ISO 8601 timestamp when validation was created"
|
|
139
|
+
},
|
|
140
|
+
"updated_at": {
|
|
141
|
+
"type": "string",
|
|
142
|
+
"format": "date-time",
|
|
143
|
+
"description": "ISO 8601 timestamp when validation was last updated"
|
|
144
|
+
},
|
|
145
|
+
"deleted_at": {
|
|
146
|
+
"type": ["string", "null"],
|
|
147
|
+
"format": "date-time",
|
|
148
|
+
"description": "ISO 8601 timestamp when validation was deleted (soft delete)"
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
"additionalProperties": false
|
|
152
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "https://loxtep.io/schemas/workflow-graph.json",
|
|
4
|
+
"title": "Workflow Graph",
|
|
5
|
+
"description": "Materialized read-only graph view for a workflow (flow). Built from per-entity S3 files; not a writable entity type.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": [
|
|
8
|
+
"workflow_id",
|
|
9
|
+
"organization_id",
|
|
10
|
+
"project_id",
|
|
11
|
+
"version",
|
|
12
|
+
"built_at",
|
|
13
|
+
"workflow",
|
|
14
|
+
"nodes",
|
|
15
|
+
"edges",
|
|
16
|
+
"connectors",
|
|
17
|
+
"deployment",
|
|
18
|
+
"metadata"
|
|
19
|
+
],
|
|
20
|
+
"properties": {
|
|
21
|
+
"workflow_id": { "type": "string", "format": "uuid" },
|
|
22
|
+
"organization_id": { "type": "string", "format": "uuid" },
|
|
23
|
+
"project_id": { "type": "string", "format": "uuid" },
|
|
24
|
+
"version": { "type": "integer", "minimum": 1 },
|
|
25
|
+
"built_at": { "type": "string", "format": "date-time" },
|
|
26
|
+
"applied_template_digest": { "type": ["string", "null"] },
|
|
27
|
+
"workflow": {
|
|
28
|
+
"type": "object",
|
|
29
|
+
"description": "Full workflow.json entity snapshot"
|
|
30
|
+
},
|
|
31
|
+
"nodes": {
|
|
32
|
+
"type": "object",
|
|
33
|
+
"additionalProperties": {
|
|
34
|
+
"type": "object",
|
|
35
|
+
"required": ["entity_type", "entity_id", "data"],
|
|
36
|
+
"properties": {
|
|
37
|
+
"entity_type": { "type": "string" },
|
|
38
|
+
"entity_id": { "type": "string", "format": "uuid" },
|
|
39
|
+
"upstream_entity_id": { "type": ["string", "null"] },
|
|
40
|
+
"deployment_status": {
|
|
41
|
+
"type": "string",
|
|
42
|
+
"enum": ["undeployed", "deployed", "stale"]
|
|
43
|
+
},
|
|
44
|
+
"container_id": { "type": ["string", "null"] },
|
|
45
|
+
"data": { "type": "object" }
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"edges": {
|
|
50
|
+
"type": "array",
|
|
51
|
+
"items": {
|
|
52
|
+
"type": "object",
|
|
53
|
+
"required": ["from", "to", "type"],
|
|
54
|
+
"properties": {
|
|
55
|
+
"from": { "type": "string" },
|
|
56
|
+
"to": { "type": "string" },
|
|
57
|
+
"type": { "type": "string", "enum": ["upstream"] }
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"connectors": {
|
|
62
|
+
"type": "object",
|
|
63
|
+
"additionalProperties": { "type": "object" }
|
|
64
|
+
},
|
|
65
|
+
"deployment": {
|
|
66
|
+
"type": "object",
|
|
67
|
+
"required": [
|
|
68
|
+
"deployment_id",
|
|
69
|
+
"deployed_at",
|
|
70
|
+
"version_id",
|
|
71
|
+
"microservice_id",
|
|
72
|
+
"runtime_mapping"
|
|
73
|
+
],
|
|
74
|
+
"properties": {
|
|
75
|
+
"deployment_id": { "type": ["string", "null"], "format": "uuid" },
|
|
76
|
+
"deployed_at": { "type": ["string", "null"], "format": "date-time" },
|
|
77
|
+
"version_id": { "type": ["string", "null"], "format": "uuid" },
|
|
78
|
+
"microservice_id": { "type": ["string", "null"] },
|
|
79
|
+
"runtime_mapping": {
|
|
80
|
+
"type": "object",
|
|
81
|
+
"properties": {
|
|
82
|
+
"containers": {
|
|
83
|
+
"type": "array",
|
|
84
|
+
"items": {
|
|
85
|
+
"type": "object",
|
|
86
|
+
"properties": {
|
|
87
|
+
"container_id": { "type": "string" },
|
|
88
|
+
"entity_id": { "type": "string" },
|
|
89
|
+
"entity_type": { "type": "string" },
|
|
90
|
+
"bot_ids": { "type": "array", "items": { "type": "string" } },
|
|
91
|
+
"queue_ids": {
|
|
92
|
+
"type": "array",
|
|
93
|
+
"items": { "type": "string" }
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
"all_bot_ids": { "type": "array", "items": { "type": "string" } },
|
|
99
|
+
"all_queue_ids": { "type": "array", "items": { "type": "string" } }
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
"metadata": {
|
|
105
|
+
"type": "object",
|
|
106
|
+
"properties": {
|
|
107
|
+
"node_count": { "type": "integer" },
|
|
108
|
+
"entity_type_counts": {
|
|
109
|
+
"type": "object",
|
|
110
|
+
"additionalProperties": { "type": "integer" }
|
|
111
|
+
},
|
|
112
|
+
"requires_redeployment": { "type": "boolean" }
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "https://loxtep.io/schemas/entity/workflow.json",
|
|
4
|
+
"title": "Workflow Entity",
|
|
5
|
+
"description": "JSON Schema for the root workflow entity in customer workspace. A workflow is a flow. Flow nodes (connection, transformation, validation, data product) reference the workflow via workflow_id and point upstream via upstream_entity_id; the workflow does not store node IDs. template_id identifies the flow starter template used to create this flow (e.g. blank, webhook-ingestion), distinct from connector catalog templates.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": [
|
|
8
|
+
"workflow_id",
|
|
9
|
+
"organization_id",
|
|
10
|
+
"project_id",
|
|
11
|
+
"name",
|
|
12
|
+
"template_id",
|
|
13
|
+
"workflow_type",
|
|
14
|
+
"domain_id",
|
|
15
|
+
"status",
|
|
16
|
+
"created_at",
|
|
17
|
+
"updated_at"
|
|
18
|
+
],
|
|
19
|
+
"properties": {
|
|
20
|
+
"workflow_id": {
|
|
21
|
+
"type": "string",
|
|
22
|
+
"format": "uuid",
|
|
23
|
+
"description": "Unique identifier for the workflow"
|
|
24
|
+
},
|
|
25
|
+
"organization_id": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"format": "uuid",
|
|
28
|
+
"description": "Organization that owns this workflow"
|
|
29
|
+
},
|
|
30
|
+
"project_id": {
|
|
31
|
+
"type": "string",
|
|
32
|
+
"format": "uuid",
|
|
33
|
+
"description": "Project that contains this workflow"
|
|
34
|
+
},
|
|
35
|
+
"name": {
|
|
36
|
+
"type": "string",
|
|
37
|
+
"minLength": 1,
|
|
38
|
+
"maxLength": 255,
|
|
39
|
+
"description": "Workflow display name"
|
|
40
|
+
},
|
|
41
|
+
"description": {
|
|
42
|
+
"type": ["string", "null"],
|
|
43
|
+
"maxLength": 1000,
|
|
44
|
+
"description": "Workflow description"
|
|
45
|
+
},
|
|
46
|
+
"template_id": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"format": "uuid",
|
|
49
|
+
"description": "Workflow starter template identifier used when this flow was created (e.g. blank, webhook-ingestion). Distinct from connector catalog templates."
|
|
50
|
+
},
|
|
51
|
+
"workflow_type": {
|
|
52
|
+
"type": "string",
|
|
53
|
+
"enum": ["ingestion", "enrichment", "consumption"],
|
|
54
|
+
"description": "Type of flow: ingestion (ingest from external sources), enrichment (transform/join data), consumption (expose or consume data products)."
|
|
55
|
+
},
|
|
56
|
+
"domain_id": {
|
|
57
|
+
"type": "string",
|
|
58
|
+
"format": "uuid",
|
|
59
|
+
"description": "Domain this workflow belongs to (required)."
|
|
60
|
+
},
|
|
61
|
+
"segments": {
|
|
62
|
+
"type": "array",
|
|
63
|
+
"default": [],
|
|
64
|
+
"description": "Visual groupings of nodes in the graph editor.",
|
|
65
|
+
"items": {
|
|
66
|
+
"type": "object",
|
|
67
|
+
"properties": {
|
|
68
|
+
"segment_id": {
|
|
69
|
+
"type": "string",
|
|
70
|
+
"description": "Unique identifier for the segment"
|
|
71
|
+
},
|
|
72
|
+
"name": { "type": "string", "description": "Display name" },
|
|
73
|
+
"description": {
|
|
74
|
+
"type": ["string", "null"],
|
|
75
|
+
"description": "Optional description"
|
|
76
|
+
},
|
|
77
|
+
"node_ids": {
|
|
78
|
+
"type": "array",
|
|
79
|
+
"items": { "type": "string" },
|
|
80
|
+
"description": "Entity IDs of nodes in this segment"
|
|
81
|
+
},
|
|
82
|
+
"color": {
|
|
83
|
+
"type": ["string", "null"],
|
|
84
|
+
"description": "Optional color for UI"
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
"additionalProperties": false
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"trigger": {
|
|
91
|
+
"type": ["object", "null"],
|
|
92
|
+
"description": "Workflow trigger configuration (event, schedule, or connector).",
|
|
93
|
+
"properties": {
|
|
94
|
+
"event": {
|
|
95
|
+
"type": ["string", "null"],
|
|
96
|
+
"description": "Event-based trigger (e.g. webhook, queue)"
|
|
97
|
+
},
|
|
98
|
+
"schedule": {
|
|
99
|
+
"type": ["string", "null"],
|
|
100
|
+
"description": "Cron or interval for scheduled execution"
|
|
101
|
+
},
|
|
102
|
+
"connector": {
|
|
103
|
+
"type": ["string", "null"],
|
|
104
|
+
"format": "uuid",
|
|
105
|
+
"description": "Connector ID for connector-driven triggers"
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"additionalProperties": false
|
|
109
|
+
},
|
|
110
|
+
"configuration": {
|
|
111
|
+
"type": "object",
|
|
112
|
+
"description": "Workflow configuration (schedule, batch_size, etc.). Flow nodes are discovered by workflow_id and upstream_entity_id; the workflow does not store connection_id or transformation_ids.",
|
|
113
|
+
"properties": {
|
|
114
|
+
"schedule": {
|
|
115
|
+
"type": ["string", "null"],
|
|
116
|
+
"description": "Cron expression for scheduled execution (optional)"
|
|
117
|
+
},
|
|
118
|
+
"batch_size": {
|
|
119
|
+
"type": ["integer", "null"],
|
|
120
|
+
"minimum": 1,
|
|
121
|
+
"description": "Number of events to process per batch"
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
"additionalProperties": false
|
|
125
|
+
},
|
|
126
|
+
"deployment": {
|
|
127
|
+
"type": ["object", "null"],
|
|
128
|
+
"description": "Deployment information (set when workflow is deployed)",
|
|
129
|
+
"properties": {
|
|
130
|
+
"instance_id": {
|
|
131
|
+
"type": "string",
|
|
132
|
+
"format": "uuid"
|
|
133
|
+
},
|
|
134
|
+
"lambda_functions": {
|
|
135
|
+
"type": "array",
|
|
136
|
+
"items": {
|
|
137
|
+
"type": "string"
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
"queues": {
|
|
141
|
+
"type": "array",
|
|
142
|
+
"items": {
|
|
143
|
+
"type": "string"
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
"additionalProperties": false
|
|
148
|
+
},
|
|
149
|
+
"status": {
|
|
150
|
+
"type": "string",
|
|
151
|
+
"enum": ["active", "paused", "error", "pending", "inactive"],
|
|
152
|
+
"description": "Workflow status"
|
|
153
|
+
},
|
|
154
|
+
"metrics": {
|
|
155
|
+
"type": "object",
|
|
156
|
+
"additionalProperties": true,
|
|
157
|
+
"default": {},
|
|
158
|
+
"description": "Workflow metrics (events processed, error rate, etc.)"
|
|
159
|
+
},
|
|
160
|
+
"metadata": {
|
|
161
|
+
"type": "object",
|
|
162
|
+
"additionalProperties": true,
|
|
163
|
+
"default": {},
|
|
164
|
+
"description": "Additional metadata for the workflow"
|
|
165
|
+
},
|
|
166
|
+
"created_by": {
|
|
167
|
+
"type": ["string", "null"],
|
|
168
|
+
"format": "uuid",
|
|
169
|
+
"description": "User ID who created the workflow"
|
|
170
|
+
},
|
|
171
|
+
"updated_by": {
|
|
172
|
+
"type": ["string", "null"],
|
|
173
|
+
"format": "uuid",
|
|
174
|
+
"description": "User ID who last updated the workflow"
|
|
175
|
+
},
|
|
176
|
+
"created_at": {
|
|
177
|
+
"type": "string",
|
|
178
|
+
"format": "date-time",
|
|
179
|
+
"description": "ISO 8601 timestamp when workflow was created"
|
|
180
|
+
},
|
|
181
|
+
"updated_at": {
|
|
182
|
+
"type": "string",
|
|
183
|
+
"format": "date-time",
|
|
184
|
+
"description": "ISO 8601 timestamp when workflow was last updated"
|
|
185
|
+
},
|
|
186
|
+
"deleted_at": {
|
|
187
|
+
"type": ["string", "null"],
|
|
188
|
+
"format": "date-time",
|
|
189
|
+
"description": "ISO 8601 timestamp when workflow was deleted (soft delete)"
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
"additionalProperties": false
|
|
193
|
+
}
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Greenfield SDK ingest — one-shot provision via CLI (preferred) or bundle JSON for manual save.
|
|
4
|
-
*
|
|
5
|
-
* Run from your Loxtep workspace root (after login, init, attach):
|
|
6
|
-
*
|
|
7
|
-
* pnpm exec loxtep ingest provision --name app-events
|
|
8
|
-
*
|
|
9
|
-
* Or generate bundle JSON only:
|
|
10
|
-
*
|
|
11
|
-
* node node_modules/@loxtep/sdk/docs/examples/generate-ingest-bundle.mjs
|
|
12
|
-
* pnpm exec loxtep bundle save --dry-run
|
|
13
|
-
* pnpm exec loxtep bundle save
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
import { LoxtepClient, buildSdkIngestBundle } from '@loxtep/sdk';
|
|
17
|
-
import { randomUUID } from 'node:crypto';
|
|
18
|
-
import { writeFileSync, mkdirSync } from 'node:fs';
|
|
19
|
-
import { join } from 'node:path';
|
|
20
|
-
|
|
21
|
-
const DATA_PRODUCT_NAME = process.env.LOXTEP_DATA_PRODUCT_NAME ?? 'app-events';
|
|
22
|
-
const WORKFLOW_NAME = process.env.LOXTEP_WORKFLOW_NAME ?? 'SDK App Events Ingest';
|
|
23
|
-
const AUTO_SAVE = process.env.LOXTEP_AUTO_SAVE === '1';
|
|
24
|
-
|
|
25
|
-
async function main() {
|
|
26
|
-
const client = await LoxtepClient.fromWorkspace();
|
|
27
|
-
|
|
28
|
-
const user = await client.session.get_current_user();
|
|
29
|
-
const organizationId = user.organization_id ?? client.organization_id;
|
|
30
|
-
const projectId = client.project_id;
|
|
31
|
-
const instanceId = client.instance_id;
|
|
32
|
-
|
|
33
|
-
if (!organizationId || !projectId) {
|
|
34
|
-
console.error(
|
|
35
|
-
'Missing organization_id or project_id. Run from a workspace after `loxtep init`.'
|
|
36
|
-
);
|
|
37
|
-
process.exit(1);
|
|
38
|
-
}
|
|
39
|
-
if (!instanceId) {
|
|
40
|
-
console.error('Missing instance_id. Run `loxtep attach --instance <id>` first.');
|
|
41
|
-
process.exit(1);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
let domainId = process.env.LOXTEP_DOMAIN_ID;
|
|
45
|
-
if (!domainId) {
|
|
46
|
-
const domains = await client.define.domains.list({ page_size: 20 });
|
|
47
|
-
const items = domains.items ?? [];
|
|
48
|
-
if (items.length === 0) {
|
|
49
|
-
console.error(
|
|
50
|
-
'No domains found. Create one in the Web UI (Governance → Domains) or set LOXTEP_DOMAIN_ID.'
|
|
51
|
-
);
|
|
52
|
-
process.exit(1);
|
|
53
|
-
}
|
|
54
|
-
domainId = items[0].domain_id;
|
|
55
|
-
console.error(`Using domain: ${items[0].name} (${domainId})`);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
console.error('Creating SDK connector…');
|
|
59
|
-
const connector = await client.connect.connectors.create({
|
|
60
|
-
connector_type: 'sdk',
|
|
61
|
-
metadata: { name: 'SDK Connector', created_by: 'generate-ingest-bundle' },
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
const bundle = buildSdkIngestBundle({
|
|
65
|
-
organization_id: organizationId,
|
|
66
|
-
project_id: projectId,
|
|
67
|
-
domain_id: domainId,
|
|
68
|
-
connector_id: connector.connector_id,
|
|
69
|
-
data_product_name: DATA_PRODUCT_NAME,
|
|
70
|
-
workflow_name: WORKFLOW_NAME,
|
|
71
|
-
user_id: user.user_id,
|
|
72
|
-
workflow_id: randomUUID(),
|
|
73
|
-
connection_id: randomUUID(),
|
|
74
|
-
data_product_id: randomUUID(),
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
mkdirSync('.loxtep', { recursive: true });
|
|
78
|
-
const outPath = join('.loxtep', 'sdk-ingest-bundle.json');
|
|
79
|
-
writeFileSync(outPath, JSON.stringify({ project_id: projectId, files: bundle.files }, null, 2));
|
|
80
|
-
|
|
81
|
-
console.log(
|
|
82
|
-
JSON.stringify(
|
|
83
|
-
{
|
|
84
|
-
connector_id: connector.connector_id,
|
|
85
|
-
workflow_id: bundle.workflow_id,
|
|
86
|
-
data_product_id: bundle.data_product_id,
|
|
87
|
-
data_product_name: bundle.data_product_name,
|
|
88
|
-
bundle_path: outPath,
|
|
89
|
-
},
|
|
90
|
-
null,
|
|
91
|
-
2
|
|
92
|
-
)
|
|
93
|
-
);
|
|
94
|
-
|
|
95
|
-
if (AUTO_SAVE) {
|
|
96
|
-
console.error('Saving workflow bundle (LOXTEP_AUTO_SAVE=1)…');
|
|
97
|
-
const saveResult = await client.build.workflows.save_workflow_bundle(projectId, {
|
|
98
|
-
files: bundle.files,
|
|
99
|
-
dry_run: false,
|
|
100
|
-
});
|
|
101
|
-
console.error('Deploying…');
|
|
102
|
-
const deployResult = await client.build.workflows.deploy({
|
|
103
|
-
project_id: projectId,
|
|
104
|
-
instance_id: instanceId,
|
|
105
|
-
});
|
|
106
|
-
console.log(JSON.stringify({ save: saveResult, deploy: deployResult }, null, 2));
|
|
107
|
-
console.error(`
|
|
108
|
-
Provisioned. Write events:
|
|
109
|
-
LOXTEP_DATA_PRODUCT_NAME=${DATA_PRODUCT_NAME} node node_modules/@loxtep/sdk/docs/examples/write-events.mjs
|
|
110
|
-
`);
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
console.error(`
|
|
115
|
-
Next steps (no MCP required)
|
|
116
|
-
────────────────────────────
|
|
117
|
-
Preferred — one command:
|
|
118
|
-
pnpm exec loxtep ingest provision --name ${DATA_PRODUCT_NAME}
|
|
119
|
-
|
|
120
|
-
Or save the generated bundle:
|
|
121
|
-
pnpm exec loxtep bundle save --dry-run --file ${outPath}
|
|
122
|
-
pnpm exec loxtep bundle save --file ${outPath}
|
|
123
|
-
pnpm exec loxtep workflows deploy --project-id ${projectId} --instance-id ${instanceId}
|
|
124
|
-
|
|
125
|
-
Write events:
|
|
126
|
-
LOXTEP_DATA_PRODUCT_NAME=${DATA_PRODUCT_NAME} node node_modules/@loxtep/sdk/docs/examples/write-events.mjs
|
|
127
|
-
`);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
main().catch(err => {
|
|
131
|
-
console.error(err instanceof Error ? err.message : err);
|
|
132
|
-
process.exit(1);
|
|
133
|
-
});
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Write sample events to a deployed source data product via get_writer.
|
|
4
|
-
*
|
|
5
|
-
* Prerequisites: login, init, attach, SDK ingest workflow deployed (see sdk-first-ingest.md).
|
|
6
|
-
*
|
|
7
|
-
* node node_modules/@loxtep/sdk/docs/examples/write-events.mjs
|
|
8
|
-
*
|
|
9
|
-
* Env:
|
|
10
|
-
* LOXTEP_DATA_PRODUCT_NAME default: app-events
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import { LoxtepClient } from '@loxtep/sdk';
|
|
14
|
-
|
|
15
|
-
const DATA_PRODUCT_NAME = process.env.LOXTEP_DATA_PRODUCT_NAME ?? 'app-events';
|
|
16
|
-
|
|
17
|
-
async function main() {
|
|
18
|
-
const client = await LoxtepClient.fromWorkspace();
|
|
19
|
-
|
|
20
|
-
console.error(`Opening writer for data product "${DATA_PRODUCT_NAME}"…`);
|
|
21
|
-
const writer = await client.get_writer(DATA_PRODUCT_NAME);
|
|
22
|
-
|
|
23
|
-
const events = [
|
|
24
|
-
{
|
|
25
|
-
event_id: `evt_${Date.now()}_1`,
|
|
26
|
-
occurred_at: new Date().toISOString(),
|
|
27
|
-
payload: { source: 'write-events.mjs', action: 'example_write', index: 1 },
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
event_id: `evt_${Date.now()}_2`,
|
|
31
|
-
occurred_at: new Date().toISOString(),
|
|
32
|
-
payload: { source: 'write-events.mjs', action: 'example_write', index: 2 },
|
|
33
|
-
},
|
|
34
|
-
];
|
|
35
|
-
|
|
36
|
-
for (const event of events) {
|
|
37
|
-
writer.write(event);
|
|
38
|
-
console.log(JSON.stringify({ written: event.event_id }));
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
await writer.close();
|
|
42
|
-
console.error('Writer closed — events flushed.');
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
main().catch(err => {
|
|
46
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
47
|
-
console.error(message);
|
|
48
|
-
if (/not deployed/i.test(message)) {
|
|
49
|
-
console.error(
|
|
50
|
-
'\nDeploy an SDK ingestion workflow first. See nodejs/docs/sdk-first-ingest.md'
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
process.exit(1);
|
|
54
|
-
});
|