@things-factory/integration-base 9.0.0-beta.80 → 9.0.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/dist-server/service/analysis/analysis-query.d.ts +3 -0
- package/dist-server/service/analysis/analysis-query.js +6 -1
- package/dist-server/service/analysis/analysis-query.js.map +1 -1
- package/dist-server/service/connection/connection-mutation.js +10 -8
- package/dist-server/service/connection/connection-mutation.js.map +1 -1
- package/dist-server/service/connection/connection-query.d.ts +3 -0
- package/dist-server/service/connection/connection-query.js +10 -3
- package/dist-server/service/connection/connection-query.js.map +1 -1
- package/dist-server/service/connection/connection-subscription.js +5 -1
- package/dist-server/service/connection/connection-subscription.js.map +1 -1
- package/dist-server/service/connection/connection-type.d.ts +1 -1
- package/dist-server/service/connection/connection-type.js +52 -46
- package/dist-server/service/connection/connection-type.js.map +1 -1
- package/dist-server/service/connector/connector-query.d.ts +4 -1
- package/dist-server/service/connector/connector-query.js +8 -5
- package/dist-server/service/connector/connector-query.js.map +1 -1
- package/dist-server/service/connector/connector-type.js +12 -9
- package/dist-server/service/connector/connector-type.js.map +1 -1
- package/dist-server/service/payload-log/payload-log-mutation.js +5 -5
- package/dist-server/service/payload-log/payload-log-mutation.js.map +1 -1
- package/dist-server/service/payload-log/payload-log-query.d.ts +3 -0
- package/dist-server/service/payload-log/payload-log-query.js +5 -2
- package/dist-server/service/payload-log/payload-log-query.js.map +1 -1
- package/dist-server/service/payload-log/payload-log-type.js +11 -11
- package/dist-server/service/payload-log/payload-log-type.js.map +1 -1
- package/dist-server/service/payload-log/payload-log.d.ts +1 -1
- package/dist-server/service/payload-log/payload-log.js +18 -14
- package/dist-server/service/payload-log/payload-log.js.map +1 -1
- package/dist-server/service/property-spec.js +12 -7
- package/dist-server/service/property-spec.js.map +1 -1
- package/dist-server/service/scenario/scenario-mutation.js +15 -14
- package/dist-server/service/scenario/scenario-mutation.js.map +1 -1
- package/dist-server/service/scenario/scenario-query.d.ts +3 -0
- package/dist-server/service/scenario/scenario-query.js +5 -2
- package/dist-server/service/scenario/scenario-query.js.map +1 -1
- package/dist-server/service/scenario/scenario-type.js +27 -24
- package/dist-server/service/scenario/scenario-type.js.map +1 -1
- package/dist-server/service/scenario/scenario.js +22 -19
- package/dist-server/service/scenario/scenario.js.map +1 -1
- package/dist-server/service/scenario-instance/scenario-instance-mutation.js +8 -3
- package/dist-server/service/scenario-instance/scenario-instance-mutation.js.map +1 -1
- package/dist-server/service/scenario-instance/scenario-instance-query.d.ts +3 -0
- package/dist-server/service/scenario-instance/scenario-instance-query.js +5 -2
- package/dist-server/service/scenario-instance/scenario-instance-query.js.map +1 -1
- package/dist-server/service/scenario-instance/scenario-instance-subscription.js +4 -1
- package/dist-server/service/scenario-instance/scenario-instance-subscription.js.map +1 -1
- package/dist-server/service/scenario-instance/scenario-instance-type.js +50 -41
- package/dist-server/service/scenario-instance/scenario-instance-type.js.map +1 -1
- package/dist-server/service/scenario-queue/scenario-queue-subscription.js +1 -0
- package/dist-server/service/scenario-queue/scenario-queue-subscription.js.map +1 -1
- package/dist-server/service/scenario-queue/scenario-queue-type.js +8 -8
- package/dist-server/service/scenario-queue/scenario-queue-type.js.map +1 -1
- package/dist-server/service/state-register/state-register-mutation.js +9 -7
- package/dist-server/service/state-register/state-register-mutation.js.map +1 -1
- package/dist-server/service/state-register/state-register-query.d.ts +3 -0
- package/dist-server/service/state-register/state-register-query.js +6 -3
- package/dist-server/service/state-register/state-register-query.js.map +1 -1
- package/dist-server/service/state-register/state-register-type.js +3 -3
- package/dist-server/service/state-register/state-register-type.js.map +1 -1
- package/dist-server/service/state-register/state-register.js +4 -2
- package/dist-server/service/state-register/state-register.js.map +1 -1
- package/dist-server/service/step/step-mutation.js +4 -2
- package/dist-server/service/step/step-mutation.js.map +1 -1
- package/dist-server/service/step/step-query.d.ts +3 -0
- package/dist-server/service/step/step-query.js +5 -2
- package/dist-server/service/step/step-query.js.map +1 -1
- package/dist-server/service/step/step-type.js +32 -32
- package/dist-server/service/step/step-type.js.map +1 -1
- package/dist-server/service/task-type/task-type-query.js +5 -3
- package/dist-server/service/task-type/task-type-query.js.map +1 -1
- package/dist-server/service/task-type/task-type-type.js +12 -9
- package/dist-server/service/task-type/task-type-type.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +11 -11
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"scenario-query.js","sourceRoot":"","sources":["../../../server/service/scenario/scenario-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,qCAAqC;AAErC,yDAAsD;AACtD,iDAAuG;AAEvG,yCAA6C;AAC7C,wFAAsG;AACtG,iDAAwC;AACxC,yCAAqC;AACrC,mDAA8C;AAC9C,mEAA0D;
|
1
|
+
{"version":3,"file":"scenario-query.js","sourceRoot":"","sources":["../../../server/service/scenario/scenario-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,qCAAqC;AAErC,yDAAsD;AACtD,iDAAuG;AAEvG,yCAA6C;AAC7C,wFAAsG;AACtG,iDAAwC;AACxC,yCAAqC;AACrC,mDAA8C;AAC9C,mEAA0D;AAE1D;;GAEG;AAEI,IAAM,aAAa,GAAnB,MAAM,aAAa;IAGlB,AAAN,KAAK,CAAC,QAAQ,CAAY,EAAU,EAAS,OAAwB;QACnE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,MAAM,QAAQ,GAAG,MAAM,IAAA,qBAAa,EAAC,mBAAQ,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAA;QACzE,IAAI,MAAM,CAAC,EAAE,IAAI,QAAQ,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ,IAAI,QAAQ,CAAC,QAAQ,EAAE,CAAC;YAC3E,OAAO,QAAQ,CAAA;QACjB,CAAC;IACH,CAAC;IAIK,AAAN,KAAK,CAAC,SAAS,CAA0B,MAAiB,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,CAAC,CAAC,yCAAgB,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC7C,mBAAA,IAAA,mBAAI,GAAE,CAAA;IAAsB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAAhB,mBAAQ;;8CAIzC;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAW,mBAAQ;;yCAEpC;wBA7FU,aAAa;IADzB,IAAA,uBAAQ,EAAC,mBAAQ,CAAC;GACN,aAAa,CA8FzB","sourcesContent":["import { Arg, Args, Ctx, Directive, FieldResolver, Query, Resolver, Root } from 'type-graphql'\nimport { Not, IsNull } from 'typeorm'\n\nimport { User, Role } from '@things-factory/auth-base'\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\n\nimport { ScenarioEngine } from '../../engine'\nimport { ScenarioInstance, ScenarioInstanceStatus } from '../scenario-instance/scenario-instance-type'\nimport { Step } from '../step/step-type'\nimport { Scenario } from './scenario'\nimport { ScenarioList } from './scenario-type'\nimport { Connection } from '../connection/connection-type'\n\n/**\n * @description Provides GraphQL resolvers for the Scenario entity.\n */\n@Resolver(Scenario)\nexport class ScenarioQuery {\n @Directive('@privilege(category: \"scenario\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(returns => Scenario, { description: 'Fetches a single scenario by its ID.' })\n async scenario(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Scenario> {\n const { domain } = context.state\n\n const scenario = await getRepository(Scenario).findOne({ where: { id } })\n if (domain.id == scenario.domainId || domain.parentId == scenario.domainId) {\n return scenario\n }\n }\n\n @Directive('@privilege(category: \"scenario\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(returns => ScenarioList, { description: 'Fetches a paginated list of scenarios.' })\n async scenarios(@Args(type => ListParam) params: ListParam, @Ctx() context: ResolverContext): Promise<ScenarioList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n repository: getRepository(Scenario),\n params,\n domain,\n searchables: ['name', 'description', 'type']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() scenario: Scenario) {\n return await getRepository(Domain).findOneBy({ id: scenario.domainId })\n }\n\n @FieldResolver(type => User)\n async updater(@Root() scenario: Scenario): Promise<User> {\n return await getRepository(User).findOneBy({ id: scenario.updaterId })\n }\n\n @FieldResolver(type => User)\n async creator(@Root() scenario: Scenario): Promise<User> {\n return await getRepository(User).findOneBy({ id: scenario.creatorId })\n }\n\n @FieldResolver(type => [Step])\n async steps(@Root() scenario: Scenario, @Ctx() context: ResolverContext): Promise<Step[]> {\n const { domain } = context.state\n\n return await getRepository(Step).find({\n where: { domain: { id: domain.id }, scenario: { id: scenario.id } }\n })\n }\n\n @FieldResolver(type => [Connection])\n async connectionNames(@Root() scenario: Scenario, @Ctx() context: ResolverContext) {\n const { domain } = context.state\n\n const steps = await getRepository(Step).find({\n where: { domain: { id: domain.id }, scenario: { id: scenario.id }, connection: Not(IsNull()) }\n })\n\n return steps.map(step => step.connection).filter(Boolean)\n }\n\n @FieldResolver(type => [Connection])\n async publishTags(@Root() scenario: Scenario, @Ctx() context: ResolverContext) {\n const { domain } = context.state\n\n const steps = await getRepository(Step).find({\n where: { domain: { id: domain.id }, scenario: { id: scenario.id }, task: 'publish' }\n })\n\n return steps.map(step => step.params?.tag).filter(Boolean)\n }\n\n @FieldResolver(type => String, { nullable: true })\n async state(@Root() scenario: Scenario, @Ctx() context: ResolverContext): Promise<string> {\n const { domain } = context.state\n\n var instance = ScenarioEngine.getScenarioInstance(domain, scenario.name)\n return instance && ScenarioInstanceStatus[instance.context?.state]\n }\n\n @FieldResolver(type => [ScenarioInstance], { nullable: true })\n async instances(@Root() scenario: Scenario, @Ctx() context: ResolverContext): Promise<ScenarioInstance[]> {\n const { domain } = context.state\n\n return ScenarioEngine.getScenarioInstances(domain, scenario.name)\n }\n\n @FieldResolver(type => Role)\n async role(@Root() scenario: Scenario) {\n return scenario.roleId && (await getRepository(Role).findOneBy({ id: scenario.roleId }))\n }\n}\n"]}
|
@@ -10,102 +10,105 @@ let NewScenario = class NewScenario {
|
|
10
10
|
};
|
11
11
|
exports.NewScenario = NewScenario;
|
12
12
|
tslib_1.__decorate([
|
13
|
-
(0, type_graphql_1.Field)(),
|
13
|
+
(0, type_graphql_1.Field)({ description: 'The name of the new scenario.' }),
|
14
14
|
tslib_1.__metadata("design:type", String)
|
15
15
|
], NewScenario.prototype, "name", void 0);
|
16
16
|
tslib_1.__decorate([
|
17
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
17
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'A detailed description for the new scenario.' }),
|
18
18
|
tslib_1.__metadata("design:type", String)
|
19
19
|
], NewScenario.prototype, "description", void 0);
|
20
20
|
tslib_1.__decorate([
|
21
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
21
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The type of the new scenario, for categorization.' }),
|
22
22
|
tslib_1.__metadata("design:type", String)
|
23
23
|
], NewScenario.prototype, "type", void 0);
|
24
24
|
tslib_1.__decorate([
|
25
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
25
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'A cron-style schedule for the new scenario.' }),
|
26
26
|
tslib_1.__metadata("design:type", String)
|
27
27
|
], NewScenario.prototype, "schedule", void 0);
|
28
28
|
tslib_1.__decorate([
|
29
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
29
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The timezone for the schedule.' }),
|
30
30
|
tslib_1.__metadata("design:type", String)
|
31
31
|
], NewScenario.prototype, "timezone", void 0);
|
32
32
|
tslib_1.__decorate([
|
33
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
33
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Time-to-live in seconds for new scenario instances.' }),
|
34
34
|
tslib_1.__metadata("design:type", Number)
|
35
35
|
], NewScenario.prototype, "ttl", void 0);
|
36
36
|
tslib_1.__decorate([
|
37
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
37
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Indicates if the new scenario should be active upon creation.' }),
|
38
38
|
tslib_1.__metadata("design:type", Boolean)
|
39
39
|
], NewScenario.prototype, "active", void 0);
|
40
40
|
tslib_1.__decorate([
|
41
|
-
(0, type_graphql_1.Field)(type => shell_1.ObjectRef, { nullable: true }),
|
41
|
+
(0, type_graphql_1.Field)(type => shell_1.ObjectRef, { nullable: true, description: 'The role required to execute the new scenario.' }),
|
42
42
|
tslib_1.__metadata("design:type", shell_1.ObjectRef)
|
43
43
|
], NewScenario.prototype, "role", void 0);
|
44
44
|
exports.NewScenario = NewScenario = tslib_1.__decorate([
|
45
|
-
(0, type_graphql_1.InputType)()
|
45
|
+
(0, type_graphql_1.InputType)({ description: 'Input for creating a new scenario.' })
|
46
46
|
], NewScenario);
|
47
47
|
let ScenarioPatch = class ScenarioPatch {
|
48
48
|
};
|
49
49
|
exports.ScenarioPatch = ScenarioPatch;
|
50
50
|
tslib_1.__decorate([
|
51
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true }),
|
51
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true, description: 'The unique identifier of the scenario to update.' }),
|
52
52
|
tslib_1.__metadata("design:type", String)
|
53
53
|
], ScenarioPatch.prototype, "id", void 0);
|
54
54
|
tslib_1.__decorate([
|
55
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
55
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The new name for the scenario.' }),
|
56
56
|
tslib_1.__metadata("design:type", String)
|
57
57
|
], ScenarioPatch.prototype, "name", void 0);
|
58
58
|
tslib_1.__decorate([
|
59
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
59
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The new description for the scenario.' }),
|
60
60
|
tslib_1.__metadata("design:type", String)
|
61
61
|
], ScenarioPatch.prototype, "description", void 0);
|
62
62
|
tslib_1.__decorate([
|
63
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
63
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The new type for the scenario.' }),
|
64
64
|
tslib_1.__metadata("design:type", String)
|
65
65
|
], ScenarioPatch.prototype, "type", void 0);
|
66
66
|
tslib_1.__decorate([
|
67
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
67
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The new schedule for the scenario.' }),
|
68
68
|
tslib_1.__metadata("design:type", String)
|
69
69
|
], ScenarioPatch.prototype, "schedule", void 0);
|
70
70
|
tslib_1.__decorate([
|
71
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
71
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The new timezone for the scenario.' }),
|
72
72
|
tslib_1.__metadata("design:type", String)
|
73
73
|
], ScenarioPatch.prototype, "timezone", void 0);
|
74
74
|
tslib_1.__decorate([
|
75
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
75
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The new time-to-live for scenario instances.' }),
|
76
76
|
tslib_1.__metadata("design:type", Number)
|
77
77
|
], ScenarioPatch.prototype, "ttl", void 0);
|
78
78
|
tslib_1.__decorate([
|
79
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
79
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The new active status for the scenario.' }),
|
80
80
|
tslib_1.__metadata("design:type", Boolean)
|
81
81
|
], ScenarioPatch.prototype, "active", void 0);
|
82
82
|
tslib_1.__decorate([
|
83
|
-
(0, type_graphql_1.Field)(type => [step_type_1.StepPatch], { nullable: true }),
|
83
|
+
(0, type_graphql_1.Field)(type => [step_type_1.StepPatch], { nullable: true, description: 'A list of steps to be updated within the scenario.' }),
|
84
84
|
tslib_1.__metadata("design:type", Array)
|
85
85
|
], ScenarioPatch.prototype, "steps", void 0);
|
86
86
|
tslib_1.__decorate([
|
87
|
-
(0, type_graphql_1.Field)(type => shell_1.ObjectRef, { nullable: true }),
|
87
|
+
(0, type_graphql_1.Field)(type => shell_1.ObjectRef, { nullable: true, description: 'The new role for the scenario.' }),
|
88
88
|
tslib_1.__metadata("design:type", shell_1.ObjectRef)
|
89
89
|
], ScenarioPatch.prototype, "role", void 0);
|
90
90
|
tslib_1.__decorate([
|
91
|
-
(0, type_graphql_1.Field)({
|
91
|
+
(0, type_graphql_1.Field)({
|
92
|
+
nullable: true,
|
93
|
+
description: 'A flag indicating whether the scenario is being created, updated, or deleted.'
|
94
|
+
}),
|
92
95
|
tslib_1.__metadata("design:type", String)
|
93
96
|
], ScenarioPatch.prototype, "cuFlag", void 0);
|
94
97
|
exports.ScenarioPatch = ScenarioPatch = tslib_1.__decorate([
|
95
|
-
(0, type_graphql_1.InputType)()
|
98
|
+
(0, type_graphql_1.InputType)({ description: 'Input for updating (patching) an existing scenario.' })
|
96
99
|
], ScenarioPatch);
|
97
100
|
let ScenarioList = class ScenarioList {
|
98
101
|
};
|
99
102
|
exports.ScenarioList = ScenarioList;
|
100
103
|
tslib_1.__decorate([
|
101
|
-
(0, type_graphql_1.Field)(type => [scenario_1.Scenario]),
|
104
|
+
(0, type_graphql_1.Field)(type => [scenario_1.Scenario], { description: 'The list of scenario items.' }),
|
102
105
|
tslib_1.__metadata("design:type", Array)
|
103
106
|
], ScenarioList.prototype, "items", void 0);
|
104
107
|
tslib_1.__decorate([
|
105
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.Int),
|
108
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { description: 'The total number of scenarios.' }),
|
106
109
|
tslib_1.__metadata("design:type", Number)
|
107
110
|
], ScenarioList.prototype, "total", void 0);
|
108
111
|
exports.ScenarioList = ScenarioList = tslib_1.__decorate([
|
109
|
-
(0, type_graphql_1.ObjectType)()
|
112
|
+
(0, type_graphql_1.ObjectType)({ description: 'A paginated list of scenarios.' })
|
110
113
|
], ScenarioList);
|
111
114
|
//# sourceMappingURL=scenario-type.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"scenario-type.js","sourceRoot":"","sources":["../../../server/service/scenario/scenario-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAoE;AAEpE,iDAAiD;AAEjD,yCAAqC;AACrC,iDAA6C;AAGtC,IAAM,WAAW,GAAjB,MAAM,WAAW;CAwBvB,CAAA;AAxBY,kCAAW;AAEtB;IADC,IAAA,oBAAK,
|
1
|
+
{"version":3,"file":"scenario-type.js","sourceRoot":"","sources":["../../../server/service/scenario/scenario-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAoE;AAEpE,iDAAiD;AAEjD,yCAAqC;AACrC,iDAA6C;AAGtC,IAAM,WAAW,GAAjB,MAAM,WAAW;CAwBvB,CAAA;AAxBY,kCAAW;AAEtB;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,+BAA+B,EAAE,CAAC;;yCAC5C;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,8CAA8C,EAAE,CAAC;;gDACnE;AAGpB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,mDAAmD,EAAE,CAAC;;yCAC/E;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,6CAA6C,EAAE,CAAC;;6CACrE;AAGjB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,gCAAgC,EAAE,CAAC;;6CACxD;AAGjB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,qDAAqD,EAAE,CAAC;;wCAClF;AAGZ;IADC,IAAA,oBAAK,EAAC,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AAyC,EAAE,CAAC;;6CAClE;AAGhB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,qBAAS,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,oDAAoD,EAAE,CAAC;;4CAC/F;AAGnB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,gCAAgC,EAAE,CAAC;sCACrF,iBAAS;2CAAA;AAMhB;IAJC,IAAA,oBAAK,EAAC;QACL,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,+EAA+E;KAC7F,CAAC;;6CACa;wBAnCJ,aAAa;IADzB,IAAA,wBAAS,EAAC,EAAE,WAAW,EAAE,qDAAqD,EAAE,CAAC;GACrE,aAAa,CAoCzB;AAGM,IAAM,YAAY,GAAlB,MAAM,YAAY;CAMxB,CAAA;AANY,oCAAY;AAEvB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,mBAAQ,CAAC,EAAE,EAAE,WAAW,EAAE,6BAA6B,EAAE,CAAC;;2CACzD;AAGjB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,WAAW,EAAE,gCAAgC,EAAE,CAAC;;2CACzD;uBALF,YAAY;IADxB,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,gCAAgC,EAAE,CAAC;GACjD,YAAY,CAMxB","sourcesContent":["import { Field, ID, InputType, Int, ObjectType } from 'type-graphql'\n\nimport { ObjectRef } from '@things-factory/shell'\n\nimport { Scenario } from './scenario'\nimport { StepPatch } from '../step/step-type'\n\n@InputType({ description: 'Input for creating a new scenario.' })\nexport class NewScenario {\n @Field({ description: 'The name of the new scenario.' })\n name: string\n\n @Field({ nullable: true, description: 'A detailed description for the new scenario.' })\n description?: string\n\n @Field({ nullable: true, description: 'The type of the new scenario, for categorization.' })\n type?: string\n\n @Field({ nullable: true, description: 'A cron-style schedule for the new scenario.' })\n schedule?: string\n\n @Field({ nullable: true, description: 'The timezone for the schedule.' })\n timezone?: string\n\n @Field({ nullable: true, description: 'Time-to-live in seconds for new scenario instances.' })\n ttl?: number\n\n @Field({ nullable: true, description: 'Indicates if the new scenario should be active upon creation.' })\n active?: boolean\n\n @Field(type => ObjectRef, { nullable: true, description: 'The role required to execute the new scenario.' })\n role?: ObjectRef\n}\n\n@InputType({ description: 'Input for updating (patching) an existing scenario.' })\nexport class ScenarioPatch {\n @Field(type => ID, { nullable: true, description: 'The unique identifier of the scenario to update.' })\n id?: string\n\n @Field({ nullable: true, description: 'The new name for the scenario.' })\n name?: string\n\n @Field({ nullable: true, description: 'The new description for the scenario.' })\n description?: string\n\n @Field({ nullable: true, description: 'The new type for the scenario.' })\n type?: string\n\n @Field({ nullable: true, description: 'The new schedule for the scenario.' })\n schedule?: string\n\n @Field({ nullable: true, description: 'The new timezone for the scenario.' })\n timezone?: string\n\n @Field({ nullable: true, description: 'The new time-to-live for scenario instances.' })\n ttl?: number\n\n @Field({ nullable: true, description: 'The new active status for the scenario.' })\n active?: boolean\n\n @Field(type => [StepPatch], { nullable: true, description: 'A list of steps to be updated within the scenario.' })\n steps?: StepPatch[]\n\n @Field(type => ObjectRef, { nullable: true, description: 'The new role for the scenario.' })\n role?: ObjectRef\n\n @Field({\n nullable: true,\n description: 'A flag indicating whether the scenario is being created, updated, or deleted.'\n })\n cuFlag?: string\n}\n\n@ObjectType({ description: 'A paginated list of scenarios.' })\nexport class ScenarioList {\n @Field(type => [Scenario], { description: 'The list of scenario items.' })\n items: Scenario[]\n\n @Field(type => Int, { description: 'The total number of scenarios.' })\n total: number\n}\n"]}
|
@@ -30,12 +30,12 @@ let Scenario = class Scenario {
|
|
30
30
|
exports.Scenario = Scenario;
|
31
31
|
tslib_1.__decorate([
|
32
32
|
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
33
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
33
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { description: 'Unique identifier for the scenario.' }),
|
34
34
|
tslib_1.__metadata("design:type", String)
|
35
35
|
], Scenario.prototype, "id", void 0);
|
36
36
|
tslib_1.__decorate([
|
37
37
|
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
38
|
-
(0, type_graphql_1.Field)(type => shell_1.Domain),
|
38
|
+
(0, type_graphql_1.Field)(type => shell_1.Domain, { description: 'The domain to which this scenario belongs.' }),
|
39
39
|
tslib_1.__metadata("design:type", shell_1.Domain)
|
40
40
|
], Scenario.prototype, "domain", void 0);
|
41
41
|
tslib_1.__decorate([
|
@@ -44,62 +44,65 @@ tslib_1.__decorate([
|
|
44
44
|
], Scenario.prototype, "domainId", void 0);
|
45
45
|
tslib_1.__decorate([
|
46
46
|
(0, typeorm_1.Column)(),
|
47
|
-
(0, type_graphql_1.Field)(),
|
47
|
+
(0, type_graphql_1.Field)({ description: 'The name of the scenario.' }),
|
48
48
|
tslib_1.__metadata("design:type", String)
|
49
49
|
], Scenario.prototype, "name", void 0);
|
50
50
|
tslib_1.__decorate([
|
51
51
|
(0, typeorm_1.Column)({ nullable: true }),
|
52
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
52
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'A detailed description of the scenario.' }),
|
53
53
|
tslib_1.__metadata("design:type", String)
|
54
54
|
], Scenario.prototype, "description", void 0);
|
55
55
|
tslib_1.__decorate([
|
56
56
|
(0, typeorm_1.Column)({ nullable: true }),
|
57
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
57
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The type of the scenario, used for categorization.' }),
|
58
58
|
tslib_1.__metadata("design:type", String)
|
59
59
|
], Scenario.prototype, "type", void 0);
|
60
60
|
tslib_1.__decorate([
|
61
61
|
(0, typeorm_1.Column)({ nullable: true }),
|
62
|
-
(0, type_graphql_1.Field)({ nullable: true, description: 'accessible and executable system-wide' }),
|
62
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Indicates if the scenario is accessible and executable system-wide.' }),
|
63
63
|
tslib_1.__metadata("design:type", Boolean)
|
64
64
|
], Scenario.prototype, "public", void 0);
|
65
65
|
tslib_1.__decorate([
|
66
66
|
(0, typeorm_1.Column)({ nullable: true }),
|
67
|
-
(0, type_graphql_1.Field)({
|
67
|
+
(0, type_graphql_1.Field)({
|
68
|
+
nullable: true,
|
69
|
+
description: 'Indicates if the scenario should be automatically started when the server starts. [will be deprecated]'
|
70
|
+
}),
|
68
71
|
tslib_1.__metadata("design:type", Boolean)
|
69
72
|
], Scenario.prototype, "active", void 0);
|
70
73
|
tslib_1.__decorate([
|
71
74
|
(0, typeorm_1.Column)({ nullable: true }),
|
72
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
75
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'A cron-style schedule for running the scenario automatically.' }),
|
73
76
|
tslib_1.__metadata("design:type", String)
|
74
77
|
], Scenario.prototype, "schedule", void 0);
|
75
78
|
tslib_1.__decorate([
|
76
79
|
(0, typeorm_1.Column)({ nullable: true }),
|
77
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
80
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The ID of the scheduled job, if any.' }),
|
78
81
|
tslib_1.__metadata("design:type", String)
|
79
82
|
], Scenario.prototype, "scheduleId", void 0);
|
80
83
|
tslib_1.__decorate([
|
81
84
|
(0, typeorm_1.Column)({ nullable: true }),
|
82
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
85
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The timezone for the schedule.' }),
|
83
86
|
tslib_1.__metadata("design:type", String)
|
84
87
|
], Scenario.prototype, "timezone", void 0);
|
85
88
|
tslib_1.__decorate([
|
86
89
|
(0, typeorm_1.Column)({ nullable: true }),
|
87
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
90
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Time-to-live in seconds for scenario instances.' }),
|
88
91
|
tslib_1.__metadata("design:type", Number)
|
89
92
|
], Scenario.prototype, "ttl", void 0);
|
90
93
|
tslib_1.__decorate([
|
91
94
|
(0, typeorm_1.OneToMany)(type => step_type_1.Step, step => step.scenario),
|
92
|
-
(0, type_graphql_1.Field)(type => [step_type_1.Step], { nullable: true }),
|
95
|
+
(0, type_graphql_1.Field)(type => [step_type_1.Step], { nullable: true, description: 'The sequence of steps that make up the scenario.' }),
|
93
96
|
tslib_1.__metadata("design:type", Array)
|
94
97
|
], Scenario.prototype, "steps", void 0);
|
95
98
|
tslib_1.__decorate([
|
96
99
|
(0, typeorm_1.Column)({ type: 'simple-json', nullable: true }),
|
97
|
-
(0, type_graphql_1.Field)(type => auth_base_1.PrivilegeObject, { nullable: true }),
|
100
|
+
(0, type_graphql_1.Field)(type => auth_base_1.PrivilegeObject, { nullable: true, description: 'Privilege required to execute the scenario.' }),
|
98
101
|
tslib_1.__metadata("design:type", auth_base_1.PrivilegeObject)
|
99
102
|
], Scenario.prototype, "privilege", void 0);
|
100
103
|
tslib_1.__decorate([
|
101
104
|
(0, typeorm_1.ManyToOne)(type => auth_base_1.Role),
|
102
|
-
(0, type_graphql_1.Field)(type => auth_base_1.Role, { nullable: true }),
|
105
|
+
(0, type_graphql_1.Field)(type => auth_base_1.Role, { nullable: true, description: 'Role required to execute the scenario.' }),
|
103
106
|
tslib_1.__metadata("design:type", auth_base_1.Role)
|
104
107
|
], Scenario.prototype, "role", void 0);
|
105
108
|
tslib_1.__decorate([
|
@@ -108,17 +111,17 @@ tslib_1.__decorate([
|
|
108
111
|
], Scenario.prototype, "roleId", void 0);
|
109
112
|
tslib_1.__decorate([
|
110
113
|
(0, typeorm_1.CreateDateColumn)(),
|
111
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
114
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The timestamp when the scenario was created.' }),
|
112
115
|
tslib_1.__metadata("design:type", Date)
|
113
116
|
], Scenario.prototype, "createdAt", void 0);
|
114
117
|
tslib_1.__decorate([
|
115
118
|
(0, typeorm_1.UpdateDateColumn)(),
|
116
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
119
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The timestamp when the scenario was last updated.' }),
|
117
120
|
tslib_1.__metadata("design:type", Date)
|
118
121
|
], Scenario.prototype, "updatedAt", void 0);
|
119
122
|
tslib_1.__decorate([
|
120
123
|
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
121
|
-
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
|
124
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'The user who created the scenario.' }),
|
122
125
|
tslib_1.__metadata("design:type", auth_base_1.User)
|
123
126
|
], Scenario.prototype, "creator", void 0);
|
124
127
|
tslib_1.__decorate([
|
@@ -127,7 +130,7 @@ tslib_1.__decorate([
|
|
127
130
|
], Scenario.prototype, "creatorId", void 0);
|
128
131
|
tslib_1.__decorate([
|
129
132
|
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
130
|
-
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
|
133
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'The user who last updated the scenario.' }),
|
131
134
|
tslib_1.__metadata("design:type", auth_base_1.User)
|
132
135
|
], Scenario.prototype, "updater", void 0);
|
133
136
|
tslib_1.__decorate([
|
@@ -137,6 +140,6 @@ tslib_1.__decorate([
|
|
137
140
|
exports.Scenario = Scenario = tslib_1.__decorate([
|
138
141
|
(0, typeorm_1.Entity)(),
|
139
142
|
(0, typeorm_1.Index)('ix_scenario_0', (scenario) => [scenario.domain, scenario.name], { unique: true }),
|
140
|
-
(0, type_graphql_1.ObjectType)()
|
143
|
+
(0, type_graphql_1.ObjectType)({ description: 'Represents a sequence of steps designed to automate a task or process.' })
|
141
144
|
], Scenario);
|
142
145
|
//# sourceMappingURL=scenario.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"scenario.js","sourceRoot":"","sources":["../../../server/service/scenario/scenario.ts"],"names":[],"mappings":";;;;AAAA,+CAAoE;AACpE,qCAUgB;AAEhB,yDAAuE;AACvE,iDAA8C;AAE9C,yCAA6C;AAC7C,iDAAwC;AAKjC,IAAM,QAAQ,GAAd,MAAM,QAAQ;
|
1
|
+
{"version":3,"file":"scenario.js","sourceRoot":"","sources":["../../../server/service/scenario/scenario.ts"],"names":[],"mappings":";;;;AAAA,+CAAoE;AACpE,qCAUgB;AAEhB,yDAAuE;AACvE,iDAA8C;AAE9C,yCAA6C;AAC7C,iDAAwC;AAKjC,IAAM,QAAQ,GAAd,MAAM,QAAQ;IAyFnB,KAAK,CAAC,KAAK,CAAC,OAAkF;QAC5F,IAAI,CAAC;YACH,MAAM,uBAAc,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,IAAI,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE;gBAClE,MAAM,EAAE,OAAO,EAAE,MAAM,IAAI,IAAI,CAAC,MAAM;gBACtC,IAAI,EAAE,OAAO,EAAE,IAAI,IAAI,IAAI,CAAC,OAAO;gBACnC,SAAS,EAAE,OAAO,EAAE,SAAS;aAC9B,CAAC,CAAA;QACJ,CAAC;QAAC,OAAO,EAAE,EAAE,CAAC,CAAA,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,OAAiE;QAC1E,IAAI,CAAC;YACH,MAAM,uBAAc,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,IAAI,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,YAAY,IAAI,IAAI,CAAC,IAAI,CAAC,CAAA;QACjG,CAAC;gBAAS,CAAC;QACX,CAAC;IACH,CAAC;CACF,CAAA;AAzGY,4BAAQ;AAGnB;IAFC,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAA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AAe,EAAE,CAAC,QAAkB,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAClG,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,wEAAwE,EAAE,CAAC;GACzF,QAAQ,CAyGpB","sourcesContent":["import { Field, ID, InputType, Int, ObjectType } from 'type-graphql'\nimport {\n Column,\n CreateDateColumn,\n Entity,\n Index,\n ManyToOne,\n OneToMany,\n PrimaryGeneratedColumn,\n RelationId,\n UpdateDateColumn\n} from 'typeorm'\n\nimport { PrivilegeObject, Role, User } from '@things-factory/auth-base'\nimport { Domain } from '@things-factory/shell'\n\nimport { ScenarioEngine } from '../../engine'\nimport { Step } from '../step/step-type'\n\n@Entity()\n@Index('ix_scenario_0', (scenario: Scenario) => [scenario.domain, scenario.name], { unique: true })\n@ObjectType({ description: 'Represents a sequence of steps designed to automate a task or process.' })\nexport class Scenario {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID, { description: 'Unique identifier for the scenario.' })\n id?: string\n\n @ManyToOne(type => Domain)\n @Field(type => Domain, { description: 'The domain to which this scenario belongs.' })\n domain?: Domain\n\n @RelationId((scenario: Scenario) => scenario.domain)\n domainId?: string\n\n @Column()\n @Field({ description: 'The name of the scenario.' })\n name?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'A detailed description of the scenario.' })\n description?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'The type of the scenario, used for categorization.' })\n type?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Indicates if the scenario is accessible and executable system-wide.' })\n public?: boolean\n\n @Column({ nullable: true })\n @Field({\n nullable: true,\n description:\n 'Indicates if the scenario should be automatically started when the server starts. [will be deprecated]'\n })\n active?: boolean\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'A cron-style schedule for running the scenario automatically.' })\n schedule?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'The ID of the scheduled job, if any.' })\n scheduleId?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'The timezone for the schedule.' })\n timezone?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Time-to-live in seconds for scenario instances.' })\n ttl?: number\n\n @OneToMany(type => Step, step => step.scenario)\n @Field(type => [Step], { nullable: true, description: 'The sequence of steps that make up the scenario.' })\n steps?: Step[]\n\n @Column({ type: 'simple-json', nullable: true })\n @Field(type => PrivilegeObject, { nullable: true, description: 'Privilege required to execute the scenario.' })\n privilege?: PrivilegeObject\n\n @ManyToOne(type => Role)\n @Field(type => Role, { nullable: true, description: 'Role required to execute the scenario.' })\n role?: Role\n\n @RelationId((scenario: Scenario) => scenario.role)\n roleId?: string\n\n @CreateDateColumn()\n @Field({ nullable: true, description: 'The timestamp when the scenario was created.' })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true, description: 'The timestamp when the scenario was last updated.' })\n updatedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'The user who created the scenario.' })\n creator?: User\n\n @RelationId((scenario: Scenario) => scenario.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'The user who last updated the scenario.' })\n updater?: User\n\n @RelationId((scenario: Scenario) => scenario.updater)\n updaterId?: string\n\n async start(options?: { instanceName?: string; domain?: Domain; user?: User; variables?: any }) {\n try {\n await ScenarioEngine.load(options?.instanceName || this.name, this, {\n domain: options?.domain || this.domain,\n user: options?.user || this.updater,\n variables: options?.variables\n })\n } catch (ex) {}\n }\n\n async stop(options?: { instanceName?: string; domain?: Domain; user?: User }) {\n try {\n await ScenarioEngine.unload(options?.domain || this.domain, options?.instanceName || this.name)\n } finally {\n }\n }\n}\n"]}
|
@@ -20,7 +20,7 @@ let ScenarioInstanceMutation = class ScenarioInstanceMutation {
|
|
20
20
|
exports.ScenarioInstanceMutation = ScenarioInstanceMutation;
|
21
21
|
tslib_1.__decorate([
|
22
22
|
(0, type_graphql_1.Mutation)(returns => scenario_instance_type_1.ScenarioInstanceRunResult, {
|
23
|
-
description: '
|
23
|
+
description: 'Runs a new scenario instance once and returns the result after it finishes.'
|
24
24
|
}),
|
25
25
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('instanceName', { nullable: true })),
|
26
26
|
tslib_1.__param(1, (0, type_graphql_1.Arg)('scenarioName')),
|
@@ -31,7 +31,9 @@ tslib_1.__decorate([
|
|
31
31
|
tslib_1.__metadata("design:returntype", Promise)
|
32
32
|
], ScenarioInstanceMutation.prototype, "runScenario", null);
|
33
33
|
tslib_1.__decorate([
|
34
|
-
(0, type_graphql_1.Mutation)(returns => scenario_instance_type_1.ScenarioInstance, {
|
34
|
+
(0, type_graphql_1.Mutation)(returns => scenario_instance_type_1.ScenarioInstance, {
|
35
|
+
description: 'Starts a new scenario instance, which will run in the background.'
|
36
|
+
}),
|
35
37
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('instanceName', { nullable: true })),
|
36
38
|
tslib_1.__param(1, (0, type_graphql_1.Arg)('scenarioName')),
|
37
39
|
tslib_1.__param(2, (0, type_graphql_1.Arg)('variables', type => shell_1.ScalarObject, { nullable: true })),
|
@@ -41,7 +43,10 @@ tslib_1.__decorate([
|
|
41
43
|
tslib_1.__metadata("design:returntype", Promise)
|
42
44
|
], ScenarioInstanceMutation.prototype, "startScenario", null);
|
43
45
|
tslib_1.__decorate([
|
44
|
-
(0, type_graphql_1.Mutation)(returns => scenario_instance_type_1.ScenarioInstance, {
|
46
|
+
(0, type_graphql_1.Mutation)(returns => scenario_instance_type_1.ScenarioInstance, {
|
47
|
+
nullable: true,
|
48
|
+
description: 'Stops a running scenario instance by its name.'
|
49
|
+
}),
|
45
50
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('instanceName', { nullable: true })),
|
46
51
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
47
52
|
tslib_1.__metadata("design:type", Function),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"scenario-instance-mutation.js","sourceRoot":"","sources":["../../../server/service/scenario-instance/scenario-instance-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAA2D;AAE3D,iDAAoD;AAEpD,qEAAsF;AAEtF,+EAI8C;AAGvC,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAI7B,AAAN,KAAK,CAAC,WAAW,CAC0B,YAAoB,EACxC,YAAoB,EACmB,SAAc,EACnE,OAAwB;QAE/B,OAAO,MAAM,IAAA,iCAAqB,EAAC,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,CAAC,CAAA;IACpF,CAAC;
|
1
|
+
{"version":3,"file":"scenario-instance-mutation.js","sourceRoot":"","sources":["../../../server/service/scenario-instance/scenario-instance-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAA2D;AAE3D,iDAAoD;AAEpD,qEAAsF;AAEtF,+EAI8C;AAGvC,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAI7B,AAAN,KAAK,CAAC,WAAW,CAC0B,YAAoB,EACxC,YAAoB,EACmB,SAAc,EACnE,OAAwB;QAE/B,OAAO,MAAM,IAAA,iCAAqB,EAAC,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,CAAC,CAAA;IACpF,CAAC;IAKK,AAAN,KAAK,CAAC,aAAa,CACwB,YAAoB,EACxC,YAAoB,EACmB,SAAc,EACnE,OAAwB;QAE/B,OAAO,MAAM,IAAA,mCAAuB,EAAC,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,CAAC,CAAA;IACtF,CAAC;IAMK,AAAN,KAAK,CAAC,YAAY,CACyB,YAAoB,EACtD,OAAwB;QAE/B,OAAO,MAAM,IAAA,kCAAsB,EAAC,YAAY,EAAE,OAAO,CAAC,CAAA;IAC5D,CAAC;CACF,CAAA;AAnCY,4DAAwB;AAI7B;IAHL,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,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port { ScenarioInstance, ScenarioInstanceRunResult } from './scenario-instance-type'\n\nimport {\n runScenario as controllerRunScenario,\n startScenario as controllerStartScenario,\n stopScenario as controllerStopScenario\n} from '../../controllers/scenario-controller'\n\n@Resolver(ScenarioInstance)\nexport class ScenarioInstanceMutation {\n @Mutation(returns => ScenarioInstanceRunResult, {\n description: 'Runs a new scenario instance once and returns the result after it finishes.'\n })\n async runScenario(\n @Arg('instanceName', { nullable: true }) instanceName: string,\n @Arg('scenarioName') scenarioName: string,\n @Arg('variables', type => ScalarObject, { nullable: true }) variables: any,\n @Ctx() context: ResolverContext\n ): Promise<ScenarioInstanceRunResult> {\n return await controllerRunScenario(instanceName, scenarioName, variables, context)\n }\n\n @Mutation(returns => ScenarioInstance, {\n description: 'Starts a new scenario instance, which will run in the background.'\n })\n async startScenario(\n @Arg('instanceName', { nullable: true }) instanceName: string,\n @Arg('scenarioName') scenarioName: string,\n @Arg('variables', type => ScalarObject, { nullable: true }) variables: any,\n @Ctx() context: ResolverContext\n ): Promise<ScenarioInstance> {\n return await controllerStartScenario(instanceName, scenarioName, variables, context)\n }\n\n @Mutation(returns => ScenarioInstance, {\n nullable: true,\n description: 'Stops a running scenario instance by its name.'\n })\n async stopScenario(\n @Arg('instanceName', { nullable: true }) instanceName: string,\n @Ctx() context: ResolverContext\n ): Promise<ScenarioInstance | undefined> {\n return await controllerStopScenario(instanceName, context)\n }\n}\n"]}
|
@@ -1,5 +1,8 @@
|
|
1
1
|
import { ListParam } from '@things-factory/shell';
|
2
2
|
import { ScenarioInstance, ScenarioInstanceList } from './scenario-instance-type';
|
3
|
+
/**
|
4
|
+
* @description Provides GraphQL resolvers for scenario instances.
|
5
|
+
*/
|
3
6
|
export declare class ScenarioInstanceQuery {
|
4
7
|
scenarioInstance(instanceName: string, context: ResolverContext): Promise<ScenarioInstance>;
|
5
8
|
scenarioInstances(params: ListParam, context: ResolverContext): Promise<ScenarioInstanceList>;
|
@@ -6,6 +6,9 @@ const type_graphql_1 = require("type-graphql");
|
|
6
6
|
const shell_1 = require("@things-factory/shell");
|
7
7
|
const engine_1 = require("../../engine");
|
8
8
|
const scenario_instance_type_1 = require("./scenario-instance-type");
|
9
|
+
/**
|
10
|
+
* @description Provides GraphQL resolvers for scenario instances.
|
11
|
+
*/
|
9
12
|
let ScenarioInstanceQuery = class ScenarioInstanceQuery {
|
10
13
|
async scenarioInstance(instanceName, context) {
|
11
14
|
const { domain } = context.state;
|
@@ -24,7 +27,7 @@ let ScenarioInstanceQuery = class ScenarioInstanceQuery {
|
|
24
27
|
};
|
25
28
|
exports.ScenarioInstanceQuery = ScenarioInstanceQuery;
|
26
29
|
tslib_1.__decorate([
|
27
|
-
(0, type_graphql_1.Query)(returns => scenario_instance_type_1.ScenarioInstance, { description: '
|
30
|
+
(0, type_graphql_1.Query)(returns => scenario_instance_type_1.ScenarioInstance, { description: 'Fetches a single scenario instance by its name.' }),
|
28
31
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('instanceName')),
|
29
32
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
30
33
|
tslib_1.__metadata("design:type", Function),
|
@@ -32,7 +35,7 @@ tslib_1.__decorate([
|
|
32
35
|
tslib_1.__metadata("design:returntype", Promise)
|
33
36
|
], ScenarioInstanceQuery.prototype, "scenarioInstance", null);
|
34
37
|
tslib_1.__decorate([
|
35
|
-
(0, type_graphql_1.Query)(returns => scenario_instance_type_1.ScenarioInstanceList, { description: '
|
38
|
+
(0, type_graphql_1.Query)(returns => scenario_instance_type_1.ScenarioInstanceList, { description: 'Fetches a list of all active scenario instances.' }),
|
36
39
|
tslib_1.__param(0, (0, type_graphql_1.Args)(type => shell_1.ListParam)),
|
37
40
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
38
41
|
tslib_1.__metadata("design:type", Function),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"scenario-instance-query.js","sourceRoot":"","sources":["../../../server/service/scenario-instance/scenario-instance-query.ts"],"names":[],"mappings":";;;;AAAA,+CAAmF;AAEnF,iDAA+D;AAE/D,yCAA6C;AAC7C,qEAKiC;
|
1
|
+
{"version":3,"file":"scenario-instance-query.js","sourceRoot":"","sources":["../../../server/service/scenario-instance/scenario-instance-query.ts"],"names":[],"mappings":";;;;AAAA,+CAAmF;AAEnF,iDAA+D;AAE/D,yCAA6C;AAC7C,qEAKiC;AAEjC;;GAEG;AAEI,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAE1B,AAAN,KAAK,CAAC,gBAAgB,CACC,YAAoB,EAClC,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,OAAO,uBAAc,CAAC,mBAAmB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;IACjE,CAAC;IAGK,AAAN,KAAK,CAAC,iBAAiB,CACI,MAAiB,EACnC,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,IAAI,iBAAiB,GAAG,uBAAc,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAA;QAEnE,0BAA0B;QAC1B,IAAI,KAAK,GAAG,iBAAiB,CAAA;QAE7B,OAAO;YACL,KAAK;YACL,KAAK,EAAE,KAAK,CAAC,MAAM;SACpB,CAAA;IACH,CAAC;CACF,CAAA;AA5BY,sDAAqB;AAE1B;IADL,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,yCAAgB,EAAE,EAAE,WAAW,EAAE,iDAAiD,EAAE,CAAC;IAEpG,mBAAA,IAAA,kBAAG,EAAC,cAAc,CAAC,CAAA;IACnB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;6DAKP;AAGK;IADL,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,6CAAoB,EAAE,EAAE,WAAW,EAAE,kDAAkD,EAAE,CAAC;IAEzG,mBAAA,IAAA,mBAAI,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAS,CAAC,CAAA;IACvB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAD2B,iBAAS;;8DAc3C;gCA3BU,qBAAqB;IADjC,IAAA,uBAAQ,EAAC,yCAAgB,CAAC;GACd,qBAAqB,CA4BjC","sourcesContent":["import { Arg, Args, Ctx, FieldResolver, Query, Resolver, Root } from 'type-graphql'\n\nimport { ListParam, ScalarObject } from '@things-factory/shell'\n\nimport { ScenarioEngine } from '../../engine'\nimport {\n ScenarioInstance,\n ScenarioInstanceList,\n ScenarioInstanceProgress,\n ScenarioInstanceStatus\n} from './scenario-instance-type'\n\n/**\n * @description Provides GraphQL resolvers for scenario instances.\n */\n@Resolver(ScenarioInstance)\nexport class ScenarioInstanceQuery {\n @Query(returns => ScenarioInstance, { description: 'Fetches a single scenario instance by its name.' })\n async scenarioInstance(\n @Arg('instanceName') instanceName: string,\n @Ctx() context: ResolverContext\n ): Promise<ScenarioInstance> {\n const { domain } = context.state\n\n return ScenarioEngine.getScenarioInstance(domain, instanceName)\n }\n\n @Query(returns => ScenarioInstanceList, { description: 'Fetches a list of all active scenario instances.' })\n async scenarioInstances(\n @Args(type => ListParam) params: ListParam,\n @Ctx() context: ResolverContext\n ): Promise<ScenarioInstanceList> {\n const { domain } = context.state\n\n var scenarioInstances = ScenarioEngine.getScenarioInstances(domain)\n\n /* IMPLEMENT-ME 검색 기능.. */\n var items = scenarioInstances\n\n return {\n items,\n total: items.length\n }\n }\n}\n"]}
|
@@ -19,6 +19,7 @@ let ScenarioInstanceSubscription = class ScenarioInstanceSubscription {
|
|
19
19
|
exports.ScenarioInstanceSubscription = ScenarioInstanceSubscription;
|
20
20
|
tslib_1.__decorate([
|
21
21
|
(0, type_graphql_1.Subscription)({
|
22
|
+
description: 'Subscribes to log messages from scenario instances.',
|
22
23
|
subscribe: ({ args, context, info }) => {
|
23
24
|
const { domain, user } = context.state;
|
24
25
|
const { instanceName, scenarioName, level } = args;
|
@@ -59,6 +60,7 @@ tslib_1.__decorate([
|
|
59
60
|
], ScenarioInstanceSubscription.prototype, "scenarioInstanceLog", null);
|
60
61
|
tslib_1.__decorate([
|
61
62
|
(0, type_graphql_1.Subscription)({
|
63
|
+
description: 'Subscribes to state changes from scenario instances.',
|
62
64
|
subscribe: ({ args, context, info }) => {
|
63
65
|
const { domain, user } = context.state;
|
64
66
|
const { instanceName, scenarioName } = args;
|
@@ -73,7 +75,8 @@ tslib_1.__decorate([
|
|
73
75
|
process.nextTick(() => {
|
74
76
|
engine_1.ScenarioEngine.getScenarioInstances(domain)
|
75
77
|
.filter(instance => {
|
76
|
-
return (!instanceName || instance.instanceName === instanceName) &&
|
78
|
+
return ((!instanceName || instance.instanceName === instanceName) &&
|
79
|
+
(!scenarioName || instance.scenarioName === scenarioName));
|
77
80
|
})
|
78
81
|
.forEach(instance => {
|
79
82
|
instance.publishState();
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"scenario-instance-subscription.js","sourceRoot":"","sources":["../../../server/service/scenario-instance/scenario-instance-subscription.ts"],"names":[],"mappings":";;;;AAAA,+CAAgE;AAChE,+CAA2C;AAC3C,iDAAmD;AACnD,qEAAkF;AAClF,yCAA6C;AAE7C,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,2DAA2D,CAAC,CAAA;AAGpF,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;
|
1
|
+
{"version":3,"file":"scenario-instance-subscription.js","sourceRoot":"","sources":["../../../server/service/scenario-instance/scenario-instance-subscription.ts"],"names":[],"mappings":";;;;AAAA,+CAAgE;AAChE,+CAA2C;AAC3C,iDAAmD;AACnD,qEAAkF;AAClF,yCAA6C;AAE7C,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,2DAA2D,CAAC,CAAA;AAGpF,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IA6CvC,mBAAmB,CACT,OAAqC,EACJ,YAAoB,EACpB,YAAoB,EAC3B,KAAa;QAE/C,OAAO,OAAO,CAAC,mBAAmB,CA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a,KAAK,YAAY,EAAE,CAAC;oBACnD,OAAO,KAAK,CAAA;gBACd,CAAC;gBAED,OAAO,IAAI,CAAA;YACb,CAAC,CAAC,CACH,CAAA;QACH,CAAC;KACF,CAAC;IAEC,mBAAA,IAAA,mBAAI,GAAE,CAAA;IACN,mBAAA,IAAA,kBAAG,EAAC,cAAc,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAA;IACvC,mBAAA,IAAA,kBAAG,EAAC,cAAc,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAA;;;4CACvC,8CAAqB;yEAEvB;uCApHU,4BAA4B;IADxC,IAAA,uBAAQ,EAAC,yCAAgB,CAAC;GACd,4BAA4B,CAqHxC","sourcesContent":["import { Resolver, Subscription, Root, Arg } from 'type-graphql'\nimport { filter, pipe } from 'graphql-yoga'\nimport { pubsub, Log } from '@things-factory/shell'\nimport { ScenarioInstance, ScenarioInstanceState } from './scenario-instance-type'\nimport { ScenarioEngine } from '../../engine'\n\nconst debug = require('debug')('things-factory:integration:scenario-instance-subscription')\n\n@Resolver(ScenarioInstance)\nexport class ScenarioInstanceSubscription {\n @Subscription({\n description: 'Subscribes to log messages from scenario instances.',\n subscribe: ({ args, context, info }) => {\n const { domain, user } = context.state\n const { instanceName, scenarioName, level } = args\n const subdomain = domain?.subdomain\n\n debug('subscribe', subdomain, scenarioName, instanceName)\n\n if (!domain) {\n throw new Error('domain required')\n }\n\n if (!user.domains?.find(d => d.subdomain === subdomain) && !process.superUserGranted(domain, user)) {\n throw new Error(`domain(${subdomain}) is not working for user(${user.email}).`)\n }\n\n return pipe(\n pubsub.subscribe('scenario-instance-log'),\n filter((payload: { scenarioInstanceLog: Log }) => {\n const { source, level: plevel } = payload.scenarioInstanceLog\n const { domain: pdomain, scenarioName: pscenarioName, instanceName: pinstanceName } = source as any\n\n if (subdomain !== pdomain?.subdomain) {\n return false\n }\n\n if (scenarioName && pscenarioName !== scenarioName) {\n return false\n }\n\n if (instanceName && pinstanceName !== instanceName) {\n return false\n }\n\n if (level && level !== plevel) {\n return false\n }\n\n return true\n })\n )\n }\n })\n scenarioInstanceLog(\n @Root() payload: { scenarioInstanceLog: Log },\n @Arg('scenarioName', { nullable: true }) scenarioName: string,\n @Arg('instanceName', { nullable: true }) instanceName: string,\n @Arg('level', { nullable: true }) level: string\n ): Log {\n return payload.scenarioInstanceLog\n }\n\n @Subscription({\n description: 'Subscribes to state changes from scenario instances.',\n subscribe: ({ args, context, info }) => {\n const { domain, user } = context.state\n const { instanceName, scenarioName } = args\n const subdomain = domain?.subdomain\n\n debug('subscribe', subdomain, scenarioName, instanceName)\n\n if (!domain) {\n throw new Error('domain required')\n }\n\n if (!user.domains?.find(d => d.subdomain === subdomain) && !process.superUserGranted(domain, user)) {\n throw new Error(`domain(${subdomain}) is not working for user(${user.email}).`)\n }\n\n process.nextTick(() => {\n ScenarioEngine.getScenarioInstances(domain)\n .filter(instance => {\n return (\n (!instanceName || instance.instanceName === instanceName) &&\n (!scenarioName || instance.scenarioName === scenarioName)\n )\n })\n .forEach(instance => {\n instance.publishState()\n })\n })\n\n return pipe(\n pubsub.subscribe('scenario-instance-state'),\n filter((payload: { scenarioInstanceState: ScenarioInstanceState }) => {\n const {\n domain: pdomain,\n scenarioName: pscenarioName,\n instanceName: pinstanceName\n } = payload.scenarioInstanceState\n\n if (subdomain !== pdomain?.subdomain) {\n return false\n }\n\n if (scenarioName && pscenarioName !== scenarioName) {\n return false\n }\n\n if (instanceName && pinstanceName !== instanceName) {\n return false\n }\n\n return true\n })\n )\n }\n })\n scenarioInstanceState(\n @Root() payload: { scenarioInstanceState: ScenarioInstanceState },\n @Arg('scenarioName', { nullable: true }) scenarioName: string,\n @Arg('instanceName', { nullable: true }) instanceName: string\n ): ScenarioInstanceState {\n return payload.scenarioInstanceState\n }\n}\n"]}
|