@loopstack/common 0.16.0 → 0.17.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/.github/workflows/publish-npm.yml +2 -2
- package/.prettierignore +15 -0
- package/dist/decorators/block.decorator.d.ts +11 -2
- package/dist/decorators/block.decorator.js +18 -7
- package/dist/entities/document.entity.d.ts +1 -1
- package/dist/entities/document.entity.js +2 -2
- package/dist/entities/event-subscriber.entity.d.ts +2 -2
- package/dist/entities/event-subscriber.entity.js +19 -19
- package/dist/entities/index.d.ts +9 -9
- package/dist/entities/namespace.entity.d.ts +1 -1
- package/dist/entities/namespace.entity.js +1 -1
- package/dist/entities/permission.entity.d.ts +1 -1
- package/dist/entities/permission.entity.js +1 -1
- package/dist/entities/pipeline.entity.d.ts +6 -3
- package/dist/entities/pipeline.entity.js +22 -3
- package/dist/entities/role.entity.d.ts +2 -2
- package/dist/entities/role.entity.js +4 -4
- package/dist/entities/user.entity.d.ts +1 -1
- package/dist/entities/user.entity.js +3 -3
- package/dist/entities/workflow.entity.d.ts +4 -4
- package/dist/entities/workflow.entity.js +3 -3
- package/dist/interfaces/sso-response.interface.d.ts +2 -4
- package/dist/utils/object-fingerprint.util.js +1 -1
- package/dist/utils/stable-json-transformer.js +1 -5
- package/eslint.config.mjs +21 -0
- package/package.json +23 -3
- package/prettier.config.mjs +19 -0
- package/dist/constants/module.constants.d.ts +0 -1
- package/dist/constants/module.constants.js +0 -4
- package/dist/services/block-config-service.d.ts +0 -8
- package/dist/services/block-config-service.js +0 -34
|
@@ -53,12 +53,12 @@ jobs:
|
|
|
53
53
|
|
|
54
54
|
- name: Install Dependencies
|
|
55
55
|
run: npm ci
|
|
56
|
-
|
|
56
|
+
|
|
57
57
|
- name: Build Package
|
|
58
58
|
run: npm run build --if-present
|
|
59
59
|
|
|
60
60
|
- name: Publish to NPM
|
|
61
|
-
run: npm publish --
|
|
61
|
+
run: npm publish --access public
|
|
62
62
|
env:
|
|
63
63
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
64
64
|
|
package/.prettierignore
ADDED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BlockOptions } from '../interfaces';
|
|
2
1
|
import { z } from 'zod';
|
|
2
|
+
import { BlockOptions } from '../interfaces';
|
|
3
3
|
export declare const BLOCK_METADATA_KEY: unique symbol;
|
|
4
4
|
export declare const INPUT_METADATA_KEY: unique symbol;
|
|
5
5
|
export declare const OUTPUT_METADATA_KEY: unique symbol;
|
|
@@ -7,13 +7,22 @@ export declare const TOOL_METADATA_KEY: unique symbol;
|
|
|
7
7
|
export declare const DOCUMENT_METADATA_KEY: unique symbol;
|
|
8
8
|
export declare const WORKFLOW_METADATA_KEY: unique symbol;
|
|
9
9
|
export declare const TEMPLATE_HELPER_METADATA_KEY: unique symbol;
|
|
10
|
+
export interface WorkflowOptions {
|
|
11
|
+
visible?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface WorkflowDecoratorOptions {
|
|
14
|
+
token?: any;
|
|
15
|
+
options?: WorkflowOptions;
|
|
16
|
+
}
|
|
17
|
+
export declare const WORKFLOW_OPTIONS_KEY = "workflow:options";
|
|
10
18
|
export declare function WithArguments<T extends z.ZodType>(schema: T): ClassDecorator;
|
|
11
19
|
export declare function WithState<T extends z.ZodType>(schema: T): ClassDecorator;
|
|
12
20
|
export declare function WithResult<T extends z.ZodType>(schema: T): ClassDecorator;
|
|
21
|
+
export declare function getWorkflowOptions(target: any, propertyKey: string | symbol): WorkflowOptions;
|
|
13
22
|
export declare function BlockConfig(options: BlockOptions): ClassDecorator;
|
|
14
23
|
export declare function Tool(token?: any): PropertyDecorator & MethodDecorator;
|
|
15
24
|
export declare function Document(token?: any): PropertyDecorator & MethodDecorator;
|
|
16
|
-
export declare function Workflow(
|
|
25
|
+
export declare function Workflow(options?: WorkflowDecoratorOptions): PropertyDecorator & MethodDecorator;
|
|
17
26
|
export declare function Helper(): MethodDecorator;
|
|
18
27
|
export declare function Input(): PropertyDecorator;
|
|
19
28
|
export declare function Output(): PropertyDecorator;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TEMPLATE_HELPER_METADATA_KEY = exports.WORKFLOW_METADATA_KEY = exports.DOCUMENT_METADATA_KEY = exports.TOOL_METADATA_KEY = exports.OUTPUT_METADATA_KEY = exports.INPUT_METADATA_KEY = exports.BLOCK_METADATA_KEY = void 0;
|
|
3
|
+
exports.WORKFLOW_OPTIONS_KEY = exports.TEMPLATE_HELPER_METADATA_KEY = exports.WORKFLOW_METADATA_KEY = exports.DOCUMENT_METADATA_KEY = exports.TOOL_METADATA_KEY = exports.OUTPUT_METADATA_KEY = exports.INPUT_METADATA_KEY = exports.BLOCK_METADATA_KEY = void 0;
|
|
4
4
|
exports.WithArguments = WithArguments;
|
|
5
5
|
exports.WithState = WithState;
|
|
6
6
|
exports.WithResult = WithResult;
|
|
7
|
+
exports.getWorkflowOptions = getWorkflowOptions;
|
|
7
8
|
exports.BlockConfig = BlockConfig;
|
|
8
9
|
exports.Tool = Tool;
|
|
9
10
|
exports.Document = Document;
|
|
@@ -12,8 +13,8 @@ exports.Helper = Helper;
|
|
|
12
13
|
exports.Input = Input;
|
|
13
14
|
exports.Output = Output;
|
|
14
15
|
const common_1 = require("@nestjs/common");
|
|
15
|
-
const block_config_builder_1 = require("../utils/block-config.builder");
|
|
16
16
|
const zod_1 = require("zod");
|
|
17
|
+
const block_config_builder_1 = require("../utils/block-config.builder");
|
|
17
18
|
exports.BLOCK_METADATA_KEY = Symbol('block');
|
|
18
19
|
exports.INPUT_METADATA_KEY = Symbol('input');
|
|
19
20
|
exports.OUTPUT_METADATA_KEY = Symbol('output');
|
|
@@ -21,6 +22,7 @@ exports.TOOL_METADATA_KEY = Symbol('tool');
|
|
|
21
22
|
exports.DOCUMENT_METADATA_KEY = Symbol('document');
|
|
22
23
|
exports.WORKFLOW_METADATA_KEY = Symbol('workflow');
|
|
23
24
|
exports.TEMPLATE_HELPER_METADATA_KEY = Symbol('templateHelper');
|
|
25
|
+
exports.WORKFLOW_OPTIONS_KEY = 'workflow:options';
|
|
24
26
|
function WithArguments(schema) {
|
|
25
27
|
return (target) => {
|
|
26
28
|
target.argsSchema = schema;
|
|
@@ -52,19 +54,22 @@ function WithResult(schema) {
|
|
|
52
54
|
}
|
|
53
55
|
function getTools(target) {
|
|
54
56
|
const keys = Reflect.getMetadata(exports.TOOL_METADATA_KEY, target.prototype) || [];
|
|
55
|
-
return keys.map(key => String(key));
|
|
57
|
+
return keys.map((key) => String(key));
|
|
56
58
|
}
|
|
57
59
|
function getDocuments(target) {
|
|
58
60
|
const keys = Reflect.getMetadata(exports.DOCUMENT_METADATA_KEY, target.prototype) || [];
|
|
59
|
-
return keys.map(key => String(key));
|
|
61
|
+
return keys.map((key) => String(key));
|
|
60
62
|
}
|
|
61
63
|
function getWorkflows(target) {
|
|
62
64
|
const keys = Reflect.getMetadata(exports.WORKFLOW_METADATA_KEY, target.prototype) || [];
|
|
63
|
-
return keys.map(key => String(key));
|
|
65
|
+
return keys.map((key) => String(key));
|
|
64
66
|
}
|
|
65
67
|
function getHelpers(target) {
|
|
66
68
|
const keys = Reflect.getMetadata(exports.TEMPLATE_HELPER_METADATA_KEY, target.prototype) || [];
|
|
67
|
-
return keys.map(key => String(key));
|
|
69
|
+
return keys.map((key) => String(key));
|
|
70
|
+
}
|
|
71
|
+
function getWorkflowOptions(target, propertyKey) {
|
|
72
|
+
return Reflect.getMetadata(exports.WORKFLOW_OPTIONS_KEY, target, propertyKey) ?? { visible: true };
|
|
68
73
|
}
|
|
69
74
|
function BlockConfig(options) {
|
|
70
75
|
return (target) => {
|
|
@@ -96,14 +101,20 @@ function Document(token) {
|
|
|
96
101
|
Reflect.defineMetadata(exports.DOCUMENT_METADATA_KEY, [...existingTools, propertyKey], target);
|
|
97
102
|
};
|
|
98
103
|
}
|
|
99
|
-
function Workflow(
|
|
104
|
+
function Workflow(options) {
|
|
100
105
|
return (target, propertyKey) => {
|
|
106
|
+
const token = options?.token;
|
|
107
|
+
const config = {
|
|
108
|
+
visible: true,
|
|
109
|
+
...options?.options,
|
|
110
|
+
};
|
|
101
111
|
const type = token ?? Reflect.getMetadata('design:type', target, propertyKey);
|
|
102
112
|
if (type) {
|
|
103
113
|
(0, common_1.Inject)(type)(target, propertyKey);
|
|
104
114
|
}
|
|
105
115
|
const existingWorkflows = Reflect.getMetadata(exports.WORKFLOW_METADATA_KEY, target) || [];
|
|
106
116
|
Reflect.defineMetadata(exports.WORKFLOW_METADATA_KEY, [...existingWorkflows, propertyKey], target);
|
|
117
|
+
Reflect.defineMetadata(exports.WORKFLOW_OPTIONS_KEY, config, target, propertyKey);
|
|
107
118
|
};
|
|
108
119
|
}
|
|
109
120
|
function Helper() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { WorkflowEntity } from './workflow.entity';
|
|
2
1
|
import { z } from 'zod';
|
|
3
2
|
import type { JSONSchemaConfigType } from '@loopstack/contracts/types';
|
|
3
|
+
import { WorkflowEntity } from './workflow.entity';
|
|
4
4
|
export declare class DocumentEntity<T = any> {
|
|
5
5
|
id: string;
|
|
6
6
|
messageId: string;
|
|
@@ -11,8 +11,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.DocumentEntity = void 0;
|
|
13
13
|
const typeorm_1 = require("typeorm");
|
|
14
|
-
const workflow_entity_1 = require("./workflow.entity");
|
|
15
14
|
const utils_1 = require("../utils");
|
|
15
|
+
const workflow_entity_1 = require("./workflow.entity");
|
|
16
16
|
let DocumentEntity = class DocumentEntity {
|
|
17
17
|
id;
|
|
18
18
|
messageId;
|
|
@@ -79,7 +79,7 @@ __decorate([
|
|
|
79
79
|
__metadata("design:type", Object)
|
|
80
80
|
], DocumentEntity.prototype, "schema", void 0);
|
|
81
81
|
__decorate([
|
|
82
|
-
(0, typeorm_1.Column)('jsonb', { nullable: true, name:
|
|
82
|
+
(0, typeorm_1.Column)('jsonb', { nullable: true, name: 'validation_error' }),
|
|
83
83
|
__metadata("design:type", Object)
|
|
84
84
|
], DocumentEntity.prototype, "error", void 0);
|
|
85
85
|
__decorate([
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { PipelineEntity } from './pipeline.entity';
|
|
2
|
+
import { WorkspaceEntity } from './workspace.entity';
|
|
3
3
|
export declare class EventSubscriberEntity {
|
|
4
4
|
id: string;
|
|
5
5
|
subscriberPipeline: PipelineEntity;
|
|
@@ -11,8 +11,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.EventSubscriberEntity = void 0;
|
|
13
13
|
const typeorm_1 = require("typeorm");
|
|
14
|
-
const workspace_entity_1 = require("./workspace.entity");
|
|
15
14
|
const pipeline_entity_1 = require("./pipeline.entity");
|
|
15
|
+
const workspace_entity_1 = require("./workspace.entity");
|
|
16
16
|
let EventSubscriberEntity = class EventSubscriberEntity {
|
|
17
17
|
id;
|
|
18
18
|
subscriberPipeline;
|
|
@@ -30,64 +30,64 @@ let EventSubscriberEntity = class EventSubscriberEntity {
|
|
|
30
30
|
};
|
|
31
31
|
exports.EventSubscriberEntity = EventSubscriberEntity;
|
|
32
32
|
__decorate([
|
|
33
|
-
(0, typeorm_1.PrimaryGeneratedColumn)(
|
|
33
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
34
34
|
__metadata("design:type", String)
|
|
35
35
|
], EventSubscriberEntity.prototype, "id", void 0);
|
|
36
36
|
__decorate([
|
|
37
|
-
(0, typeorm_1.ManyToOne)(() => pipeline_entity_1.PipelineEntity, { onDelete:
|
|
38
|
-
(0, typeorm_1.JoinColumn)({ name:
|
|
37
|
+
(0, typeorm_1.ManyToOne)(() => pipeline_entity_1.PipelineEntity, { onDelete: 'CASCADE' }),
|
|
38
|
+
(0, typeorm_1.JoinColumn)({ name: 'subscriber_pipeline_id' }),
|
|
39
39
|
__metadata("design:type", pipeline_entity_1.PipelineEntity)
|
|
40
40
|
], EventSubscriberEntity.prototype, "subscriberPipeline", void 0);
|
|
41
41
|
__decorate([
|
|
42
|
-
(0, typeorm_1.Column)({ type:
|
|
42
|
+
(0, typeorm_1.Column)({ type: 'uuid', name: 'subscriber_pipeline_id' }),
|
|
43
43
|
(0, typeorm_1.Index)(),
|
|
44
44
|
__metadata("design:type", String)
|
|
45
45
|
], EventSubscriberEntity.prototype, "subscriberPipelineId", void 0);
|
|
46
46
|
__decorate([
|
|
47
|
-
(0, typeorm_1.Column)({ type:
|
|
47
|
+
(0, typeorm_1.Column)({ type: 'uuid', name: 'subscriber_workflow_id' }),
|
|
48
48
|
__metadata("design:type", String)
|
|
49
49
|
], EventSubscriberEntity.prototype, "subscriberWorkflowId", void 0);
|
|
50
50
|
__decorate([
|
|
51
|
-
(0, typeorm_1.Column)({ type:
|
|
51
|
+
(0, typeorm_1.Column)({ type: 'varchar', name: 'subscriber_transition' }),
|
|
52
52
|
__metadata("design:type", String)
|
|
53
53
|
], EventSubscriberEntity.prototype, "subscriberTransition", void 0);
|
|
54
54
|
__decorate([
|
|
55
|
-
(0, typeorm_1.Column)({ type:
|
|
55
|
+
(0, typeorm_1.Column)({ type: 'uuid', name: 'event_pipeline_id' }),
|
|
56
56
|
(0, typeorm_1.Index)(),
|
|
57
57
|
__metadata("design:type", String)
|
|
58
58
|
], EventSubscriberEntity.prototype, "eventPipelineId", void 0);
|
|
59
59
|
__decorate([
|
|
60
|
-
(0, typeorm_1.Column)({ type:
|
|
60
|
+
(0, typeorm_1.Column)({ type: 'varchar', name: 'event_name' }),
|
|
61
61
|
(0, typeorm_1.Index)(),
|
|
62
62
|
__metadata("design:type", String)
|
|
63
63
|
], EventSubscriberEntity.prototype, "eventName", void 0);
|
|
64
64
|
__decorate([
|
|
65
|
-
(0, typeorm_1.CreateDateColumn)({ name:
|
|
65
|
+
(0, typeorm_1.CreateDateColumn)({ name: 'created_at' }),
|
|
66
66
|
__metadata("design:type", Date)
|
|
67
67
|
], EventSubscriberEntity.prototype, "createdAt", void 0);
|
|
68
68
|
__decorate([
|
|
69
|
-
(0, typeorm_1.UpdateDateColumn)({ name:
|
|
69
|
+
(0, typeorm_1.UpdateDateColumn)({ name: 'updated_at' }),
|
|
70
70
|
__metadata("design:type", Date)
|
|
71
71
|
], EventSubscriberEntity.prototype, "updatedAt", void 0);
|
|
72
72
|
__decorate([
|
|
73
|
-
(0, typeorm_1.ManyToOne)(() => workspace_entity_1.WorkspaceEntity, { onDelete:
|
|
74
|
-
(0, typeorm_1.JoinColumn)({ name:
|
|
73
|
+
(0, typeorm_1.ManyToOne)(() => workspace_entity_1.WorkspaceEntity, { onDelete: 'CASCADE' }),
|
|
74
|
+
(0, typeorm_1.JoinColumn)({ name: 'workspace_id' }),
|
|
75
75
|
__metadata("design:type", workspace_entity_1.WorkspaceEntity)
|
|
76
76
|
], EventSubscriberEntity.prototype, "workspace", void 0);
|
|
77
77
|
__decorate([
|
|
78
|
-
(0, typeorm_1.Column)({ name:
|
|
78
|
+
(0, typeorm_1.Column)({ name: 'workspace_id', nullable: true }),
|
|
79
79
|
__metadata("design:type", String)
|
|
80
80
|
], EventSubscriberEntity.prototype, "workspaceId", void 0);
|
|
81
81
|
__decorate([
|
|
82
|
-
(0, typeorm_1.Column)({ name:
|
|
82
|
+
(0, typeorm_1.Column)({ name: 'user_id', type: 'uuid' }),
|
|
83
83
|
__metadata("design:type", String)
|
|
84
84
|
], EventSubscriberEntity.prototype, "userId", void 0);
|
|
85
85
|
__decorate([
|
|
86
|
-
(0, typeorm_1.Column)({ name:
|
|
86
|
+
(0, typeorm_1.Column)({ name: 'once', type: 'boolean', default: true }),
|
|
87
87
|
__metadata("design:type", Boolean)
|
|
88
88
|
], EventSubscriberEntity.prototype, "once", void 0);
|
|
89
89
|
exports.EventSubscriberEntity = EventSubscriberEntity = __decorate([
|
|
90
|
-
(0, typeorm_1.Entity)({ name:
|
|
91
|
-
(0, typeorm_1.Index)([
|
|
92
|
-
(0, typeorm_1.Index)([
|
|
90
|
+
(0, typeorm_1.Entity)({ name: 'core_event_subscriber' }),
|
|
91
|
+
(0, typeorm_1.Index)(['eventPipelineId', 'eventName']),
|
|
92
|
+
(0, typeorm_1.Index)(['subscriberPipelineId', 'subscriberWorkflowId', 'subscriberTransition'])
|
|
93
93
|
], EventSubscriberEntity);
|
package/dist/entities/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
1
|
+
export * from './pipeline.entity.js';
|
|
2
|
+
export * from './document.entity.js';
|
|
3
|
+
export * from './workflow.entity.js';
|
|
4
|
+
export * from './workspace.entity.js';
|
|
5
|
+
export * from './namespace.entity.js';
|
|
6
|
+
export * from './permission.entity.js';
|
|
7
|
+
export * from './role.entity.js';
|
|
8
|
+
export * from './user.entity.js';
|
|
9
|
+
export * from './event-subscriber.entity.js';
|
|
@@ -11,8 +11,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.NamespaceEntity = void 0;
|
|
13
13
|
const typeorm_1 = require("typeorm");
|
|
14
|
-
const workflow_entity_1 = require("./workflow.entity");
|
|
15
14
|
const pipeline_entity_1 = require("./pipeline.entity");
|
|
15
|
+
const workflow_entity_1 = require("./workflow.entity");
|
|
16
16
|
let NamespaceEntity = class NamespaceEntity {
|
|
17
17
|
id;
|
|
18
18
|
name;
|
|
@@ -42,7 +42,7 @@ __decorate([
|
|
|
42
42
|
__metadata("design:type", String)
|
|
43
43
|
], Permission.prototype, "description", void 0);
|
|
44
44
|
__decorate([
|
|
45
|
-
(0, typeorm_1.ManyToMany)(() => role_entity_1.Role, role => role.permissions),
|
|
45
|
+
(0, typeorm_1.ManyToMany)(() => role_entity_1.Role, (role) => role.permissions),
|
|
46
46
|
__metadata("design:type", Array)
|
|
47
47
|
], Permission.prototype, "roles", void 0);
|
|
48
48
|
exports.Permission = Permission = __decorate([
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { WorkspaceEntity } from './workspace.entity';
|
|
2
|
-
import { NamespaceEntity } from './namespace.entity';
|
|
3
|
-
import { PipelineState } from '../enums';
|
|
4
1
|
import { z } from 'zod';
|
|
5
2
|
import type { JSONSchemaConfigType } from '@loopstack/contracts/types';
|
|
3
|
+
import { PipelineState } from '../enums';
|
|
4
|
+
import { NamespaceEntity } from './namespace.entity';
|
|
5
|
+
import { WorkspaceEntity } from './workspace.entity';
|
|
6
6
|
export declare class PipelineEntity {
|
|
7
7
|
id: string;
|
|
8
8
|
blockName: string;
|
|
@@ -22,4 +22,7 @@ export declare class PipelineEntity {
|
|
|
22
22
|
workspaceId: string;
|
|
23
23
|
createdBy: string;
|
|
24
24
|
namespaces: NamespaceEntity[];
|
|
25
|
+
parent: PipelineEntity | null;
|
|
26
|
+
parentId: string | null;
|
|
27
|
+
children: PipelineEntity[];
|
|
25
28
|
}
|
|
@@ -11,10 +11,10 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.PipelineEntity = void 0;
|
|
13
13
|
const typeorm_1 = require("typeorm");
|
|
14
|
-
const workspace_entity_1 = require("./workspace.entity");
|
|
15
|
-
const namespace_entity_1 = require("./namespace.entity");
|
|
16
14
|
const enums_1 = require("../enums");
|
|
17
15
|
const utils_1 = require("../utils");
|
|
16
|
+
const namespace_entity_1 = require("./namespace.entity");
|
|
17
|
+
const workspace_entity_1 = require("./workspace.entity");
|
|
18
18
|
let PipelineEntity = class PipelineEntity {
|
|
19
19
|
id;
|
|
20
20
|
blockName;
|
|
@@ -34,6 +34,9 @@ let PipelineEntity = class PipelineEntity {
|
|
|
34
34
|
workspaceId;
|
|
35
35
|
createdBy;
|
|
36
36
|
namespaces;
|
|
37
|
+
parent;
|
|
38
|
+
parentId;
|
|
39
|
+
children;
|
|
37
40
|
};
|
|
38
41
|
exports.PipelineEntity = PipelineEntity;
|
|
39
42
|
__decorate([
|
|
@@ -87,7 +90,7 @@ __decorate([
|
|
|
87
90
|
__metadata("design:type", Object)
|
|
88
91
|
], PipelineEntity.prototype, "schema", void 0);
|
|
89
92
|
__decorate([
|
|
90
|
-
(0, typeorm_1.Column)('jsonb', { nullable: true, name:
|
|
93
|
+
(0, typeorm_1.Column)('jsonb', { nullable: true, name: 'error' }),
|
|
91
94
|
__metadata("design:type", Object)
|
|
92
95
|
], PipelineEntity.prototype, "error", void 0);
|
|
93
96
|
__decorate([
|
|
@@ -126,6 +129,22 @@ __decorate([
|
|
|
126
129
|
(0, typeorm_1.OneToMany)(() => namespace_entity_1.NamespaceEntity, (namespace) => namespace.pipeline),
|
|
127
130
|
__metadata("design:type", Array)
|
|
128
131
|
], PipelineEntity.prototype, "namespaces", void 0);
|
|
132
|
+
__decorate([
|
|
133
|
+
(0, typeorm_1.ManyToOne)(() => PipelineEntity, (pipeline) => pipeline.children, {
|
|
134
|
+
onDelete: 'CASCADE',
|
|
135
|
+
nullable: true,
|
|
136
|
+
}),
|
|
137
|
+
(0, typeorm_1.JoinColumn)({ name: 'parent_id' }),
|
|
138
|
+
__metadata("design:type", Object)
|
|
139
|
+
], PipelineEntity.prototype, "parent", void 0);
|
|
140
|
+
__decorate([
|
|
141
|
+
(0, typeorm_1.Column)({ name: 'parent_id', type: 'uuid', nullable: true }),
|
|
142
|
+
__metadata("design:type", Object)
|
|
143
|
+
], PipelineEntity.prototype, "parentId", void 0);
|
|
144
|
+
__decorate([
|
|
145
|
+
(0, typeorm_1.OneToMany)(() => PipelineEntity, (pipeline) => pipeline.parent),
|
|
146
|
+
__metadata("design:type", Array)
|
|
147
|
+
], PipelineEntity.prototype, "children", void 0);
|
|
129
148
|
exports.PipelineEntity = PipelineEntity = __decorate([
|
|
130
149
|
(0, typeorm_1.Entity)({ name: 'core_pipeline' })
|
|
131
150
|
], PipelineEntity);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { User } from './user.entity';
|
|
2
|
-
import { Permission } from './permission.entity';
|
|
3
1
|
import { RoleInterface } from '../interfaces';
|
|
2
|
+
import { Permission } from './permission.entity';
|
|
3
|
+
import { User } from './user.entity';
|
|
4
4
|
export declare class Role implements RoleInterface {
|
|
5
5
|
id: string;
|
|
6
6
|
name: string;
|
|
@@ -11,8 +11,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.Role = void 0;
|
|
13
13
|
const typeorm_1 = require("typeorm");
|
|
14
|
-
const user_entity_1 = require("./user.entity");
|
|
15
14
|
const permission_entity_1 = require("./permission.entity");
|
|
15
|
+
const user_entity_1 = require("./user.entity");
|
|
16
16
|
let Role = class Role {
|
|
17
17
|
id;
|
|
18
18
|
name;
|
|
@@ -34,15 +34,15 @@ __decorate([
|
|
|
34
34
|
__metadata("design:type", String)
|
|
35
35
|
], Role.prototype, "description", void 0);
|
|
36
36
|
__decorate([
|
|
37
|
-
(0, typeorm_1.ManyToMany)(() => user_entity_1.User, user => user.roles),
|
|
37
|
+
(0, typeorm_1.ManyToMany)(() => user_entity_1.User, (user) => user.roles),
|
|
38
38
|
__metadata("design:type", Array)
|
|
39
39
|
], Role.prototype, "users", void 0);
|
|
40
40
|
__decorate([
|
|
41
|
-
(0, typeorm_1.ManyToMany)(() => permission_entity_1.Permission, permission => permission.roles),
|
|
41
|
+
(0, typeorm_1.ManyToMany)(() => permission_entity_1.Permission, (permission) => permission.roles),
|
|
42
42
|
(0, typeorm_1.JoinTable)({
|
|
43
43
|
name: 'auth_role_permissions',
|
|
44
44
|
joinColumn: { name: 'role_id', referencedColumnName: 'id' },
|
|
45
|
-
inverseJoinColumn: { name: 'permission_id', referencedColumnName: 'id' }
|
|
45
|
+
inverseJoinColumn: { name: 'permission_id', referencedColumnName: 'id' },
|
|
46
46
|
}),
|
|
47
47
|
__metadata("design:type", Array)
|
|
48
48
|
], Role.prototype, "permissions", void 0);
|
|
@@ -11,8 +11,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.User = void 0;
|
|
13
13
|
const typeorm_1 = require("typeorm");
|
|
14
|
-
const role_entity_1 = require("./role.entity");
|
|
15
14
|
const user_type_enum_1 = require("../enums/user-type.enum");
|
|
15
|
+
const role_entity_1 = require("./role.entity");
|
|
16
16
|
let User = class User {
|
|
17
17
|
id;
|
|
18
18
|
type;
|
|
@@ -38,11 +38,11 @@ __decorate([
|
|
|
38
38
|
__metadata("design:type", Boolean)
|
|
39
39
|
], User.prototype, "isActive", void 0);
|
|
40
40
|
__decorate([
|
|
41
|
-
(0, typeorm_1.ManyToMany)(() => role_entity_1.Role, role => role.users),
|
|
41
|
+
(0, typeorm_1.ManyToMany)(() => role_entity_1.Role, (role) => role.users),
|
|
42
42
|
(0, typeorm_1.JoinTable)({
|
|
43
43
|
name: 'auth_user_roles',
|
|
44
44
|
joinColumn: { name: 'user_id', referencedColumnName: 'id' },
|
|
45
|
-
inverseJoinColumn: { name: 'role_id', referencedColumnName: 'id' }
|
|
45
|
+
inverseJoinColumn: { name: 'role_id', referencedColumnName: 'id' },
|
|
46
46
|
}),
|
|
47
47
|
__metadata("design:type", Array)
|
|
48
48
|
], User.prototype, "roles", void 0);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { DocumentEntity } from './document.entity';
|
|
2
|
-
import { NamespaceEntity } from './namespace.entity';
|
|
3
|
-
import { WorkflowState } from '../enums';
|
|
4
|
-
import { TransitionResultLookup } from '../interfaces';
|
|
5
1
|
import { z } from 'zod';
|
|
6
2
|
import type { JSONSchemaConfigType, UiFormType, WorkflowTransitionType } from '@loopstack/contracts/types';
|
|
3
|
+
import { WorkflowState } from '../enums';
|
|
4
|
+
import { TransitionResultLookup } from '../interfaces';
|
|
5
|
+
import { DocumentEntity } from './document.entity';
|
|
6
|
+
import { NamespaceEntity } from './namespace.entity';
|
|
7
7
|
export declare class WorkflowEntity {
|
|
8
8
|
id: string;
|
|
9
9
|
blockName: string;
|
|
@@ -11,10 +11,10 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.WorkflowEntity = void 0;
|
|
13
13
|
const typeorm_1 = require("typeorm");
|
|
14
|
-
const document_entity_1 = require("./document.entity");
|
|
15
|
-
const namespace_entity_1 = require("./namespace.entity");
|
|
16
14
|
const enums_1 = require("../enums");
|
|
17
15
|
const utils_1 = require("../utils");
|
|
16
|
+
const document_entity_1 = require("./document.entity");
|
|
17
|
+
const namespace_entity_1 = require("./namespace.entity");
|
|
18
18
|
let WorkflowEntity = class WorkflowEntity {
|
|
19
19
|
id;
|
|
20
20
|
blockName;
|
|
@@ -137,7 +137,7 @@ __decorate([
|
|
|
137
137
|
__metadata("design:type", Object)
|
|
138
138
|
], WorkflowEntity.prototype, "schema", void 0);
|
|
139
139
|
__decorate([
|
|
140
|
-
(0, typeorm_1.Column)('jsonb', { nullable: true, name:
|
|
140
|
+
(0, typeorm_1.Column)('jsonb', { nullable: true, name: 'error' }),
|
|
141
141
|
__metadata("design:type", Object)
|
|
142
142
|
], WorkflowEntity.prototype, "error", void 0);
|
|
143
143
|
__decorate([
|
|
@@ -11,10 +11,8 @@ export interface IApiResponse<T = any> {
|
|
|
11
11
|
timestamp: Date;
|
|
12
12
|
correlationId?: string;
|
|
13
13
|
}
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
export interface IValidateCodeResponse extends IApiResponse<UserInterface> {
|
|
17
|
-
}
|
|
14
|
+
export type IGenerateCodeResponse = IApiResponse<IAuthorizationCodeResponse>;
|
|
15
|
+
export type IValidateCodeResponse = IApiResponse<UserInterface>;
|
|
18
16
|
export interface IErrorResponse {
|
|
19
17
|
statusCode: number;
|
|
20
18
|
message: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateObjectFingerprint = void 0;
|
|
4
|
-
const normalize_deep_serialize_util_1 = require("./normalize-deep-serialize.util");
|
|
5
4
|
const create_hash_util_1 = require("./create-hash.util");
|
|
5
|
+
const normalize_deep_serialize_util_1 = require("./normalize-deep-serialize.util");
|
|
6
6
|
const generateObjectFingerprint = (obj) => {
|
|
7
7
|
return (0, create_hash_util_1.createHash)((0, normalize_deep_serialize_util_1.normalizeDeepSerializeUtil)(obj));
|
|
8
8
|
};
|
|
@@ -7,11 +7,7 @@ exports.StableJsonTransformer = void 0;
|
|
|
7
7
|
const fast_json_stable_stringify_1 = __importDefault(require("fast-json-stable-stringify"));
|
|
8
8
|
class StableJsonTransformer {
|
|
9
9
|
from(value) {
|
|
10
|
-
return value
|
|
11
|
-
? typeof value === 'string'
|
|
12
|
-
? JSON.parse(value)
|
|
13
|
-
: value
|
|
14
|
-
: value;
|
|
10
|
+
return value ? (typeof value === 'string' ? JSON.parse(value) : value) : value;
|
|
15
11
|
}
|
|
16
12
|
to(value) {
|
|
17
13
|
return value !== undefined ? (0, fast_json_stable_stringify_1.default)(value) : value;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import js from '@eslint/js';
|
|
2
|
+
import prettier from 'eslint-plugin-prettier/recommended';
|
|
3
|
+
import { defineConfig, globalIgnores } from 'eslint/config';
|
|
4
|
+
import globals from 'globals';
|
|
5
|
+
import tseslint from 'typescript-eslint';
|
|
6
|
+
|
|
7
|
+
export default defineConfig([
|
|
8
|
+
globalIgnores(['dist', 'src/components/ai-elements']),
|
|
9
|
+
{
|
|
10
|
+
files: ['**/*.{ts,tsx}'],
|
|
11
|
+
extends: [js.configs.recommended, tseslint.configs.recommended, prettier],
|
|
12
|
+
languageOptions: {
|
|
13
|
+
ecmaVersion: 2020,
|
|
14
|
+
globals: globals.browser,
|
|
15
|
+
},
|
|
16
|
+
rules: {
|
|
17
|
+
//for now we ignore this, fix later
|
|
18
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
]);
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@loopstack/common",
|
|
3
3
|
"displayName": "Loopstack Common Module",
|
|
4
4
|
"description": "A collection of utils and dtos shared between nestjs modules",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.17.0",
|
|
6
6
|
"license": "BSL",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "Jakob Klippel",
|
|
@@ -13,18 +13,38 @@
|
|
|
13
13
|
"scripts": {
|
|
14
14
|
"build": "tsc -p tsconfig.json",
|
|
15
15
|
"watch": "tsc --watch",
|
|
16
|
-
"compile": "tsc --noEmit"
|
|
16
|
+
"compile": "tsc --noEmit",
|
|
17
|
+
"lint": "eslint .",
|
|
18
|
+
"format": "prettier --write ."
|
|
17
19
|
},
|
|
18
20
|
"peerDependencies": {
|
|
19
21
|
"@nestjs/typeorm": "^11.0.0",
|
|
20
22
|
"typeorm": "^0.3.25"
|
|
21
23
|
},
|
|
22
24
|
"devDependencies": {
|
|
25
|
+
"@eslint/js": "^9.39.1",
|
|
23
26
|
"@nestjs/common": "^11.0.1",
|
|
24
27
|
"@nestjs/typeorm": "^11.0.0",
|
|
28
|
+
"@trivago/prettier-plugin-sort-imports": "^6.0.1",
|
|
25
29
|
"@types/node": "^22.13.4",
|
|
30
|
+
"eslint": "^9.39.1",
|
|
31
|
+
"eslint-config-prettier": "^10.1.5",
|
|
32
|
+
"eslint-plugin-prettier": "^5.4.1",
|
|
33
|
+
"globals": "^16.5.0",
|
|
34
|
+
"husky": "^9.1.7",
|
|
35
|
+
"lint-staged": "^16.2.7",
|
|
36
|
+
"prettier": "^3.7.4",
|
|
26
37
|
"typeorm": "^0.3.25",
|
|
27
|
-
"typescript": "^5.7.3"
|
|
38
|
+
"typescript": "^5.7.3",
|
|
39
|
+
"typescript-eslint": "^8.46.3"
|
|
40
|
+
},
|
|
41
|
+
"lint-staged": {
|
|
42
|
+
"*.{ts,tsx}": [
|
|
43
|
+
"eslint"
|
|
44
|
+
],
|
|
45
|
+
"*.{json,md,css,yaml,yml}": [
|
|
46
|
+
"prettier --check"
|
|
47
|
+
]
|
|
28
48
|
},
|
|
29
49
|
"dependencies": {
|
|
30
50
|
"@loopstack/contracts": "^0.16.0",
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
plugins: ['@trivago/prettier-plugin-sort-imports'],
|
|
3
|
+
importOrder: [
|
|
4
|
+
'<THIRD_PARTY_MODULES>', // Imports not matched by other special phrases
|
|
5
|
+
'^@loopstack/(.*)$', // Internal packages
|
|
6
|
+
'^@/(.*)$', // Path aliases
|
|
7
|
+
'^[./]', // Relative imports
|
|
8
|
+
],
|
|
9
|
+
importOrderSortSpecifiers: true,
|
|
10
|
+
importOrderParserPlugins: ['typescript', 'jsx', 'decorators-legacy'],
|
|
11
|
+
printWidth: 120,
|
|
12
|
+
singleQuote: true,
|
|
13
|
+
trailingComma: 'all',
|
|
14
|
+
semi: true,
|
|
15
|
+
tabWidth: 2,
|
|
16
|
+
bracketSpacing: true,
|
|
17
|
+
arrowParens: 'always',
|
|
18
|
+
endOfLine: 'lf',
|
|
19
|
+
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const MODULE_NAME_TOKEN = "MODULE_NAME_TOKEN";
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Reflector } from '@nestjs/core';
|
|
2
|
-
import { BlockOptions } from '../interfaces';
|
|
3
|
-
export declare class BlockConfigService {
|
|
4
|
-
private reflector;
|
|
5
|
-
constructor(reflector: Reflector);
|
|
6
|
-
getMetadata(): BlockOptions;
|
|
7
|
-
getConfig(target: object | Function): void;
|
|
8
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
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
|
-
var _a;
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.BlockConfigService = void 0;
|
|
14
|
-
const common_1 = require("@nestjs/common");
|
|
15
|
-
const core_1 = require("@nestjs/core");
|
|
16
|
-
const decorators_1 = require("../decorators");
|
|
17
|
-
let BlockConfigService = class BlockConfigService {
|
|
18
|
-
reflector;
|
|
19
|
-
constructor(reflector) {
|
|
20
|
-
this.reflector = reflector;
|
|
21
|
-
}
|
|
22
|
-
getMetadata() {
|
|
23
|
-
return this.reflector.get(decorators_1.BLOCK_METADATA_KEY, this.constructor);
|
|
24
|
-
}
|
|
25
|
-
getConfig(target) {
|
|
26
|
-
const constructor = typeof target === 'function' ? target : target.constructor;
|
|
27
|
-
const metadata = this.getMetadata();
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
exports.BlockConfigService = BlockConfigService;
|
|
31
|
-
exports.BlockConfigService = BlockConfigService = __decorate([
|
|
32
|
-
(0, common_1.Injectable)(),
|
|
33
|
-
__metadata("design:paramtypes", [typeof (_a = typeof core_1.Reflector !== "undefined" && core_1.Reflector) === "function" ? _a : Object])
|
|
34
|
-
], BlockConfigService);
|