@loopstack/common 0.14.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 +43 -0
- package/README.md +7 -0
- package/dist/constants/auth.constants.d.ts +2 -0
- package/dist/constants/auth.constants.js +5 -0
- package/dist/constants/index.d.ts +2 -0
- package/dist/constants/index.js +18 -0
- package/dist/constants/module.constants.d.ts +1 -0
- package/dist/constants/module.constants.js +4 -0
- package/dist/decorators/ai-provider.decorator.d.ts +5 -0
- package/dist/decorators/ai-provider.decorator.js +10 -0
- package/dist/decorators/block.decorator.d.ts +16 -0
- package/dist/decorators/block.decorator.js +55 -0
- package/dist/decorators/capability-decorator.d.ts +5 -0
- package/dist/decorators/capability-decorator.js +19 -0
- package/dist/decorators/current-user.decorator.d.ts +1 -0
- package/dist/decorators/current-user.decorator.js +8 -0
- package/dist/decorators/index.d.ts +7 -0
- package/dist/decorators/index.js +23 -0
- package/dist/decorators/public.decorator.d.ts +1 -0
- package/dist/decorators/public.decorator.js +7 -0
- package/dist/decorators/roles.decorator.d.ts +1 -0
- package/dist/decorators/roles.decorator.js +7 -0
- package/dist/decorators/state-machine-validator.decorator.d.ts +4 -0
- package/dist/decorators/state-machine-validator.decorator.js +10 -0
- package/dist/entities/document.entity.d.ts +30 -0
- package/dist/entities/document.entity.js +165 -0
- package/dist/entities/index.d.ts +8 -0
- package/dist/entities/index.js +24 -0
- package/dist/entities/namespace.entity.d.ts +17 -0
- package/dist/entities/namespace.entity.js +98 -0
- package/dist/entities/permission.entity.d.ts +10 -0
- package/dist/entities/permission.entity.js +50 -0
- package/dist/entities/pipeline.entity.d.ts +25 -0
- package/dist/entities/pipeline.entity.js +131 -0
- package/dist/entities/role.entity.d.ts +10 -0
- package/dist/entities/role.entity.js +51 -0
- package/dist/entities/user.entity.d.ts +10 -0
- package/dist/entities/user.entity.js +59 -0
- package/dist/entities/workflow.entity.d.ts +34 -0
- package/dist/entities/workflow.entity.js +196 -0
- package/dist/entities/workspace.entity.d.ts +10 -0
- package/dist/entities/workspace.entity.js +60 -0
- package/dist/enums/index.d.ts +3 -0
- package/dist/enums/index.js +19 -0
- package/dist/enums/pipeline-state.d.ts +8 -0
- package/dist/enums/pipeline-state.js +12 -0
- package/dist/enums/user-type.enum.d.ts +4 -0
- package/dist/enums/user-type.enum.js +8 -0
- package/dist/enums/workflow-state.enum.d.ts +8 -0
- package/dist/enums/workflow-state.enum.js +12 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +23 -0
- package/dist/interfaces/ai-provider.interface.d.ts +9 -0
- package/dist/interfaces/ai-provider.interface.js +2 -0
- package/dist/interfaces/block.interface.d.ts +22 -0
- package/dist/interfaces/block.interface.js +2 -0
- package/dist/interfaces/current-user.interface.d.ts +6 -0
- package/dist/interfaces/current-user.interface.js +2 -0
- package/dist/interfaces/handler.interface.d.ts +11 -0
- package/dist/interfaces/handler.interface.js +2 -0
- package/dist/interfaces/index.d.ts +13 -0
- package/dist/interfaces/index.js +29 -0
- package/dist/interfaces/jwt-payload.interface.d.ts +9 -0
- package/dist/interfaces/jwt-payload.interface.js +2 -0
- package/dist/interfaces/permission.interface.d.ts +7 -0
- package/dist/interfaces/permission.interface.js +2 -0
- package/dist/interfaces/role.interface.d.ts +7 -0
- package/dist/interfaces/role.interface.js +2 -0
- package/dist/interfaces/sso-response.interface.d.ts +24 -0
- package/dist/interfaces/sso-response.interface.js +2 -0
- package/dist/interfaces/sso-validate-code.interface.d.ts +4 -0
- package/dist/interfaces/sso-validate-code.interface.js +2 -0
- package/dist/interfaces/state-machine-validator-result.interface.d.ts +4 -0
- package/dist/interfaces/state-machine-validator-result.interface.js +2 -0
- package/dist/interfaces/state-machine-validator.interface.d.ts +8 -0
- package/dist/interfaces/state-machine-validator.interface.js +2 -0
- package/dist/interfaces/transition-results.types.d.ts +6 -0
- package/dist/interfaces/transition-results.types.js +2 -0
- package/dist/interfaces/user.interface.d.ts +12 -0
- package/dist/interfaces/user.interface.js +2 -0
- package/dist/utils/create-hash.util.d.ts +1 -0
- package/dist/utils/create-hash.util.js +12 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.js +21 -0
- package/dist/utils/normalize-deep-serialize.util.d.ts +1 -0
- package/dist/utils/normalize-deep-serialize.util.js +20 -0
- package/dist/utils/normalize-object.d.ts +1 -0
- package/dist/utils/normalize-object.js +13 -0
- package/dist/utils/object-fingerprint.util.d.ts +1 -0
- package/dist/utils/object-fingerprint.util.js +9 -0
- package/dist/utils/stable-json-transformer.d.ts +5 -0
- package/dist/utils/stable-json-transformer.js +20 -0
- package/package.json +37 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Role } from './role.entity';
|
|
2
|
+
import { PermissionInterface } from '../interfaces';
|
|
3
|
+
export declare class Permission implements PermissionInterface {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
resource: string;
|
|
7
|
+
action: string;
|
|
8
|
+
description: string;
|
|
9
|
+
roles: Role[];
|
|
10
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Permission = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const role_entity_1 = require("./role.entity");
|
|
15
|
+
let Permission = class Permission {
|
|
16
|
+
id;
|
|
17
|
+
name;
|
|
18
|
+
resource;
|
|
19
|
+
action;
|
|
20
|
+
description;
|
|
21
|
+
roles;
|
|
22
|
+
};
|
|
23
|
+
exports.Permission = Permission;
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
26
|
+
__metadata("design:type", String)
|
|
27
|
+
], Permission.prototype, "id", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, typeorm_1.Column)({ unique: true }),
|
|
30
|
+
__metadata("design:type", String)
|
|
31
|
+
], Permission.prototype, "name", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, typeorm_1.Column)(),
|
|
34
|
+
__metadata("design:type", String)
|
|
35
|
+
], Permission.prototype, "resource", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, typeorm_1.Column)(),
|
|
38
|
+
__metadata("design:type", String)
|
|
39
|
+
], Permission.prototype, "action", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
42
|
+
__metadata("design:type", String)
|
|
43
|
+
], Permission.prototype, "description", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, typeorm_1.ManyToMany)(() => role_entity_1.Role, role => role.permissions),
|
|
46
|
+
__metadata("design:type", Array)
|
|
47
|
+
], Permission.prototype, "roles", void 0);
|
|
48
|
+
exports.Permission = Permission = __decorate([
|
|
49
|
+
(0, typeorm_1.Entity)('auth_permissions')
|
|
50
|
+
], Permission);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { WorkspaceEntity } from './workspace.entity';
|
|
2
|
+
import { NamespaceEntity } from './namespace.entity';
|
|
3
|
+
import { PipelineState } from '../enums';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import type { JSONSchemaConfigType } from '@loopstack/contracts/types';
|
|
6
|
+
export declare class PipelineEntity {
|
|
7
|
+
id: string;
|
|
8
|
+
configKey: string;
|
|
9
|
+
title: string | null;
|
|
10
|
+
run: number;
|
|
11
|
+
labels: string[];
|
|
12
|
+
index: string;
|
|
13
|
+
status: PipelineState;
|
|
14
|
+
args: any;
|
|
15
|
+
context: Record<string, any>;
|
|
16
|
+
schema: JSONSchemaConfigType | null;
|
|
17
|
+
error: z.ZodError | null;
|
|
18
|
+
ui: any;
|
|
19
|
+
createdAt: Date;
|
|
20
|
+
updatedAt: Date;
|
|
21
|
+
workspace: WorkspaceEntity;
|
|
22
|
+
workspaceId: string;
|
|
23
|
+
createdBy: string;
|
|
24
|
+
namespaces: NamespaceEntity[];
|
|
25
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.PipelineEntity = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const workspace_entity_1 = require("./workspace.entity");
|
|
15
|
+
const namespace_entity_1 = require("./namespace.entity");
|
|
16
|
+
const enums_1 = require("../enums");
|
|
17
|
+
const utils_1 = require("../utils");
|
|
18
|
+
let PipelineEntity = class PipelineEntity {
|
|
19
|
+
id;
|
|
20
|
+
configKey;
|
|
21
|
+
title;
|
|
22
|
+
run;
|
|
23
|
+
labels;
|
|
24
|
+
index;
|
|
25
|
+
status;
|
|
26
|
+
args;
|
|
27
|
+
context;
|
|
28
|
+
schema;
|
|
29
|
+
error;
|
|
30
|
+
ui;
|
|
31
|
+
createdAt;
|
|
32
|
+
updatedAt;
|
|
33
|
+
workspace;
|
|
34
|
+
workspaceId;
|
|
35
|
+
createdBy;
|
|
36
|
+
namespaces;
|
|
37
|
+
};
|
|
38
|
+
exports.PipelineEntity = PipelineEntity;
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
41
|
+
__metadata("design:type", String)
|
|
42
|
+
], PipelineEntity.prototype, "id", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, typeorm_1.Column)({ type: 'varchar', name: 'config_key' }),
|
|
45
|
+
(0, typeorm_1.Index)(),
|
|
46
|
+
__metadata("design:type", String)
|
|
47
|
+
], PipelineEntity.prototype, "configKey", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
(0, typeorm_1.Column)({ type: 'varchar', nullable: true }),
|
|
50
|
+
__metadata("design:type", Object)
|
|
51
|
+
], PipelineEntity.prototype, "title", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, typeorm_1.Column)({ default: 1 }),
|
|
54
|
+
__metadata("design:type", Number)
|
|
55
|
+
], PipelineEntity.prototype, "run", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, typeorm_1.Column)('jsonb', { default: [] }),
|
|
58
|
+
__metadata("design:type", Array)
|
|
59
|
+
], PipelineEntity.prototype, "labels", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, typeorm_1.Column)('ltree', { default: '0001' }),
|
|
62
|
+
__metadata("design:type", String)
|
|
63
|
+
], PipelineEntity.prototype, "index", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, typeorm_1.Column)({
|
|
66
|
+
type: 'enum',
|
|
67
|
+
enum: enums_1.PipelineState,
|
|
68
|
+
default: 'pending',
|
|
69
|
+
}),
|
|
70
|
+
__metadata("design:type", String)
|
|
71
|
+
], PipelineEntity.prototype, "status", void 0);
|
|
72
|
+
__decorate([
|
|
73
|
+
(0, typeorm_1.Column)('jsonb', { default: {} }),
|
|
74
|
+
__metadata("design:type", Object)
|
|
75
|
+
], PipelineEntity.prototype, "args", void 0);
|
|
76
|
+
__decorate([
|
|
77
|
+
(0, typeorm_1.Column)('jsonb', { default: {} }),
|
|
78
|
+
__metadata("design:type", Object)
|
|
79
|
+
], PipelineEntity.prototype, "context", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
(0, typeorm_1.Column)({
|
|
82
|
+
type: 'jsonb',
|
|
83
|
+
transformer: new utils_1.StableJsonTransformer(),
|
|
84
|
+
name: 'schema',
|
|
85
|
+
nullable: true,
|
|
86
|
+
}),
|
|
87
|
+
__metadata("design:type", Object)
|
|
88
|
+
], PipelineEntity.prototype, "schema", void 0);
|
|
89
|
+
__decorate([
|
|
90
|
+
(0, typeorm_1.Column)('jsonb', { nullable: true, name: "error" }),
|
|
91
|
+
__metadata("design:type", Object)
|
|
92
|
+
], PipelineEntity.prototype, "error", void 0);
|
|
93
|
+
__decorate([
|
|
94
|
+
(0, typeorm_1.Column)({
|
|
95
|
+
type: 'jsonb',
|
|
96
|
+
transformer: new utils_1.StableJsonTransformer(),
|
|
97
|
+
name: 'ui',
|
|
98
|
+
nullable: true,
|
|
99
|
+
}),
|
|
100
|
+
__metadata("design:type", Object)
|
|
101
|
+
], PipelineEntity.prototype, "ui", void 0);
|
|
102
|
+
__decorate([
|
|
103
|
+
(0, typeorm_1.CreateDateColumn)({ name: 'created_at' }),
|
|
104
|
+
__metadata("design:type", Date)
|
|
105
|
+
], PipelineEntity.prototype, "createdAt", void 0);
|
|
106
|
+
__decorate([
|
|
107
|
+
(0, typeorm_1.UpdateDateColumn)({ name: 'updated_at' }),
|
|
108
|
+
__metadata("design:type", Date)
|
|
109
|
+
], PipelineEntity.prototype, "updatedAt", void 0);
|
|
110
|
+
__decorate([
|
|
111
|
+
(0, typeorm_1.ManyToOne)(() => workspace_entity_1.WorkspaceEntity, (workspace) => workspace.pipelines, {
|
|
112
|
+
onDelete: 'CASCADE',
|
|
113
|
+
}),
|
|
114
|
+
(0, typeorm_1.JoinColumn)({ name: 'workspace_id' }),
|
|
115
|
+
__metadata("design:type", workspace_entity_1.WorkspaceEntity)
|
|
116
|
+
], PipelineEntity.prototype, "workspace", void 0);
|
|
117
|
+
__decorate([
|
|
118
|
+
(0, typeorm_1.Column)({ name: 'workspace_id', nullable: true }),
|
|
119
|
+
__metadata("design:type", String)
|
|
120
|
+
], PipelineEntity.prototype, "workspaceId", void 0);
|
|
121
|
+
__decorate([
|
|
122
|
+
(0, typeorm_1.Column)({ name: 'created_by', type: 'uuid' }),
|
|
123
|
+
__metadata("design:type", String)
|
|
124
|
+
], PipelineEntity.prototype, "createdBy", void 0);
|
|
125
|
+
__decorate([
|
|
126
|
+
(0, typeorm_1.OneToMany)(() => namespace_entity_1.NamespaceEntity, (namespace) => namespace.pipeline),
|
|
127
|
+
__metadata("design:type", Array)
|
|
128
|
+
], PipelineEntity.prototype, "namespaces", void 0);
|
|
129
|
+
exports.PipelineEntity = PipelineEntity = __decorate([
|
|
130
|
+
(0, typeorm_1.Entity)({ name: 'core_pipeline' })
|
|
131
|
+
], PipelineEntity);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { User } from './user.entity';
|
|
2
|
+
import { Permission } from './permission.entity';
|
|
3
|
+
import { RoleInterface } from '../interfaces';
|
|
4
|
+
export declare class Role implements RoleInterface {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
users: User[];
|
|
9
|
+
permissions: Permission[];
|
|
10
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Role = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const user_entity_1 = require("./user.entity");
|
|
15
|
+
const permission_entity_1 = require("./permission.entity");
|
|
16
|
+
let Role = class Role {
|
|
17
|
+
id;
|
|
18
|
+
name;
|
|
19
|
+
description;
|
|
20
|
+
users;
|
|
21
|
+
permissions;
|
|
22
|
+
};
|
|
23
|
+
exports.Role = Role;
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
26
|
+
__metadata("design:type", String)
|
|
27
|
+
], Role.prototype, "id", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, typeorm_1.Column)({ unique: true }),
|
|
30
|
+
__metadata("design:type", String)
|
|
31
|
+
], Role.prototype, "name", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
34
|
+
__metadata("design:type", String)
|
|
35
|
+
], Role.prototype, "description", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, typeorm_1.ManyToMany)(() => user_entity_1.User, user => user.roles),
|
|
38
|
+
__metadata("design:type", Array)
|
|
39
|
+
], Role.prototype, "users", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, typeorm_1.ManyToMany)(() => permission_entity_1.Permission, permission => permission.roles),
|
|
42
|
+
(0, typeorm_1.JoinTable)({
|
|
43
|
+
name: 'auth_role_permissions',
|
|
44
|
+
joinColumn: { name: 'role_id', referencedColumnName: 'id' },
|
|
45
|
+
inverseJoinColumn: { name: 'permission_id', referencedColumnName: 'id' }
|
|
46
|
+
}),
|
|
47
|
+
__metadata("design:type", Array)
|
|
48
|
+
], Role.prototype, "permissions", void 0);
|
|
49
|
+
exports.Role = Role = __decorate([
|
|
50
|
+
(0, typeorm_1.Entity)('auth_roles')
|
|
51
|
+
], Role);
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.User = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const role_entity_1 = require("./role.entity");
|
|
15
|
+
const user_type_enum_1 = require("../enums/user-type.enum");
|
|
16
|
+
let User = class User {
|
|
17
|
+
id;
|
|
18
|
+
type;
|
|
19
|
+
isActive;
|
|
20
|
+
roles;
|
|
21
|
+
createdAt;
|
|
22
|
+
updatedAt;
|
|
23
|
+
};
|
|
24
|
+
exports.User = User;
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, typeorm_1.PrimaryColumn)({ type: 'uuid' }),
|
|
27
|
+
__metadata("design:type", String)
|
|
28
|
+
], User.prototype, "id", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, typeorm_1.Column)({
|
|
31
|
+
type: 'enum',
|
|
32
|
+
enum: user_type_enum_1.UserTypeEnum,
|
|
33
|
+
}),
|
|
34
|
+
__metadata("design:type", String)
|
|
35
|
+
], User.prototype, "type", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, typeorm_1.Column)({ default: true }),
|
|
38
|
+
__metadata("design:type", Boolean)
|
|
39
|
+
], User.prototype, "isActive", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, typeorm_1.ManyToMany)(() => role_entity_1.Role, role => role.users),
|
|
42
|
+
(0, typeorm_1.JoinTable)({
|
|
43
|
+
name: 'auth_user_roles',
|
|
44
|
+
joinColumn: { name: 'user_id', referencedColumnName: 'id' },
|
|
45
|
+
inverseJoinColumn: { name: 'role_id', referencedColumnName: 'id' }
|
|
46
|
+
}),
|
|
47
|
+
__metadata("design:type", Array)
|
|
48
|
+
], User.prototype, "roles", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, typeorm_1.CreateDateColumn)(),
|
|
51
|
+
__metadata("design:type", Date)
|
|
52
|
+
], User.prototype, "createdAt", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, typeorm_1.UpdateDateColumn)(),
|
|
55
|
+
__metadata("design:type", Date)
|
|
56
|
+
], User.prototype, "updatedAt", void 0);
|
|
57
|
+
exports.User = User = __decorate([
|
|
58
|
+
(0, typeorm_1.Entity)('auth_users')
|
|
59
|
+
], User);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { DocumentEntity } from './document.entity';
|
|
2
|
+
import { NamespaceEntity } from './namespace.entity';
|
|
3
|
+
import { WorkflowState } from '../enums';
|
|
4
|
+
import { TransitionResultLookup } from '../interfaces';
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import type { HistoryTransition, JSONSchemaConfigType, UiFormType, WorkflowTransitionType } from '@loopstack/contracts/types';
|
|
7
|
+
export declare class WorkflowEntity {
|
|
8
|
+
id: string;
|
|
9
|
+
configKey: string;
|
|
10
|
+
title: string;
|
|
11
|
+
index: string;
|
|
12
|
+
progress: number;
|
|
13
|
+
status: WorkflowState;
|
|
14
|
+
hasError: boolean;
|
|
15
|
+
errorMessage: string | null;
|
|
16
|
+
createdAt: Date;
|
|
17
|
+
updatedAt: Date;
|
|
18
|
+
place: string;
|
|
19
|
+
transitionResults: TransitionResultLookup | null;
|
|
20
|
+
inputData: Record<string, any>;
|
|
21
|
+
availableTransitions: WorkflowTransitionType[] | null;
|
|
22
|
+
history: HistoryTransition[] | null;
|
|
23
|
+
schema: JSONSchemaConfigType | null;
|
|
24
|
+
error: z.ZodError | null;
|
|
25
|
+
ui: UiFormType | null;
|
|
26
|
+
namespace: NamespaceEntity;
|
|
27
|
+
namespaceId: string;
|
|
28
|
+
pipelineId: string;
|
|
29
|
+
labels: string[];
|
|
30
|
+
dependencies: DocumentEntity[];
|
|
31
|
+
hashRecord: Record<string, string | null> | null;
|
|
32
|
+
documents: DocumentEntity[];
|
|
33
|
+
createdBy: string;
|
|
34
|
+
}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.WorkflowEntity = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const document_entity_1 = require("./document.entity");
|
|
15
|
+
const namespace_entity_1 = require("./namespace.entity");
|
|
16
|
+
const enums_1 = require("../enums");
|
|
17
|
+
const utils_1 = require("../utils");
|
|
18
|
+
let WorkflowEntity = class WorkflowEntity {
|
|
19
|
+
id;
|
|
20
|
+
configKey;
|
|
21
|
+
title;
|
|
22
|
+
index;
|
|
23
|
+
progress;
|
|
24
|
+
status;
|
|
25
|
+
hasError;
|
|
26
|
+
errorMessage;
|
|
27
|
+
createdAt;
|
|
28
|
+
updatedAt;
|
|
29
|
+
place;
|
|
30
|
+
transitionResults;
|
|
31
|
+
inputData;
|
|
32
|
+
availableTransitions;
|
|
33
|
+
history;
|
|
34
|
+
schema;
|
|
35
|
+
error;
|
|
36
|
+
ui;
|
|
37
|
+
namespace;
|
|
38
|
+
namespaceId;
|
|
39
|
+
pipelineId;
|
|
40
|
+
labels;
|
|
41
|
+
dependencies;
|
|
42
|
+
hashRecord;
|
|
43
|
+
documents;
|
|
44
|
+
createdBy;
|
|
45
|
+
};
|
|
46
|
+
exports.WorkflowEntity = WorkflowEntity;
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
49
|
+
__metadata("design:type", String)
|
|
50
|
+
], WorkflowEntity.prototype, "id", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, typeorm_1.Column)({ type: 'varchar', name: 'config_key' }),
|
|
53
|
+
(0, typeorm_1.Index)(),
|
|
54
|
+
__metadata("design:type", String)
|
|
55
|
+
], WorkflowEntity.prototype, "configKey", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, typeorm_1.Column)({ type: 'varchar', nullable: true }),
|
|
58
|
+
__metadata("design:type", String)
|
|
59
|
+
], WorkflowEntity.prototype, "title", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, typeorm_1.Column)('ltree', { default: '1' }),
|
|
62
|
+
__metadata("design:type", String)
|
|
63
|
+
], WorkflowEntity.prototype, "index", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, typeorm_1.Column)({ default: 0 }),
|
|
66
|
+
__metadata("design:type", Number)
|
|
67
|
+
], WorkflowEntity.prototype, "progress", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
(0, typeorm_1.Column)({
|
|
70
|
+
type: 'enum',
|
|
71
|
+
enum: enums_1.WorkflowState,
|
|
72
|
+
default: 'pending',
|
|
73
|
+
}),
|
|
74
|
+
__metadata("design:type", String)
|
|
75
|
+
], WorkflowEntity.prototype, "status", void 0);
|
|
76
|
+
__decorate([
|
|
77
|
+
(0, typeorm_1.Column)({ default: false }),
|
|
78
|
+
__metadata("design:type", Boolean)
|
|
79
|
+
], WorkflowEntity.prototype, "hasError", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
(0, typeorm_1.Column)({ type: 'varchar', nullable: true }),
|
|
82
|
+
__metadata("design:type", Object)
|
|
83
|
+
], WorkflowEntity.prototype, "errorMessage", void 0);
|
|
84
|
+
__decorate([
|
|
85
|
+
(0, typeorm_1.CreateDateColumn)({ name: 'created_at' }),
|
|
86
|
+
__metadata("design:type", Date)
|
|
87
|
+
], WorkflowEntity.prototype, "createdAt", void 0);
|
|
88
|
+
__decorate([
|
|
89
|
+
(0, typeorm_1.UpdateDateColumn)({ name: 'updated_at' }),
|
|
90
|
+
__metadata("design:type", Date)
|
|
91
|
+
], WorkflowEntity.prototype, "updatedAt", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
(0, typeorm_1.Column)({ type: 'varchar' }),
|
|
94
|
+
__metadata("design:type", String)
|
|
95
|
+
], WorkflowEntity.prototype, "place", void 0);
|
|
96
|
+
__decorate([
|
|
97
|
+
(0, typeorm_1.Column)('jsonb', {
|
|
98
|
+
name: 'transition_results',
|
|
99
|
+
nullable: true,
|
|
100
|
+
}),
|
|
101
|
+
__metadata("design:type", Object)
|
|
102
|
+
], WorkflowEntity.prototype, "transitionResults", void 0);
|
|
103
|
+
__decorate([
|
|
104
|
+
(0, typeorm_1.Column)('jsonb', {
|
|
105
|
+
name: 'input_data',
|
|
106
|
+
default: {},
|
|
107
|
+
}),
|
|
108
|
+
__metadata("design:type", Object)
|
|
109
|
+
], WorkflowEntity.prototype, "inputData", void 0);
|
|
110
|
+
__decorate([
|
|
111
|
+
(0, typeorm_1.Column)('jsonb', {
|
|
112
|
+
name: 'available_transitions',
|
|
113
|
+
nullable: true,
|
|
114
|
+
}),
|
|
115
|
+
__metadata("design:type", Object)
|
|
116
|
+
], WorkflowEntity.prototype, "availableTransitions", void 0);
|
|
117
|
+
__decorate([
|
|
118
|
+
(0, typeorm_1.Column)('jsonb', { name: 'history', nullable: true }),
|
|
119
|
+
__metadata("design:type", Object)
|
|
120
|
+
], WorkflowEntity.prototype, "history", void 0);
|
|
121
|
+
__decorate([
|
|
122
|
+
(0, typeorm_1.Column)({
|
|
123
|
+
type: 'jsonb',
|
|
124
|
+
transformer: new utils_1.StableJsonTransformer(),
|
|
125
|
+
name: 'schema',
|
|
126
|
+
nullable: true,
|
|
127
|
+
}),
|
|
128
|
+
__metadata("design:type", Object)
|
|
129
|
+
], WorkflowEntity.prototype, "schema", void 0);
|
|
130
|
+
__decorate([
|
|
131
|
+
(0, typeorm_1.Column)('jsonb', { nullable: true, name: "error" }),
|
|
132
|
+
__metadata("design:type", Object)
|
|
133
|
+
], WorkflowEntity.prototype, "error", void 0);
|
|
134
|
+
__decorate([
|
|
135
|
+
(0, typeorm_1.Column)({
|
|
136
|
+
type: 'jsonb',
|
|
137
|
+
transformer: new utils_1.StableJsonTransformer(),
|
|
138
|
+
name: 'ui',
|
|
139
|
+
nullable: true,
|
|
140
|
+
}),
|
|
141
|
+
__metadata("design:type", Object)
|
|
142
|
+
], WorkflowEntity.prototype, "ui", void 0);
|
|
143
|
+
__decorate([
|
|
144
|
+
(0, typeorm_1.ManyToOne)(() => namespace_entity_1.NamespaceEntity, (namespace) => namespace.workflows, {
|
|
145
|
+
onDelete: 'CASCADE',
|
|
146
|
+
}),
|
|
147
|
+
(0, typeorm_1.JoinColumn)({ name: 'namespace_id' }),
|
|
148
|
+
__metadata("design:type", namespace_entity_1.NamespaceEntity)
|
|
149
|
+
], WorkflowEntity.prototype, "namespace", void 0);
|
|
150
|
+
__decorate([
|
|
151
|
+
(0, typeorm_1.Column)({ name: 'namespace_id' }),
|
|
152
|
+
__metadata("design:type", String)
|
|
153
|
+
], WorkflowEntity.prototype, "namespaceId", void 0);
|
|
154
|
+
__decorate([
|
|
155
|
+
(0, typeorm_1.Column)({ name: 'pipeline_id' }),
|
|
156
|
+
__metadata("design:type", String)
|
|
157
|
+
], WorkflowEntity.prototype, "pipelineId", void 0);
|
|
158
|
+
__decorate([
|
|
159
|
+
(0, typeorm_1.Column)('varchar', { name: 'labels', array: true, default: [] }),
|
|
160
|
+
__metadata("design:type", Array)
|
|
161
|
+
], WorkflowEntity.prototype, "labels", void 0);
|
|
162
|
+
__decorate([
|
|
163
|
+
(0, typeorm_1.ManyToMany)(() => document_entity_1.DocumentEntity, (document) => document.dependentStates, {
|
|
164
|
+
onDelete: 'CASCADE',
|
|
165
|
+
}),
|
|
166
|
+
(0, typeorm_1.JoinTable)({
|
|
167
|
+
name: 'core_workflow_document',
|
|
168
|
+
joinColumn: {
|
|
169
|
+
name: 'workflow_id',
|
|
170
|
+
referencedColumnName: 'id',
|
|
171
|
+
},
|
|
172
|
+
inverseJoinColumn: {
|
|
173
|
+
name: 'document_id',
|
|
174
|
+
referencedColumnName: 'id',
|
|
175
|
+
},
|
|
176
|
+
}),
|
|
177
|
+
__metadata("design:type", Array)
|
|
178
|
+
], WorkflowEntity.prototype, "dependencies", void 0);
|
|
179
|
+
__decorate([
|
|
180
|
+
(0, typeorm_1.Column)('jsonb', { name: 'hash_record', nullable: true }),
|
|
181
|
+
__metadata("design:type", Object)
|
|
182
|
+
], WorkflowEntity.prototype, "hashRecord", void 0);
|
|
183
|
+
__decorate([
|
|
184
|
+
(0, typeorm_1.OneToMany)(() => document_entity_1.DocumentEntity, (document) => document.workflow, {
|
|
185
|
+
cascade: true,
|
|
186
|
+
onDelete: 'CASCADE',
|
|
187
|
+
}),
|
|
188
|
+
__metadata("design:type", Array)
|
|
189
|
+
], WorkflowEntity.prototype, "documents", void 0);
|
|
190
|
+
__decorate([
|
|
191
|
+
(0, typeorm_1.Column)({ name: 'created_by', type: 'uuid' }),
|
|
192
|
+
__metadata("design:type", String)
|
|
193
|
+
], WorkflowEntity.prototype, "createdBy", void 0);
|
|
194
|
+
exports.WorkflowEntity = WorkflowEntity = __decorate([
|
|
195
|
+
(0, typeorm_1.Entity)({ name: 'core_workflow' })
|
|
196
|
+
], WorkflowEntity);
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.WorkspaceEntity = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const typeorm_2 = require("typeorm");
|
|
15
|
+
const pipeline_entity_1 = require("./pipeline.entity");
|
|
16
|
+
let WorkspaceEntity = class WorkspaceEntity {
|
|
17
|
+
id;
|
|
18
|
+
title;
|
|
19
|
+
configKey;
|
|
20
|
+
createdAt;
|
|
21
|
+
updatedAt;
|
|
22
|
+
pipelines;
|
|
23
|
+
createdBy;
|
|
24
|
+
};
|
|
25
|
+
exports.WorkspaceEntity = WorkspaceEntity;
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
28
|
+
__metadata("design:type", String)
|
|
29
|
+
], WorkspaceEntity.prototype, "id", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, typeorm_1.Column)({ type: 'varchar', nullable: true }),
|
|
32
|
+
__metadata("design:type", String)
|
|
33
|
+
], WorkspaceEntity.prototype, "title", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, typeorm_1.Column)({ type: 'varchar', name: 'config_key' }),
|
|
36
|
+
(0, typeorm_1.Index)(),
|
|
37
|
+
__metadata("design:type", String)
|
|
38
|
+
], WorkspaceEntity.prototype, "configKey", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, typeorm_2.CreateDateColumn)({ name: 'created_at' }),
|
|
41
|
+
__metadata("design:type", Date)
|
|
42
|
+
], WorkspaceEntity.prototype, "createdAt", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, typeorm_2.UpdateDateColumn)({ name: 'updated_at' }),
|
|
45
|
+
__metadata("design:type", Date)
|
|
46
|
+
], WorkspaceEntity.prototype, "updatedAt", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, typeorm_1.OneToMany)(() => pipeline_entity_1.PipelineEntity, (pipeline) => pipeline.workspace, {
|
|
49
|
+
cascade: true,
|
|
50
|
+
onDelete: 'CASCADE',
|
|
51
|
+
}),
|
|
52
|
+
__metadata("design:type", Array)
|
|
53
|
+
], WorkspaceEntity.prototype, "pipelines", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
(0, typeorm_1.Column)({ name: 'created_by', type: 'uuid' }),
|
|
56
|
+
__metadata("design:type", String)
|
|
57
|
+
], WorkspaceEntity.prototype, "createdBy", void 0);
|
|
58
|
+
exports.WorkspaceEntity = WorkspaceEntity = __decorate([
|
|
59
|
+
(0, typeorm_1.Entity)({ name: 'core_workspace' })
|
|
60
|
+
], WorkspaceEntity);
|