near-protocol-rewards
Version:
A transparent, metric-based rewards system for NEAR projects
68 lines (67 loc) • 2.49 kB
JavaScript
;
/**
* Core Type Definitions
*
* Contains all shared types used throughout the SDK.
* Maintains type safety and consistency across components.
*
* Key type hierarchies:
* - Metrics (GitHub)
* - Validation (Results, Errors)
* - Configuration (Settings, Options)
*
* @important
* Update these types carefully as they affect the entire SDK
*/
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ErrorCode = exports.SDKConfigSchema = void 0;
const zod_1 = require("zod");
// SDK Configuration Schema
exports.SDKConfigSchema = zod_1.z.object({
githubRepo: zod_1.z.string().regex(/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/),
githubToken: zod_1.z.string().min(1),
timeframe: zod_1.z.enum(["day", "week", "month"]).optional(),
logLevel: zod_1.z.enum(["debug", "info", "warn", "error"]).optional(),
maxRequestsPerSecond: zod_1.z.number().positive().optional(),
validation: zod_1.z
.object({
github: zod_1.z
.object({
minCommits: zod_1.z.number().positive(),
maxCommitsPerDay: zod_1.z.number().positive(),
minAuthors: zod_1.z.number().positive(),
})
.optional(),
})
.optional(),
weights: zod_1.z
.object({
commits: zod_1.z.number(),
pullRequests: zod_1.z.number(),
reviews: zod_1.z.number(),
issues: zod_1.z.number(),
})
.optional(),
});
// Export error codes
var errors_1 = require("./errors");
Object.defineProperty(exports, "ErrorCode", { enumerable: true, get: function () { return errors_1.ErrorCode; } });
// Export core types
__exportStar(require("./json"), exports);
__exportStar(require("./errors"), exports);
__exportStar(require("./logger"), exports);
__exportStar(require("./sdk"), exports);