@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,19 @@
|
|
|
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-state.js"), exports);
|
|
18
|
+
__exportStar(require("./workflow-state.enum.js"), exports);
|
|
19
|
+
__exportStar(require("./user-type.enum.js"), exports);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PipelineState = void 0;
|
|
4
|
+
var PipelineState;
|
|
5
|
+
(function (PipelineState) {
|
|
6
|
+
PipelineState["Pending"] = "pending";
|
|
7
|
+
PipelineState["Running"] = "running";
|
|
8
|
+
PipelineState["Paused"] = "paused";
|
|
9
|
+
PipelineState["Completed"] = "completed";
|
|
10
|
+
PipelineState["Failed"] = "failed";
|
|
11
|
+
PipelineState["Canceled"] = "canceled";
|
|
12
|
+
})(PipelineState || (exports.PipelineState = PipelineState = {}));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserTypeEnum = void 0;
|
|
4
|
+
var UserTypeEnum;
|
|
5
|
+
(function (UserTypeEnum) {
|
|
6
|
+
UserTypeEnum["Local"] = "local";
|
|
7
|
+
UserTypeEnum["Cloud"] = "cloud";
|
|
8
|
+
})(UserTypeEnum || (exports.UserTypeEnum = UserTypeEnum = {}));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WorkflowState = void 0;
|
|
4
|
+
var WorkflowState;
|
|
5
|
+
(function (WorkflowState) {
|
|
6
|
+
WorkflowState["Pending"] = "pending";
|
|
7
|
+
WorkflowState["Running"] = "running";
|
|
8
|
+
WorkflowState["Waiting"] = "waiting";
|
|
9
|
+
WorkflowState["Completed"] = "completed";
|
|
10
|
+
WorkflowState["Failed"] = "failed";
|
|
11
|
+
WorkflowState["Canceled"] = "canceled";
|
|
12
|
+
})(WorkflowState || (exports.WorkflowState = WorkflowState = {}));
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -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
|
+
require("reflect-metadata");
|
|
18
|
+
__exportStar(require("./decorators/index.js"), exports);
|
|
19
|
+
__exportStar(require("./entities/index.js"), exports);
|
|
20
|
+
__exportStar(require("./enums/index.js"), exports);
|
|
21
|
+
__exportStar(require("./interfaces/index.js"), exports);
|
|
22
|
+
__exportStar(require("./utils/index.js"), exports);
|
|
23
|
+
__exportStar(require("./constants/index.js"), exports);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Scope, Type } from '@nestjs/common';
|
|
3
|
+
import type { BlockConfigType, JSONSchemaConfigType } from '@loopstack/contracts/types';
|
|
4
|
+
export interface BlockOptions {
|
|
5
|
+
scope?: Scope;
|
|
6
|
+
imports?: any[];
|
|
7
|
+
config?: Partial<BlockConfigType>;
|
|
8
|
+
configFile?: string;
|
|
9
|
+
documentationFile?: string;
|
|
10
|
+
properties?: z.ZodType;
|
|
11
|
+
configSchema?: z.ZodType;
|
|
12
|
+
}
|
|
13
|
+
export interface BlockMetadata {
|
|
14
|
+
imports: Type<any>[];
|
|
15
|
+
config: BlockConfigType;
|
|
16
|
+
configFile?: string;
|
|
17
|
+
properties?: z.ZodType;
|
|
18
|
+
propertiesSchema?: JSONSchemaConfigType;
|
|
19
|
+
configSchema?: z.ZodType;
|
|
20
|
+
inputProperties: string[];
|
|
21
|
+
outputProperties: string[];
|
|
22
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DocumentEntity } from '../entities';
|
|
2
|
+
export interface ToolSideEffects {
|
|
3
|
+
setTransitionPlace?: string;
|
|
4
|
+
addWorkflowDocuments?: DocumentEntity[];
|
|
5
|
+
}
|
|
6
|
+
export type HandlerCallResult = {
|
|
7
|
+
type?: 'text' | 'image' | 'file';
|
|
8
|
+
data?: any;
|
|
9
|
+
error?: string;
|
|
10
|
+
effects?: ToolSideEffects;
|
|
11
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from './state-machine-validator.interface.js';
|
|
2
|
+
export * from './handler.interface.js';
|
|
3
|
+
export * from './permission.interface.js';
|
|
4
|
+
export * from './role.interface.js';
|
|
5
|
+
export * from './user.interface.js';
|
|
6
|
+
export * from './ai-provider.interface.js';
|
|
7
|
+
export * from './block.interface.js';
|
|
8
|
+
export * from './transition-results.types.js';
|
|
9
|
+
export * from './sso-validate-code.interface.js';
|
|
10
|
+
export * from './sso-response.interface.js';
|
|
11
|
+
export * from './state-machine-validator-result.interface.js';
|
|
12
|
+
export * from './jwt-payload.interface.js';
|
|
13
|
+
export * from './current-user.interface.js';
|
|
@@ -0,0 +1,29 @@
|
|
|
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.interface.js"), exports);
|
|
18
|
+
__exportStar(require("./handler.interface.js"), exports);
|
|
19
|
+
__exportStar(require("./permission.interface.js"), exports);
|
|
20
|
+
__exportStar(require("./role.interface.js"), exports);
|
|
21
|
+
__exportStar(require("./user.interface.js"), exports);
|
|
22
|
+
__exportStar(require("./ai-provider.interface.js"), exports);
|
|
23
|
+
__exportStar(require("./block.interface.js"), exports);
|
|
24
|
+
__exportStar(require("./transition-results.types.js"), exports);
|
|
25
|
+
__exportStar(require("./sso-validate-code.interface.js"), exports);
|
|
26
|
+
__exportStar(require("./sso-response.interface.js"), exports);
|
|
27
|
+
__exportStar(require("./state-machine-validator-result.interface.js"), exports);
|
|
28
|
+
__exportStar(require("./jwt-payload.interface.js"), exports);
|
|
29
|
+
__exportStar(require("./current-user.interface.js"), exports);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { UserInterface } from './user.interface';
|
|
2
|
+
export interface IAuthorizationCodeResponse {
|
|
3
|
+
authCode: string;
|
|
4
|
+
expiresAt: Date;
|
|
5
|
+
expiresIn: number;
|
|
6
|
+
}
|
|
7
|
+
export interface IApiResponse<T = any> {
|
|
8
|
+
success: boolean;
|
|
9
|
+
data?: T;
|
|
10
|
+
message: string;
|
|
11
|
+
timestamp: Date;
|
|
12
|
+
correlationId?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface IGenerateCodeResponse extends IApiResponse<IAuthorizationCodeResponse> {
|
|
15
|
+
}
|
|
16
|
+
export interface IValidateCodeResponse extends IApiResponse<UserInterface> {
|
|
17
|
+
}
|
|
18
|
+
export interface IErrorResponse {
|
|
19
|
+
statusCode: number;
|
|
20
|
+
message: string;
|
|
21
|
+
error: string;
|
|
22
|
+
timestamp: Date;
|
|
23
|
+
correlationId?: string;
|
|
24
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { HandlerCallResult } from './handler.interface';
|
|
2
|
+
export type StepResultLookup = Record<string, any>;
|
|
3
|
+
export type ToolResultLookup = Record<string, HandlerCallResult>;
|
|
4
|
+
export type TransitionResultLookup = Record<string, {
|
|
5
|
+
toolResults: ToolResultLookup;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RoleInterface } from './role.interface';
|
|
2
|
+
export interface UserInterface {
|
|
3
|
+
id: string;
|
|
4
|
+
email: string;
|
|
5
|
+
password?: string;
|
|
6
|
+
firstName: string;
|
|
7
|
+
lastName: string;
|
|
8
|
+
isActive: boolean;
|
|
9
|
+
roles: RoleInterface[];
|
|
10
|
+
createdAt: Date;
|
|
11
|
+
updatedAt: Date;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const createHash: (subject: any) => string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createHash = void 0;
|
|
7
|
+
const murmurhash_1 = __importDefault(require("murmurhash"));
|
|
8
|
+
const createHash = (subject) => {
|
|
9
|
+
const jsonString = JSON.stringify(subject);
|
|
10
|
+
return murmurhash_1.default.v3(jsonString).toString();
|
|
11
|
+
};
|
|
12
|
+
exports.createHash = createHash;
|
|
@@ -0,0 +1,21 @@
|
|
|
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("./create-hash.util.js"), exports);
|
|
18
|
+
__exportStar(require("./normalize-deep-serialize.util.js"), exports);
|
|
19
|
+
__exportStar(require("./normalize-object.js"), exports);
|
|
20
|
+
__exportStar(require("./object-fingerprint.util.js"), exports);
|
|
21
|
+
__exportStar(require("./stable-json-transformer.js"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function normalizeDeepSerializeUtil(obj: any): string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeDeepSerializeUtil = normalizeDeepSerializeUtil;
|
|
4
|
+
// create a normalized string representation of an object
|
|
5
|
+
// that makes sure nested array and object keys are sorted
|
|
6
|
+
// can be used to generate a fingerprint hash of an object
|
|
7
|
+
function normalizeDeepSerializeUtil(obj) {
|
|
8
|
+
if (Array.isArray(obj)) {
|
|
9
|
+
return JSON.stringify(obj.map(normalizeDeepSerializeUtil).sort());
|
|
10
|
+
}
|
|
11
|
+
else if (typeof obj === 'object' && obj !== null) {
|
|
12
|
+
return JSON.stringify(Object.keys(obj)
|
|
13
|
+
.sort()
|
|
14
|
+
.reduce((result, key) => {
|
|
15
|
+
result[key] = normalizeDeepSerializeUtil(obj[key]); // Recursively sort nested objects
|
|
16
|
+
return result;
|
|
17
|
+
}, {}));
|
|
18
|
+
}
|
|
19
|
+
return obj?.toString();
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function normalizeObject(object: Record<string, any>): Record<string, any>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeObject = normalizeObject;
|
|
4
|
+
function normalizeObject(object) {
|
|
5
|
+
return object
|
|
6
|
+
? Object.keys(object)
|
|
7
|
+
.sort()
|
|
8
|
+
.reduce((sortedObj, key) => {
|
|
9
|
+
sortedObj[key] = object[key];
|
|
10
|
+
return sortedObj;
|
|
11
|
+
}, {})
|
|
12
|
+
: {};
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const generateObjectFingerprint: (obj: Record<string, any>) => string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateObjectFingerprint = void 0;
|
|
4
|
+
const normalize_deep_serialize_util_1 = require("./normalize-deep-serialize.util");
|
|
5
|
+
const create_hash_util_1 = require("./create-hash.util");
|
|
6
|
+
const generateObjectFingerprint = (obj) => {
|
|
7
|
+
return (0, create_hash_util_1.createHash)((0, normalize_deep_serialize_util_1.normalizeDeepSerializeUtil)(obj));
|
|
8
|
+
};
|
|
9
|
+
exports.generateObjectFingerprint = generateObjectFingerprint;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.StableJsonTransformer = void 0;
|
|
7
|
+
const fast_json_stable_stringify_1 = __importDefault(require("fast-json-stable-stringify"));
|
|
8
|
+
class StableJsonTransformer {
|
|
9
|
+
from(value) {
|
|
10
|
+
return value
|
|
11
|
+
? typeof value === 'string'
|
|
12
|
+
? JSON.parse(value)
|
|
13
|
+
: value
|
|
14
|
+
: value;
|
|
15
|
+
}
|
|
16
|
+
to(value) {
|
|
17
|
+
return value !== undefined ? (0, fast_json_stable_stringify_1.default)(value) : value;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.StableJsonTransformer = StableJsonTransformer;
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@loopstack/common",
|
|
3
|
+
"displayName": "Loopstack Common Module",
|
|
4
|
+
"description": "A collection of utils and dtos shared between nestjs modules",
|
|
5
|
+
"version": "0.14.0",
|
|
6
|
+
"license": "BSL",
|
|
7
|
+
"author": {
|
|
8
|
+
"name": "Jakob Klippel",
|
|
9
|
+
"url": "https://www.linkedin.com/in/jakob-klippel/"
|
|
10
|
+
},
|
|
11
|
+
"main": "dist/index.js",
|
|
12
|
+
"types": "dist/index.d.ts",
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "tsc -p tsconfig.json",
|
|
15
|
+
"watch": "tsc --watch",
|
|
16
|
+
"prepare": "npm run build",
|
|
17
|
+
"compile": "tsc --noEmit"
|
|
18
|
+
},
|
|
19
|
+
"peerDependencies": {
|
|
20
|
+
"@nestjs/typeorm": "^11.0.0",
|
|
21
|
+
"typeorm": "^0.3.25"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@nestjs/common": "^11.0.1",
|
|
25
|
+
"@nestjs/typeorm": "^11.0.0",
|
|
26
|
+
"@types/node": "^22.13.4",
|
|
27
|
+
"typeorm": "^0.3.25",
|
|
28
|
+
"typescript": "^5.7.3"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@loopstack/contracts": "^0.14.0",
|
|
32
|
+
"fast-json-stable-stringify": "^2.1.0",
|
|
33
|
+
"murmurhash": "^2.0.1",
|
|
34
|
+
"reflect-metadata": "^0.2.2",
|
|
35
|
+
"zod": "^3.25.76"
|
|
36
|
+
}
|
|
37
|
+
}
|