@zenning/tool-app-contracts 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/README.md +88 -0
- package/dist/cjs/base.d.ts +9 -0
- package/dist/cjs/base.js +7 -0
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.js +18 -0
- package/dist/cjs/tools/index.d.ts +2 -0
- package/dist/cjs/tools/index.js +38 -0
- package/dist/cjs/tools/visualise-data-tables/index.d.ts +6 -0
- package/dist/cjs/tools/visualise-data-tables/index.js +21 -0
- package/dist/cjs/tools/visualise-data-tables/schema.d.ts +67 -0
- package/dist/cjs/tools/visualise-data-tables/schema.js +21 -0
- package/dist/cjs/tools/visualise-data-tables/types.d.ts +6 -0
- package/dist/cjs/tools/visualise-data-tables/types.js +2 -0
- package/dist/cjs/tools/visualise-salesforce-records/index.d.ts +6 -0
- package/dist/cjs/tools/visualise-salesforce-records/index.js +21 -0
- package/dist/cjs/tools/visualise-salesforce-records/schema.d.ts +145 -0
- package/dist/cjs/tools/visualise-salesforce-records/schema.js +51 -0
- package/dist/cjs/tools/visualise-salesforce-records/types.d.ts +8 -0
- package/dist/cjs/tools/visualise-salesforce-records/types.js +2 -0
- package/dist/esm/base.d.ts +9 -0
- package/dist/esm/base.js +4 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/tools/index.d.ts +2 -0
- package/dist/esm/tools/index.js +2 -0
- package/dist/esm/tools/visualise-data-tables/index.d.ts +6 -0
- package/dist/esm/tools/visualise-data-tables/index.js +5 -0
- package/dist/esm/tools/visualise-data-tables/schema.d.ts +67 -0
- package/dist/esm/tools/visualise-data-tables/schema.js +18 -0
- package/dist/esm/tools/visualise-data-tables/types.d.ts +6 -0
- package/dist/esm/tools/visualise-data-tables/types.js +1 -0
- package/dist/esm/tools/visualise-salesforce-records/index.d.ts +6 -0
- package/dist/esm/tools/visualise-salesforce-records/index.js +5 -0
- package/dist/esm/tools/visualise-salesforce-records/schema.d.ts +145 -0
- package/dist/esm/tools/visualise-salesforce-records/schema.js +48 -0
- package/dist/esm/tools/visualise-salesforce-records/types.d.ts +8 -0
- package/dist/esm/tools/visualise-salesforce-records/types.js +1 -0
- package/package.json +36 -0
package/README.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Zenning Tool App Contracts
|
|
2
|
+
|
|
3
|
+
Shared Zod contracts for Zenning Tool Apps, ensuring type safety between backend and frontend.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Since this is a private GitHub repository, install it as a Git dependency:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Install from main branch
|
|
11
|
+
npm install github:AllTheTables/zenning-tool-app-contracts#main
|
|
12
|
+
|
|
13
|
+
# OR with pnpm
|
|
14
|
+
pnpm add github:AllTheTables/zenning-tool-app-contracts#main
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Updating
|
|
18
|
+
|
|
19
|
+
To pull the latest changes:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm update zenning-tool-app-contracts
|
|
23
|
+
# or
|
|
24
|
+
pnpm update zenning-tool-app-contracts
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
Tools are exported as namespaces to keep things tidy.
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
import { VisualiseDataTables } from 'zenning-tool-app-contracts';
|
|
33
|
+
|
|
34
|
+
// 1. Use the Schema for runtime validation
|
|
35
|
+
const result = VisualiseDataTables.Schema.safeParse(data);
|
|
36
|
+
|
|
37
|
+
if (result.success) {
|
|
38
|
+
// 2. Use the Contract type for TypeScript definitions
|
|
39
|
+
const myData: VisualiseDataTables.Contract = result.data;
|
|
40
|
+
console.log(myData.toolId);
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Available Tools
|
|
45
|
+
|
|
46
|
+
- `VisualiseDataTables` - Data visualisation tool for tabular data
|
|
47
|
+
|
|
48
|
+
## Adding a New Tool
|
|
49
|
+
|
|
50
|
+
1. Create a new folder in `src/tools/<tool-name>/`
|
|
51
|
+
2. Create `schema.ts` extending `BaseToolSchema`:
|
|
52
|
+
```typescript
|
|
53
|
+
// src/tools/my-tool/schema.ts
|
|
54
|
+
import { z } from 'zod';
|
|
55
|
+
import { BaseToolSchema } from '../../base';
|
|
56
|
+
|
|
57
|
+
export const MyToolSchema = BaseToolSchema.extend({
|
|
58
|
+
toolId: z.literal('my-tool-id'),
|
|
59
|
+
// ... custom fields
|
|
60
|
+
});
|
|
61
|
+
```
|
|
62
|
+
3. Create `types.ts` for inferred types:
|
|
63
|
+
```typescript
|
|
64
|
+
// src/tools/my-tool/types.ts
|
|
65
|
+
import { z } from 'zod';
|
|
66
|
+
import { MyToolSchema } from './schema';
|
|
67
|
+
|
|
68
|
+
export type MyTool = z.infer<typeof MyToolSchema>;
|
|
69
|
+
```
|
|
70
|
+
4. Create `index.ts` to export and alias them:
|
|
71
|
+
```typescript
|
|
72
|
+
// src/tools/my-tool/index.ts
|
|
73
|
+
import { MyToolSchema } from './schema';
|
|
74
|
+
import { MyTool } from './types';
|
|
75
|
+
|
|
76
|
+
export * from './schema';
|
|
77
|
+
export * from './types';
|
|
78
|
+
|
|
79
|
+
// Standard aliases
|
|
80
|
+
export { MyToolSchema as Schema };
|
|
81
|
+
export type { MyTool as Contract };
|
|
82
|
+
```
|
|
83
|
+
5. Add to `src/tools/index.ts`:
|
|
84
|
+
```typescript
|
|
85
|
+
export * as MyTool from './my-tool';
|
|
86
|
+
```
|
|
87
|
+
6. Run `npm run build` to verify
|
|
88
|
+
7. Commit and push your changes
|
package/dist/cjs/base.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseToolSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.BaseToolSchema = zod_1.z.object({
|
|
6
|
+
toolId: zod_1.z.string().describe('The unique human-readable identifier for this tool app'),
|
|
7
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./base"), exports);
|
|
18
|
+
__exportStar(require("./tools"), exports);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.VisualiseSalesforceRecords = exports.VisualiseDataTables = void 0;
|
|
37
|
+
exports.VisualiseDataTables = __importStar(require("./visualise-data-tables"));
|
|
38
|
+
exports.VisualiseSalesforceRecords = __importStar(require("./visualise-salesforce-records"));
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.Schema = void 0;
|
|
18
|
+
const schema_1 = require("./schema");
|
|
19
|
+
Object.defineProperty(exports, "Schema", { enumerable: true, get: function () { return schema_1.VisualiseDataTablesSchema; } });
|
|
20
|
+
__exportStar(require("./schema"), exports);
|
|
21
|
+
__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const ColumnTypeSchema: z.ZodEnum<["string", "number", "boolean", "date", "datetime"]>;
|
|
3
|
+
export declare const VisualizationTypeSchema: z.ZodEnum<["table", "barChart", "lineChart", "areaChart", "pieChart"]>;
|
|
4
|
+
export declare const ColumnSchema: z.ZodObject<{
|
|
5
|
+
key: z.ZodString;
|
|
6
|
+
label: z.ZodString;
|
|
7
|
+
type: z.ZodEnum<["string", "number", "boolean", "date", "datetime"]>;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
type: "string" | "number" | "boolean" | "date" | "datetime";
|
|
10
|
+
key: string;
|
|
11
|
+
label: string;
|
|
12
|
+
}, {
|
|
13
|
+
type: "string" | "number" | "boolean" | "date" | "datetime";
|
|
14
|
+
key: string;
|
|
15
|
+
label: string;
|
|
16
|
+
}>;
|
|
17
|
+
export declare const VisualiseDataTablesSchema: z.ZodObject<{} & {
|
|
18
|
+
toolId: z.ZodLiteral<"visualise-data-tables">;
|
|
19
|
+
columns: z.ZodArray<z.ZodObject<{
|
|
20
|
+
key: z.ZodString;
|
|
21
|
+
label: z.ZodString;
|
|
22
|
+
type: z.ZodEnum<["string", "number", "boolean", "date", "datetime"]>;
|
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
|
+
type: "string" | "number" | "boolean" | "date" | "datetime";
|
|
25
|
+
key: string;
|
|
26
|
+
label: string;
|
|
27
|
+
}, {
|
|
28
|
+
type: "string" | "number" | "boolean" | "date" | "datetime";
|
|
29
|
+
key: string;
|
|
30
|
+
label: string;
|
|
31
|
+
}>, "many">;
|
|
32
|
+
rows: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>, "many">;
|
|
33
|
+
visualizationOptions: z.ZodObject<{
|
|
34
|
+
default: z.ZodEnum<["table", "barChart", "lineChart", "areaChart", "pieChart"]>;
|
|
35
|
+
allowed: z.ZodArray<z.ZodEnum<["table", "barChart", "lineChart", "areaChart", "pieChart"]>, "many">;
|
|
36
|
+
}, "strip", z.ZodTypeAny, {
|
|
37
|
+
default: "table" | "barChart" | "lineChart" | "areaChart" | "pieChart";
|
|
38
|
+
allowed: ("table" | "barChart" | "lineChart" | "areaChart" | "pieChart")[];
|
|
39
|
+
}, {
|
|
40
|
+
default: "table" | "barChart" | "lineChart" | "areaChart" | "pieChart";
|
|
41
|
+
allowed: ("table" | "barChart" | "lineChart" | "areaChart" | "pieChart")[];
|
|
42
|
+
}>;
|
|
43
|
+
}, "strip", z.ZodTypeAny, {
|
|
44
|
+
toolId: "visualise-data-tables";
|
|
45
|
+
columns: {
|
|
46
|
+
type: "string" | "number" | "boolean" | "date" | "datetime";
|
|
47
|
+
key: string;
|
|
48
|
+
label: string;
|
|
49
|
+
}[];
|
|
50
|
+
rows: Record<string, string | number | boolean | null>[];
|
|
51
|
+
visualizationOptions: {
|
|
52
|
+
default: "table" | "barChart" | "lineChart" | "areaChart" | "pieChart";
|
|
53
|
+
allowed: ("table" | "barChart" | "lineChart" | "areaChart" | "pieChart")[];
|
|
54
|
+
};
|
|
55
|
+
}, {
|
|
56
|
+
toolId: "visualise-data-tables";
|
|
57
|
+
columns: {
|
|
58
|
+
type: "string" | "number" | "boolean" | "date" | "datetime";
|
|
59
|
+
key: string;
|
|
60
|
+
label: string;
|
|
61
|
+
}[];
|
|
62
|
+
rows: Record<string, string | number | boolean | null>[];
|
|
63
|
+
visualizationOptions: {
|
|
64
|
+
default: "table" | "barChart" | "lineChart" | "areaChart" | "pieChart";
|
|
65
|
+
allowed: ("table" | "barChart" | "lineChart" | "areaChart" | "pieChart")[];
|
|
66
|
+
};
|
|
67
|
+
}>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VisualiseDataTablesSchema = exports.ColumnSchema = exports.VisualizationTypeSchema = exports.ColumnTypeSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const base_1 = require("../../base");
|
|
6
|
+
exports.ColumnTypeSchema = zod_1.z.enum(['string', 'number', 'boolean', 'date', 'datetime']);
|
|
7
|
+
exports.VisualizationTypeSchema = zod_1.z.enum(['table', 'barChart', 'lineChart', 'areaChart', 'pieChart']);
|
|
8
|
+
exports.ColumnSchema = zod_1.z.object({
|
|
9
|
+
key: zod_1.z.string(),
|
|
10
|
+
label: zod_1.z.string(),
|
|
11
|
+
type: exports.ColumnTypeSchema,
|
|
12
|
+
});
|
|
13
|
+
exports.VisualiseDataTablesSchema = base_1.BaseToolSchema.extend({
|
|
14
|
+
toolId: zod_1.z.literal('visualise-data-tables'),
|
|
15
|
+
columns: zod_1.z.array(exports.ColumnSchema),
|
|
16
|
+
rows: zod_1.z.array(zod_1.z.record(zod_1.z.union([zod_1.z.string(), zod_1.z.number(), zod_1.z.boolean(), zod_1.z.null()]))),
|
|
17
|
+
visualizationOptions: zod_1.z.object({
|
|
18
|
+
default: exports.VisualizationTypeSchema,
|
|
19
|
+
allowed: zod_1.z.array(exports.VisualizationTypeSchema),
|
|
20
|
+
}),
|
|
21
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ColumnTypeSchema, VisualizationTypeSchema, ColumnSchema, VisualiseDataTablesSchema } from './schema';
|
|
3
|
+
export type ColumnType = z.infer<typeof ColumnTypeSchema>;
|
|
4
|
+
export type VisualizationType = z.infer<typeof VisualizationTypeSchema>;
|
|
5
|
+
export type Column = z.infer<typeof ColumnSchema>;
|
|
6
|
+
export type VisualiseDataTables = z.infer<typeof VisualiseDataTablesSchema>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { VisualiseSalesforceRecordsSchema } from './schema';
|
|
2
|
+
import { VisualiseSalesforceRecords } from './types';
|
|
3
|
+
export * from './schema';
|
|
4
|
+
export * from './types';
|
|
5
|
+
export { VisualiseSalesforceRecordsSchema as Schema };
|
|
6
|
+
export type { VisualiseSalesforceRecords as Contract };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.Schema = void 0;
|
|
18
|
+
const schema_1 = require("./schema");
|
|
19
|
+
Object.defineProperty(exports, "Schema", { enumerable: true, get: function () { return schema_1.VisualiseSalesforceRecordsSchema; } });
|
|
20
|
+
__exportStar(require("./schema"), exports);
|
|
21
|
+
__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const SalesforceColumnTypeSchema: z.ZodEnum<["string", "number", "boolean", "date", "datetime", "id", "reference"]>;
|
|
3
|
+
export declare const SalesforceVisualizationTypeSchema: z.ZodEnum<["table", "barChart", "lineChart", "areaChart", "pieChart"]>;
|
|
4
|
+
export declare const SalesforceColumnSchema: z.ZodObject<{
|
|
5
|
+
key: z.ZodString;
|
|
6
|
+
label: z.ZodString;
|
|
7
|
+
type: z.ZodEnum<["string", "number", "boolean", "date", "datetime", "id", "reference"]>;
|
|
8
|
+
referenceTo: z.ZodOptional<z.ZodString>;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
type: "string" | "number" | "boolean" | "date" | "datetime" | "id" | "reference";
|
|
11
|
+
key: string;
|
|
12
|
+
label: string;
|
|
13
|
+
referenceTo?: string | undefined;
|
|
14
|
+
}, {
|
|
15
|
+
type: "string" | "number" | "boolean" | "date" | "datetime" | "id" | "reference";
|
|
16
|
+
key: string;
|
|
17
|
+
label: string;
|
|
18
|
+
referenceTo?: string | undefined;
|
|
19
|
+
}>;
|
|
20
|
+
export declare const SalesforceRecordSchema: z.ZodObject<{
|
|
21
|
+
_sfId: z.ZodString;
|
|
22
|
+
_sfType: z.ZodString;
|
|
23
|
+
_sfUrl: z.ZodOptional<z.ZodString>;
|
|
24
|
+
}, "strip", z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.objectOutputType<{
|
|
25
|
+
_sfId: z.ZodString;
|
|
26
|
+
_sfType: z.ZodString;
|
|
27
|
+
_sfUrl: z.ZodOptional<z.ZodString>;
|
|
28
|
+
}, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, "strip">, z.objectInputType<{
|
|
29
|
+
_sfId: z.ZodString;
|
|
30
|
+
_sfType: z.ZodString;
|
|
31
|
+
_sfUrl: z.ZodOptional<z.ZodString>;
|
|
32
|
+
}, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, "strip">>;
|
|
33
|
+
export declare const QueryInfoSchema: z.ZodObject<{
|
|
34
|
+
soql: z.ZodString;
|
|
35
|
+
queryName: z.ZodOptional<z.ZodString>;
|
|
36
|
+
}, "strip", z.ZodTypeAny, {
|
|
37
|
+
soql: string;
|
|
38
|
+
queryName?: string | undefined;
|
|
39
|
+
}, {
|
|
40
|
+
soql: string;
|
|
41
|
+
queryName?: string | undefined;
|
|
42
|
+
}>;
|
|
43
|
+
export declare const VisualiseSalesforceRecordsSchema: z.ZodObject<{} & {
|
|
44
|
+
toolId: z.ZodLiteral<"visualise-salesforce-records">;
|
|
45
|
+
objectType: z.ZodString;
|
|
46
|
+
instanceUrl: z.ZodString;
|
|
47
|
+
columns: z.ZodArray<z.ZodObject<{
|
|
48
|
+
key: z.ZodString;
|
|
49
|
+
label: z.ZodString;
|
|
50
|
+
type: z.ZodEnum<["string", "number", "boolean", "date", "datetime", "id", "reference"]>;
|
|
51
|
+
referenceTo: z.ZodOptional<z.ZodString>;
|
|
52
|
+
}, "strip", z.ZodTypeAny, {
|
|
53
|
+
type: "string" | "number" | "boolean" | "date" | "datetime" | "id" | "reference";
|
|
54
|
+
key: string;
|
|
55
|
+
label: string;
|
|
56
|
+
referenceTo?: string | undefined;
|
|
57
|
+
}, {
|
|
58
|
+
type: "string" | "number" | "boolean" | "date" | "datetime" | "id" | "reference";
|
|
59
|
+
key: string;
|
|
60
|
+
label: string;
|
|
61
|
+
referenceTo?: string | undefined;
|
|
62
|
+
}>, "many">;
|
|
63
|
+
records: z.ZodArray<z.ZodObject<{
|
|
64
|
+
_sfId: z.ZodString;
|
|
65
|
+
_sfType: z.ZodString;
|
|
66
|
+
_sfUrl: z.ZodOptional<z.ZodString>;
|
|
67
|
+
}, "strip", z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.objectOutputType<{
|
|
68
|
+
_sfId: z.ZodString;
|
|
69
|
+
_sfType: z.ZodString;
|
|
70
|
+
_sfUrl: z.ZodOptional<z.ZodString>;
|
|
71
|
+
}, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, "strip">, z.objectInputType<{
|
|
72
|
+
_sfId: z.ZodString;
|
|
73
|
+
_sfType: z.ZodString;
|
|
74
|
+
_sfUrl: z.ZodOptional<z.ZodString>;
|
|
75
|
+
}, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, "strip">>, "many">;
|
|
76
|
+
totalSize: z.ZodNumber;
|
|
77
|
+
queryInfo: z.ZodObject<{
|
|
78
|
+
soql: z.ZodString;
|
|
79
|
+
queryName: z.ZodOptional<z.ZodString>;
|
|
80
|
+
}, "strip", z.ZodTypeAny, {
|
|
81
|
+
soql: string;
|
|
82
|
+
queryName?: string | undefined;
|
|
83
|
+
}, {
|
|
84
|
+
soql: string;
|
|
85
|
+
queryName?: string | undefined;
|
|
86
|
+
}>;
|
|
87
|
+
visualizationOptions: z.ZodObject<{
|
|
88
|
+
default: z.ZodEnum<["table", "barChart", "lineChart", "areaChart", "pieChart"]>;
|
|
89
|
+
allowed: z.ZodArray<z.ZodEnum<["table", "barChart", "lineChart", "areaChart", "pieChart"]>, "many">;
|
|
90
|
+
}, "strip", z.ZodTypeAny, {
|
|
91
|
+
default: "table" | "barChart" | "lineChart" | "areaChart" | "pieChart";
|
|
92
|
+
allowed: ("table" | "barChart" | "lineChart" | "areaChart" | "pieChart")[];
|
|
93
|
+
}, {
|
|
94
|
+
default: "table" | "barChart" | "lineChart" | "areaChart" | "pieChart";
|
|
95
|
+
allowed: ("table" | "barChart" | "lineChart" | "areaChart" | "pieChart")[];
|
|
96
|
+
}>;
|
|
97
|
+
}, "strip", z.ZodTypeAny, {
|
|
98
|
+
toolId: "visualise-salesforce-records";
|
|
99
|
+
columns: {
|
|
100
|
+
type: "string" | "number" | "boolean" | "date" | "datetime" | "id" | "reference";
|
|
101
|
+
key: string;
|
|
102
|
+
label: string;
|
|
103
|
+
referenceTo?: string | undefined;
|
|
104
|
+
}[];
|
|
105
|
+
visualizationOptions: {
|
|
106
|
+
default: "table" | "barChart" | "lineChart" | "areaChart" | "pieChart";
|
|
107
|
+
allowed: ("table" | "barChart" | "lineChart" | "areaChart" | "pieChart")[];
|
|
108
|
+
};
|
|
109
|
+
objectType: string;
|
|
110
|
+
instanceUrl: string;
|
|
111
|
+
records: z.objectOutputType<{
|
|
112
|
+
_sfId: z.ZodString;
|
|
113
|
+
_sfType: z.ZodString;
|
|
114
|
+
_sfUrl: z.ZodOptional<z.ZodString>;
|
|
115
|
+
}, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, "strip">[];
|
|
116
|
+
totalSize: number;
|
|
117
|
+
queryInfo: {
|
|
118
|
+
soql: string;
|
|
119
|
+
queryName?: string | undefined;
|
|
120
|
+
};
|
|
121
|
+
}, {
|
|
122
|
+
toolId: "visualise-salesforce-records";
|
|
123
|
+
columns: {
|
|
124
|
+
type: "string" | "number" | "boolean" | "date" | "datetime" | "id" | "reference";
|
|
125
|
+
key: string;
|
|
126
|
+
label: string;
|
|
127
|
+
referenceTo?: string | undefined;
|
|
128
|
+
}[];
|
|
129
|
+
visualizationOptions: {
|
|
130
|
+
default: "table" | "barChart" | "lineChart" | "areaChart" | "pieChart";
|
|
131
|
+
allowed: ("table" | "barChart" | "lineChart" | "areaChart" | "pieChart")[];
|
|
132
|
+
};
|
|
133
|
+
objectType: string;
|
|
134
|
+
instanceUrl: string;
|
|
135
|
+
records: z.objectInputType<{
|
|
136
|
+
_sfId: z.ZodString;
|
|
137
|
+
_sfType: z.ZodString;
|
|
138
|
+
_sfUrl: z.ZodOptional<z.ZodString>;
|
|
139
|
+
}, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, "strip">[];
|
|
140
|
+
totalSize: number;
|
|
141
|
+
queryInfo: {
|
|
142
|
+
soql: string;
|
|
143
|
+
queryName?: string | undefined;
|
|
144
|
+
};
|
|
145
|
+
}>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VisualiseSalesforceRecordsSchema = exports.QueryInfoSchema = exports.SalesforceRecordSchema = exports.SalesforceColumnSchema = exports.SalesforceVisualizationTypeSchema = exports.SalesforceColumnTypeSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const base_1 = require("../../base");
|
|
6
|
+
exports.SalesforceColumnTypeSchema = zod_1.z.enum([
|
|
7
|
+
'string',
|
|
8
|
+
'number',
|
|
9
|
+
'boolean',
|
|
10
|
+
'date',
|
|
11
|
+
'datetime',
|
|
12
|
+
'id',
|
|
13
|
+
'reference',
|
|
14
|
+
]);
|
|
15
|
+
exports.SalesforceVisualizationTypeSchema = zod_1.z.enum([
|
|
16
|
+
'table',
|
|
17
|
+
'barChart',
|
|
18
|
+
'lineChart',
|
|
19
|
+
'areaChart',
|
|
20
|
+
'pieChart',
|
|
21
|
+
]);
|
|
22
|
+
exports.SalesforceColumnSchema = zod_1.z.object({
|
|
23
|
+
key: zod_1.z.string().describe('Field API name (e.g., "Account.Name")'),
|
|
24
|
+
label: zod_1.z.string().describe('Display label (e.g., "Account Name")'),
|
|
25
|
+
type: exports.SalesforceColumnTypeSchema,
|
|
26
|
+
referenceTo: zod_1.z.string().optional().describe('For reference fields, the target object (e.g., "Account")'),
|
|
27
|
+
});
|
|
28
|
+
exports.SalesforceRecordSchema = zod_1.z
|
|
29
|
+
.object({
|
|
30
|
+
_sfId: zod_1.z.string().describe('Salesforce record ID'),
|
|
31
|
+
_sfType: zod_1.z.string().describe('Salesforce object type (e.g., "Contact")'),
|
|
32
|
+
_sfUrl: zod_1.z.string().optional().describe('Direct link to Salesforce record'),
|
|
33
|
+
})
|
|
34
|
+
.catchall(zod_1.z.union([zod_1.z.string(), zod_1.z.number(), zod_1.z.boolean(), zod_1.z.null()]));
|
|
35
|
+
exports.QueryInfoSchema = zod_1.z.object({
|
|
36
|
+
soql: zod_1.z.string().describe('The SOQL query executed'),
|
|
37
|
+
queryName: zod_1.z.string().optional().describe('Human-readable query name'),
|
|
38
|
+
});
|
|
39
|
+
exports.VisualiseSalesforceRecordsSchema = base_1.BaseToolSchema.extend({
|
|
40
|
+
toolId: zod_1.z.literal('visualise-salesforce-records'),
|
|
41
|
+
objectType: zod_1.z.string().describe('Primary object queried'),
|
|
42
|
+
instanceUrl: zod_1.z.string().describe('Salesforce instance URL for record links'),
|
|
43
|
+
columns: zod_1.z.array(exports.SalesforceColumnSchema),
|
|
44
|
+
records: zod_1.z.array(exports.SalesforceRecordSchema),
|
|
45
|
+
totalSize: zod_1.z.number(),
|
|
46
|
+
queryInfo: exports.QueryInfoSchema,
|
|
47
|
+
visualizationOptions: zod_1.z.object({
|
|
48
|
+
default: exports.SalesforceVisualizationTypeSchema,
|
|
49
|
+
allowed: zod_1.z.array(exports.SalesforceVisualizationTypeSchema),
|
|
50
|
+
}),
|
|
51
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { SalesforceColumnTypeSchema, SalesforceVisualizationTypeSchema, SalesforceColumnSchema, SalesforceRecordSchema, QueryInfoSchema, VisualiseSalesforceRecordsSchema } from './schema';
|
|
3
|
+
export type SalesforceColumnType = z.infer<typeof SalesforceColumnTypeSchema>;
|
|
4
|
+
export type SalesforceVisualizationType = z.infer<typeof SalesforceVisualizationTypeSchema>;
|
|
5
|
+
export type SalesforceColumn = z.infer<typeof SalesforceColumnSchema>;
|
|
6
|
+
export type SalesforceRecord = z.infer<typeof SalesforceRecordSchema>;
|
|
7
|
+
export type QueryInfo = z.infer<typeof QueryInfoSchema>;
|
|
8
|
+
export type VisualiseSalesforceRecords = z.infer<typeof VisualiseSalesforceRecordsSchema>;
|
package/dist/esm/base.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const ColumnTypeSchema: z.ZodEnum<["string", "number", "boolean", "date", "datetime"]>;
|
|
3
|
+
export declare const VisualizationTypeSchema: z.ZodEnum<["table", "barChart", "lineChart", "areaChart", "pieChart"]>;
|
|
4
|
+
export declare const ColumnSchema: z.ZodObject<{
|
|
5
|
+
key: z.ZodString;
|
|
6
|
+
label: z.ZodString;
|
|
7
|
+
type: z.ZodEnum<["string", "number", "boolean", "date", "datetime"]>;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
type: "string" | "number" | "boolean" | "date" | "datetime";
|
|
10
|
+
key: string;
|
|
11
|
+
label: string;
|
|
12
|
+
}, {
|
|
13
|
+
type: "string" | "number" | "boolean" | "date" | "datetime";
|
|
14
|
+
key: string;
|
|
15
|
+
label: string;
|
|
16
|
+
}>;
|
|
17
|
+
export declare const VisualiseDataTablesSchema: z.ZodObject<{} & {
|
|
18
|
+
toolId: z.ZodLiteral<"visualise-data-tables">;
|
|
19
|
+
columns: z.ZodArray<z.ZodObject<{
|
|
20
|
+
key: z.ZodString;
|
|
21
|
+
label: z.ZodString;
|
|
22
|
+
type: z.ZodEnum<["string", "number", "boolean", "date", "datetime"]>;
|
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
|
+
type: "string" | "number" | "boolean" | "date" | "datetime";
|
|
25
|
+
key: string;
|
|
26
|
+
label: string;
|
|
27
|
+
}, {
|
|
28
|
+
type: "string" | "number" | "boolean" | "date" | "datetime";
|
|
29
|
+
key: string;
|
|
30
|
+
label: string;
|
|
31
|
+
}>, "many">;
|
|
32
|
+
rows: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>, "many">;
|
|
33
|
+
visualizationOptions: z.ZodObject<{
|
|
34
|
+
default: z.ZodEnum<["table", "barChart", "lineChart", "areaChart", "pieChart"]>;
|
|
35
|
+
allowed: z.ZodArray<z.ZodEnum<["table", "barChart", "lineChart", "areaChart", "pieChart"]>, "many">;
|
|
36
|
+
}, "strip", z.ZodTypeAny, {
|
|
37
|
+
default: "table" | "barChart" | "lineChart" | "areaChart" | "pieChart";
|
|
38
|
+
allowed: ("table" | "barChart" | "lineChart" | "areaChart" | "pieChart")[];
|
|
39
|
+
}, {
|
|
40
|
+
default: "table" | "barChart" | "lineChart" | "areaChart" | "pieChart";
|
|
41
|
+
allowed: ("table" | "barChart" | "lineChart" | "areaChart" | "pieChart")[];
|
|
42
|
+
}>;
|
|
43
|
+
}, "strip", z.ZodTypeAny, {
|
|
44
|
+
toolId: "visualise-data-tables";
|
|
45
|
+
columns: {
|
|
46
|
+
type: "string" | "number" | "boolean" | "date" | "datetime";
|
|
47
|
+
key: string;
|
|
48
|
+
label: string;
|
|
49
|
+
}[];
|
|
50
|
+
rows: Record<string, string | number | boolean | null>[];
|
|
51
|
+
visualizationOptions: {
|
|
52
|
+
default: "table" | "barChart" | "lineChart" | "areaChart" | "pieChart";
|
|
53
|
+
allowed: ("table" | "barChart" | "lineChart" | "areaChart" | "pieChart")[];
|
|
54
|
+
};
|
|
55
|
+
}, {
|
|
56
|
+
toolId: "visualise-data-tables";
|
|
57
|
+
columns: {
|
|
58
|
+
type: "string" | "number" | "boolean" | "date" | "datetime";
|
|
59
|
+
key: string;
|
|
60
|
+
label: string;
|
|
61
|
+
}[];
|
|
62
|
+
rows: Record<string, string | number | boolean | null>[];
|
|
63
|
+
visualizationOptions: {
|
|
64
|
+
default: "table" | "barChart" | "lineChart" | "areaChart" | "pieChart";
|
|
65
|
+
allowed: ("table" | "barChart" | "lineChart" | "areaChart" | "pieChart")[];
|
|
66
|
+
};
|
|
67
|
+
}>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { BaseToolSchema } from '../../base';
|
|
3
|
+
export const ColumnTypeSchema = z.enum(['string', 'number', 'boolean', 'date', 'datetime']);
|
|
4
|
+
export const VisualizationTypeSchema = z.enum(['table', 'barChart', 'lineChart', 'areaChart', 'pieChart']);
|
|
5
|
+
export const ColumnSchema = z.object({
|
|
6
|
+
key: z.string(),
|
|
7
|
+
label: z.string(),
|
|
8
|
+
type: ColumnTypeSchema,
|
|
9
|
+
});
|
|
10
|
+
export const VisualiseDataTablesSchema = BaseToolSchema.extend({
|
|
11
|
+
toolId: z.literal('visualise-data-tables'),
|
|
12
|
+
columns: z.array(ColumnSchema),
|
|
13
|
+
rows: z.array(z.record(z.union([z.string(), z.number(), z.boolean(), z.null()]))),
|
|
14
|
+
visualizationOptions: z.object({
|
|
15
|
+
default: VisualizationTypeSchema,
|
|
16
|
+
allowed: z.array(VisualizationTypeSchema),
|
|
17
|
+
}),
|
|
18
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ColumnTypeSchema, VisualizationTypeSchema, ColumnSchema, VisualiseDataTablesSchema } from './schema';
|
|
3
|
+
export type ColumnType = z.infer<typeof ColumnTypeSchema>;
|
|
4
|
+
export type VisualizationType = z.infer<typeof VisualizationTypeSchema>;
|
|
5
|
+
export type Column = z.infer<typeof ColumnSchema>;
|
|
6
|
+
export type VisualiseDataTables = z.infer<typeof VisualiseDataTablesSchema>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { VisualiseSalesforceRecordsSchema } from './schema';
|
|
2
|
+
import { VisualiseSalesforceRecords } from './types';
|
|
3
|
+
export * from './schema';
|
|
4
|
+
export * from './types';
|
|
5
|
+
export { VisualiseSalesforceRecordsSchema as Schema };
|
|
6
|
+
export type { VisualiseSalesforceRecords as Contract };
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const SalesforceColumnTypeSchema: z.ZodEnum<["string", "number", "boolean", "date", "datetime", "id", "reference"]>;
|
|
3
|
+
export declare const SalesforceVisualizationTypeSchema: z.ZodEnum<["table", "barChart", "lineChart", "areaChart", "pieChart"]>;
|
|
4
|
+
export declare const SalesforceColumnSchema: z.ZodObject<{
|
|
5
|
+
key: z.ZodString;
|
|
6
|
+
label: z.ZodString;
|
|
7
|
+
type: z.ZodEnum<["string", "number", "boolean", "date", "datetime", "id", "reference"]>;
|
|
8
|
+
referenceTo: z.ZodOptional<z.ZodString>;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
type: "string" | "number" | "boolean" | "date" | "datetime" | "id" | "reference";
|
|
11
|
+
key: string;
|
|
12
|
+
label: string;
|
|
13
|
+
referenceTo?: string | undefined;
|
|
14
|
+
}, {
|
|
15
|
+
type: "string" | "number" | "boolean" | "date" | "datetime" | "id" | "reference";
|
|
16
|
+
key: string;
|
|
17
|
+
label: string;
|
|
18
|
+
referenceTo?: string | undefined;
|
|
19
|
+
}>;
|
|
20
|
+
export declare const SalesforceRecordSchema: z.ZodObject<{
|
|
21
|
+
_sfId: z.ZodString;
|
|
22
|
+
_sfType: z.ZodString;
|
|
23
|
+
_sfUrl: z.ZodOptional<z.ZodString>;
|
|
24
|
+
}, "strip", z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.objectOutputType<{
|
|
25
|
+
_sfId: z.ZodString;
|
|
26
|
+
_sfType: z.ZodString;
|
|
27
|
+
_sfUrl: z.ZodOptional<z.ZodString>;
|
|
28
|
+
}, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, "strip">, z.objectInputType<{
|
|
29
|
+
_sfId: z.ZodString;
|
|
30
|
+
_sfType: z.ZodString;
|
|
31
|
+
_sfUrl: z.ZodOptional<z.ZodString>;
|
|
32
|
+
}, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, "strip">>;
|
|
33
|
+
export declare const QueryInfoSchema: z.ZodObject<{
|
|
34
|
+
soql: z.ZodString;
|
|
35
|
+
queryName: z.ZodOptional<z.ZodString>;
|
|
36
|
+
}, "strip", z.ZodTypeAny, {
|
|
37
|
+
soql: string;
|
|
38
|
+
queryName?: string | undefined;
|
|
39
|
+
}, {
|
|
40
|
+
soql: string;
|
|
41
|
+
queryName?: string | undefined;
|
|
42
|
+
}>;
|
|
43
|
+
export declare const VisualiseSalesforceRecordsSchema: z.ZodObject<{} & {
|
|
44
|
+
toolId: z.ZodLiteral<"visualise-salesforce-records">;
|
|
45
|
+
objectType: z.ZodString;
|
|
46
|
+
instanceUrl: z.ZodString;
|
|
47
|
+
columns: z.ZodArray<z.ZodObject<{
|
|
48
|
+
key: z.ZodString;
|
|
49
|
+
label: z.ZodString;
|
|
50
|
+
type: z.ZodEnum<["string", "number", "boolean", "date", "datetime", "id", "reference"]>;
|
|
51
|
+
referenceTo: z.ZodOptional<z.ZodString>;
|
|
52
|
+
}, "strip", z.ZodTypeAny, {
|
|
53
|
+
type: "string" | "number" | "boolean" | "date" | "datetime" | "id" | "reference";
|
|
54
|
+
key: string;
|
|
55
|
+
label: string;
|
|
56
|
+
referenceTo?: string | undefined;
|
|
57
|
+
}, {
|
|
58
|
+
type: "string" | "number" | "boolean" | "date" | "datetime" | "id" | "reference";
|
|
59
|
+
key: string;
|
|
60
|
+
label: string;
|
|
61
|
+
referenceTo?: string | undefined;
|
|
62
|
+
}>, "many">;
|
|
63
|
+
records: z.ZodArray<z.ZodObject<{
|
|
64
|
+
_sfId: z.ZodString;
|
|
65
|
+
_sfType: z.ZodString;
|
|
66
|
+
_sfUrl: z.ZodOptional<z.ZodString>;
|
|
67
|
+
}, "strip", z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.objectOutputType<{
|
|
68
|
+
_sfId: z.ZodString;
|
|
69
|
+
_sfType: z.ZodString;
|
|
70
|
+
_sfUrl: z.ZodOptional<z.ZodString>;
|
|
71
|
+
}, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, "strip">, z.objectInputType<{
|
|
72
|
+
_sfId: z.ZodString;
|
|
73
|
+
_sfType: z.ZodString;
|
|
74
|
+
_sfUrl: z.ZodOptional<z.ZodString>;
|
|
75
|
+
}, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, "strip">>, "many">;
|
|
76
|
+
totalSize: z.ZodNumber;
|
|
77
|
+
queryInfo: z.ZodObject<{
|
|
78
|
+
soql: z.ZodString;
|
|
79
|
+
queryName: z.ZodOptional<z.ZodString>;
|
|
80
|
+
}, "strip", z.ZodTypeAny, {
|
|
81
|
+
soql: string;
|
|
82
|
+
queryName?: string | undefined;
|
|
83
|
+
}, {
|
|
84
|
+
soql: string;
|
|
85
|
+
queryName?: string | undefined;
|
|
86
|
+
}>;
|
|
87
|
+
visualizationOptions: z.ZodObject<{
|
|
88
|
+
default: z.ZodEnum<["table", "barChart", "lineChart", "areaChart", "pieChart"]>;
|
|
89
|
+
allowed: z.ZodArray<z.ZodEnum<["table", "barChart", "lineChart", "areaChart", "pieChart"]>, "many">;
|
|
90
|
+
}, "strip", z.ZodTypeAny, {
|
|
91
|
+
default: "table" | "barChart" | "lineChart" | "areaChart" | "pieChart";
|
|
92
|
+
allowed: ("table" | "barChart" | "lineChart" | "areaChart" | "pieChart")[];
|
|
93
|
+
}, {
|
|
94
|
+
default: "table" | "barChart" | "lineChart" | "areaChart" | "pieChart";
|
|
95
|
+
allowed: ("table" | "barChart" | "lineChart" | "areaChart" | "pieChart")[];
|
|
96
|
+
}>;
|
|
97
|
+
}, "strip", z.ZodTypeAny, {
|
|
98
|
+
toolId: "visualise-salesforce-records";
|
|
99
|
+
columns: {
|
|
100
|
+
type: "string" | "number" | "boolean" | "date" | "datetime" | "id" | "reference";
|
|
101
|
+
key: string;
|
|
102
|
+
label: string;
|
|
103
|
+
referenceTo?: string | undefined;
|
|
104
|
+
}[];
|
|
105
|
+
visualizationOptions: {
|
|
106
|
+
default: "table" | "barChart" | "lineChart" | "areaChart" | "pieChart";
|
|
107
|
+
allowed: ("table" | "barChart" | "lineChart" | "areaChart" | "pieChart")[];
|
|
108
|
+
};
|
|
109
|
+
objectType: string;
|
|
110
|
+
instanceUrl: string;
|
|
111
|
+
records: z.objectOutputType<{
|
|
112
|
+
_sfId: z.ZodString;
|
|
113
|
+
_sfType: z.ZodString;
|
|
114
|
+
_sfUrl: z.ZodOptional<z.ZodString>;
|
|
115
|
+
}, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, "strip">[];
|
|
116
|
+
totalSize: number;
|
|
117
|
+
queryInfo: {
|
|
118
|
+
soql: string;
|
|
119
|
+
queryName?: string | undefined;
|
|
120
|
+
};
|
|
121
|
+
}, {
|
|
122
|
+
toolId: "visualise-salesforce-records";
|
|
123
|
+
columns: {
|
|
124
|
+
type: "string" | "number" | "boolean" | "date" | "datetime" | "id" | "reference";
|
|
125
|
+
key: string;
|
|
126
|
+
label: string;
|
|
127
|
+
referenceTo?: string | undefined;
|
|
128
|
+
}[];
|
|
129
|
+
visualizationOptions: {
|
|
130
|
+
default: "table" | "barChart" | "lineChart" | "areaChart" | "pieChart";
|
|
131
|
+
allowed: ("table" | "barChart" | "lineChart" | "areaChart" | "pieChart")[];
|
|
132
|
+
};
|
|
133
|
+
objectType: string;
|
|
134
|
+
instanceUrl: string;
|
|
135
|
+
records: z.objectInputType<{
|
|
136
|
+
_sfId: z.ZodString;
|
|
137
|
+
_sfType: z.ZodString;
|
|
138
|
+
_sfUrl: z.ZodOptional<z.ZodString>;
|
|
139
|
+
}, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, "strip">[];
|
|
140
|
+
totalSize: number;
|
|
141
|
+
queryInfo: {
|
|
142
|
+
soql: string;
|
|
143
|
+
queryName?: string | undefined;
|
|
144
|
+
};
|
|
145
|
+
}>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { BaseToolSchema } from '../../base';
|
|
3
|
+
export const SalesforceColumnTypeSchema = z.enum([
|
|
4
|
+
'string',
|
|
5
|
+
'number',
|
|
6
|
+
'boolean',
|
|
7
|
+
'date',
|
|
8
|
+
'datetime',
|
|
9
|
+
'id',
|
|
10
|
+
'reference',
|
|
11
|
+
]);
|
|
12
|
+
export const SalesforceVisualizationTypeSchema = z.enum([
|
|
13
|
+
'table',
|
|
14
|
+
'barChart',
|
|
15
|
+
'lineChart',
|
|
16
|
+
'areaChart',
|
|
17
|
+
'pieChart',
|
|
18
|
+
]);
|
|
19
|
+
export const SalesforceColumnSchema = z.object({
|
|
20
|
+
key: z.string().describe('Field API name (e.g., "Account.Name")'),
|
|
21
|
+
label: z.string().describe('Display label (e.g., "Account Name")'),
|
|
22
|
+
type: SalesforceColumnTypeSchema,
|
|
23
|
+
referenceTo: z.string().optional().describe('For reference fields, the target object (e.g., "Account")'),
|
|
24
|
+
});
|
|
25
|
+
export const SalesforceRecordSchema = z
|
|
26
|
+
.object({
|
|
27
|
+
_sfId: z.string().describe('Salesforce record ID'),
|
|
28
|
+
_sfType: z.string().describe('Salesforce object type (e.g., "Contact")'),
|
|
29
|
+
_sfUrl: z.string().optional().describe('Direct link to Salesforce record'),
|
|
30
|
+
})
|
|
31
|
+
.catchall(z.union([z.string(), z.number(), z.boolean(), z.null()]));
|
|
32
|
+
export const QueryInfoSchema = z.object({
|
|
33
|
+
soql: z.string().describe('The SOQL query executed'),
|
|
34
|
+
queryName: z.string().optional().describe('Human-readable query name'),
|
|
35
|
+
});
|
|
36
|
+
export const VisualiseSalesforceRecordsSchema = BaseToolSchema.extend({
|
|
37
|
+
toolId: z.literal('visualise-salesforce-records'),
|
|
38
|
+
objectType: z.string().describe('Primary object queried'),
|
|
39
|
+
instanceUrl: z.string().describe('Salesforce instance URL for record links'),
|
|
40
|
+
columns: z.array(SalesforceColumnSchema),
|
|
41
|
+
records: z.array(SalesforceRecordSchema),
|
|
42
|
+
totalSize: z.number(),
|
|
43
|
+
queryInfo: QueryInfoSchema,
|
|
44
|
+
visualizationOptions: z.object({
|
|
45
|
+
default: SalesforceVisualizationTypeSchema,
|
|
46
|
+
allowed: z.array(SalesforceVisualizationTypeSchema),
|
|
47
|
+
}),
|
|
48
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { SalesforceColumnTypeSchema, SalesforceVisualizationTypeSchema, SalesforceColumnSchema, SalesforceRecordSchema, QueryInfoSchema, VisualiseSalesforceRecordsSchema } from './schema';
|
|
3
|
+
export type SalesforceColumnType = z.infer<typeof SalesforceColumnTypeSchema>;
|
|
4
|
+
export type SalesforceVisualizationType = z.infer<typeof SalesforceVisualizationTypeSchema>;
|
|
5
|
+
export type SalesforceColumn = z.infer<typeof SalesforceColumnSchema>;
|
|
6
|
+
export type SalesforceRecord = z.infer<typeof SalesforceRecordSchema>;
|
|
7
|
+
export type QueryInfo = z.infer<typeof QueryInfoSchema>;
|
|
8
|
+
export type VisualiseSalesforceRecords = z.infer<typeof VisualiseSalesforceRecordsSchema>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@zenning/tool-app-contracts",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Shared Zod contracts for Zenning Tool Apps",
|
|
5
|
+
"main": "dist/cjs/index.js",
|
|
6
|
+
"module": "dist/esm/index.js",
|
|
7
|
+
"types": "dist/cjs/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": "./dist/esm/index.js",
|
|
14
|
+
"require": "./dist/cjs/index.js",
|
|
15
|
+
"types": "./dist/cjs/index.d.ts"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"zenning",
|
|
20
|
+
"contracts",
|
|
21
|
+
"zod"
|
|
22
|
+
],
|
|
23
|
+
"author": "",
|
|
24
|
+
"license": "ISC",
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"zod": "^3.22.4"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"typescript": "^5.3.3",
|
|
30
|
+
"vitest": "^4.0.14"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "rm -rf dist && tsc -p tsconfig.json && tsc -p tsconfig.esm.json",
|
|
34
|
+
"test": "vitest run"
|
|
35
|
+
}
|
|
36
|
+
}
|