@meridianjs/types 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/dist/index.d.mts +170 -0
- package/dist/index.d.ts +170 -0
- package/dist/index.js +18 -0
- package/dist/index.mjs +0 -0
- package/package.json +37 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
interface MeridianContainer {
|
|
2
|
+
resolve<T = unknown>(token: string): T;
|
|
3
|
+
register(registrations: Record<string, unknown>): void;
|
|
4
|
+
createScope(): MeridianContainer;
|
|
5
|
+
}
|
|
6
|
+
interface ModuleDefinition {
|
|
7
|
+
key: string;
|
|
8
|
+
service: new (...args: any[]) => IModuleService;
|
|
9
|
+
models?: unknown[];
|
|
10
|
+
loaders?: LoaderFn[];
|
|
11
|
+
linkable?: LinkableConfig;
|
|
12
|
+
}
|
|
13
|
+
interface IModuleService {
|
|
14
|
+
[method: string]: any;
|
|
15
|
+
}
|
|
16
|
+
type LoaderFn = (options: LoaderOptions) => Promise<void>;
|
|
17
|
+
interface LoaderOptions {
|
|
18
|
+
container: MeridianContainer;
|
|
19
|
+
options?: Record<string, unknown>;
|
|
20
|
+
logger: ILogger;
|
|
21
|
+
}
|
|
22
|
+
interface LinkableConfig {
|
|
23
|
+
[modelName: string]: {
|
|
24
|
+
tableName: string;
|
|
25
|
+
primaryKey: string;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
type WorkerMode = "shared" | "worker" | "server";
|
|
29
|
+
interface ProjectConfig {
|
|
30
|
+
databaseUrl: string;
|
|
31
|
+
redisUrl?: string;
|
|
32
|
+
httpPort?: number;
|
|
33
|
+
jwtSecret: string;
|
|
34
|
+
cookieSecret?: string;
|
|
35
|
+
workerMode?: WorkerMode;
|
|
36
|
+
cors?: {
|
|
37
|
+
origin: string | string[];
|
|
38
|
+
credentials?: boolean;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
interface MeridianConfig {
|
|
42
|
+
projectConfig: ProjectConfig;
|
|
43
|
+
modules?: ModuleConfig[];
|
|
44
|
+
plugins?: PluginConfig[];
|
|
45
|
+
admin?: AdminConfig;
|
|
46
|
+
}
|
|
47
|
+
interface ModuleConfig {
|
|
48
|
+
resolve: string | ModuleDefinition;
|
|
49
|
+
options?: Record<string, unknown>;
|
|
50
|
+
}
|
|
51
|
+
interface PluginConfig {
|
|
52
|
+
resolve: string;
|
|
53
|
+
options?: Record<string, unknown>;
|
|
54
|
+
}
|
|
55
|
+
interface AdminConfig {
|
|
56
|
+
disable?: boolean;
|
|
57
|
+
path?: string;
|
|
58
|
+
}
|
|
59
|
+
interface EventMessage<T = unknown> {
|
|
60
|
+
name: string;
|
|
61
|
+
data: T;
|
|
62
|
+
metadata?: Record<string, unknown>;
|
|
63
|
+
}
|
|
64
|
+
interface IEventBus {
|
|
65
|
+
emit<T>(event: EventMessage<T> | EventMessage<T>[]): Promise<void>;
|
|
66
|
+
subscribe(eventName: string, handler: SubscriberFn): void;
|
|
67
|
+
unsubscribe(eventName: string, handler: SubscriberFn): void;
|
|
68
|
+
close?(): Promise<void>;
|
|
69
|
+
}
|
|
70
|
+
type SubscriberFn<T = unknown> = (args: SubscriberArgs<T>) => Promise<void>;
|
|
71
|
+
interface SubscriberArgs<T = unknown> {
|
|
72
|
+
event: EventMessage<T>;
|
|
73
|
+
container: MeridianContainer;
|
|
74
|
+
}
|
|
75
|
+
interface SubscriberConfig {
|
|
76
|
+
event: string | string[];
|
|
77
|
+
context?: Record<string, unknown>;
|
|
78
|
+
}
|
|
79
|
+
interface StepConfig {
|
|
80
|
+
name: string;
|
|
81
|
+
async?: boolean;
|
|
82
|
+
retries?: number;
|
|
83
|
+
timeout?: number;
|
|
84
|
+
}
|
|
85
|
+
interface StepContext {
|
|
86
|
+
container: MeridianContainer;
|
|
87
|
+
metadata?: Record<string, unknown>;
|
|
88
|
+
}
|
|
89
|
+
interface WorkflowConfig {
|
|
90
|
+
name: string;
|
|
91
|
+
retentionTime?: number;
|
|
92
|
+
}
|
|
93
|
+
interface ScheduledJobConfig {
|
|
94
|
+
name: string;
|
|
95
|
+
schedule: string | {
|
|
96
|
+
interval: number;
|
|
97
|
+
};
|
|
98
|
+
numberOfExecutions?: number;
|
|
99
|
+
}
|
|
100
|
+
type ScheduledJobFn = (container: MeridianContainer) => Promise<void>;
|
|
101
|
+
interface IScheduler {
|
|
102
|
+
register(config: ScheduledJobConfig, fn: () => Promise<void>): Promise<void>;
|
|
103
|
+
close(): Promise<void>;
|
|
104
|
+
}
|
|
105
|
+
interface AuthenticatedUser {
|
|
106
|
+
id: string;
|
|
107
|
+
workspaceId: string;
|
|
108
|
+
roles: string[];
|
|
109
|
+
}
|
|
110
|
+
interface MeridianRequestBase {
|
|
111
|
+
scope: MeridianContainer;
|
|
112
|
+
user?: AuthenticatedUser;
|
|
113
|
+
}
|
|
114
|
+
interface ILogger {
|
|
115
|
+
info(message: string, meta?: Record<string, unknown>): void;
|
|
116
|
+
warn(message: string, meta?: Record<string, unknown>): void;
|
|
117
|
+
error(message: string, meta?: Record<string, unknown>): void;
|
|
118
|
+
debug(message: string, meta?: Record<string, unknown>): void;
|
|
119
|
+
}
|
|
120
|
+
type IssueType = "bug" | "feature" | "task" | "epic" | "story";
|
|
121
|
+
type IssuePriority = "urgent" | "high" | "medium" | "low" | "none";
|
|
122
|
+
type IssueStatus = "backlog" | "todo" | "in_progress" | "in_review" | "done" | "cancelled";
|
|
123
|
+
type ProjectVisibility = "private" | "public" | "workspace";
|
|
124
|
+
type ProjectStatus = "active" | "archived" | "paused";
|
|
125
|
+
type SprintStatus = "planned" | "active" | "completed";
|
|
126
|
+
type NotificationChannel = "in_app" | "email" | "push";
|
|
127
|
+
type WorkspacePlan = "free" | "pro" | "enterprise";
|
|
128
|
+
type TeamRole = "admin" | "member" | "guest";
|
|
129
|
+
interface LinkableEntry {
|
|
130
|
+
tableName: string;
|
|
131
|
+
primaryKey: string;
|
|
132
|
+
}
|
|
133
|
+
interface LinkEndpoint {
|
|
134
|
+
linkable: LinkableEntry;
|
|
135
|
+
isList?: boolean;
|
|
136
|
+
deleteCascades?: boolean;
|
|
137
|
+
field?: string;
|
|
138
|
+
}
|
|
139
|
+
interface LinkDefinition {
|
|
140
|
+
left: LinkEndpoint;
|
|
141
|
+
right: LinkEndpoint;
|
|
142
|
+
extraColumns?: Record<string, {
|
|
143
|
+
type: string;
|
|
144
|
+
}>;
|
|
145
|
+
readOnly?: boolean;
|
|
146
|
+
linkTableName: string;
|
|
147
|
+
entryPoint: string;
|
|
148
|
+
}
|
|
149
|
+
interface QueryGraphOptions {
|
|
150
|
+
entity: string;
|
|
151
|
+
fields: string[];
|
|
152
|
+
filters?: Record<string, unknown>;
|
|
153
|
+
pagination?: {
|
|
154
|
+
limit?: number;
|
|
155
|
+
offset?: number;
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
interface IQuery {
|
|
159
|
+
graph<T = unknown>(options: QueryGraphOptions): Promise<{
|
|
160
|
+
data: T[];
|
|
161
|
+
}>;
|
|
162
|
+
}
|
|
163
|
+
interface PluginRegistrationContext {
|
|
164
|
+
container: MeridianContainer;
|
|
165
|
+
pluginOptions: Record<string, unknown>;
|
|
166
|
+
addModule(config: ModuleConfig): Promise<void>;
|
|
167
|
+
}
|
|
168
|
+
type PluginRegisterFn = (ctx: PluginRegistrationContext) => Promise<void>;
|
|
169
|
+
|
|
170
|
+
export type { AdminConfig, AuthenticatedUser, EventMessage, IEventBus, ILogger, IModuleService, IQuery, IScheduler, IssuePriority, IssueStatus, IssueType, LinkDefinition, LinkEndpoint, LinkableConfig, LinkableEntry, LoaderFn, LoaderOptions, MeridianConfig, MeridianContainer, MeridianRequestBase, ModuleConfig, ModuleDefinition, NotificationChannel, PluginConfig, PluginRegisterFn, PluginRegistrationContext, ProjectConfig, ProjectStatus, ProjectVisibility, QueryGraphOptions, ScheduledJobConfig, ScheduledJobFn, SprintStatus, StepConfig, StepContext, SubscriberArgs, SubscriberConfig, SubscriberFn, TeamRole, WorkerMode, WorkflowConfig, WorkspacePlan };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
interface MeridianContainer {
|
|
2
|
+
resolve<T = unknown>(token: string): T;
|
|
3
|
+
register(registrations: Record<string, unknown>): void;
|
|
4
|
+
createScope(): MeridianContainer;
|
|
5
|
+
}
|
|
6
|
+
interface ModuleDefinition {
|
|
7
|
+
key: string;
|
|
8
|
+
service: new (...args: any[]) => IModuleService;
|
|
9
|
+
models?: unknown[];
|
|
10
|
+
loaders?: LoaderFn[];
|
|
11
|
+
linkable?: LinkableConfig;
|
|
12
|
+
}
|
|
13
|
+
interface IModuleService {
|
|
14
|
+
[method: string]: any;
|
|
15
|
+
}
|
|
16
|
+
type LoaderFn = (options: LoaderOptions) => Promise<void>;
|
|
17
|
+
interface LoaderOptions {
|
|
18
|
+
container: MeridianContainer;
|
|
19
|
+
options?: Record<string, unknown>;
|
|
20
|
+
logger: ILogger;
|
|
21
|
+
}
|
|
22
|
+
interface LinkableConfig {
|
|
23
|
+
[modelName: string]: {
|
|
24
|
+
tableName: string;
|
|
25
|
+
primaryKey: string;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
type WorkerMode = "shared" | "worker" | "server";
|
|
29
|
+
interface ProjectConfig {
|
|
30
|
+
databaseUrl: string;
|
|
31
|
+
redisUrl?: string;
|
|
32
|
+
httpPort?: number;
|
|
33
|
+
jwtSecret: string;
|
|
34
|
+
cookieSecret?: string;
|
|
35
|
+
workerMode?: WorkerMode;
|
|
36
|
+
cors?: {
|
|
37
|
+
origin: string | string[];
|
|
38
|
+
credentials?: boolean;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
interface MeridianConfig {
|
|
42
|
+
projectConfig: ProjectConfig;
|
|
43
|
+
modules?: ModuleConfig[];
|
|
44
|
+
plugins?: PluginConfig[];
|
|
45
|
+
admin?: AdminConfig;
|
|
46
|
+
}
|
|
47
|
+
interface ModuleConfig {
|
|
48
|
+
resolve: string | ModuleDefinition;
|
|
49
|
+
options?: Record<string, unknown>;
|
|
50
|
+
}
|
|
51
|
+
interface PluginConfig {
|
|
52
|
+
resolve: string;
|
|
53
|
+
options?: Record<string, unknown>;
|
|
54
|
+
}
|
|
55
|
+
interface AdminConfig {
|
|
56
|
+
disable?: boolean;
|
|
57
|
+
path?: string;
|
|
58
|
+
}
|
|
59
|
+
interface EventMessage<T = unknown> {
|
|
60
|
+
name: string;
|
|
61
|
+
data: T;
|
|
62
|
+
metadata?: Record<string, unknown>;
|
|
63
|
+
}
|
|
64
|
+
interface IEventBus {
|
|
65
|
+
emit<T>(event: EventMessage<T> | EventMessage<T>[]): Promise<void>;
|
|
66
|
+
subscribe(eventName: string, handler: SubscriberFn): void;
|
|
67
|
+
unsubscribe(eventName: string, handler: SubscriberFn): void;
|
|
68
|
+
close?(): Promise<void>;
|
|
69
|
+
}
|
|
70
|
+
type SubscriberFn<T = unknown> = (args: SubscriberArgs<T>) => Promise<void>;
|
|
71
|
+
interface SubscriberArgs<T = unknown> {
|
|
72
|
+
event: EventMessage<T>;
|
|
73
|
+
container: MeridianContainer;
|
|
74
|
+
}
|
|
75
|
+
interface SubscriberConfig {
|
|
76
|
+
event: string | string[];
|
|
77
|
+
context?: Record<string, unknown>;
|
|
78
|
+
}
|
|
79
|
+
interface StepConfig {
|
|
80
|
+
name: string;
|
|
81
|
+
async?: boolean;
|
|
82
|
+
retries?: number;
|
|
83
|
+
timeout?: number;
|
|
84
|
+
}
|
|
85
|
+
interface StepContext {
|
|
86
|
+
container: MeridianContainer;
|
|
87
|
+
metadata?: Record<string, unknown>;
|
|
88
|
+
}
|
|
89
|
+
interface WorkflowConfig {
|
|
90
|
+
name: string;
|
|
91
|
+
retentionTime?: number;
|
|
92
|
+
}
|
|
93
|
+
interface ScheduledJobConfig {
|
|
94
|
+
name: string;
|
|
95
|
+
schedule: string | {
|
|
96
|
+
interval: number;
|
|
97
|
+
};
|
|
98
|
+
numberOfExecutions?: number;
|
|
99
|
+
}
|
|
100
|
+
type ScheduledJobFn = (container: MeridianContainer) => Promise<void>;
|
|
101
|
+
interface IScheduler {
|
|
102
|
+
register(config: ScheduledJobConfig, fn: () => Promise<void>): Promise<void>;
|
|
103
|
+
close(): Promise<void>;
|
|
104
|
+
}
|
|
105
|
+
interface AuthenticatedUser {
|
|
106
|
+
id: string;
|
|
107
|
+
workspaceId: string;
|
|
108
|
+
roles: string[];
|
|
109
|
+
}
|
|
110
|
+
interface MeridianRequestBase {
|
|
111
|
+
scope: MeridianContainer;
|
|
112
|
+
user?: AuthenticatedUser;
|
|
113
|
+
}
|
|
114
|
+
interface ILogger {
|
|
115
|
+
info(message: string, meta?: Record<string, unknown>): void;
|
|
116
|
+
warn(message: string, meta?: Record<string, unknown>): void;
|
|
117
|
+
error(message: string, meta?: Record<string, unknown>): void;
|
|
118
|
+
debug(message: string, meta?: Record<string, unknown>): void;
|
|
119
|
+
}
|
|
120
|
+
type IssueType = "bug" | "feature" | "task" | "epic" | "story";
|
|
121
|
+
type IssuePriority = "urgent" | "high" | "medium" | "low" | "none";
|
|
122
|
+
type IssueStatus = "backlog" | "todo" | "in_progress" | "in_review" | "done" | "cancelled";
|
|
123
|
+
type ProjectVisibility = "private" | "public" | "workspace";
|
|
124
|
+
type ProjectStatus = "active" | "archived" | "paused";
|
|
125
|
+
type SprintStatus = "planned" | "active" | "completed";
|
|
126
|
+
type NotificationChannel = "in_app" | "email" | "push";
|
|
127
|
+
type WorkspacePlan = "free" | "pro" | "enterprise";
|
|
128
|
+
type TeamRole = "admin" | "member" | "guest";
|
|
129
|
+
interface LinkableEntry {
|
|
130
|
+
tableName: string;
|
|
131
|
+
primaryKey: string;
|
|
132
|
+
}
|
|
133
|
+
interface LinkEndpoint {
|
|
134
|
+
linkable: LinkableEntry;
|
|
135
|
+
isList?: boolean;
|
|
136
|
+
deleteCascades?: boolean;
|
|
137
|
+
field?: string;
|
|
138
|
+
}
|
|
139
|
+
interface LinkDefinition {
|
|
140
|
+
left: LinkEndpoint;
|
|
141
|
+
right: LinkEndpoint;
|
|
142
|
+
extraColumns?: Record<string, {
|
|
143
|
+
type: string;
|
|
144
|
+
}>;
|
|
145
|
+
readOnly?: boolean;
|
|
146
|
+
linkTableName: string;
|
|
147
|
+
entryPoint: string;
|
|
148
|
+
}
|
|
149
|
+
interface QueryGraphOptions {
|
|
150
|
+
entity: string;
|
|
151
|
+
fields: string[];
|
|
152
|
+
filters?: Record<string, unknown>;
|
|
153
|
+
pagination?: {
|
|
154
|
+
limit?: number;
|
|
155
|
+
offset?: number;
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
interface IQuery {
|
|
159
|
+
graph<T = unknown>(options: QueryGraphOptions): Promise<{
|
|
160
|
+
data: T[];
|
|
161
|
+
}>;
|
|
162
|
+
}
|
|
163
|
+
interface PluginRegistrationContext {
|
|
164
|
+
container: MeridianContainer;
|
|
165
|
+
pluginOptions: Record<string, unknown>;
|
|
166
|
+
addModule(config: ModuleConfig): Promise<void>;
|
|
167
|
+
}
|
|
168
|
+
type PluginRegisterFn = (ctx: PluginRegistrationContext) => Promise<void>;
|
|
169
|
+
|
|
170
|
+
export type { AdminConfig, AuthenticatedUser, EventMessage, IEventBus, ILogger, IModuleService, IQuery, IScheduler, IssuePriority, IssueStatus, IssueType, LinkDefinition, LinkEndpoint, LinkableConfig, LinkableEntry, LoaderFn, LoaderOptions, MeridianConfig, MeridianContainer, MeridianRequestBase, ModuleConfig, ModuleDefinition, NotificationChannel, PluginConfig, PluginRegisterFn, PluginRegistrationContext, ProjectConfig, ProjectStatus, ProjectVisibility, QueryGraphOptions, ScheduledJobConfig, ScheduledJobFn, SprintStatus, StepConfig, StepContext, SubscriberArgs, SubscriberConfig, SubscriberFn, TeamRole, WorkerMode, WorkflowConfig, WorkspacePlan };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
|
|
16
|
+
// src/index.ts
|
|
17
|
+
var index_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(index_exports);
|
package/dist/index.mjs
ADDED
|
File without changes
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@meridianjs/types",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Shared TypeScript types and interfaces for Meridian",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/index.mjs",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": {
|
|
11
|
+
"types": "./dist/index.d.mts",
|
|
12
|
+
"default": "./dist/index.mjs"
|
|
13
|
+
},
|
|
14
|
+
"require": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"default": "./dist/index.js"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsup src/index.ts --format esm,cjs --dts --clean",
|
|
22
|
+
"dev": "tsup src/index.ts --format esm,cjs --dts --watch",
|
|
23
|
+
"typecheck": "tsc --noEmit",
|
|
24
|
+
"clean": "rm -rf dist",
|
|
25
|
+
"prepublishOnly": "npm run build"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"tsup": "^8.3.5",
|
|
29
|
+
"typescript": "*"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist"
|
|
33
|
+
],
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
36
|
+
}
|
|
37
|
+
}
|