@digipair/skill-factory 0.68.0 → 0.69.1

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/index.cjs.js CHANGED
@@ -19,40 +19,40 @@ let FactoryService = class FactoryService {
19
19
  }
20
20
  return result;
21
21
  }
22
- async executeWithContext(params, _pinsSettingsList, _context) {
23
- const { execute, context } = params;
22
+ async execute(params, _pinsSettingsList, _context) {
23
+ const { execute, context = _context } = params;
24
24
  const result = await engine.executePinsList(execute, context);
25
25
  return result;
26
26
  }
27
27
  async keepAlive(_params, _pinsSettingsList, _context) {
28
28
  throw 'DIGIPAIR_KEEPALIVE';
29
29
  }
30
- async send(params, _pinsSettingsList, context) {
31
- const { body } = params;
32
- return context.protected.res.send(body);
30
+ async task(params, _pinsSettingsList, context) {
31
+ const { execute } = params;
32
+ return await engine.executePinsList(execute, context);
33
33
  }
34
- async status(params, _pinsSettingsList, context) {
35
- const { code = 200 } = params;
36
- return context.protected.res.status(code);
34
+ async action(params, _pinsSettingsList, context) {
35
+ const { execute } = params;
36
+ return await engine.executePinsList(execute, context);
37
37
  }
38
- async headers(params, _pinsSettingsList, context) {
39
- const { headers } = params;
40
- return context.protected.res.set(headers);
38
+ async trigger(params, _pinsSettingsList, context) {
39
+ const { execute } = params;
40
+ return await engine.executePinsList(execute, context);
41
41
  }
42
42
  };
43
43
  let instance;
44
44
  const initialize = (launcher)=>(instance = new FactoryService()).initialize(launcher);
45
45
  const start = (params, pinsSettingsList, context)=>instance.start(params, pinsSettingsList, context);
46
- const executeWithContext = (params, pinsSettingsList, context)=>instance.executeWithContext(params, pinsSettingsList, context);
47
- const keepAlive = (params, pinsSettingsList, context)=>instance.keepAlive(params, pinsSettingsList, context);
48
- const send = (params, pinsSettingsList, context)=>instance.send(params, pinsSettingsList, context);
49
- const status = (params, pinsSettingsList, context)=>instance.status(params, pinsSettingsList, context);
50
- const headers = (params, pinsSettingsList, context)=>instance.headers(params, pinsSettingsList, context);
46
+ const execute = (params, pinsSettingsList, context)=>new FactoryService().execute(params, pinsSettingsList, context);
47
+ const keepAlive = (params, pinsSettingsList, context)=>new FactoryService().keepAlive(params, pinsSettingsList, context);
48
+ const task = (params, pinsSettingsList, context)=>new FactoryService().task(params, pinsSettingsList, context);
49
+ const action = (params, pinsSettingsList, context)=>new FactoryService().action(params, pinsSettingsList, context);
50
+ const trigger = (params, pinsSettingsList, context)=>new FactoryService().trigger(params, pinsSettingsList, context);
51
51
 
52
- exports.executeWithContext = executeWithContext;
53
- exports.headers = headers;
52
+ exports.action = action;
53
+ exports.execute = execute;
54
54
  exports.initialize = initialize;
55
55
  exports.keepAlive = keepAlive;
56
- exports.send = send;
57
56
  exports.start = start;
58
- exports.status = status;
57
+ exports.task = task;
58
+ exports.trigger = trigger;
package/index.esm.js CHANGED
@@ -23899,14 +23899,14 @@ function indent(str, spaces) {
23899
23899
  var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
23900
23900
  // match is required
23901
23901
  if (!match) {
23902
- return nextMatch = nextMatch1, i = i1, tokens = tokens1, {
23902
+ return i = i1, nextMatch = nextMatch1, tokens = tokens1, {
23903
23903
  v: nextMatch1
23904
23904
  };
23905
23905
  }
23906
23906
  var token = match.token, offset = match.offset;
23907
23907
  i1 += offset;
23908
23908
  if (token === " ") {
23909
- return nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
23909
+ return i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
23910
23910
  }
23911
23911
  tokens1 = _to_consumable_array$1(tokens1).concat([
23912
23912
  token
@@ -23925,7 +23925,7 @@ function indent(str, spaces) {
23925
23925
  if (contextKeys.some(function(el) {
23926
23926
  return el.startsWith(name);
23927
23927
  })) {
23928
- return nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
23928
+ return i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
23929
23929
  }
23930
23930
  if (dateTimeIdentifiers.some(function(el) {
23931
23931
  return el === name;
@@ -23944,9 +23944,9 @@ function indent(str, spaces) {
23944
23944
  if (dateTimeIdentifiers.some(function(el) {
23945
23945
  return el.startsWith(name);
23946
23946
  })) {
23947
- return nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
23947
+ return i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
23948
23948
  }
23949
- return nextMatch = nextMatch1, i = i1, tokens = tokens1, {
23949
+ return i = i1, nextMatch = nextMatch1, tokens = tokens1, {
23950
23950
  v: nextMatch1
23951
23951
  };
23952
23952
  };
@@ -27990,34 +27990,34 @@ let FactoryService = class FactoryService {
27990
27990
  }
27991
27991
  return result;
27992
27992
  }
27993
- async executeWithContext(params, _pinsSettingsList, _context) {
27994
- const { execute, context } = params;
27993
+ async execute(params, _pinsSettingsList, _context) {
27994
+ const { execute, context = _context } = params;
27995
27995
  const result = await executePinsList(execute, context);
27996
27996
  return result;
27997
27997
  }
27998
27998
  async keepAlive(_params, _pinsSettingsList, _context) {
27999
27999
  throw 'DIGIPAIR_KEEPALIVE';
28000
28000
  }
28001
- async send(params, _pinsSettingsList, context) {
28002
- const { body } = params;
28003
- return context.protected.res.send(body);
28001
+ async task(params, _pinsSettingsList, context) {
28002
+ const { execute } = params;
28003
+ return await executePinsList(execute, context);
28004
28004
  }
28005
- async status(params, _pinsSettingsList, context) {
28006
- const { code = 200 } = params;
28007
- return context.protected.res.status(code);
28005
+ async action(params, _pinsSettingsList, context) {
28006
+ const { execute } = params;
28007
+ return await executePinsList(execute, context);
28008
28008
  }
28009
- async headers(params, _pinsSettingsList, context) {
28010
- const { headers } = params;
28011
- return context.protected.res.set(headers);
28009
+ async trigger(params, _pinsSettingsList, context) {
28010
+ const { execute } = params;
28011
+ return await executePinsList(execute, context);
28012
28012
  }
28013
28013
  };
28014
28014
  let instance;
28015
28015
  const initialize = (launcher)=>(instance = new FactoryService()).initialize(launcher);
28016
28016
  const start = (params, pinsSettingsList, context)=>instance.start(params, pinsSettingsList, context);
28017
- const executeWithContext = (params, pinsSettingsList, context)=>instance.executeWithContext(params, pinsSettingsList, context);
28018
- const keepAlive = (params, pinsSettingsList, context)=>instance.keepAlive(params, pinsSettingsList, context);
28019
- const send = (params, pinsSettingsList, context)=>instance.send(params, pinsSettingsList, context);
28020
- const status = (params, pinsSettingsList, context)=>instance.status(params, pinsSettingsList, context);
28021
- const headers = (params, pinsSettingsList, context)=>instance.headers(params, pinsSettingsList, context);
28017
+ const execute = (params, pinsSettingsList, context)=>new FactoryService().execute(params, pinsSettingsList, context);
28018
+ const keepAlive = (params, pinsSettingsList, context)=>new FactoryService().keepAlive(params, pinsSettingsList, context);
28019
+ const task = (params, pinsSettingsList, context)=>new FactoryService().task(params, pinsSettingsList, context);
28020
+ const action = (params, pinsSettingsList, context)=>new FactoryService().action(params, pinsSettingsList, context);
28021
+ const trigger = (params, pinsSettingsList, context)=>new FactoryService().trigger(params, pinsSettingsList, context);
28022
28022
 
28023
- export { executeWithContext, headers, initialize, keepAlive, send, start, status };
28023
+ export { action, execute, initialize, keepAlive, start, task, trigger };
@@ -1,8 +1,8 @@
1
1
  import { PinsSettings } from '@digipair/engine';
2
2
  export declare const initialize: (launcher: Function) => Promise<void>;
3
3
  export declare const start: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
4
- export declare const executeWithContext: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
4
+ export declare const execute: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
5
5
  export declare const keepAlive: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<void>;
6
- export declare const send: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
7
- export declare const status: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
8
- export declare const headers: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
6
+ export declare const task: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
7
+ export declare const action: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
8
+ export declare const trigger: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digipair/skill-factory",
3
- "version": "0.68.0",
3
+ "version": "0.69.1",
4
4
  "dependencies": {},
5
5
  "main": "./index.cjs.js",
6
6
  "module": "./index.esm.js"
package/schema.fr.json CHANGED
@@ -54,7 +54,7 @@
54
54
  "x-events": []
55
55
  }
56
56
  },
57
- "/executeWithContext": {
57
+ "/execute": {
58
58
  "post": {
59
59
  "tags": ["service"],
60
60
  "summary": "Execute avec un contexte",
@@ -74,7 +74,7 @@
74
74
  },
75
75
  {
76
76
  "name": "context",
77
- "required": true,
77
+ "required": false,
78
78
  "summary": "Contexte",
79
79
  "description": "Contexte d'exécution",
80
80
  "schema": {
@@ -93,66 +93,150 @@
93
93
  "parameters": [],
94
94
  "x-events": []
95
95
  }
96
- },
97
- "/send": {
98
- "post": {
99
- "tags": ["service"],
100
- "summary": "Envoi de données HTTP",
101
- "description": "Envoi de données à la connection HTTP",
102
- "parameters": [
103
- {
104
- "name": "body",
105
- "required": false,
106
- "summary": "Body",
107
- "description": "Corps de la réponse",
108
- "schema": {
109
- "type": "object"
96
+ }
97
+ },
98
+ "x-scene-blocks": {
99
+ "/task": {
100
+ "summary": "Tache",
101
+ "description": "Exécution d'une tache.",
102
+ "tags": ["service"],
103
+ "metadata": [],
104
+ "parameters": [
105
+ {
106
+ "name": "execute",
107
+ "summary": "Exécute",
108
+ "required": true,
109
+ "description": "Commandes à exécuter",
110
+ "schema": {
111
+ "type": "array",
112
+ "items": {
113
+ "$ref": "https://schemas.digipair.ai/pinsSettings"
110
114
  }
111
115
  }
112
- ],
113
- "x-events": []
114
- }
116
+ }
117
+ ]
115
118
  },
116
- "/status": {
117
- "post": {
118
- "tags": ["service"],
119
- "summary": "Code de retour HTTP",
120
- "description": "Envoi d'un code de retour à la connection HTTP",
121
- "parameters": [
122
- {
123
- "name": "code",
124
- "required": true,
125
- "summary": "Code de retour",
126
- "description": "Code de retour",
127
- "schema": {
128
- "type": "number"
119
+ "/action": {
120
+ "summary": "Action",
121
+ "description": "Action exécutable.",
122
+ "tags": ["service"],
123
+ "metadata": [
124
+ {
125
+ "name": "tags",
126
+ "summary": "Tags",
127
+ "required": true,
128
+ "description": "Tags de l'action",
129
+ "schema": {
130
+ "type": "array",
131
+ "items": {
132
+ "type": "string"
129
133
  }
130
134
  }
131
- ],
132
- "x-events": []
133
- }
135
+ },
136
+ {
137
+ "name": "parameters",
138
+ "summary": "Paramètres",
139
+ "required": true,
140
+ "description": "Paramètres de l'action",
141
+ "schema": {
142
+ "type": "array",
143
+ "items": {
144
+ "$ref": "#/components/schemas/Parameter"
145
+ }
146
+ }
147
+ }
148
+ ],
149
+ "parameters": [
150
+ {
151
+ "name": "execute",
152
+ "summary": "Execute",
153
+ "required": true,
154
+ "description": "Commandes à exécuter.",
155
+ "schema": {
156
+ "type": "array",
157
+ "items": {
158
+ "$ref": "https://schemas.digipair.ai/pinsSettings"
159
+ }
160
+ }
161
+ }
162
+ ]
134
163
  },
135
- "/headers": {
136
- "post": {
137
- "tags": ["service"],
138
- "summary": "Headers HTTP",
139
- "description": "Envoi des headers à la connection HTTP",
140
- "parameters": [
141
- {
142
- "name": "headers",
143
- "required": true,
144
- "summary": "Headers",
145
- "description": "Headers",
146
- "schema": {
147
- "type": "object"
164
+ "/trigger": {
165
+ "summary": "Déclencheur",
166
+ "description": "Déclenchement d'une exécution d'actions.",
167
+ "tags": ["service"],
168
+ "metadata": [
169
+ {
170
+ "name": "tags",
171
+ "summary": "Tags",
172
+ "required": true,
173
+ "description": "Tags du déclencheur",
174
+ "schema": {
175
+ "type": "array",
176
+ "items": {
177
+ "type": "string"
148
178
  }
149
179
  }
150
- ],
151
- "x-events": []
152
- }
180
+ },
181
+ {
182
+ "name": "parameters",
183
+ "summary": "Paramètres",
184
+ "required": true,
185
+ "description": "Paramètres du déclencheur",
186
+ "schema": {
187
+ "type": "array",
188
+ "items": {
189
+ "$ref": "#/components/schemas/Parameter"
190
+ }
191
+ }
192
+ }
193
+ ],
194
+ "parameters": [
195
+ {
196
+ "name": "execute",
197
+ "summary": "Execute",
198
+ "required": true,
199
+ "description": "Commandes à exécuter.",
200
+ "schema": {
201
+ "type": "array",
202
+ "items": {
203
+ "$ref": "https://schemas.digipair.ai/pinsSettings"
204
+ }
205
+ }
206
+ }
207
+ ]
153
208
  }
154
209
  },
155
210
  "components": {
156
- "schemas": {}
211
+ "schemas": {
212
+ "Parameter": {
213
+ "type": "object",
214
+ "tags": ["service"],
215
+ "summary": "Parameter",
216
+ "properties": {
217
+ "name": {
218
+ "summary": "Nom",
219
+ "type": "string"
220
+ },
221
+ "summary": {
222
+ "summary": "Affichage",
223
+ "type": "string"
224
+ },
225
+ "required": {
226
+ "summary": "Requis",
227
+ "type": "boolean"
228
+ },
229
+ "schema": {
230
+ "summary": "Schema",
231
+ "type": "object"
232
+ },
233
+ "description": {
234
+ "summary": "Description",
235
+ "type": "string"
236
+ }
237
+ },
238
+ "required": ["name", "summary", "required", "schema"]
239
+ }
240
+ }
157
241
  }
158
242
  }
package/schema.json CHANGED
@@ -54,7 +54,7 @@
54
54
  "x-events": []
55
55
  }
56
56
  },
57
- "/executeWithContext": {
57
+ "/execute": {
58
58
  "post": {
59
59
  "tags": ["service"],
60
60
  "summary": "Execute with context",
@@ -74,7 +74,7 @@
74
74
  },
75
75
  {
76
76
  "name": "context",
77
- "required": true,
77
+ "required": false,
78
78
  "summary": "Context",
79
79
  "description": "Context of the execution",
80
80
  "schema": {
@@ -93,66 +93,150 @@
93
93
  "parameters": [],
94
94
  "x-events": []
95
95
  }
96
- },
97
- "/send": {
98
- "post": {
96
+ }
97
+ },
98
+ "components": {
99
+ "schemas": {
100
+ "Parameter": {
101
+ "type": "object",
99
102
  "tags": ["service"],
100
- "summary": "Send HTTP",
101
- "description": "Send an HTTP request",
102
- "parameters": [
103
- {
104
- "name": "body",
105
- "required": false,
106
- "summary": "Body",
107
- "description": "Body of the request",
108
- "schema": {
109
- "type": "object"
110
- }
103
+ "summary": "Parameter",
104
+ "properties": {
105
+ "name": {
106
+ "summary": "Name",
107
+ "type": "string"
108
+ },
109
+ "summary": {
110
+ "summary": "Summary",
111
+ "type": "string"
112
+ },
113
+ "required": {
114
+ "summary": "Required",
115
+ "type": "boolean"
116
+ },
117
+ "schema": {
118
+ "summary": "Schema",
119
+ "type": "object"
120
+ },
121
+ "description": {
122
+ "summary": "Summary",
123
+ "type": "string"
111
124
  }
112
- ],
113
- "x-events": []
125
+ },
126
+ "required": ["name", "summary", "required", "schema"]
114
127
  }
128
+ }
129
+ },
130
+ "x-scene-blocks": {
131
+ "/task": {
132
+ "summary": "Task",
133
+ "description": "Execution of a task.",
134
+ "tags": ["service"],
135
+ "metadata": [],
136
+ "parameters": [
137
+ {
138
+ "name": "execute",
139
+ "summary": "Execute",
140
+ "required": true,
141
+ "description": "Commands to execute",
142
+ "schema": {
143
+ "type": "array",
144
+ "items": {
145
+ "$ref": "https://schemas.digipair.ai/pinsSettings"
146
+ }
147
+ }
148
+ }
149
+ ]
115
150
  },
116
- "/status": {
117
- "post": {
118
- "tags": ["service"],
119
- "summary": "Send HTTP status",
120
- "description": "Send an HTTP status",
121
- "parameters": [
122
- {
123
- "name": "code",
124
- "required": true,
125
- "summary": "Return code",
126
- "description": "HTTP return code",
127
- "schema": {
128
- "type": "number"
151
+ "/action": {
152
+ "summary": "Action",
153
+ "description": "Executable action.",
154
+ "tags": ["service"],
155
+ "metadata": [
156
+ {
157
+ "name": "tags",
158
+ "summary": "Tags",
159
+ "required": true,
160
+ "description": "Action tags",
161
+ "schema": {
162
+ "type": "array",
163
+ "items": {
164
+ "type": "string"
129
165
  }
130
166
  }
131
- ],
132
- "x-events": []
133
- }
167
+ },
168
+ {
169
+ "name": "parameters",
170
+ "summary": "Parameters",
171
+ "required": true,
172
+ "description": "Input parameters",
173
+ "schema": {
174
+ "type": "array",
175
+ "items": {
176
+ "$ref": "#/components/schemas/Parameter"
177
+ }
178
+ }
179
+ }
180
+ ],
181
+ "parameters": [
182
+ {
183
+ "name": "execute",
184
+ "summary": "Execute",
185
+ "required": true,
186
+ "description": "Commands to execute",
187
+ "schema": {
188
+ "type": "array",
189
+ "items": {
190
+ "$ref": "https://schemas.digipair.ai/pinsSettings"
191
+ }
192
+ }
193
+ }
194
+ ]
134
195
  },
135
- "/headers": {
136
- "post": {
137
- "tags": ["service"],
138
- "summary": "Send HTTP headers",
139
- "description": "Send HTTP headers",
140
- "parameters": [
141
- {
142
- "name": "headers",
143
- "required": true,
144
- "summary": "Headers",
145
- "description": "HTTP headers",
146
- "schema": {
147
- "type": "object"
196
+ "/trigger": {
197
+ "summary": "Trigger",
198
+ "description": "Executable trigger.",
199
+ "tags": ["service"],
200
+ "metadata": [
201
+ {
202
+ "name": "tags",
203
+ "summary": "Tags",
204
+ "required": true,
205
+ "description": "Trigger tags",
206
+ "schema": {
207
+ "type": "array",
208
+ "items": {
209
+ "type": "string"
148
210
  }
149
211
  }
150
- ],
151
- "x-events": []
152
- }
212
+ },
213
+ {
214
+ "name": "parameters",
215
+ "summary": "Parameters",
216
+ "required": true,
217
+ "description": "Input parameters",
218
+ "schema": {
219
+ "type": "array",
220
+ "items": {
221
+ "$ref": "#/components/schemas/Parameter"
222
+ }
223
+ }
224
+ }
225
+ ],
226
+ "parameters": [
227
+ {
228
+ "name": "execute",
229
+ "summary": "Execute",
230
+ "required": true,
231
+ "description": "Commands to execute",
232
+ "schema": {
233
+ "type": "array",
234
+ "items": {
235
+ "$ref": "https://schemas.digipair.ai/pinsSettings"
236
+ }
237
+ }
238
+ }
239
+ ]
153
240
  }
154
- },
155
- "components": {
156
- "schemas": {}
157
241
  }
158
242
  }
File without changes