@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
package/LICENSE
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
Business Source License 1.1
|
|
2
|
+
|
|
3
|
+
Parameters
|
|
4
|
+
----------
|
|
5
|
+
Licensor: Loopstack GmbH
|
|
6
|
+
Licensed Work: Loopstack Shared Module (the "Licensed Work")
|
|
7
|
+
Additional Use Grant: You may freely use, copy, modify, and distribute the Licensed Work
|
|
8
|
+
for both personal and commercial purposes, subject to the conditions below.
|
|
9
|
+
Change Date: Four years after the release date of each version.
|
|
10
|
+
Change License: Apache License, Version 2.0
|
|
11
|
+
|
|
12
|
+
Terms
|
|
13
|
+
-----
|
|
14
|
+
1. License Grant
|
|
15
|
+
The Licensed Work is made available under the terms of this Business Source License (the "License").
|
|
16
|
+
You are granted the right to use, copy, modify, and distribute the Licensed Work for any
|
|
17
|
+
personal or commercial purpose, provided that:
|
|
18
|
+
|
|
19
|
+
- You do not provide the Licensed Work to third parties as a managed or hosted service
|
|
20
|
+
where the primary value of the service is the Licensed Work itself, or a substantial
|
|
21
|
+
substitute for it.
|
|
22
|
+
- You comply with attribution requirements by including this License file with any distribution.
|
|
23
|
+
|
|
24
|
+
2. Change License
|
|
25
|
+
On the Change Date, each version of the Licensed Work will automatically be
|
|
26
|
+
made available under the Change License (Apache License 2.0).
|
|
27
|
+
|
|
28
|
+
3. Contributions
|
|
29
|
+
Any contributions to the Licensed Work will be licensed under the terms of this License
|
|
30
|
+
until the Change Date, and under the Change License thereafter.
|
|
31
|
+
|
|
32
|
+
4. Disclaimer
|
|
33
|
+
The Licensed Work is provided "as is," without warranty of any kind, express or implied.
|
|
34
|
+
|
|
35
|
+
Additional Terms
|
|
36
|
+
----------------
|
|
37
|
+
- This License does not grant you any rights to use the Licensor's trademarks or brand.
|
|
38
|
+
- This License explicitly permits both personal and commercial use of the Licensed Work,
|
|
39
|
+
including incorporation into commercial products and services, subject to the restrictions
|
|
40
|
+
outlined in Section 1.
|
|
41
|
+
|
|
42
|
+
For details on the Apache License 2.0 (effective after the Change Date), see:
|
|
43
|
+
https://www.apache.org/licenses/LICENSE-2.0
|
package/README.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Loopstack Common Module
|
|
2
|
+
|
|
3
|
+
This is a submodule of the **Loopstack** framework.
|
|
4
|
+
|
|
5
|
+
For full documentation, contribution guidelines, and to get started with Loopstack, please visit the main repository:
|
|
6
|
+
|
|
7
|
+
👉 [github.com/loopstack-ai/loopstack](https://github.com/loopstack-ai/loopstack)
|
|
@@ -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("./auth.constants"), exports);
|
|
18
|
+
__exportStar(require("./module.constants"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const MODULE_NAME_TOKEN = "MODULE_NAME_TOKEN";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AI_PROVIDER_DECORATOR = void 0;
|
|
4
|
+
exports.AiProvider = AiProvider;
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
const common_2 = require("@nestjs/common");
|
|
7
|
+
exports.AI_PROVIDER_DECORATOR = 'AI_PROVIDER_DECORATOR';
|
|
8
|
+
function AiProvider(options) {
|
|
9
|
+
return (0, common_2.applyDecorators)((0, common_1.Injectable)(), (0, common_1.SetMetadata)(exports.AI_PROVIDER_DECORATOR, options));
|
|
10
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BlockOptions } from '../interfaces';
|
|
2
|
+
export declare const BLOCK_METADATA_KEY = "block:metadata";
|
|
3
|
+
export declare function BlockConfig(options: BlockOptions): ClassDecorator;
|
|
4
|
+
export declare const INPUT_METADATA_KEY: unique symbol;
|
|
5
|
+
export declare const OUTPUT_METADATA_KEY: unique symbol;
|
|
6
|
+
/**
|
|
7
|
+
* Marks a property as an input parameter
|
|
8
|
+
* Inputs can be read and written
|
|
9
|
+
*/
|
|
10
|
+
export declare function Input(): (target: any, propertyKey: string) => void;
|
|
11
|
+
/**
|
|
12
|
+
* Marks a property/getter as an output value
|
|
13
|
+
* Outputs are typically read-only (often getters)
|
|
14
|
+
*/
|
|
15
|
+
export declare function Output(): (target: any, propertyKey: string) => void;
|
|
16
|
+
export declare function getDecoratedProperties(metatype: any, metadataKey: symbol): string[];
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OUTPUT_METADATA_KEY = exports.INPUT_METADATA_KEY = exports.BLOCK_METADATA_KEY = void 0;
|
|
4
|
+
exports.BlockConfig = BlockConfig;
|
|
5
|
+
exports.Input = Input;
|
|
6
|
+
exports.Output = Output;
|
|
7
|
+
exports.getDecoratedProperties = getDecoratedProperties;
|
|
8
|
+
const common_1 = require("@nestjs/common");
|
|
9
|
+
exports.BLOCK_METADATA_KEY = 'block:metadata';
|
|
10
|
+
function BlockConfig(options) {
|
|
11
|
+
return (target) => {
|
|
12
|
+
const scope = options.scope ?? common_1.Scope.TRANSIENT;
|
|
13
|
+
(0, common_1.Injectable)({ scope })(target);
|
|
14
|
+
Reflect.defineMetadata(exports.BLOCK_METADATA_KEY, options, target);
|
|
15
|
+
return target;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
exports.INPUT_METADATA_KEY = Symbol('input');
|
|
19
|
+
exports.OUTPUT_METADATA_KEY = Symbol('output');
|
|
20
|
+
/**
|
|
21
|
+
* Marks a property as an input parameter
|
|
22
|
+
* Inputs can be read and written
|
|
23
|
+
*/
|
|
24
|
+
function Input() {
|
|
25
|
+
return function (target, propertyKey) {
|
|
26
|
+
const constructor = target.constructor;
|
|
27
|
+
const existingInputs = Reflect.getOwnMetadata(exports.INPUT_METADATA_KEY, constructor) || [];
|
|
28
|
+
const newInputs = [...existingInputs, propertyKey];
|
|
29
|
+
Reflect.defineMetadata(exports.INPUT_METADATA_KEY, newInputs, constructor);
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Marks a property/getter as an output value
|
|
34
|
+
* Outputs are typically read-only (often getters)
|
|
35
|
+
*/
|
|
36
|
+
function Output() {
|
|
37
|
+
return function (target, propertyKey) {
|
|
38
|
+
const constructor = target.constructor;
|
|
39
|
+
const existingOutputs = Reflect.getOwnMetadata(exports.OUTPUT_METADATA_KEY, constructor) || [];
|
|
40
|
+
const newOutputs = [...existingOutputs, propertyKey];
|
|
41
|
+
Reflect.defineMetadata(exports.OUTPUT_METADATA_KEY, newOutputs, constructor);
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function getDecoratedProperties(metatype, metadataKey) {
|
|
45
|
+
const properties = new Set();
|
|
46
|
+
let current = metatype;
|
|
47
|
+
while (current && current !== Object && current !== Function.prototype) {
|
|
48
|
+
const metadata = Reflect.getOwnMetadata(metadataKey, current);
|
|
49
|
+
if (metadata && Array.isArray(metadata)) {
|
|
50
|
+
metadata.forEach(prop => properties.add(prop));
|
|
51
|
+
}
|
|
52
|
+
current = Object.getPrototypeOf(current);
|
|
53
|
+
}
|
|
54
|
+
return Array.from(properties);
|
|
55
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Type } from '@nestjs/common';
|
|
2
|
+
export declare const CAPABILITY_METADATA = "is_capability";
|
|
3
|
+
export declare const MODULE_FACTORY_CLASS = "module_factory_class";
|
|
4
|
+
export declare function Capability(): (target: any) => void;
|
|
5
|
+
export declare function ModuleFactory(factoryClass: Type<any>): (target: any) => void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MODULE_FACTORY_CLASS = exports.CAPABILITY_METADATA = void 0;
|
|
4
|
+
exports.Capability = Capability;
|
|
5
|
+
exports.ModuleFactory = ModuleFactory;
|
|
6
|
+
const common_1 = require("@nestjs/common");
|
|
7
|
+
exports.CAPABILITY_METADATA = 'is_capability';
|
|
8
|
+
exports.MODULE_FACTORY_CLASS = 'module_factory_class';
|
|
9
|
+
function Capability() {
|
|
10
|
+
return (target) => {
|
|
11
|
+
(0, common_1.Injectable)()(target);
|
|
12
|
+
Reflect.defineMetadata(exports.CAPABILITY_METADATA, true, target);
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function ModuleFactory(factoryClass) {
|
|
16
|
+
return (target) => {
|
|
17
|
+
Reflect.defineMetadata(exports.MODULE_FACTORY_CLASS, factoryClass, target);
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CurrentUser: (...dataOrPipes: unknown[]) => ParameterDecorator;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CurrentUser = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
exports.CurrentUser = (0, common_1.createParamDecorator)((data, ctx) => {
|
|
6
|
+
const request = ctx.switchToHttp().getRequest();
|
|
7
|
+
return request.user;
|
|
8
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './state-machine-validator.decorator';
|
|
2
|
+
export * from './current-user.decorator';
|
|
3
|
+
export * from './public.decorator';
|
|
4
|
+
export * from './roles.decorator';
|
|
5
|
+
export * from './ai-provider.decorator';
|
|
6
|
+
export * from './block.decorator';
|
|
7
|
+
export * from './capability-decorator';
|
|
@@ -0,0 +1,23 @@
|
|
|
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("./state-machine-validator.decorator"), exports);
|
|
18
|
+
__exportStar(require("./current-user.decorator"), exports);
|
|
19
|
+
__exportStar(require("./public.decorator"), exports);
|
|
20
|
+
__exportStar(require("./roles.decorator"), exports);
|
|
21
|
+
__exportStar(require("./ai-provider.decorator"), exports);
|
|
22
|
+
__exportStar(require("./block.decorator"), exports);
|
|
23
|
+
__exportStar(require("./capability-decorator"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Public: () => import("@nestjs/common").CustomDecorator<string>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Public = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
const constants_1 = require("../constants");
|
|
6
|
+
const Public = () => (0, common_1.SetMetadata)(constants_1.IS_PUBLIC_KEY, true);
|
|
7
|
+
exports.Public = Public;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Roles: (...roles: string[]) => import("@nestjs/common").CustomDecorator<string>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Roles = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
const constants_1 = require("../constants");
|
|
6
|
+
const Roles = (...roles) => (0, common_1.SetMetadata)(constants_1.ROLES_KEY, roles);
|
|
7
|
+
exports.Roles = Roles;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LOOP_STATE_MACHINE_VALIDATOR_DECORATOR = void 0;
|
|
4
|
+
exports.StateMachineValidator = StateMachineValidator;
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
const common_2 = require("@nestjs/common");
|
|
7
|
+
exports.LOOP_STATE_MACHINE_VALIDATOR_DECORATOR = 'LOOP_STATE_MACHINE_VALIDATOR_DECORATOR';
|
|
8
|
+
function StateMachineValidator(options) {
|
|
9
|
+
return (0, common_2.applyDecorators)((0, common_1.Injectable)(), (0, common_1.SetMetadata)(exports.LOOP_STATE_MACHINE_VALIDATOR_DECORATOR, options));
|
|
10
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { WorkflowEntity } from './workflow.entity';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import type { JSONSchemaConfigType } from '@loopstack/contracts/types';
|
|
4
|
+
export declare class DocumentEntity<T = any> {
|
|
5
|
+
id: string;
|
|
6
|
+
messageId: string;
|
|
7
|
+
configKey: string;
|
|
8
|
+
workspaceId: string;
|
|
9
|
+
pipelineId: string;
|
|
10
|
+
content: T | null;
|
|
11
|
+
schema: JSONSchemaConfigType | null;
|
|
12
|
+
error: z.ZodError | null;
|
|
13
|
+
ui: any;
|
|
14
|
+
tags: string[];
|
|
15
|
+
meta: Record<string, any> | null;
|
|
16
|
+
isInvalidated: boolean;
|
|
17
|
+
isPendingRemoval: boolean;
|
|
18
|
+
workflowIndex: string;
|
|
19
|
+
version: number;
|
|
20
|
+
index: number;
|
|
21
|
+
transition: string | null;
|
|
22
|
+
place: string | null;
|
|
23
|
+
createdAt: Date;
|
|
24
|
+
updatedAt: Date;
|
|
25
|
+
workflow: WorkflowEntity;
|
|
26
|
+
labels: string[];
|
|
27
|
+
workflowId: string;
|
|
28
|
+
dependentStates: WorkflowEntity[];
|
|
29
|
+
createdBy: string;
|
|
30
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
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.DocumentEntity = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const workflow_entity_1 = require("./workflow.entity");
|
|
15
|
+
const utils_1 = require("../utils");
|
|
16
|
+
let DocumentEntity = class DocumentEntity {
|
|
17
|
+
id;
|
|
18
|
+
messageId;
|
|
19
|
+
configKey;
|
|
20
|
+
workspaceId;
|
|
21
|
+
pipelineId;
|
|
22
|
+
content;
|
|
23
|
+
schema;
|
|
24
|
+
error;
|
|
25
|
+
ui;
|
|
26
|
+
tags;
|
|
27
|
+
meta;
|
|
28
|
+
isInvalidated;
|
|
29
|
+
isPendingRemoval;
|
|
30
|
+
workflowIndex;
|
|
31
|
+
version;
|
|
32
|
+
index;
|
|
33
|
+
transition;
|
|
34
|
+
place;
|
|
35
|
+
createdAt;
|
|
36
|
+
updatedAt;
|
|
37
|
+
workflow;
|
|
38
|
+
labels;
|
|
39
|
+
workflowId;
|
|
40
|
+
dependentStates;
|
|
41
|
+
createdBy;
|
|
42
|
+
};
|
|
43
|
+
exports.DocumentEntity = DocumentEntity;
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
46
|
+
__metadata("design:type", String)
|
|
47
|
+
], DocumentEntity.prototype, "id", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
(0, typeorm_1.Column)({ type: 'varchar', name: 'message_id' }),
|
|
50
|
+
(0, typeorm_1.Index)(),
|
|
51
|
+
__metadata("design:type", String)
|
|
52
|
+
], DocumentEntity.prototype, "messageId", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, typeorm_1.Column)({ type: 'varchar', name: 'config_key' }),
|
|
55
|
+
(0, typeorm_1.Index)(),
|
|
56
|
+
__metadata("design:type", String)
|
|
57
|
+
], DocumentEntity.prototype, "configKey", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
(0, typeorm_1.Column)({ name: 'workspace_id' }),
|
|
60
|
+
(0, typeorm_1.Index)(),
|
|
61
|
+
__metadata("design:type", String)
|
|
62
|
+
], DocumentEntity.prototype, "workspaceId", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
(0, typeorm_1.Column)({ name: 'pipeline_id' }),
|
|
65
|
+
(0, typeorm_1.Index)(),
|
|
66
|
+
__metadata("design:type", String)
|
|
67
|
+
], DocumentEntity.prototype, "pipelineId", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
(0, typeorm_1.Column)('jsonb', { nullable: true }),
|
|
70
|
+
__metadata("design:type", Object)
|
|
71
|
+
], DocumentEntity.prototype, "content", void 0);
|
|
72
|
+
__decorate([
|
|
73
|
+
(0, typeorm_1.Column)({
|
|
74
|
+
type: 'jsonb',
|
|
75
|
+
transformer: new utils_1.StableJsonTransformer(),
|
|
76
|
+
name: 'schema',
|
|
77
|
+
nullable: true,
|
|
78
|
+
}),
|
|
79
|
+
__metadata("design:type", Object)
|
|
80
|
+
], DocumentEntity.prototype, "schema", void 0);
|
|
81
|
+
__decorate([
|
|
82
|
+
(0, typeorm_1.Column)('jsonb', { nullable: true, name: "validation_error" }),
|
|
83
|
+
__metadata("design:type", Object)
|
|
84
|
+
], DocumentEntity.prototype, "error", void 0);
|
|
85
|
+
__decorate([
|
|
86
|
+
(0, typeorm_1.Column)({
|
|
87
|
+
type: 'jsonb',
|
|
88
|
+
transformer: new utils_1.StableJsonTransformer(),
|
|
89
|
+
name: 'ui',
|
|
90
|
+
nullable: true,
|
|
91
|
+
}),
|
|
92
|
+
__metadata("design:type", Object)
|
|
93
|
+
], DocumentEntity.prototype, "ui", void 0);
|
|
94
|
+
__decorate([
|
|
95
|
+
(0, typeorm_1.Column)('varchar', { name: 'tags', array: true, nullable: true }),
|
|
96
|
+
__metadata("design:type", Array)
|
|
97
|
+
], DocumentEntity.prototype, "tags", void 0);
|
|
98
|
+
__decorate([
|
|
99
|
+
(0, typeorm_1.Column)('jsonb', { nullable: true }),
|
|
100
|
+
__metadata("design:type", Object)
|
|
101
|
+
], DocumentEntity.prototype, "meta", void 0);
|
|
102
|
+
__decorate([
|
|
103
|
+
(0, typeorm_1.Column)({ name: 'is_invalidated', default: false }),
|
|
104
|
+
__metadata("design:type", Boolean)
|
|
105
|
+
], DocumentEntity.prototype, "isInvalidated", void 0);
|
|
106
|
+
__decorate([
|
|
107
|
+
(0, typeorm_1.Column)({ name: 'is_pending_removal', default: false }),
|
|
108
|
+
__metadata("design:type", Boolean)
|
|
109
|
+
], DocumentEntity.prototype, "isPendingRemoval", void 0);
|
|
110
|
+
__decorate([
|
|
111
|
+
(0, typeorm_1.Column)('ltree', { name: 'workflow_index', default: '1' }),
|
|
112
|
+
__metadata("design:type", String)
|
|
113
|
+
], DocumentEntity.prototype, "workflowIndex", void 0);
|
|
114
|
+
__decorate([
|
|
115
|
+
(0, typeorm_1.Column)({ default: 1 }),
|
|
116
|
+
__metadata("design:type", Number)
|
|
117
|
+
], DocumentEntity.prototype, "version", void 0);
|
|
118
|
+
__decorate([
|
|
119
|
+
(0, typeorm_1.Column)({ default: 0 }),
|
|
120
|
+
__metadata("design:type", Number)
|
|
121
|
+
], DocumentEntity.prototype, "index", void 0);
|
|
122
|
+
__decorate([
|
|
123
|
+
(0, typeorm_1.Column)({ type: 'varchar', nullable: true }),
|
|
124
|
+
__metadata("design:type", Object)
|
|
125
|
+
], DocumentEntity.prototype, "transition", void 0);
|
|
126
|
+
__decorate([
|
|
127
|
+
(0, typeorm_1.Column)({ type: 'varchar', nullable: true }),
|
|
128
|
+
__metadata("design:type", Object)
|
|
129
|
+
], DocumentEntity.prototype, "place", void 0);
|
|
130
|
+
__decorate([
|
|
131
|
+
(0, typeorm_1.CreateDateColumn)({ name: 'created_at' }),
|
|
132
|
+
__metadata("design:type", Date)
|
|
133
|
+
], DocumentEntity.prototype, "createdAt", void 0);
|
|
134
|
+
__decorate([
|
|
135
|
+
(0, typeorm_1.UpdateDateColumn)({ name: 'updated_at' }),
|
|
136
|
+
__metadata("design:type", Date)
|
|
137
|
+
], DocumentEntity.prototype, "updatedAt", void 0);
|
|
138
|
+
__decorate([
|
|
139
|
+
(0, typeorm_1.ManyToOne)(() => workflow_entity_1.WorkflowEntity, (state) => state.documents, {
|
|
140
|
+
onDelete: 'CASCADE',
|
|
141
|
+
}),
|
|
142
|
+
(0, typeorm_1.JoinColumn)({ name: 'workflow_id' }),
|
|
143
|
+
__metadata("design:type", workflow_entity_1.WorkflowEntity)
|
|
144
|
+
], DocumentEntity.prototype, "workflow", void 0);
|
|
145
|
+
__decorate([
|
|
146
|
+
(0, typeorm_1.Column)('varchar', { name: 'labels', array: true, nullable: false }),
|
|
147
|
+
__metadata("design:type", Array)
|
|
148
|
+
], DocumentEntity.prototype, "labels", void 0);
|
|
149
|
+
__decorate([
|
|
150
|
+
(0, typeorm_1.Column)({ name: 'workflow_id', nullable: true }),
|
|
151
|
+
__metadata("design:type", String)
|
|
152
|
+
], DocumentEntity.prototype, "workflowId", void 0);
|
|
153
|
+
__decorate([
|
|
154
|
+
(0, typeorm_1.ManyToMany)(() => workflow_entity_1.WorkflowEntity, (state) => state.dependencies, {
|
|
155
|
+
onDelete: 'CASCADE',
|
|
156
|
+
}),
|
|
157
|
+
__metadata("design:type", Array)
|
|
158
|
+
], DocumentEntity.prototype, "dependentStates", void 0);
|
|
159
|
+
__decorate([
|
|
160
|
+
(0, typeorm_1.Column)({ name: 'created_by', type: 'uuid' }),
|
|
161
|
+
__metadata("design:type", String)
|
|
162
|
+
], DocumentEntity.prototype, "createdBy", void 0);
|
|
163
|
+
exports.DocumentEntity = DocumentEntity = __decorate([
|
|
164
|
+
(0, typeorm_1.Entity)({ name: 'core_document' })
|
|
165
|
+
], DocumentEntity);
|
|
@@ -0,0 +1,8 @@
|
|
|
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';
|
|
@@ -0,0 +1,24 @@
|
|
|
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("./pipeline.entity.js"), exports);
|
|
18
|
+
__exportStar(require("./document.entity.js"), exports);
|
|
19
|
+
__exportStar(require("./workflow.entity.js"), exports);
|
|
20
|
+
__exportStar(require("./workspace.entity.js"), exports);
|
|
21
|
+
__exportStar(require("./namespace.entity.js"), exports);
|
|
22
|
+
__exportStar(require("./permission.entity.js"), exports);
|
|
23
|
+
__exportStar(require("./role.entity.js"), exports);
|
|
24
|
+
__exportStar(require("./user.entity.js"), exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { WorkflowEntity } from './workflow.entity';
|
|
2
|
+
import { PipelineEntity } from './pipeline.entity';
|
|
3
|
+
export declare class NamespaceEntity {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
workspaceId: string;
|
|
7
|
+
pipeline: PipelineEntity;
|
|
8
|
+
pipelineId: string;
|
|
9
|
+
parent: NamespaceEntity;
|
|
10
|
+
parentId: string | null;
|
|
11
|
+
metadata: Record<string, any> | null;
|
|
12
|
+
children: NamespaceEntity[];
|
|
13
|
+
workflows: WorkflowEntity[];
|
|
14
|
+
createdAt: Date;
|
|
15
|
+
updatedAt: Date;
|
|
16
|
+
createdBy: string;
|
|
17
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
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.NamespaceEntity = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const workflow_entity_1 = require("./workflow.entity");
|
|
15
|
+
const pipeline_entity_1 = require("./pipeline.entity");
|
|
16
|
+
let NamespaceEntity = class NamespaceEntity {
|
|
17
|
+
id;
|
|
18
|
+
name;
|
|
19
|
+
workspaceId;
|
|
20
|
+
pipeline;
|
|
21
|
+
pipelineId;
|
|
22
|
+
parent;
|
|
23
|
+
parentId;
|
|
24
|
+
metadata;
|
|
25
|
+
children;
|
|
26
|
+
workflows;
|
|
27
|
+
createdAt;
|
|
28
|
+
updatedAt;
|
|
29
|
+
createdBy;
|
|
30
|
+
};
|
|
31
|
+
exports.NamespaceEntity = NamespaceEntity;
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
34
|
+
__metadata("design:type", String)
|
|
35
|
+
], NamespaceEntity.prototype, "id", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, typeorm_1.Column)(),
|
|
38
|
+
__metadata("design:type", String)
|
|
39
|
+
], NamespaceEntity.prototype, "name", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, typeorm_1.Column)({ name: 'workspace_id' }),
|
|
42
|
+
__metadata("design:type", String)
|
|
43
|
+
], NamespaceEntity.prototype, "workspaceId", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, typeorm_1.ManyToOne)(() => pipeline_entity_1.PipelineEntity, (pipeline) => pipeline.namespaces, {
|
|
46
|
+
onDelete: 'CASCADE',
|
|
47
|
+
}),
|
|
48
|
+
(0, typeorm_1.JoinColumn)({ name: 'pipeline_id' }),
|
|
49
|
+
__metadata("design:type", pipeline_entity_1.PipelineEntity)
|
|
50
|
+
], NamespaceEntity.prototype, "pipeline", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, typeorm_1.Column)({ name: 'pipeline_id' }),
|
|
53
|
+
__metadata("design:type", String)
|
|
54
|
+
], NamespaceEntity.prototype, "pipelineId", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, typeorm_1.ManyToOne)(() => NamespaceEntity, (namespace) => namespace.children, {
|
|
57
|
+
onDelete: 'CASCADE',
|
|
58
|
+
nullable: true,
|
|
59
|
+
}),
|
|
60
|
+
(0, typeorm_1.JoinColumn)({ name: 'parent_id' }),
|
|
61
|
+
__metadata("design:type", NamespaceEntity)
|
|
62
|
+
], NamespaceEntity.prototype, "parent", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
(0, typeorm_1.Column)({ name: 'parent_id', nullable: true }),
|
|
65
|
+
(0, typeorm_1.Index)(),
|
|
66
|
+
__metadata("design:type", Object)
|
|
67
|
+
], NamespaceEntity.prototype, "parentId", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
(0, typeorm_1.Column)('json', { nullable: true }),
|
|
70
|
+
__metadata("design:type", Object)
|
|
71
|
+
], NamespaceEntity.prototype, "metadata", void 0);
|
|
72
|
+
__decorate([
|
|
73
|
+
(0, typeorm_1.OneToMany)(() => NamespaceEntity, (namespace) => namespace.parent, {
|
|
74
|
+
onDelete: 'CASCADE',
|
|
75
|
+
}),
|
|
76
|
+
__metadata("design:type", Array)
|
|
77
|
+
], NamespaceEntity.prototype, "children", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
(0, typeorm_1.OneToMany)(() => workflow_entity_1.WorkflowEntity, (workflow) => workflow.namespace, {
|
|
80
|
+
onDelete: 'CASCADE',
|
|
81
|
+
}),
|
|
82
|
+
__metadata("design:type", Array)
|
|
83
|
+
], NamespaceEntity.prototype, "workflows", void 0);
|
|
84
|
+
__decorate([
|
|
85
|
+
(0, typeorm_1.CreateDateColumn)({ name: 'created_at' }),
|
|
86
|
+
__metadata("design:type", Date)
|
|
87
|
+
], NamespaceEntity.prototype, "createdAt", void 0);
|
|
88
|
+
__decorate([
|
|
89
|
+
(0, typeorm_1.UpdateDateColumn)({ name: 'updated_at' }),
|
|
90
|
+
__metadata("design:type", Date)
|
|
91
|
+
], NamespaceEntity.prototype, "updatedAt", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
(0, typeorm_1.Column)({ name: 'created_by', type: 'uuid' }),
|
|
94
|
+
__metadata("design:type", String)
|
|
95
|
+
], NamespaceEntity.prototype, "createdBy", void 0);
|
|
96
|
+
exports.NamespaceEntity = NamespaceEntity = __decorate([
|
|
97
|
+
(0, typeorm_1.Entity)('core_namespace')
|
|
98
|
+
], NamespaceEntity);
|