speechstate 2.8.2 → 2.8.3-pr13-1-13187794303.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/asr.d.ts CHANGED
@@ -31,7 +31,9 @@ export declare const asrMachine: import("xstate").StateMachine<ASRContext, ASREv
31
31
  type: "nlu_is_activated";
32
32
  params: unknown;
33
33
  }, "noinputTimeout", "Ready" | "Fail" | "NLURequest" | {
34
- Recognising: "WaitForRecogniser" | "NoInput" | "InProgress" | "WaitToStop" | "Stopped" | {
34
+ Recognising: "WaitForRecogniser" | "InProgress" | "WaitToStop" | "Stopped" | {
35
+ NoInput: "Wait" | "ApplyNoInputTimeout";
36
+ } | {
35
37
  Pausing: "Paused" | "WaitToPause" | "Continue";
36
38
  };
37
39
  }, string, ASRInit, {}, import("xstate").EventObject, import("xstate").MetaObject, {
@@ -107,6 +109,7 @@ export declare const asrMachine: import("xstate").StateMachine<ASRContext, ASREv
107
109
  azureRegion: string;
108
110
  azureLanguageCredentials: AzureLanguageCredentials;
109
111
  speechRecognitionEndpointId: string;
112
+ params: {};
110
113
  };
111
114
  readonly initial: "Ready";
112
115
  readonly on: {
@@ -157,6 +160,29 @@ export declare const asrMachine: import("xstate").StateMachine<ASRContext, ASREv
157
160
  };
158
161
  }>, never, never, never, never>;
159
162
  };
163
+ readonly UPDATE_ASR_PARAMS: {
164
+ readonly actions: readonly [({ event }: import("xstate").ActionArgs<ASRContext, {
165
+ type: "UPDATE_ASR_PARAMS";
166
+ value: import("./types").RecogniseParameters;
167
+ }, ASREvent>) => void, import("xstate").ActionFunction<ASRContext, {
168
+ type: "UPDATE_ASR_PARAMS";
169
+ value: import("./types").RecogniseParameters;
170
+ }, ASREvent, undefined, import("xstate").Values<{
171
+ new_ponyfill: {
172
+ src: "new_ponyfill";
173
+ logic: import("xstate").CallbackActorLogic<null, ASRPonyfillInput, import("xstate").EventObject>;
174
+ id: string;
175
+ };
176
+ nluPromise: {
177
+ src: "nluPromise";
178
+ logic: import("xstate").PromiseActorLogic<any, AzureLanguageCredentials & {
179
+ query: string;
180
+ locale: string;
181
+ }, import("xstate").EventObject>;
182
+ id: string;
183
+ };
184
+ }>, never, never, never, never>];
185
+ };
160
186
  };
161
187
  };
162
188
  readonly Recognising: {
@@ -208,15 +234,27 @@ export declare const asrMachine: import("xstate").StateMachine<ASRContext, ASREv
208
234
  };
209
235
  };
210
236
  readonly NoInput: {
211
- readonly entry: {
212
- readonly type: "raise_noinput_after_timeout";
213
- };
237
+ readonly initial: "Wait";
214
238
  readonly on: {
215
239
  readonly STARTSPEECH: {
216
240
  readonly target: "InProgress";
217
- readonly actions: import("xstate").CancelAction<ASRContext, {
241
+ readonly actions: readonly [import("xstate").ActionFunction<ASRContext, {
242
+ type: "STARTSPEECH";
243
+ }, ASREvent, undefined, never, never, never, "noinputTimeout", never>, import("xstate").CancelAction<ASRContext, {
218
244
  type: "STARTSPEECH";
219
- }, undefined, ASREvent>;
245
+ }, undefined, ASREvent>];
246
+ };
247
+ };
248
+ readonly states: {
249
+ readonly Wait: {
250
+ readonly on: {
251
+ readonly START_NOINPUT_TIMEOUT: "ApplyNoInputTimeout";
252
+ };
253
+ };
254
+ readonly ApplyNoInputTimeout: {
255
+ readonly entry: readonly [({ context }: import("xstate").ActionArgs<ASRContext, ASREvent, ASREvent>) => void, {
256
+ readonly type: "raise_noinput_after_timeout";
257
+ }];
220
258
  };
221
259
  };
222
260
  readonly exit: {
@@ -324,10 +362,10 @@ export declare const asrMachine: import("xstate").StateMachine<ASRContext, ASREv
324
362
  event: ASREvent;
325
363
  self: import("xstate").ActorRef<import("xstate").MachineSnapshot<ASRContext, ASREvent, Record<string, import("xstate").AnyActorRef>, import("xstate").StateValue, string, unknown, any, any>, ASREvent, import("xstate").AnyEventObject>;
326
364
  }) => {
327
- endpoint: string;
328
- key: string;
329
- projectName: string;
330
- deploymentName: string;
365
+ endpoint: any;
366
+ key: any;
367
+ projectName: any;
368
+ deploymentName: any;
331
369
  query: string;
332
370
  locale: string;
333
371
  };
package/dist/asr.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"asr.d.ts","sourceRoot":"","sources":["../src/asr.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,UAAU,EACV,QAAQ,EACR,OAAO,EACP,gBAAgB,EAChB,UAAU,EACV,wBAAwB,EACzB,MAAM,SAAS,CAAC;AAMjB,eAAO,MAAM,UAAU;;eAwGmB,MAAM;gBAAU,MAAM;;;;;;;;;;;mBAAtB,MAAM;oBAAU,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAAtB,MAAM;4BAAU,MAAM;;;;;;2BAAtB,MAAM;4BAAU,MAAM;;;;;;;;;;;;;;;;;;;+BAAtB,MAAM;gCAAU,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+BAAtB,MAAM;gCAAU,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;uCAAtB,MAAM;wCAAU,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+CAAtB,MAAM;gDAAU,MAAM;;;;;;;;;;;;;;;;;;;+CAAtB,MAAM;gDAAU,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiP9D,CAAC"}
1
+ {"version":3,"file":"asr.d.ts","sourceRoot":"","sources":["../src/asr.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,UAAU,EACV,QAAQ,EACR,OAAO,EACP,gBAAgB,EAChB,UAAU,EACV,wBAAwB,EACzB,MAAM,SAAS,CAAC;AAMjB,eAAO,MAAM,UAAU;;eAwGmB,MAAM;gBAAU,MAAM;;;;;;;;;;;mBAAtB,MAAM;oBAAU,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAAtB,MAAM;4BAAU,MAAM;;;;;;2BAAtB,MAAM;4BAAU,MAAM;;;;;;;;;;;;;;;;;;;+BAAtB,MAAM;gCAAU,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+BAAtB,MAAM;gCAAU,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;uCAAtB,MAAM;wCAAU,MAAM;;;;;;;;;;;;;;;;;;;;;;uCAAtB,MAAM;wCAAU,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+CAAtB,MAAM;gDAAU,MAAM;;;;;;;;;;;;;;;;;;;+CAAtB,MAAM;gDAAU,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6Q9D,CAAC"}
package/dist/asr.js CHANGED
@@ -19,7 +19,7 @@ exports.asrMachine = (0, xstate_1.setup)({
19
19
  input: {},
20
20
  },
21
21
  delays: {
22
- noinputTimeout: ({ context }) => (context.params || {}).noInputTimeout || context.asrDefaultNoInputTimeout,
22
+ noinputTimeout: ({ context }) => { var _a; return (_a = context.params.noInputTimeout) !== null && _a !== void 0 ? _a : context.asrDefaultNoInputTimeout; },
23
23
  },
24
24
  actions: {
25
25
  raise_noinput_after_timeout: (0, xstate_1.raise)({ type: "NOINPUT" }, {
@@ -30,7 +30,7 @@ exports.asrMachine = (0, xstate_1.setup)({
30
30
  },
31
31
  guards: {
32
32
  nlu_is_activated: ({ context }) => {
33
- const nlu = (context.params || {}).nlu;
33
+ const nlu = context.params.nlu;
34
34
  if (nlu) {
35
35
  if (typeof nlu === "object") {
36
36
  return true;
@@ -144,6 +144,7 @@ exports.asrMachine = (0, xstate_1.setup)({
144
144
  azureRegion: input.azureRegion,
145
145
  azureLanguageCredentials: input.azureLanguageCredentials,
146
146
  speechRecognitionEndpointId: input.speechRecognitionEndpointId,
147
+ params: {},
147
148
  }),
148
149
  initial: "Ready",
149
150
  on: {
@@ -160,10 +161,18 @@ exports.asrMachine = (0, xstate_1.setup)({
160
161
  on: {
161
162
  START: {
162
163
  target: "Recognising",
163
- actions: (0, xstate_1.assign)(({ event }) => ({
164
- params: event.value,
164
+ actions: (0, xstate_1.assign)(({ context, event }) => ({
165
+ params: Object.assign(Object.assign({}, context.params), event.value),
165
166
  })),
166
167
  },
168
+ UPDATE_ASR_PARAMS: {
169
+ actions: [
170
+ ({ event }) => console.debug("[ASR] UPDATE_ASR_PARAMS", event.value),
171
+ (0, xstate_1.assign)(({ event }) => ({
172
+ params: event.value,
173
+ })),
174
+ ],
175
+ },
167
176
  },
168
177
  },
169
178
  Recognising: {
@@ -175,11 +184,10 @@ exports.asrMachine = (0, xstate_1.setup)({
175
184
  azureRegion: context.azureRegion,
176
185
  audioContext: context.audioContext,
177
186
  azureAuthorizationToken: context.azureAuthorizationToken,
178
- locale: (context.params || {}).locale || context.locale,
187
+ locale: context.params.locale || context.locale,
179
188
  speechRecognitionEndpointId: context.speechRecognitionEndpointId,
180
- completeTimeout: (context.params || {}).completeTimeout ||
181
- context.asrDefaultCompleteTimeout,
182
- hints: (context.params || {}).hints,
189
+ completeTimeout: context.params.completeTimeout || context.asrDefaultCompleteTimeout,
190
+ hints: context.params.hints,
183
191
  }),
184
192
  },
185
193
  on: {
@@ -208,11 +216,28 @@ exports.asrMachine = (0, xstate_1.setup)({
208
216
  },
209
217
  },
210
218
  NoInput: {
211
- entry: { type: "raise_noinput_after_timeout" },
219
+ initial: "Wait",
212
220
  on: {
213
221
  STARTSPEECH: {
214
222
  target: "InProgress",
215
- actions: (0, xstate_1.cancel)("completeTimeout"),
223
+ actions: [
224
+ (0, xstate_1.sendParent)({ type: "STARTSPEECH" }),
225
+ (0, xstate_1.cancel)("completeTimeout"),
226
+ ],
227
+ },
228
+ },
229
+ states: {
230
+ Wait: {
231
+ on: { START_NOINPUT_TIMEOUT: "ApplyNoInputTimeout" },
232
+ },
233
+ ApplyNoInputTimeout: {
234
+ entry: [
235
+ ({ context }) => {
236
+ var _a;
237
+ return console.debug("[ASR] START_NOINPUT_TIMEOUT", (_a = context.params.noInputTimeout) !== null && _a !== void 0 ? _a : context.asrDefaultNoInputTimeout);
238
+ },
239
+ { type: "raise_noinput_after_timeout" },
240
+ ],
216
241
  },
217
242
  },
218
243
  exit: { type: "cancel_noinput_timeout" },
@@ -293,7 +318,7 @@ exports.asrMachine = (0, xstate_1.setup)({
293
318
  projectName: c.projectName,
294
319
  deploymentName: c.deploymentName,
295
320
  query: context.result[0].utterance,
296
- locale: (context.params || {}).locale || context.locale,
321
+ locale: context.params.locale || context.locale,
297
322
  };
298
323
  },
299
324
  onDone: [
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export { speechstate } from "./speechstate";
2
- export { AzureCredentials, Settings, Hypothesis, Agenda, RecogniseParameters, } from "./types";
2
+ export { AzureSpeechCredentials, Settings, Hypothesis, Agenda, RecogniseParameters, } from "./types";
3
3
  export type { SpeechStateExternalEvent } from "./types";
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EACL,gBAAgB,EAChB,QAAQ,EACR,UAAU,EACV,MAAM,EACN,mBAAmB,GACpB,MAAM,SAAS,CAAC;AAEjB,YAAY,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EACL,sBAAsB,EACtB,QAAQ,EACR,UAAU,EACV,MAAM,EACN,mBAAmB,GACpB,MAAM,SAAS,CAAC;AAEjB,YAAY,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC"}