@loopstack/core 0.15.1 → 0.15.3
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/ci-test.yml +31 -0
- package/.github/workflows/pr-main.yaml +16 -0
- package/.github/workflows/publish-npm.yml +86 -0
- package/.github/workflows/push-main.yaml +16 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/loop-core.module.js +0 -8
- package/dist/loop-core.module.js.map +1 -1
- package/dist/persistence/persistence.module.js +1 -0
- package/dist/persistence/persistence.module.js.map +1 -1
- package/dist/persistence/services/index.d.ts +1 -0
- package/dist/persistence/services/index.js +1 -0
- package/dist/persistence/services/index.js.map +1 -1
- package/dist/{services → persistence/services}/migrations.service.js +1 -1
- package/dist/persistence/services/migrations.service.js.map +1 -0
- package/package.json +9 -4
- package/dist/services/migrations.service.js.map +0 -1
- package/dist/utils/create-document-mock.d.ts +0 -2
- package/dist/utils/create-document-mock.js +0 -11
- package/dist/utils/create-document-mock.js.map +0 -1
- package/dist/utils/create-testing-module.d.ts +0 -5
- package/dist/utils/create-testing-module.js +0 -32
- package/dist/utils/create-testing-module.js.map +0 -1
- package/dist/utils/get-tool-result.d.ts +0 -2
- package/dist/utils/get-tool-result.js +0 -7
- package/dist/utils/get-tool-result.js.map +0 -1
- package/dist/utils/index.d.ts +0 -5
- package/dist/utils/index.js +0 -22
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/tool-test-builder.d.ts +0 -24
- package/dist/utils/tool-test-builder.js +0 -92
- package/dist/utils/tool-test-builder.js.map +0 -1
- package/dist/utils/workflow-test-builder.d.ts +0 -30
- package/dist/utils/workflow-test-builder.js +0 -130
- package/dist/utils/workflow-test-builder.js.map +0 -1
- /package/dist/{services → persistence/services}/migrations.service.d.ts +0 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
name: "CI Test Workflow"
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_call:
|
|
5
|
+
inputs:
|
|
6
|
+
node-version:
|
|
7
|
+
required: false
|
|
8
|
+
type: string
|
|
9
|
+
default: '20'
|
|
10
|
+
description: "Node.js version to use"
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
test:
|
|
14
|
+
name: "Install & Test"
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
timeout-minutes: 15
|
|
17
|
+
steps:
|
|
18
|
+
- name: Checkout Code
|
|
19
|
+
uses: actions/checkout@v4
|
|
20
|
+
|
|
21
|
+
- name: Setup Node.js ${{ inputs.node-version }}
|
|
22
|
+
uses: actions/setup-node@v4
|
|
23
|
+
with:
|
|
24
|
+
node-version: ${{ inputs.node-version }}
|
|
25
|
+
cache: 'npm'
|
|
26
|
+
|
|
27
|
+
- name: Install Dependencies
|
|
28
|
+
run: npm ci
|
|
29
|
+
|
|
30
|
+
- name: Run Tests
|
|
31
|
+
run: npm test
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
name: "PR Main Workflow"
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
branches: [ "main" ]
|
|
6
|
+
|
|
7
|
+
concurrency:
|
|
8
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
9
|
+
cancel-in-progress: true
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
call-test-workflow:
|
|
13
|
+
name: "Run CI"
|
|
14
|
+
uses: ./.github/workflows/ci-test.yml
|
|
15
|
+
with:
|
|
16
|
+
node-version: '20'
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
name: 'Publish to NPM Workflow'
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*.*.*'
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
name: 'Build & Publish to NPM'
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
timeout-minutes: 15
|
|
13
|
+
permissions:
|
|
14
|
+
contents: write
|
|
15
|
+
id-token: write
|
|
16
|
+
steps:
|
|
17
|
+
- name: Checkout Code
|
|
18
|
+
uses: actions/checkout@v4
|
|
19
|
+
with:
|
|
20
|
+
fetch-depth: 0
|
|
21
|
+
|
|
22
|
+
- name: Check if tag is on main branch
|
|
23
|
+
run: |
|
|
24
|
+
git fetch origin main
|
|
25
|
+
if ! git branch -r --contains ${{ github.ref }} | grep -q 'origin/main'; then
|
|
26
|
+
echo "❌ Tag is not on main branch"
|
|
27
|
+
exit 1
|
|
28
|
+
fi
|
|
29
|
+
echo "✅ Tag is on main branch"
|
|
30
|
+
|
|
31
|
+
- name: Setup Node.js
|
|
32
|
+
uses: actions/setup-node@v4
|
|
33
|
+
with:
|
|
34
|
+
node-version: '20'
|
|
35
|
+
cache: 'npm'
|
|
36
|
+
registry-url: 'https://registry.npmjs.org'
|
|
37
|
+
|
|
38
|
+
- name: Extract Package Version
|
|
39
|
+
id: package
|
|
40
|
+
run: |
|
|
41
|
+
echo "name=$(node -p "require('./package.json').name")" >> $GITHUB_OUTPUT
|
|
42
|
+
echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
|
|
43
|
+
|
|
44
|
+
- name: Validate Version Matches Tag
|
|
45
|
+
run: |
|
|
46
|
+
TAG_VERSION=${GITHUB_REF#refs/tags/v}
|
|
47
|
+
PKG_VERSION=${{ steps.package.outputs.version }}
|
|
48
|
+
if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then
|
|
49
|
+
echo "❌ Tag version ($TAG_VERSION) does not match package.json version ($PKG_VERSION)"
|
|
50
|
+
exit 1
|
|
51
|
+
fi
|
|
52
|
+
echo "✅ Versions match"
|
|
53
|
+
|
|
54
|
+
- name: Install Dependencies
|
|
55
|
+
run: npm ci
|
|
56
|
+
|
|
57
|
+
- name: Run Tests
|
|
58
|
+
run: npm test
|
|
59
|
+
|
|
60
|
+
- name: Build Package
|
|
61
|
+
run: npm run build --if-present
|
|
62
|
+
|
|
63
|
+
- name: Publish to NPM
|
|
64
|
+
run: npm publish --access public
|
|
65
|
+
env:
|
|
66
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
67
|
+
|
|
68
|
+
- name: Create GitHub Release
|
|
69
|
+
uses: softprops/action-gh-release@v2
|
|
70
|
+
if: success()
|
|
71
|
+
with:
|
|
72
|
+
tag_name: ${{ github.ref_name }}
|
|
73
|
+
body: |
|
|
74
|
+
## 📦 NPM Package
|
|
75
|
+
|
|
76
|
+
**Package:** [${{ steps.package.outputs.name }}](https://www.npmjs.com/package/${{ steps.package.outputs.name }}/v/${{ steps.package.outputs.version }})
|
|
77
|
+
**Version:** ${{ steps.package.outputs.version }}
|
|
78
|
+
|
|
79
|
+
Install with:
|
|
80
|
+
```bash
|
|
81
|
+
npm install ${{ steps.package.outputs.name }}@${{ steps.package.outputs.version }}
|
|
82
|
+
```
|
|
83
|
+
draft: false
|
|
84
|
+
prerelease: false
|
|
85
|
+
env:
|
|
86
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
name: 'Push Main Workflow'
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: ['main']
|
|
6
|
+
|
|
7
|
+
concurrency:
|
|
8
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
9
|
+
cancel-in-progress: true
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
call-test-workflow:
|
|
13
|
+
name: 'Run CI'
|
|
14
|
+
uses: ./.github/workflows/ci-test.yml
|
|
15
|
+
with:
|
|
16
|
+
node-version: '20'
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -21,5 +21,4 @@ __exportStar(require("./scheduler"), exports);
|
|
|
21
21
|
__exportStar(require("./workflow-processor"), exports);
|
|
22
22
|
__exportStar(require("./loop-core.module"), exports);
|
|
23
23
|
__exportStar(require("./loop-core.module-definition"), exports);
|
|
24
|
-
__exportStar(require("./utils"), exports);
|
|
25
24
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4BAA0B;AAE1B,2CAAyB;AACzB,gDAA8B;AAC9B,8CAA4B;AAC5B,uDAAqC;AAErC,qDAAmC;AACnC,gEAA8C
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4BAA0B;AAE1B,2CAAyB;AACzB,gDAA8B;AAC9B,8CAA4B;AAC5B,uDAAqC;AAErC,qDAAmC;AACnC,gEAA8C"}
|
package/dist/loop-core.module.js
CHANGED
|
@@ -8,7 +8,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.LoopCoreModule = void 0;
|
|
10
10
|
const common_1 = require("@nestjs/common");
|
|
11
|
-
const migrations_service_1 = require("./services/migrations.service");
|
|
12
11
|
const scheduler_1 = require("./scheduler");
|
|
13
12
|
const event_emitter_1 = require("@nestjs/event-emitter");
|
|
14
13
|
const common_2 = require("@loopstack/common");
|
|
@@ -35,13 +34,6 @@ exports.LoopCoreModule = LoopCoreModule = __decorate([
|
|
|
35
34
|
workflow_processor_1.WorkflowProcessorModule,
|
|
36
35
|
scheduler_1.SchedulerModule,
|
|
37
36
|
],
|
|
38
|
-
providers: [
|
|
39
|
-
{
|
|
40
|
-
provide: common_2.MODULE_NAME_TOKEN,
|
|
41
|
-
useValue: 'core',
|
|
42
|
-
},
|
|
43
|
-
migrations_service_1.MigrationsService,
|
|
44
|
-
],
|
|
45
37
|
exports: [common_3.CommonModule, workflow_processor_1.WorkflowProcessorModule, scheduler_1.SchedulerModule],
|
|
46
38
|
})
|
|
47
39
|
], LoopCoreModule);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loop-core.module.js","sourceRoot":"","sources":["../src/loop-core.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,
|
|
1
|
+
{"version":3,"file":"loop-core.module.js","sourceRoot":"","sources":["../src/loop-core.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,2CAA8C;AAC9C,yDAA2D;AAC3D,8CAM2B;AAC3B,qCAAwC;AACxC,6DAA+D;AAC/D,6CAAgD;AAoBzC,IAAM,cAAc,GAApB,MAAM,cAAc;CAAG,CAAA;AAAjB,wCAAc;yBAAd,cAAc;IAlB1B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,uBAAa,CAAC,UAAU,CAAC;gBACvB,uBAAc;gBACd,uBAAc;gBACd,uBAAc;gBACd,wBAAe;gBACf,wBAAe;aAChB,CAAC;YACF,kCAAkB,CAAC,OAAO,CAAC;gBACzB,MAAM,EAAE,IAAI;aACb,CAAC;YACF,qBAAY;YACZ,4CAAuB;YACvB,2BAAe;SAChB;QACD,OAAO,EAAE,CAAC,qBAAY,EAAE,4CAAuB,EAAE,2BAAe,CAAC;KAClE,CAAC;GACW,cAAc,CAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"persistence.module.js","sourceRoot":"","sources":["../../src/persistence/persistence.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,6CAAgD;AAChD,8CAM2B;AAC3B,
|
|
1
|
+
{"version":3,"file":"persistence.module.js","sourceRoot":"","sources":["../../src/persistence/persistence.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,6CAAgD;AAChD,8CAM2B;AAC3B,yCAOoB;AACpB,sCAAyC;AA6BlC,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;CAAG,CAAA;AAApB,8CAAiB;4BAAjB,iBAAiB;IA3B7B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,uBAAa,CAAC,UAAU,CAAC;gBACvB,uBAAc;gBACd,wBAAe;gBACf,wBAAe;gBACf,uBAAc;gBACd,uBAAc;aACf,CAAC;YACF,qBAAY;SACb;QACD,SAAS,EAAE;YACT,0BAAe;YACf,4BAAiB;YACjB,2BAAgB;YAChB,0BAAe;YACf,0BAAe;YACf,4BAAiB;SAClB;QACD,OAAO,EAAE;YACP,0BAAe;YACf,4BAAiB;YACjB,2BAAgB;YAChB,0BAAe;YACf,0BAAe;SAChB;KACF,CAAC;GACW,iBAAiB,CAAG"}
|
|
@@ -19,4 +19,5 @@ __exportStar(require("./namespace.service"), exports);
|
|
|
19
19
|
__exportStar(require("./workspace.service"), exports);
|
|
20
20
|
__exportStar(require("./pipeline.service"), exports);
|
|
21
21
|
__exportStar(require("./document.service"), exports);
|
|
22
|
+
__exportStar(require("./migrations.service"), exports);
|
|
22
23
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/persistence/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,sDAAoC;AACpC,sDAAoC;AACpC,qDAAmC;AACnC,qDAAmC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/persistence/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,sDAAoC;AACpC,sDAAoC;AACpC,qDAAmC;AACnC,qDAAmC;AACnC,uDAAqC"}
|
|
@@ -13,7 +13,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
13
13
|
exports.MigrationsService = void 0;
|
|
14
14
|
const common_1 = require("@nestjs/common");
|
|
15
15
|
const typeorm_1 = require("typeorm");
|
|
16
|
-
const _1742827301075_EnableLtreeExtension_1 = require("
|
|
16
|
+
const _1742827301075_EnableLtreeExtension_1 = require("../../migrations/1742827301075-EnableLtreeExtension");
|
|
17
17
|
let MigrationsService = MigrationsService_1 = class MigrationsService {
|
|
18
18
|
dataSource;
|
|
19
19
|
logger = new common_1.Logger(MigrationsService_1.name);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrations.service.js","sourceRoot":"","sources":["../../../src/persistence/services/migrations.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAkE;AAClE,qCAAqC;AACrC,6GAAwG;AAGjG,IAAM,iBAAiB,yBAAvB,MAAM,iBAAiB;IAGR;IAFH,MAAM,GAAG,IAAI,eAAM,CAAC,mBAAiB,CAAC,IAAI,CAAC,CAAC;IAE7D,YAAoB,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;IAAG,CAAC;IAE9C,KAAK,CAAC,YAAY;QAEhB,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;IAE7B,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;QAEzC,IAAI,CAAC;YACH,MAAM,aAAa,GAAG,CAAC,uEAAiC,CAAC,CAAC;YAE1D,MAAM,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,iBAAiB,EAAE,CAAC;YAExD,KAAK,MAAM,SAAS,IAAI,aAAa,EAAE,CAAC;gBACtC,MAAM,SAAS,GAAG,IAAI,SAAS,EAAE,CAAC;gBAClC,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC;gBAE5B,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,sBAAsB,IAAI,EAAE,CAAC,CAAC;gBAE9C,IAAI,CAAC;oBACH,MAAM,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC;;;;;;;WAO/B,CAAC,CAAC;oBAEH,MAAM,iBAAiB,GAAG,MAAM,WAAW,CAAC,OAAO;yBAChD,KAAK,CAAC,+CAA+C,EAAE,CAAC,IAAI,CAAC,CAAC;yBAC9D,KAAK,CAAC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": "@loopstack/core",
|
|
3
3
|
"displayName": "Loopstack Core Module",
|
|
4
4
|
"description": "The core module of the loopstack automation framework",
|
|
5
|
-
"version": "0.15.
|
|
5
|
+
"version": "0.15.3",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Jakob Klippel",
|
|
8
8
|
"url": "https://www.linkedin.com/in/jakob-klippel//"
|
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
"license": "BSL",
|
|
11
11
|
"main": "dist/index.js",
|
|
12
12
|
"types": "dist/index.d.ts",
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/loopstack-ai/core"
|
|
16
|
+
},
|
|
13
17
|
"scripts": {
|
|
14
18
|
"build": "nest build",
|
|
15
19
|
"watch": "nest build --watch",
|
|
@@ -17,7 +21,7 @@
|
|
|
17
21
|
"compile": "tsc --noEmit",
|
|
18
22
|
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
|
19
23
|
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
|
20
|
-
"test": "jest",
|
|
24
|
+
"test": "jest --passWithNoTests",
|
|
21
25
|
"test:watch": "jest --watch",
|
|
22
26
|
"test:cov": "jest --coverage",
|
|
23
27
|
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
|
|
@@ -33,7 +37,7 @@
|
|
|
33
37
|
"typeorm": "^0.3.20"
|
|
34
38
|
},
|
|
35
39
|
"dependencies": {
|
|
36
|
-
"@loopstack/common": "^0.15.
|
|
40
|
+
"@loopstack/common": "^0.15.1",
|
|
37
41
|
"@nestjs/bullmq": "^11.0.3",
|
|
38
42
|
"@nestjs/config": "^4.0.0",
|
|
39
43
|
"@nestjs/event-emitter": "^3.0.1",
|
|
@@ -50,7 +54,8 @@
|
|
|
50
54
|
"lodash": "^4.17.21",
|
|
51
55
|
"openai": "^4.86.2",
|
|
52
56
|
"yaml": "^2.8.1",
|
|
53
|
-
"zod": "^3.25.76"
|
|
57
|
+
"zod": "^3.25.76",
|
|
58
|
+
"zod-to-json-schema": "^3.25.0"
|
|
54
59
|
},
|
|
55
60
|
"devDependencies": {
|
|
56
61
|
"@eslint/eslintrc": "^3.2.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"migrations.service.js","sourceRoot":"","sources":["../../src/services/migrations.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAkE;AAClE,qCAAqC;AACrC,0GAAqG;AAG9F,IAAM,iBAAiB,yBAAvB,MAAM,iBAAiB;IAGR;IAFH,MAAM,GAAG,IAAI,eAAM,CAAC,mBAAiB,CAAC,IAAI,CAAC,CAAC;IAE7D,YAAoB,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;IAAG,CAAC;IAE9C,KAAK,CAAC,YAAY;QAEhB,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;IAE7B,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;QAEzC,IAAI,CAAC;YACH,MAAM,aAAa,GAAG,CAAC,uEAAiC,CAAC,CAAC;YAE1D,MAAM,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,iBAAiB,EAAE,CAAC;YAExD,KAAK,MAAM,SAAS,IAAI,aAAa,EAAE,CAAC;gBACtC,MAAM,SAAS,GAAG,IAAI,SAAS,EAAE,CAAC;gBAClC,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC;gBAE5B,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,sBAAsB,IAAI,EAAE,CAAC,CAAC;gBAE9C,IAAI,CAAC;oBACH,MAAM,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC;;;;;;;WAO/B,CAAC,CAAC;oBAEH,MAAM,iBAAiB,GAAG,MAAM,WAAW,CAAC,OAAO;yBAChD,KAAK,CAAC,+CAA+C,EAAE,CAAC,IAAI,CAAC,CA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
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createDocumentMock = createDocumentMock;
|
|
4
|
-
function createDocumentMock(source, content, documentProps = {}) {
|
|
5
|
-
return {
|
|
6
|
-
...documentProps,
|
|
7
|
-
blockName: source.name,
|
|
8
|
-
content: content,
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=create-document-mock.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-document-mock.js","sourceRoot":"","sources":["../../src/utils/create-document-mock.ts"],"names":[],"mappings":";;AAEA,gDAUC;AAVD,SAAgB,kBAAkB,CAChC,MAAmC,EACnC,OAAU,EACV,gBAAyC,EAAE;IAE3C,OAAO;QACL,GAAG,aAAa;QAChB,SAAS,EAAE,MAAM,CAAC,IAAI;QACtB,OAAO,EAAE,OAAO;KACI,CAAC;AACzB,CAAC"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createTestingModule = createTestingModule;
|
|
4
|
-
const testing_1 = require("@nestjs/testing");
|
|
5
|
-
const typeorm_1 = require("@nestjs/typeorm");
|
|
6
|
-
const config_1 = require("@nestjs/config");
|
|
7
|
-
function createTestingModule(options) {
|
|
8
|
-
return testing_1.Test.createTestingModule({
|
|
9
|
-
imports: [
|
|
10
|
-
config_1.ConfigModule.forRoot({
|
|
11
|
-
isGlobal: true,
|
|
12
|
-
}),
|
|
13
|
-
typeorm_1.TypeOrmModule.forRoot({
|
|
14
|
-
type: 'postgres',
|
|
15
|
-
host: process.env.DB_HOST || 'localhost',
|
|
16
|
-
port: parseInt(process.env.DB_PORT || '5432'),
|
|
17
|
-
username: process.env.DB_USERNAME || 'postgres',
|
|
18
|
-
password: process.env.DB_PASSWORD || 'admin',
|
|
19
|
-
database: 'e2e_test',
|
|
20
|
-
autoLoadEntities: true,
|
|
21
|
-
synchronize: true,
|
|
22
|
-
dropSchema: true,
|
|
23
|
-
logging: false,
|
|
24
|
-
}),
|
|
25
|
-
...options.imports,
|
|
26
|
-
],
|
|
27
|
-
providers: [
|
|
28
|
-
...options.providers,
|
|
29
|
-
]
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=create-testing-module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-testing-module.js","sourceRoot":"","sources":["../../src/utils/create-testing-module.ts"],"names":[],"mappings":";;AAIA,kDAwBC;AA5BD,6CAA6D;AAC7D,6CAAgD;AAChD,2CAA8C;AAE9C,SAAgB,mBAAmB,CAAC,OAA4C;IAC9E,OAAO,cAAI,CAAC,mBAAmB,CAAC;QAC9B,OAAO,EAAE;YACP,qBAAY,CAAC,OAAO,CAAC;gBACnB,QAAQ,EAAE,IAAI;aACf,CAAC;YACF,uBAAa,CAAC,OAAO,CAAC;gBACpB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,WAAW;gBACxC,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,MAAM,CAAC;gBAC7C,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,UAAU;gBAC/C,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,OAAO;gBAC5C,QAAQ,EAAE,UAAU;gBACpB,gBAAgB,EAAE,IAAI;gBACtB,WAAW,EAAE,IAAI;gBACjB,UAAU,EAAE,IAAI;gBAChB,OAAO,EAAE,KAAK;aACf,CAAC;YACF,GAAG,OAAO,CAAC,OAAO;SACnB;QACD,SAAS,EAAE;YACT,GAAG,OAAO,CAAC,SAAS;SACrB;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getToolResult = getToolResult;
|
|
4
|
-
function getToolResult(ctx, transitionId, toolId) {
|
|
5
|
-
return ctx.state.transitionResults?.[transitionId]?.toolResults?.[toolId];
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=get-tool-result.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-tool-result.js","sourceRoot":"","sources":["../../src/utils/get-tool-result.ts"],"names":[],"mappings":";;AAEA,sCAMC;AAND,SAAgB,aAAa,CAC3B,GAAgC,EAChC,YAA6B,EAC7B,MAAuB;IAEvB,OAAO,GAAG,CAAC,KAAK,CAAC,iBAAiB,EAAE,CAAC,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC,MAAM,CAAC,CAAC;AAC5E,CAAC"}
|
package/dist/utils/index.d.ts
DELETED
package/dist/utils/index.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
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-document-mock"), exports);
|
|
18
|
-
__exportStar(require("./get-tool-result"), exports);
|
|
19
|
-
__exportStar(require("./tool-test-builder"), exports);
|
|
20
|
-
__exportStar(require("./workflow-test-builder"), exports);
|
|
21
|
-
__exportStar(require("./create-testing-module"), exports);
|
|
22
|
-
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC;AACvC,oDAAkC;AAClC,sDAAoC;AACpC,0DAAwC;AACxC,0DAAwC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { TestingModule } from '@nestjs/testing';
|
|
2
|
-
import { Type } from '@nestjs/common';
|
|
3
|
-
import { ToolBase } from '../workflow-processor';
|
|
4
|
-
import { WorkflowExecution } from '../workflow-processor/interfaces/workflow-execution.interface';
|
|
5
|
-
export interface ToolMock {
|
|
6
|
-
validate: jest.Mock;
|
|
7
|
-
execute: jest.Mock;
|
|
8
|
-
}
|
|
9
|
-
export declare function createToolMock(): ToolMock;
|
|
10
|
-
export declare function createExecutionContext(overrides?: any): WorkflowExecution;
|
|
11
|
-
export declare class ToolTestBuilder<TTool extends ToolBase<any> = ToolBase<any>> {
|
|
12
|
-
private toolClass?;
|
|
13
|
-
private providers;
|
|
14
|
-
private overrides;
|
|
15
|
-
forTool<T extends ToolBase<any>>(toolClass: Type<T>): ToolTestBuilder<T>;
|
|
16
|
-
withProvider(...providers: Type<any>[]): this;
|
|
17
|
-
withProviders(...providers: any[]): this;
|
|
18
|
-
withMock<T>(token: Type<T> | string | symbol, mock: Partial<T> | any): this;
|
|
19
|
-
withOverride<T>(token: Type<T> | string | symbol, mock: Partial<T> | any): this;
|
|
20
|
-
withToolMock<T>(toolClass: Type<T>): this;
|
|
21
|
-
compile(): Promise<TestingModule>;
|
|
22
|
-
private verifyToolDecorators;
|
|
23
|
-
}
|
|
24
|
-
export declare function createToolTest(): ToolTestBuilder;
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ToolTestBuilder = void 0;
|
|
4
|
-
exports.createToolMock = createToolMock;
|
|
5
|
-
exports.createExecutionContext = createExecutionContext;
|
|
6
|
-
exports.createToolTest = createToolTest;
|
|
7
|
-
const testing_1 = require("@nestjs/testing");
|
|
8
|
-
const common_1 = require("@loopstack/common");
|
|
9
|
-
const lodash_1 = require("lodash");
|
|
10
|
-
function createToolMock() {
|
|
11
|
-
return {
|
|
12
|
-
validate: jest.fn().mockImplementation((v) => v),
|
|
13
|
-
execute: jest.fn().mockResolvedValue({ data: undefined }),
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
function createExecutionContext(overrides) {
|
|
17
|
-
return (0, lodash_1.merge)({
|
|
18
|
-
runtime: {
|
|
19
|
-
error: false,
|
|
20
|
-
stop: false,
|
|
21
|
-
availableTransitions: [],
|
|
22
|
-
transition: {
|
|
23
|
-
id: 'test-transition',
|
|
24
|
-
from: 'start',
|
|
25
|
-
to: 'end',
|
|
26
|
-
},
|
|
27
|
-
persistenceState: { documentsUpdated: false },
|
|
28
|
-
},
|
|
29
|
-
}, overrides);
|
|
30
|
-
}
|
|
31
|
-
class ToolTestBuilder {
|
|
32
|
-
toolClass;
|
|
33
|
-
providers = [];
|
|
34
|
-
overrides = new Map();
|
|
35
|
-
forTool(toolClass) {
|
|
36
|
-
this.verifyToolDecorators(toolClass);
|
|
37
|
-
this.toolClass = toolClass;
|
|
38
|
-
this.providers.push(toolClass);
|
|
39
|
-
return this;
|
|
40
|
-
}
|
|
41
|
-
withProvider(...providers) {
|
|
42
|
-
this.providers.push(...providers);
|
|
43
|
-
return this;
|
|
44
|
-
}
|
|
45
|
-
withProviders(...providers) {
|
|
46
|
-
this.providers.push(...providers);
|
|
47
|
-
return this;
|
|
48
|
-
}
|
|
49
|
-
withMock(token, mock) {
|
|
50
|
-
this.providers.push({
|
|
51
|
-
provide: token,
|
|
52
|
-
useValue: mock,
|
|
53
|
-
});
|
|
54
|
-
return this;
|
|
55
|
-
}
|
|
56
|
-
withOverride(token, mock) {
|
|
57
|
-
this.overrides.set(token, mock);
|
|
58
|
-
return this;
|
|
59
|
-
}
|
|
60
|
-
withToolMock(toolClass) {
|
|
61
|
-
const mock = createToolMock();
|
|
62
|
-
this.providers.push({
|
|
63
|
-
provide: toolClass,
|
|
64
|
-
useValue: mock,
|
|
65
|
-
});
|
|
66
|
-
return this;
|
|
67
|
-
}
|
|
68
|
-
async compile() {
|
|
69
|
-
if (!this.toolClass) {
|
|
70
|
-
throw new Error('Tool class not set. Call forTool() first.');
|
|
71
|
-
}
|
|
72
|
-
let builder = testing_1.Test.createTestingModule({
|
|
73
|
-
providers: this.providers,
|
|
74
|
-
});
|
|
75
|
-
for (const [token, mock] of this.overrides) {
|
|
76
|
-
builder = builder.overrideProvider(token).useValue(mock);
|
|
77
|
-
}
|
|
78
|
-
const module = await builder.compile();
|
|
79
|
-
return module;
|
|
80
|
-
}
|
|
81
|
-
verifyToolDecorators(toolClass) {
|
|
82
|
-
const blockConfig = Reflect.getMetadata(common_1.BLOCK_METADATA_KEY, toolClass);
|
|
83
|
-
if (!blockConfig) {
|
|
84
|
-
throw new Error(`Tool ${toolClass.name} is not decorated with @BlockConfig`);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
exports.ToolTestBuilder = ToolTestBuilder;
|
|
89
|
-
function createToolTest() {
|
|
90
|
-
return new ToolTestBuilder();
|
|
91
|
-
}
|
|
92
|
-
//# sourceMappingURL=tool-test-builder.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tool-test-builder.js","sourceRoot":"","sources":["../../src/utils/tool-test-builder.ts"],"names":[],"mappings":";;;AAkBA,wCAKC;AAKD,wDA4BC;AA0HD,wCAEC;AApLD,6CAAsD;AAEtD,8CAAmE;AAGnE,mCAA+B;AAa/B,SAAgB,cAAc;IAC5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,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AA3FD,0CA2FC;AAeD,SAAgB,cAAc;IAC5B,OAAO,IAAI,eAAe,EAAE,CAAC;AAC/B,CAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { TestingModule } from '@nestjs/testing';
|
|
2
|
-
import { Type } from '@nestjs/common';
|
|
3
|
-
import { WorkflowEntity } from '@loopstack/common';
|
|
4
|
-
export declare const DEFAULT_WORKFLOW_ENTITY: Omit<WorkflowEntity, 'namespace'>;
|
|
5
|
-
export interface WorkflowServiceMock {
|
|
6
|
-
save: jest.Mock;
|
|
7
|
-
create: jest.Mock;
|
|
8
|
-
findOneByQuery: jest.Mock;
|
|
9
|
-
}
|
|
10
|
-
export declare function createWorkflowServiceMock(): WorkflowServiceMock;
|
|
11
|
-
export declare class WorkflowTestBuilder<TWorkflow = any> {
|
|
12
|
-
private imports;
|
|
13
|
-
private providers;
|
|
14
|
-
private overrides;
|
|
15
|
-
private workflowClass?;
|
|
16
|
-
private workflowServiceMock;
|
|
17
|
-
private existingWorkflowEntity?;
|
|
18
|
-
constructor();
|
|
19
|
-
forWorkflow<T>(workflowClass: Type<T>): WorkflowTestBuilder<T>;
|
|
20
|
-
withImports(...imports: any[]): this;
|
|
21
|
-
withProvider(...providers: Type<any>[]): this;
|
|
22
|
-
withProviders(...providers: any[]): this;
|
|
23
|
-
withMock<T>(token: Type<T> | string | symbol, mock: Partial<T> | any): this;
|
|
24
|
-
withOverride<T>(token: Type<T> | string | symbol, mock: Partial<T> | any): this;
|
|
25
|
-
withToolMock<T>(toolClass: Type<T>): this;
|
|
26
|
-
withToolOverride<T>(toolClass: Type<T>): this;
|
|
27
|
-
withExistingWorkflow(entity: Partial<WorkflowEntity>): this;
|
|
28
|
-
compile(): Promise<TestingModule>;
|
|
29
|
-
}
|
|
30
|
-
export declare function createWorkflowTest(): WorkflowTestBuilder;
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WorkflowTestBuilder = exports.DEFAULT_WORKFLOW_ENTITY = void 0;
|
|
4
|
-
exports.createWorkflowServiceMock = createWorkflowServiceMock;
|
|
5
|
-
exports.createWorkflowTest = createWorkflowTest;
|
|
6
|
-
const common_1 = require("@loopstack/common");
|
|
7
|
-
const create_testing_module_1 = require("./create-testing-module");
|
|
8
|
-
const persistence_1 = require("../persistence");
|
|
9
|
-
const tool_test_builder_1 = require("./tool-test-builder");
|
|
10
|
-
exports.DEFAULT_WORKFLOW_ENTITY = {
|
|
11
|
-
id: '00000000-0000-0000-0000-000000000000',
|
|
12
|
-
blockName: '',
|
|
13
|
-
title: '',
|
|
14
|
-
index: '1',
|
|
15
|
-
progress: 0,
|
|
16
|
-
status: common_1.WorkflowState.Pending,
|
|
17
|
-
hasError: false,
|
|
18
|
-
errorMessage: null,
|
|
19
|
-
createdAt: new Date(),
|
|
20
|
-
updatedAt: new Date(),
|
|
21
|
-
place: 'start',
|
|
22
|
-
transitionResults: null,
|
|
23
|
-
inputData: {},
|
|
24
|
-
availableTransitions: null,
|
|
25
|
-
history: null,
|
|
26
|
-
schema: null,
|
|
27
|
-
error: null,
|
|
28
|
-
ui: null,
|
|
29
|
-
namespaceId: '',
|
|
30
|
-
pipelineId: '',
|
|
31
|
-
labels: [],
|
|
32
|
-
hashRecord: null,
|
|
33
|
-
createdBy: '',
|
|
34
|
-
documents: [],
|
|
35
|
-
dependencies: [],
|
|
36
|
-
};
|
|
37
|
-
function createWorkflowServiceMock() {
|
|
38
|
-
return {
|
|
39
|
-
save: jest.fn(),
|
|
40
|
-
create: jest.fn().mockImplementation((input) => Promise.resolve({
|
|
41
|
-
...exports.DEFAULT_WORKFLOW_ENTITY,
|
|
42
|
-
...input,
|
|
43
|
-
id: crypto.randomUUID(),
|
|
44
|
-
})),
|
|
45
|
-
findOneByQuery: jest.fn().mockResolvedValue(undefined),
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
class WorkflowTestBuilder {
|
|
49
|
-
imports = [];
|
|
50
|
-
providers = [];
|
|
51
|
-
overrides = new Map();
|
|
52
|
-
workflowClass;
|
|
53
|
-
workflowServiceMock;
|
|
54
|
-
existingWorkflowEntity;
|
|
55
|
-
constructor() {
|
|
56
|
-
this.workflowServiceMock = createWorkflowServiceMock();
|
|
57
|
-
}
|
|
58
|
-
forWorkflow(workflowClass) {
|
|
59
|
-
this.workflowClass = workflowClass;
|
|
60
|
-
this.providers.push(workflowClass);
|
|
61
|
-
return this;
|
|
62
|
-
}
|
|
63
|
-
withImports(...imports) {
|
|
64
|
-
this.imports.push(...imports);
|
|
65
|
-
return this;
|
|
66
|
-
}
|
|
67
|
-
withProvider(...providers) {
|
|
68
|
-
this.providers.push(...providers);
|
|
69
|
-
return this;
|
|
70
|
-
}
|
|
71
|
-
withProviders(...providers) {
|
|
72
|
-
this.providers.push(...providers);
|
|
73
|
-
return this;
|
|
74
|
-
}
|
|
75
|
-
withMock(token, mock) {
|
|
76
|
-
this.providers.push({
|
|
77
|
-
provide: token,
|
|
78
|
-
useValue: mock,
|
|
79
|
-
});
|
|
80
|
-
return this;
|
|
81
|
-
}
|
|
82
|
-
withOverride(token, mock) {
|
|
83
|
-
this.overrides.set(token, mock);
|
|
84
|
-
return this;
|
|
85
|
-
}
|
|
86
|
-
withToolMock(toolClass) {
|
|
87
|
-
const mock = (0, tool_test_builder_1.createToolMock)();
|
|
88
|
-
this.providers.push({
|
|
89
|
-
provide: toolClass,
|
|
90
|
-
useValue: mock,
|
|
91
|
-
});
|
|
92
|
-
return this;
|
|
93
|
-
}
|
|
94
|
-
withToolOverride(toolClass) {
|
|
95
|
-
const mock = (0, tool_test_builder_1.createToolMock)();
|
|
96
|
-
this.overrides.set(toolClass, mock);
|
|
97
|
-
return this;
|
|
98
|
-
}
|
|
99
|
-
withExistingWorkflow(entity) {
|
|
100
|
-
this.existingWorkflowEntity = entity;
|
|
101
|
-
return this;
|
|
102
|
-
}
|
|
103
|
-
async compile() {
|
|
104
|
-
if (this.existingWorkflowEntity) {
|
|
105
|
-
this.workflowServiceMock.findOneByQuery.mockResolvedValue({
|
|
106
|
-
...exports.DEFAULT_WORKFLOW_ENTITY,
|
|
107
|
-
id: crypto.randomUUID(),
|
|
108
|
-
...this.existingWorkflowEntity,
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
let builder = (0, create_testing_module_1.createTestingModule)({
|
|
112
|
-
imports: this.imports,
|
|
113
|
-
providers: this.providers,
|
|
114
|
-
});
|
|
115
|
-
builder = builder
|
|
116
|
-
.overrideProvider(persistence_1.WorkflowService)
|
|
117
|
-
.useValue(this.workflowServiceMock);
|
|
118
|
-
for (const [token, mock] of this.overrides) {
|
|
119
|
-
builder = builder.overrideProvider(token).useValue(mock);
|
|
120
|
-
}
|
|
121
|
-
const module = await builder.compile();
|
|
122
|
-
await module.init();
|
|
123
|
-
return module;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
exports.WorkflowTestBuilder = WorkflowTestBuilder;
|
|
127
|
-
function createWorkflowTest() {
|
|
128
|
-
return new WorkflowTestBuilder();
|
|
129
|
-
}
|
|
130
|
-
//# sourceMappingURL=workflow-test-builder.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-test-builder.js","sourceRoot":"","sources":["../../src/utils/workflow-test-builder.ts"],"names":[],"mappings":";;;AA+CA,8DAYC;AAkKD,gDAEC;AA7ND,8CAAkE;AAClE,mEAA8D;AAC9D,gDAAiD;AACjD,2DAA+D;AAElD,QAAA,uBAAuB,GAAsC;IACxE,EAAE,EAAE,sCAAsC;IAC1C,SAAS,EAAE,EAAE;IACb,KAAK,EAAE,EAAE;IACT,KAAK,EAAE,GAAG;IACV,QAAQ,EAAE,CAAC;IACX,MAAM,EAAE,sBAAa,CAAC,OAAO;IAC7B,QAAQ,EAAE,KAAK;IACf,YAAY,EAAE,IAAI;IAClB,SAAS,EAAE,IAAI,IAAI,E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