@dqc.ai/fiori-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/LICENSE +6 -0
- package/README.md +209 -0
- package/index.d.ts +66 -0
- package/index.js +60 -0
- package/package.json +37 -0
package/LICENSE
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
# @dqc.ai/fiori-sdk
|
|
2
|
+
|
|
3
|
+
> Real-time data quality validation for SAP Fiori applications — powered by [DQC](https://dqc.ai).
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The **DQC Fiori SDK** is a UI5 library that integrates DQC's Validation API directly into SAP Fiori apps. It enables **inline, real-time validation** of form data against centrally managed DQC rulesets — before the data is saved to SAP.
|
|
8
|
+
|
|
9
|
+
- ✅ **Catch data quality issues at the point of entry** — not days later in a batch run
|
|
10
|
+
- ✅ **Central rule management** — rules are maintained in DQC, not hard-coded in Fiori apps
|
|
11
|
+
- ✅ **No ABAP changes required** — the SDK calls the DQC Validation API over HTTPS
|
|
12
|
+
- ✅ **Works with any Fiori app** — Freestyle, Fiori Elements, or custom UI5 apps
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
**Please reach out to the DQC team to get access.**
|
|
17
|
+
|
|
18
|
+
Add the DQC Fiori SDK to your UI5 project:
|
|
19
|
+
|
|
20
|
+
```json
|
|
21
|
+
{
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@dqc.ai/fiori-sdk": "^0.1.0"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Or load directly in `manifest.json`:
|
|
29
|
+
|
|
30
|
+
```json
|
|
31
|
+
{
|
|
32
|
+
"sap.ui5": {
|
|
33
|
+
"resourceRoots": {
|
|
34
|
+
"dqc.validation": "https://cdn.dqc.ai/<customer-id>/fiori-sdk/1.0/"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Quick Start
|
|
41
|
+
|
|
42
|
+
```javascript
|
|
43
|
+
// Component.js
|
|
44
|
+
sap.ui.define([
|
|
45
|
+
"sap/ui/core/UIComponent",
|
|
46
|
+
"dqc/validation/DQCClient"
|
|
47
|
+
], function(UIComponent, DQCClient) {
|
|
48
|
+
"use strict";
|
|
49
|
+
|
|
50
|
+
return UIComponent.extend("my.app.Component", {
|
|
51
|
+
init: function() {
|
|
52
|
+
UIComponent.prototype.init.apply(this, arguments);
|
|
53
|
+
|
|
54
|
+
// Initialize DQC Client
|
|
55
|
+
this._dqcClient = new DQCClient({
|
|
56
|
+
baseUrl: "https://your-dqc-instance.dqc.ai",
|
|
57
|
+
tenantId: "your-tenant-uuid",
|
|
58
|
+
apiKey: "your-api-key",
|
|
59
|
+
rulesetId: "your-ruleset-uuid"
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Validate Form Data
|
|
67
|
+
|
|
68
|
+
```javascript
|
|
69
|
+
// In your controller
|
|
70
|
+
onValidatePress: async function() {
|
|
71
|
+
var oModel = this.getView().getModel();
|
|
72
|
+
var oData = oModel.getProperty("/materialData");
|
|
73
|
+
|
|
74
|
+
try {
|
|
75
|
+
var oResult = await this._dqcClient.validate({
|
|
76
|
+
data: [
|
|
77
|
+
{
|
|
78
|
+
"MaterialNumber": { type: "string", value: oData.MaterialNumber },
|
|
79
|
+
"Description": { type: "string", value: oData.Description },
|
|
80
|
+
"Weight": { type: "number", value: oData.Weight },
|
|
81
|
+
"CreatedDate": { type: "date", value: oData.CreatedDate, date_format: "YYYY-MM-DD" }
|
|
82
|
+
}
|
|
83
|
+
]
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
if (oResult.passed) {
|
|
87
|
+
MessageToast.show("Alle Prüfungen bestanden ✓");
|
|
88
|
+
} else {
|
|
89
|
+
this._dqcClient.applyIssues(this.getView(), oResult);
|
|
90
|
+
}
|
|
91
|
+
} catch (oError) {
|
|
92
|
+
MessageBox.error("Validierung fehlgeschlagen: " + oError.message);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## API Reference
|
|
98
|
+
|
|
99
|
+
### `DQCClient(config)`
|
|
100
|
+
|
|
101
|
+
```javascript
|
|
102
|
+
new DQCClient({
|
|
103
|
+
baseUrl: string, // DQC platform URL
|
|
104
|
+
tenantId: string, // Tenant UUID
|
|
105
|
+
apiKey?: string, // API key authentication
|
|
106
|
+
destination?: string, // SAP BTP Destination name (alternative to baseUrl + apiKey)
|
|
107
|
+
rulesetId?: string, // Default ruleset (can override per call)
|
|
108
|
+
timeout?: number // Request timeout in ms (default: 30000)
|
|
109
|
+
})
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### `validate(payload, options?)`
|
|
113
|
+
|
|
114
|
+
Validates data against a DQC ruleset.
|
|
115
|
+
|
|
116
|
+
| Parameter | Type | Description |
|
|
117
|
+
|-----------|------|-------------|
|
|
118
|
+
| `payload.data` | `Array<Object>` | Row objects. Each field: `{ type, value, date_format? }` |
|
|
119
|
+
| `payload.rules_to_apply` | `string[]` | *(Optional)* Specific rule IDs. Empty = all rules |
|
|
120
|
+
| `options.rulesetId` | `string` | *(Optional)* Override default ruleset |
|
|
121
|
+
| `options.detailed` | `boolean` | *(Optional)* Detailed results (default: `true`) |
|
|
122
|
+
|
|
123
|
+
**Returns:** `Promise<ValidationResponse>`
|
|
124
|
+
|
|
125
|
+
```javascript
|
|
126
|
+
{
|
|
127
|
+
request_id: "req-123",
|
|
128
|
+
passed: false,
|
|
129
|
+
total_rows_validated: 1,
|
|
130
|
+
total_issues: 2,
|
|
131
|
+
rule_results: [{
|
|
132
|
+
rule_id: "uuid",
|
|
133
|
+
rule_name: "Material Number Format",
|
|
134
|
+
rule_description: "Must match pattern MAT-XXXXXX",
|
|
135
|
+
total_issues: 1,
|
|
136
|
+
passed: false,
|
|
137
|
+
issues: [{
|
|
138
|
+
row_index: 0,
|
|
139
|
+
column_name: "MaterialNumber",
|
|
140
|
+
value: "12345",
|
|
141
|
+
expected_pattern: "MAT-\\d{6}",
|
|
142
|
+
error_message: "Material number does not match required format"
|
|
143
|
+
}]
|
|
144
|
+
}]
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### `applyIssues(view, validationResponse)`
|
|
149
|
+
|
|
150
|
+
Sets `ValueState.Error` and `ValueStateText` on matching UI5 input controls automatically.
|
|
151
|
+
|
|
152
|
+
### `clearIssues(view)`
|
|
153
|
+
|
|
154
|
+
Resets all `ValueState` on controls previously marked by `applyIssues`.
|
|
155
|
+
|
|
156
|
+
### `validateField(fieldName, value, type)`
|
|
157
|
+
|
|
158
|
+
Validates a single field. Returns only issues for that field. Useful for `liveChange` handlers.
|
|
159
|
+
|
|
160
|
+
## Authentication
|
|
161
|
+
|
|
162
|
+
### API Key
|
|
163
|
+
|
|
164
|
+
```javascript
|
|
165
|
+
new DQCClient({
|
|
166
|
+
baseUrl: "https://your-instance.dqc.ai",
|
|
167
|
+
tenantId: "...",
|
|
168
|
+
apiKey: "dqc_ak_xxxxxxxxxxxx"
|
|
169
|
+
});
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
⚠️ API keys in frontend code are visible to users. Use only for internal/intranet Fiori apps or combine with SAP BTP Destination Service.
|
|
173
|
+
|
|
174
|
+
### SAP BTP Destination (Recommended for Production)
|
|
175
|
+
|
|
176
|
+
Route requests through SAP BTP Destination Service — keeps credentials server-side.
|
|
177
|
+
|
|
178
|
+
1. Create a Destination in SAP BTP Cockpit (`DQC_VALIDATION`, OAuth2ClientCredentials)
|
|
179
|
+
2. Use in SDK:
|
|
180
|
+
|
|
181
|
+
```javascript
|
|
182
|
+
new DQCClient({
|
|
183
|
+
destination: "DQC_VALIDATION",
|
|
184
|
+
rulesetId: "your-ruleset-uuid"
|
|
185
|
+
});
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## Supported Environments
|
|
189
|
+
|
|
190
|
+
| Environment | Support |
|
|
191
|
+
|-------------|---------|
|
|
192
|
+
| SAP Fiori Launchpad (on-premise) | ✅ |
|
|
193
|
+
| SAP BTP / Fiori Launchpad (cloud) | ✅ |
|
|
194
|
+
| SAP Work Zone | ✅ |
|
|
195
|
+
| Standalone UI5 app | ✅ |
|
|
196
|
+
| SAP Mobile Start | ✅ (via BTP Destination) |
|
|
197
|
+
| SAPUI5 1.96+ / OpenUI5 | ✅ |
|
|
198
|
+
|
|
199
|
+
## Documentation
|
|
200
|
+
|
|
201
|
+
Full documentation: **[docs.dqc.ai/fiori-sdk](https://docs.dqc.ai/fiori-sdk)**
|
|
202
|
+
|
|
203
|
+
## Status
|
|
204
|
+
|
|
205
|
+
🚧 **Early Access** — This package is under active development. Contact [support@dqc.ai](mailto:support@dqc.ai) for early access and integration support.
|
|
206
|
+
|
|
207
|
+
## License
|
|
208
|
+
|
|
209
|
+
Proprietary — see [LICENSE](./LICENSE) for details.
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @dqc.ai/fiori-sdk
|
|
3
|
+
* DQC Validation SDK for SAP Fiori
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export interface DQCClientConfig {
|
|
7
|
+
baseUrl?: string;
|
|
8
|
+
tenantId?: string;
|
|
9
|
+
apiKey?: string;
|
|
10
|
+
destination?: string;
|
|
11
|
+
rulesetId?: string;
|
|
12
|
+
language?: "de" | "en";
|
|
13
|
+
timeout?: number;
|
|
14
|
+
failMode?: "open" | "closed";
|
|
15
|
+
retries?: number;
|
|
16
|
+
retryDelay?: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface EntryDataType {
|
|
20
|
+
type: "string" | "number" | "date" | "boolean";
|
|
21
|
+
value: any;
|
|
22
|
+
date_format?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface ValidatePayload {
|
|
26
|
+
data: Array<Record<string, EntryDataType>>;
|
|
27
|
+
rules_to_apply?: string[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface ValidateOptions {
|
|
31
|
+
rulesetId?: string;
|
|
32
|
+
detailed?: boolean;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface ValidationIssue {
|
|
36
|
+
row_index: number;
|
|
37
|
+
column_name: string | null;
|
|
38
|
+
value: any;
|
|
39
|
+
expected_pattern: string | null;
|
|
40
|
+
error_message: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface RuleValidationResult {
|
|
44
|
+
rule_id: string;
|
|
45
|
+
rule_name: string;
|
|
46
|
+
rule_description: string | null;
|
|
47
|
+
total_issues: number;
|
|
48
|
+
issues: ValidationIssue[];
|
|
49
|
+
passed: boolean;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface ValidationResponse {
|
|
53
|
+
request_id: string;
|
|
54
|
+
total_rows_validated: number;
|
|
55
|
+
total_issues: number;
|
|
56
|
+
passed: boolean;
|
|
57
|
+
rule_results: RuleValidationResult[];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export declare class DQCClient {
|
|
61
|
+
constructor(config: DQCClientConfig);
|
|
62
|
+
validate(payload: ValidatePayload, options?: ValidateOptions): Promise<ValidationResponse>;
|
|
63
|
+
validateField(fieldName: string, value: any, type: string): Promise<ValidationIssue[]>;
|
|
64
|
+
applyIssues(view: any, validationResponse: ValidationResponse): void;
|
|
65
|
+
clearIssues(view: any): void;
|
|
66
|
+
}
|
package/index.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @dqc.ai/fiori-sdk
|
|
3
|
+
*
|
|
4
|
+
* DQC Validation SDK for SAP Fiori
|
|
5
|
+
* Real-time data quality validation in UI5 applications.
|
|
6
|
+
*
|
|
7
|
+
* Documentation: https://docs.dqc.ai/fiori-sdk
|
|
8
|
+
* Support: support@dqc.ai
|
|
9
|
+
*
|
|
10
|
+
* @version 0.1.0
|
|
11
|
+
* @license SEE LICENSE IN LICENSE
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
"use strict";
|
|
15
|
+
|
|
16
|
+
class DQCClient {
|
|
17
|
+
constructor(config) {
|
|
18
|
+
this.baseUrl = config.baseUrl;
|
|
19
|
+
this.tenantId = config.tenantId;
|
|
20
|
+
this.rulesetId = config.rulesetId;
|
|
21
|
+
this._ready = false;
|
|
22
|
+
|
|
23
|
+
if (!config.baseUrl) {
|
|
24
|
+
console.warn(
|
|
25
|
+
"[@dqc.ai/fiori-sdk] This is a placeholder package. " +
|
|
26
|
+
"Full SDK coming soon — contact support@dqc.ai for early access."
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async validate(/* payload, options */) {
|
|
32
|
+
throw new Error(
|
|
33
|
+
"[@dqc.ai/fiori-sdk] Not yet implemented. " +
|
|
34
|
+
"Full SDK coming soon — see https://docs.dqc.ai/fiori-sdk"
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async validateField(/* fieldName, value, type */) {
|
|
39
|
+
throw new Error(
|
|
40
|
+
"[@dqc.ai/fiori-sdk] Not yet implemented. " +
|
|
41
|
+
"Full SDK coming soon — see https://docs.dqc.ai/fiori-sdk"
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
applyIssues(/* view, validationResponse */) {
|
|
46
|
+
throw new Error(
|
|
47
|
+
"[@dqc.ai/fiori-sdk] Not yet implemented. " +
|
|
48
|
+
"Full SDK coming soon — see https://docs.dqc.ai/fiori-sdk"
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
clearIssues(/* view */) {
|
|
53
|
+
throw new Error(
|
|
54
|
+
"[@dqc.ai/fiori-sdk] Not yet implemented. " +
|
|
55
|
+
"Full SDK coming soon — see https://docs.dqc.ai/fiori-sdk"
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
module.exports = { DQCClient };
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dqc.ai/fiori-sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "DQC Validation SDK for SAP Fiori — real-time data quality validation in UI5 apps",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"types": "index.d.ts",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"dqc",
|
|
9
|
+
"data-quality",
|
|
10
|
+
"sap",
|
|
11
|
+
"fiori",
|
|
12
|
+
"ui5",
|
|
13
|
+
"sapui5",
|
|
14
|
+
"openui5",
|
|
15
|
+
"validation",
|
|
16
|
+
"sap-btp"
|
|
17
|
+
],
|
|
18
|
+
"author": "dqc.ai <code@dqc.ai> (https://dqc.ai)",
|
|
19
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
20
|
+
"homepage": "https://docs.dqc.ai/fiori-sdk",
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "https://github.com/dataqcompany/fiori-sdk"
|
|
24
|
+
},
|
|
25
|
+
"bugs": {
|
|
26
|
+
"url": "https://github.com/dataqcompany/fiori-sdk/issues"
|
|
27
|
+
},
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=16.0.0"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"index.js",
|
|
33
|
+
"index.d.ts",
|
|
34
|
+
"README.md",
|
|
35
|
+
"LICENSE"
|
|
36
|
+
]
|
|
37
|
+
}
|