@xapp/stentor-templates 1.27.4 → 1.27.7
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/CHANGELOG.md +27 -0
- package/README.md +2 -1
- package/lib/MediaTemplateFactory.d.ts +9 -0
- package/lib/MediaTemplateFactory.js +90 -0
- package/lib/MediaTemplateFactory.js.map +1 -0
- package/lib/TemplateFactory.d.ts +25 -37
- package/lib/TemplateFactory.js +0 -104
- package/lib/TemplateFactory.js.map +1 -1
- package/lib/index.d.ts +6 -0
- package/lib/index.js +19 -0
- package/lib/index.js.map +1 -0
- package/lib/oc-studio-starter/Constants.d.ts +3 -0
- package/lib/oc-studio-starter/Constants.js +5 -0
- package/lib/oc-studio-starter/Constants.js.map +1 -0
- package/lib/oc-studio-starter/OCStudioStarterTemplate.d.ts +5 -0
- package/lib/oc-studio-starter/OCStudioStarterTemplate.js +4 -0
- package/lib/oc-studio-starter/OCStudioStarterTemplate.js.map +1 -0
- package/lib/oc-studio-starter/OCStudioStarterTemplateFactory.d.ts +18 -0
- package/lib/oc-studio-starter/OCStudioStarterTemplateFactory.js +75 -0
- package/lib/oc-studio-starter/OCStudioStarterTemplateFactory.js.map +1 -0
- package/lib/oc-studio-starter/index.d.ts +4 -0
- package/lib/oc-studio-starter/index.js +17 -0
- package/lib/oc-studio-starter/index.js.map +1 -0
- package/lib/onDemand/OnDemandTemplateFactory.d.ts +6 -3
- package/lib/onDemand/OnDemandTemplateFactory.js +11 -2
- package/lib/onDemand/OnDemandTemplateFactory.js.map +1 -1
- package/lib/radio/RadioTemplateFactory.d.ts +6 -3
- package/lib/radio/RadioTemplateFactory.js +11 -2
- package/lib/radio/RadioTemplateFactory.js.map +1 -1
- package/package.json +12 -10
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,33 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.27.7](https://github.com/XappMedia/stentor-core/compare/v1.27.6...v1.27.7) (2020-10-28)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @xapp/stentor-templates
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [1.27.6](https://github.com/XappMedia/stentor-core/compare/v1.27.5...v1.27.6) (2020-10-28)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @xapp/stentor-templates
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [1.27.5](https://github.com/XappMedia/stentor-core/compare/v1.27.4...v1.27.5) (2020-10-28)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* **deps:** update stentor to v1.35.5 ([ef6f507](https://github.com/XappMedia/stentor-core/commit/ef6f507966b46f42c5be3ee4f31c85fd11227465))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
6
33
|
## [1.27.4](https://github.com/XappMedia/stentor-core/compare/v1.27.3...v1.27.4) (2020-10-27)
|
|
7
34
|
|
|
8
35
|
|
package/README.md
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
## @xapp/stentor-templates
|
|
2
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Template, OVAIApp } from "@xapp/ovai-lib";
|
|
2
|
+
import { TemplateFactory } from './TemplateFactory';
|
|
3
|
+
export declare abstract class MediaTemplateFactory<T extends Template> extends TemplateFactory<T> {
|
|
4
|
+
/**
|
|
5
|
+
* Overrides template properties with those from the provided app
|
|
6
|
+
*/
|
|
7
|
+
protected overrideWithAppProps?(template: T, app?: OVAIApp): T;
|
|
8
|
+
generateApp(template: T, app?: OVAIApp): OVAIApp;
|
|
9
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MediaTemplateFactory = void 0;
|
|
4
|
+
/*! Copyright (c) 2020, XAPPmedia */
|
|
5
|
+
const stentor_app_1 = require("@xapp/stentor-app");
|
|
6
|
+
const stentor_constants_1 = require("stentor-constants");
|
|
7
|
+
const TemplateFactory_1 = require("./TemplateFactory");
|
|
8
|
+
class MediaTemplateFactory extends TemplateFactory_1.TemplateFactory {
|
|
9
|
+
/**
|
|
10
|
+
* Overrides template properties with those from the provided app
|
|
11
|
+
*/
|
|
12
|
+
overrideWithAppProps(template, app) {
|
|
13
|
+
// Check to see if we have a donor App to build from
|
|
14
|
+
if (app) {
|
|
15
|
+
// Set the required keywords if they don't exist
|
|
16
|
+
template.keywords = [...new Set((app.keywords || []).concat(template.keywords))];
|
|
17
|
+
// if we do we need to set some parameters from it
|
|
18
|
+
if (app.testingInstructions) {
|
|
19
|
+
// See if we can pull the URL out of the testing instructions
|
|
20
|
+
const matches = app.testingInstructions.match(stentor_constants_1.URL_REGEX) || [];
|
|
21
|
+
// Only take the first one
|
|
22
|
+
template.collaborationAgreementUrl = matches[0];
|
|
23
|
+
}
|
|
24
|
+
// Also, set the location information
|
|
25
|
+
if (app.location) {
|
|
26
|
+
if (app.location.streetAddress && app.location.streetAddress.length > 0) {
|
|
27
|
+
template.location.streetAddress = app.location.streetAddress;
|
|
28
|
+
}
|
|
29
|
+
if (app.location.geocode && typeof app.location.geocode.latitude === "number") {
|
|
30
|
+
template.location.geocode.latitude = app.location.geocode.latitude;
|
|
31
|
+
}
|
|
32
|
+
if (app.location.geocode && typeof app.location.geocode.longitude === "number") {
|
|
33
|
+
template.location.geocode.longitude = app.location.geocode.longitude;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
// Get the icons
|
|
37
|
+
template.smallIcon = app.smallIcon || stentor_app_1.generateSmallIconUrl(app.icon);
|
|
38
|
+
template.largeIcon = app.largeIcon || stentor_app_1.generateLargeIconUrl(app.icon);
|
|
39
|
+
}
|
|
40
|
+
return template;
|
|
41
|
+
}
|
|
42
|
+
generateApp(template, app) {
|
|
43
|
+
// Clean up un-App items off the template before merging
|
|
44
|
+
const copy = Object.assign({}, template);
|
|
45
|
+
const cleanedTemplate = this.removeTemplateProperties(copy);
|
|
46
|
+
// Merge the existing properties of the template
|
|
47
|
+
const newApp = Object.assign(Object.assign({}, app), cleanedTemplate);
|
|
48
|
+
// Set the street address if it exists.
|
|
49
|
+
if (template.location && template.location.streetAddress) {
|
|
50
|
+
newApp.location = Object.assign(Object.assign({}, newApp.location), { streetAddress: template.location.streetAddress });
|
|
51
|
+
}
|
|
52
|
+
// Testing instructions contains the collab agreement
|
|
53
|
+
// The testing instructions, it is a template
|
|
54
|
+
newApp.testingInstructions =
|
|
55
|
+
`We have collaborated with the owner of this content to create and publish this skill.\n\n` +
|
|
56
|
+
`The signed IP rights for the app can be downloaded at: https://go.xappmedia.com/${newApp.organizationId}/iprights \n\n` +
|
|
57
|
+
`You will be prompted to login in first. The username is "alexa.cert@xappmedia.com" and the password is "S&9jDq@9".\n\n` +
|
|
58
|
+
`After successful login, the pdf should automatically download. If it does not download, then refresh https://go.xappmedia.com/${newApp.organizationId}/iprights or ` +
|
|
59
|
+
`click the link on the page to try again.`;
|
|
60
|
+
// Get the invocationName
|
|
61
|
+
let invocationName;
|
|
62
|
+
if (Array.isArray(template.invocationName)) {
|
|
63
|
+
invocationName = template.invocationName[0];
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
invocationName = template.invocationName;
|
|
67
|
+
}
|
|
68
|
+
// If it exists at this point, lowercase it and set it, otherwise leave it undefined.
|
|
69
|
+
newApp.invocationName = invocationName ? invocationName.toLowerCase() : undefined;
|
|
70
|
+
// Description and example phrases include the invocation name, don't generate them unless
|
|
71
|
+
// we have one.
|
|
72
|
+
if (newApp.invocationName) {
|
|
73
|
+
// For the description, we use the summary but at one line
|
|
74
|
+
// Make sure the summary ends in a period!
|
|
75
|
+
newApp.description =
|
|
76
|
+
template.summary +
|
|
77
|
+
`\n\nOnce you've enabled the skill, you can say "Alexa, open ${newApp.invocationName}“ to start listening.`;
|
|
78
|
+
// The example phrase are straight forward
|
|
79
|
+
newApp.examplePhrases = [`Alexa, open ${newApp.invocationName}`, `Alexa, pause`, `Alexa, resume`];
|
|
80
|
+
}
|
|
81
|
+
// Icons!
|
|
82
|
+
newApp.icon = template.icon;
|
|
83
|
+
newApp.smallIcon = stentor_app_1.generateSmallIconUrl(newApp.icon);
|
|
84
|
+
newApp.largeIcon = stentor_app_1.generateLargeIconUrl(newApp.icon);
|
|
85
|
+
// Be free new App!
|
|
86
|
+
return newApp;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
exports.MediaTemplateFactory = MediaTemplateFactory;
|
|
90
|
+
//# sourceMappingURL=MediaTemplateFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MediaTemplateFactory.js","sourceRoot":"","sources":["../src/MediaTemplateFactory.ts"],"names":[],"mappings":";;;AAAA,oCAAoC;AACpC,mDAA+E;AAG/E,yDAA8C;AAC9C,uDAAoD;AAEpD,MAAsB,oBAAyC,SAAQ,iCAAkB;IAErF;;OAEG;IACO,oBAAoB,CAAE,QAAW,EAAE,GAAa;QACtD,oDAAoD;QACpD,IAAI,GAAG,EAAE;YACL,gDAAgD;YAChD,QAAQ,CAAC,QAAQ,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;YAEjF,kDAAkD;YAClD,IAAI,GAAG,CAAC,mBAAmB,EAAE;gBACzB,6DAA6D;gBAC7D,MAAM,OAAO,GAAG,GAAG,CAAC,mBAAmB,CAAC,KAAK,CAAC,6BAAS,CAAC,IAAI,EAAE,CAAC;gBAC/D,0BAA0B;gBAC1B,QAAQ,CAAC,yBAAy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,kCAAoB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACrD,MAAM,CAAC,SAAS,GAAG,kCAAoB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAErD,mBAAmB;QACnB,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AAlGD,oDAkGC"}
|
package/lib/TemplateFactory.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright (c) 2019, XAPPmedia */
|
|
2
2
|
import { Template, OVAIApp } from "@xapp/ovai-lib";
|
|
3
|
-
import { Handler, Intent } from "stentor-models";
|
|
3
|
+
import { Handler, Intent, Entity, UtteranceTest } from "stentor-models";
|
|
4
4
|
/**
|
|
5
5
|
* Abstract TemplateFactory for generating Templates of a certain type.
|
|
6
6
|
*/
|
|
@@ -13,55 +13,43 @@ export declare abstract class TemplateFactory<T extends Template> {
|
|
|
13
13
|
*
|
|
14
14
|
* Note to implementer: This method should only be concerned with setting the parameters
|
|
15
15
|
* on the template it generates.
|
|
16
|
-
*
|
|
17
|
-
* @abstract
|
|
18
|
-
* @param {App} app
|
|
19
|
-
* @param {((Handler | Intent)[])} handlers
|
|
20
|
-
* @returns {(T | undefined)}
|
|
21
|
-
* @memberof TemplateFactory
|
|
22
|
-
*/
|
|
23
|
-
abstract generateTemplate(app: OVAIApp, handlers: (Handler | Intent)[]): T | undefined;
|
|
24
|
-
/**
|
|
25
|
-
* Overrides template properties with those from the provided app
|
|
26
|
-
*
|
|
27
|
-
* @protected
|
|
28
|
-
* @param {T} template
|
|
29
|
-
* @param {App} [app]
|
|
30
|
-
* @returns {T}
|
|
31
|
-
* @memberof TemplateFactory
|
|
32
16
|
*/
|
|
33
|
-
|
|
17
|
+
abstract generateTemplate?(app: OVAIApp, handlers: (Handler | Intent)[]): T | undefined;
|
|
34
18
|
/**
|
|
35
19
|
* Generate an App from the provided template with optional App is used to fill in
|
|
36
20
|
* already existing information that did not exist on the template.
|
|
37
|
-
*
|
|
38
|
-
* @abstract
|
|
39
|
-
* @param {T} template
|
|
40
|
-
* @param {App} [app]
|
|
41
|
-
* @returns {App}
|
|
42
|
-
* @memberof TemplateFactory
|
|
43
21
|
*/
|
|
44
|
-
generateApp(template: T, app?: OVAIApp): OVAIApp;
|
|
22
|
+
abstract generateApp(template: T, app?: OVAIApp): OVAIApp;
|
|
45
23
|
/**
|
|
46
24
|
* Template specific cleaner to remove the template properties making it
|
|
47
25
|
* just a partial App.
|
|
48
|
-
*
|
|
49
|
-
* @protected
|
|
50
|
-
* @abstract
|
|
51
|
-
* @returns {Partial<App>}
|
|
52
|
-
* @memberof TemplateFactory
|
|
53
26
|
*/
|
|
54
|
-
protected abstract removeTemplateProperties(template: T): Partial<OVAIApp>;
|
|
27
|
+
protected abstract removeTemplateProperties?(template: T): Partial<OVAIApp>;
|
|
55
28
|
/**
|
|
56
29
|
* Generate an array of Intents & Handlers from the provided template and optional existing handlers
|
|
57
30
|
* that are merged with the new handlers. Additionally, if other Intents or Handler are in the optional
|
|
58
31
|
* array, they are passed through to the new array.
|
|
59
32
|
*
|
|
60
|
-
* @
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
*
|
|
33
|
+
* @deprecated Use TemplateFactory#generateIntentsAndHandlers instead
|
|
34
|
+
*/
|
|
35
|
+
abstract generateHandlers?(template: T, handlers?: (Handler | Intent)[]): (Handler | Intent)[];
|
|
36
|
+
/**
|
|
37
|
+
* Generate intents and handlers for the templated app.
|
|
38
|
+
*
|
|
39
|
+
* @param template
|
|
40
|
+
* @param handlers
|
|
41
|
+
*/
|
|
42
|
+
abstract generateIntentsAndHandlers(template: T, handlers: (Handler | Intent)[]): (Handler | Intent)[];
|
|
43
|
+
/**
|
|
44
|
+
* Generate entities for the templated app.
|
|
45
|
+
*
|
|
46
|
+
* @param template
|
|
47
|
+
*/
|
|
48
|
+
abstract generateEntities(template?: T): Entity[];
|
|
49
|
+
/**
|
|
50
|
+
* Generate test cases for the templated app.
|
|
51
|
+
*
|
|
52
|
+
* @param template
|
|
65
53
|
*/
|
|
66
|
-
abstract
|
|
54
|
+
abstract generateUtterancesTests(template?: T): UtteranceTest[];
|
|
67
55
|
}
|
package/lib/TemplateFactory.js
CHANGED
|
@@ -1,114 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TemplateFactory = void 0;
|
|
4
|
-
const stentor_app_1 = require("@xapp/stentor-app");
|
|
5
|
-
const stentor_constants_1 = require("stentor-constants");
|
|
6
4
|
/**
|
|
7
5
|
* Abstract TemplateFactory for generating Templates of a certain type.
|
|
8
6
|
*/
|
|
9
7
|
class TemplateFactory {
|
|
10
|
-
/**
|
|
11
|
-
* Overrides template properties with those from the provided app
|
|
12
|
-
*
|
|
13
|
-
* @protected
|
|
14
|
-
* @param {T} template
|
|
15
|
-
* @param {App} [app]
|
|
16
|
-
* @returns {T}
|
|
17
|
-
* @memberof TemplateFactory
|
|
18
|
-
*/
|
|
19
|
-
overrideWithAppProps(template, app) {
|
|
20
|
-
// Check to see if we have a donor App to build from
|
|
21
|
-
if (app) {
|
|
22
|
-
// Set the required keywords if they don't exist
|
|
23
|
-
template.keywords = [...new Set((app.keywords || []).concat(template.keywords))];
|
|
24
|
-
// if we do we need to set some parameters from it
|
|
25
|
-
if (app.testingInstructions) {
|
|
26
|
-
// See if we can pull the URL out of the testing instructions
|
|
27
|
-
const matches = app.testingInstructions.match(stentor_constants_1.URL_REGEX) || [];
|
|
28
|
-
// Only take the first one
|
|
29
|
-
template.collaborationAgreementUrl = matches[0];
|
|
30
|
-
}
|
|
31
|
-
// Also, set the location information
|
|
32
|
-
if (app.location) {
|
|
33
|
-
if (app.location.streetAddress && app.location.streetAddress.length > 0) {
|
|
34
|
-
template.location.streetAddress = app.location.streetAddress;
|
|
35
|
-
}
|
|
36
|
-
if (app.location.geocode && typeof app.location.geocode.latitude === "number") {
|
|
37
|
-
template.location.geocode.latitude = app.location.geocode.latitude;
|
|
38
|
-
}
|
|
39
|
-
if (app.location.geocode && typeof app.location.geocode.longitude === "number") {
|
|
40
|
-
template.location.geocode.longitude = app.location.geocode.longitude;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
// Get the icons
|
|
44
|
-
template.smallIcon = app.smallIcon || stentor_app_1.generateSmallIconUrl(app.icon);
|
|
45
|
-
template.largeIcon = app.largeIcon || stentor_app_1.generateLargeIconUrl(app.icon);
|
|
46
|
-
template.endPoint = app.endPoint || stentor_app_1.generateEndpointMap(app);
|
|
47
|
-
// Set the platformData
|
|
48
|
-
if (app.platformData && app.platformData.alexa && app.platformData.alexa.privacyAndCompliance) {
|
|
49
|
-
template.platformData.alexa.privacyAndCompliance = app.platformData.alexa.privacyAndCompliance;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return template;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Generate an App from the provided template with optional App is used to fill in
|
|
56
|
-
* already existing information that did not exist on the template.
|
|
57
|
-
*
|
|
58
|
-
* @abstract
|
|
59
|
-
* @param {T} template
|
|
60
|
-
* @param {App} [app]
|
|
61
|
-
* @returns {App}
|
|
62
|
-
* @memberof TemplateFactory
|
|
63
|
-
*/
|
|
64
|
-
generateApp(template, app) {
|
|
65
|
-
// Clean up un-App items off the template before merging
|
|
66
|
-
const copy = Object.assign({}, template);
|
|
67
|
-
const cleanedTemplate = this.removeTemplateProperties(copy);
|
|
68
|
-
// Merge the existing properties of the template
|
|
69
|
-
const newApp = Object.assign(Object.assign({}, app), cleanedTemplate);
|
|
70
|
-
// Set the street address if it exists.
|
|
71
|
-
if (template.location && template.location.streetAddress) {
|
|
72
|
-
newApp.location = Object.assign(Object.assign({}, newApp.location), { streetAddress: template.location.streetAddress });
|
|
73
|
-
}
|
|
74
|
-
// Testing instructions contains the collab agreement
|
|
75
|
-
// The testing instructions, it is a template
|
|
76
|
-
newApp.testingInstructions =
|
|
77
|
-
`We have collaborated with the owner of this content to create and publish this skill.\n\n` +
|
|
78
|
-
`The signed IP rights for the app can be downloaded at: https://go.xappmedia.com/${newApp.organizationId}/iprights \n\n` +
|
|
79
|
-
`You will be prompted to login in first. The username is "alexa.cert@xappmedia.com" and the password is "S&9jDq@9".\n\n` +
|
|
80
|
-
`After successful login, the pdf should automatically download. If it does not download, then refresh https://go.xappmedia.com/${newApp.organizationId}/iprights or ` +
|
|
81
|
-
`click the link on the page to try again.`;
|
|
82
|
-
// Get the invocationName
|
|
83
|
-
let invocationName;
|
|
84
|
-
if (Array.isArray(template.invocationName)) {
|
|
85
|
-
invocationName = template.invocationName[0];
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
invocationName = template.invocationName;
|
|
89
|
-
}
|
|
90
|
-
// If it exists at this point, lowercase it and set it, otherwise leave it undefined.
|
|
91
|
-
newApp.invocationName = invocationName ? invocationName.toLowerCase() : undefined;
|
|
92
|
-
// Description and example phrases include the invocation name, don't generate them unless
|
|
93
|
-
// we have one.
|
|
94
|
-
if (newApp.invocationName) {
|
|
95
|
-
// For the description, we use the summary but at one line
|
|
96
|
-
// Make sure the summary ends in a period!
|
|
97
|
-
newApp.description =
|
|
98
|
-
template.summary +
|
|
99
|
-
`\n\nOnce you've enabled the skill, you can say "Alexa, open ${newApp.invocationName}“ to start listening.`;
|
|
100
|
-
// The example phrase are straight forward
|
|
101
|
-
newApp.examplePhrases = [`Alexa, open ${newApp.invocationName}`, `Alexa, pause`, `Alexa, resume`];
|
|
102
|
-
}
|
|
103
|
-
// Icons!
|
|
104
|
-
newApp.icon = template.icon;
|
|
105
|
-
newApp.smallIcon = stentor_app_1.generateSmallIconUrl(newApp.icon);
|
|
106
|
-
newApp.largeIcon = stentor_app_1.generateLargeIconUrl(newApp.icon);
|
|
107
|
-
// And make sure the endpoint is up to date
|
|
108
|
-
newApp.endPoint = newApp.endPoint || stentor_app_1.generateEndpointMap(newApp);
|
|
109
|
-
// Be free new App!
|
|
110
|
-
return newApp;
|
|
111
|
-
}
|
|
112
8
|
}
|
|
113
9
|
exports.TemplateFactory = TemplateFactory;
|
|
114
10
|
//# sourceMappingURL=TemplateFactory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TemplateFactory.js","sourceRoot":"","sources":["../src/TemplateFactory.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"TemplateFactory.js","sourceRoot":"","sources":["../src/TemplateFactory.ts"],"names":[],"mappings":";;;AAIA;;GAEG;AACH,MAAsB,eAAe;CAgDpC;AAhDD,0CAgDC"}
|
package/lib/index.d.ts
ADDED
package/lib/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
/*! Copyright (c) 2020, XAPPmedia */
|
|
14
|
+
__exportStar(require("./oc-studio-starter"), exports);
|
|
15
|
+
__exportStar(require("./onDemand"), exports);
|
|
16
|
+
__exportStar(require("./radio"), exports);
|
|
17
|
+
__exportStar(require("./TemplateFactory"), exports);
|
|
18
|
+
__exportStar(require("./Types"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oCAAoC;AACpC,sDAAoC;AACpC,6CAA2B;AAC3B,0CAAwB;AACxB,oDAAkC;AAClC,0CAAwB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../src/oc-studio-starter/Constants.ts"],"names":[],"mappings":";;;AAGa,QAAA,0BAA0B,GAAgC,4BAA4B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OCStudioStarterTemplate.js","sourceRoot":"","sources":["../../src/oc-studio-starter/OCStudioStarterTemplate.ts"],"names":[],"mappings":";AAAA,oCAAoC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { OVAIApp } from "@xapp/ovai-lib";
|
|
2
|
+
import { Intent, Handler, Entity, UtteranceTest } from "stentor-models";
|
|
3
|
+
import { TemplateFactory } from "../TemplateFactory";
|
|
4
|
+
import { OCStudioStarterTemplate } from "./OCStudioStarterTemplate";
|
|
5
|
+
/**
|
|
6
|
+
* A starter template for OC Studio.
|
|
7
|
+
*
|
|
8
|
+
* You can find the contents here: https://github.com/xapp-ai/oc-studio-starter/tree/main/template
|
|
9
|
+
*/
|
|
10
|
+
export declare class OCStudioStarterTemplateFactory extends TemplateFactory<OCStudioStarterTemplate> {
|
|
11
|
+
removeTemplateProperties?(template: OCStudioStarterTemplate): Partial<OVAIApp>;
|
|
12
|
+
generateTemplate(): OCStudioStarterTemplate;
|
|
13
|
+
generateApp(template: OCStudioStarterTemplate, app: OVAIApp): OVAIApp;
|
|
14
|
+
generateHandlers(): (Intent | Handler)[];
|
|
15
|
+
generateIntentsAndHandlers(): (Intent | Handler)[];
|
|
16
|
+
generateEntities(): Entity[];
|
|
17
|
+
generateUtterancesTests(): UtteranceTest[];
|
|
18
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OCStudioStarterTemplateFactory = void 0;
|
|
4
|
+
/*! Copyright (c) 2020, XAPPmedia */
|
|
5
|
+
const fs_1 = require("fs");
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
const stentor_interaction_model_profiler_1 = require("@xapp/stentor-interaction-model-profiler");
|
|
8
|
+
const TemplateFactory_1 = require("../TemplateFactory");
|
|
9
|
+
/**
|
|
10
|
+
* A starter template for OC Studio.
|
|
11
|
+
*
|
|
12
|
+
* You can find the contents here: https://github.com/xapp-ai/oc-studio-starter/tree/main/template
|
|
13
|
+
*/
|
|
14
|
+
class OCStudioStarterTemplateFactory extends TemplateFactory_1.TemplateFactory {
|
|
15
|
+
removeTemplateProperties(template) {
|
|
16
|
+
// no-op
|
|
17
|
+
return template;
|
|
18
|
+
}
|
|
19
|
+
generateTemplate() {
|
|
20
|
+
return { templateType: "OC_STUDIO_STARTER_TEMPLATE" };
|
|
21
|
+
}
|
|
22
|
+
generateApp(template, app) {
|
|
23
|
+
return Object.assign({ templateType: template.templateType }, app);
|
|
24
|
+
}
|
|
25
|
+
generateHandlers() {
|
|
26
|
+
return this.generateIntentsAndHandlers();
|
|
27
|
+
}
|
|
28
|
+
generateIntentsAndHandlers() {
|
|
29
|
+
const packagePath = require.resolve('@xapp/oc-studio-starter');
|
|
30
|
+
// Our intents & handlers are at the root of template
|
|
31
|
+
const intentsDirPath = path_1.resolve(packagePath, "../../template");
|
|
32
|
+
const intentFiles = fs_1.readdirSync(intentsDirPath);
|
|
33
|
+
const intents = [];
|
|
34
|
+
intentFiles.forEach((fileName) => {
|
|
35
|
+
if (fileName.endsWith(".json")) {
|
|
36
|
+
const filePath = path_1.resolve(intentsDirPath, fileName);
|
|
37
|
+
const intent = JSON.parse(fs_1.readFileSync(filePath, "utf-8"));
|
|
38
|
+
intents.push(intent);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
return intents;
|
|
42
|
+
}
|
|
43
|
+
generateEntities() {
|
|
44
|
+
const packagePath = require.resolve('@xapp/oc-studio-starter');
|
|
45
|
+
// Our entities are at ../../template/entities
|
|
46
|
+
const entitiesDirPath = path_1.resolve(packagePath, "../../template/entities");
|
|
47
|
+
const entityFiles = fs_1.readdirSync(entitiesDirPath);
|
|
48
|
+
const entities = [];
|
|
49
|
+
entityFiles.forEach((fileName) => {
|
|
50
|
+
const filePath = path_1.resolve(entitiesDirPath, fileName);
|
|
51
|
+
const entity = JSON.parse(fs_1.readFileSync(filePath, "utf-8"));
|
|
52
|
+
entities.push(entity);
|
|
53
|
+
});
|
|
54
|
+
return entities;
|
|
55
|
+
}
|
|
56
|
+
generateUtterancesTests() {
|
|
57
|
+
const packagePath = require.resolve('@xapp/oc-studio-starter');
|
|
58
|
+
// This will tell us where the package is, it will end in /lib/index.js
|
|
59
|
+
// We want the file ../../template/utterance-tests.md
|
|
60
|
+
const testsPath = path_1.resolve(packagePath, "../../template/utterance-tests.md");
|
|
61
|
+
const testsString = fs_1.readFileSync(testsPath, "utf-8");
|
|
62
|
+
const tests = testsString.split("\n");
|
|
63
|
+
const utteranceTests = [];
|
|
64
|
+
tests.forEach((testString) => {
|
|
65
|
+
// empty lines return undefined
|
|
66
|
+
const utteranceTest = stentor_interaction_model_profiler_1.convertToUtteranceTest(testString);
|
|
67
|
+
if (utteranceTest) {
|
|
68
|
+
utteranceTests.push(utteranceTest);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
return utteranceTests;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
exports.OCStudioStarterTemplateFactory = OCStudioStarterTemplateFactory;
|
|
75
|
+
//# sourceMappingURL=OCStudioStarterTemplateFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OCStudioStarterTemplateFactory.js","sourceRoot":"","sources":["../../src/oc-studio-starter/OCStudioStarterTemplateFactory.ts"],"names":[],"mappings":";;;AAAA,oCAAoC;AACpC,2BAA+C;AAC/C,+BAA+B;AAG/B,iGAAkF;AAGlF,wDAAqD;AAGrD;;;;GAIG;AACH,MAAa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Ae,CAAC,CAAC;QAEjD,MAAM,QAAQ,GAAa,EAAE,CAAC;QAE9B,WAAW,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;YAC7B,MAAM,QAAQ,GAAG,cAAO,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;YACpD,MAAM,MAAM,GAAW,IAAI,CAAC,KAAK,CAAC,iBAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;YACnE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC1B,CAAC,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC;IACpB,CAAC;IAED,uBAAuB;QACnB,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC;QAC/D,uEAAuE;QACvE,qDAAqD;QACrD,MAAM,SAAS,GAAG,cAAO,CAAC,WAAW,EAAE,mCAAmC,CAAC,CAAC;QAC5E,MAAM,WAAW,GAAG,iBAAY,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QACrD,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACtC,MAAM,cAAc,GAAoB,EAAE,CAAC;QAC3C,KAAK,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE;YACzB,+BAA+B;YAC/B,MAAM,aAAa,GAAG,2DAAsB,CAAC,UAAU,CAAC,CAAC;YACzD,IAAI,aAAa,EAAE;gBACf,cAAc,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;aACtC;QACL,CAAC,CAAC,CAAC;QACH,OAAO,cAAc,CAAC;IAC1B,CAAC;CACJ;AAxED,wEAwEC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*! Copyright (c) 2020, XAPPmedia */
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
6
|
+
}) : (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
o[k2] = m[k];
|
|
9
|
+
}));
|
|
10
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
11
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
__exportStar(require("./Constants"), exports);
|
|
15
|
+
__exportStar(require("./OCStudioStarterTemplate"), exports);
|
|
16
|
+
__exportStar(require("./OCStudioStarterTemplateFactory"), exports);
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/oc-studio-starter/index.ts"],"names":[],"mappings":";AAAA,oCAAoC;;;;;;;;;;;;AAEpC,8CAA4B;AAC5B,4DAA0C;AAC1C,mEAAiD"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
/*! Copyright (c) 2019, XAPPmedia */
|
|
2
2
|
import { OVAIApp } from "@xapp/ovai-lib";
|
|
3
|
-
import { Handler, Intent } from "stentor-models";
|
|
4
|
-
import {
|
|
3
|
+
import { Handler, Intent, Entity, UtteranceTest } from "stentor-models";
|
|
4
|
+
import { MediaTemplateFactory } from "../MediaTemplateFactory";
|
|
5
5
|
import { OnDemandTemplate } from "./OnDemandTemplate";
|
|
6
|
-
export declare class OnDemandTemplateFactory extends
|
|
6
|
+
export declare class OnDemandTemplateFactory extends MediaTemplateFactory<OnDemandTemplate> {
|
|
7
7
|
generateTemplate(app: OVAIApp, handlers?: (Handler | Intent)[]): OnDemandTemplate | undefined;
|
|
8
8
|
removeTemplateProperties(template: OnDemandTemplate): Partial<OVAIApp>;
|
|
9
9
|
generateHandlers(template: OnDemandTemplate, handlers?: (Handler | Intent)[]): (Handler | Intent)[];
|
|
10
|
+
generateIntentsAndHandlers(template: OnDemandTemplate, handlers?: (Handler | Intent)[]): (Handler | Intent)[];
|
|
11
|
+
generateEntities(): Entity[];
|
|
12
|
+
generateUtterancesTests(): UtteranceTest[];
|
|
10
13
|
}
|
|
@@ -6,9 +6,9 @@ const ovai_lib_1 = require("@xapp/ovai-lib");
|
|
|
6
6
|
const stentor_alexa_lib_1 = require("@xapp/stentor-alexa-lib");
|
|
7
7
|
const stentor_interaction_model_1 = require("stentor-interaction-model");
|
|
8
8
|
const Constants_1 = require("../Constants");
|
|
9
|
-
const
|
|
9
|
+
const MediaTemplateFactory_1 = require("../MediaTemplateFactory");
|
|
10
10
|
const Constants_2 = require("./Constants");
|
|
11
|
-
class OnDemandTemplateFactory extends
|
|
11
|
+
class OnDemandTemplateFactory extends MediaTemplateFactory_1.MediaTemplateFactory {
|
|
12
12
|
generateTemplate(app, handlers = []) {
|
|
13
13
|
let template = Object.assign(Object.assign(Object.assign({}, Constants_1.TEMPLATE_DEFAULTS), app), { templateType: Constants_2.ON_DEMAND_TEMPLATE, customIntros: [], alexaCategory: stentor_alexa_lib_1.PODCAST,
|
|
14
14
|
// on google we use the same Dialogflow client
|
|
@@ -126,6 +126,15 @@ class OnDemandTemplateFactory extends TemplateFactory_1.TemplateFactory {
|
|
|
126
126
|
}
|
|
127
127
|
return handlers;
|
|
128
128
|
}
|
|
129
|
+
generateIntentsAndHandlers(template, handlers) {
|
|
130
|
+
return this.generateHandlers(template, handlers);
|
|
131
|
+
}
|
|
132
|
+
generateEntities() {
|
|
133
|
+
return [];
|
|
134
|
+
}
|
|
135
|
+
generateUtterancesTests() {
|
|
136
|
+
return [];
|
|
137
|
+
}
|
|
129
138
|
}
|
|
130
139
|
exports.OnDemandTemplateFactory = OnDemandTemplateFactory;
|
|
131
140
|
//# sourceMappingURL=OnDemandTemplateFactory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OnDemandTemplateFactory.js","sourceRoot":"","sources":["../../src/onDemand/OnDemandTemplateFactory.ts"],"names":[],"mappings":";;;AAAA,oCAAoC;AACpC,6CAMwB;AACxB,+DAAkD;AAClD,yEAOmC;AAEnC,4CAAiD;AACjD,
|
|
1
|
+
{"version":3,"file":"OnDemandTemplateFactory.js","sourceRoot":"","sources":["../../src/onDemand/OnDemandTemplateFactory.ts"],"names":[],"mappings":";;;AAAA,oCAAoC;AACpC,6CAMwB;AACxB,+DAAkD;AAClD,yEAOmC;AAEnC,4CAAiD;AACjD,kEAA+D;AAC/D,2CAOqB;AAGrB,MAAa,uBAAwB,SAAQ,2CAAsC;IAC/E,gBAAgB,CAAC,GAAY,EAAE,WAAiC,EAAE;QAC9D,IAAI,QAAQ,iDACL,6BAAiB,GACjB,GAAG,KACN,YAAY,EAAE,8BAAkB,EAChC,YAAY,EAAE,EAAE,EAChB,aAAa,EAAE,2BAAO;YACtB,8CAA8C;YAC9C,qBAAqB,EAAE,oDAAwC,EAC/D,QAAQ,EAAE,uCAA2B,CAAC,KAAK,EAAE,GAChD,CAAC;QAEF,QAAQ,GAAG,KAAK,CAAC,oBAAoB,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;QAErD,IAAI,QAAQ,EAAE;YACV,6CAA6C;YAC7C,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;gBACvB,IAAI,oCAAyB,CAAC,OAAO,CAAC,EAAE;oBACpC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;oBAE1B,IAAI,IAAI,EAAE;wBACN,IAAI,IAAI,CAAC,GAAG,EAAE;4BACV,QAAQ,CAAC,UAAU,GAAqB,OAAO,CAAC,IAAK,CAAC,GAAG,CAAC;yBAC7D;wBAED,IAAI,IAAI,CAAC,gBAAgB,EAAE;4BACvB,QAAQ,CAAC,WAAW,GAAG,2CAA+B,CAAC;yBAC1D;wBAED,IAAI,IAAI,CAAC,iBAAiB,EAAE;4BACxB,QAAQ,CAAC,WAAW,GAAG,8CAAkC,C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models";
|
|
4
|
-
import {
|
|
3
|
+
import { Entity, Handler, Intent, UtteranceTest } from "stentor-models";
|
|
4
|
+
import { MediaTemplateFactory } from "../MediaTemplateFactory";
|
|
5
5
|
import { RadioTemplate } from "./RadioTemplate";
|
|
6
|
-
export declare class RadioTemplateFactory extends
|
|
6
|
+
export declare class RadioTemplateFactory extends MediaTemplateFactory<RadioTemplate> {
|
|
7
7
|
generateTemplate(app: OVAIApp, handlers?: (Handler | Intent)[]): RadioTemplate | undefined;
|
|
8
8
|
removeTemplateProperties(template: RadioTemplate): Partial<OVAIApp>;
|
|
9
9
|
generateHandlers(template: RadioTemplate, handlers?: (Handler | Intent)[]): (Handler | Intent)[];
|
|
10
|
+
generateIntentsAndHandlers(template: RadioTemplate, handlers?: (Handler | Intent)[]): (Handler | Intent)[];
|
|
11
|
+
generateEntities(): Entity[];
|
|
12
|
+
generateUtterancesTests(): UtteranceTest[];
|
|
10
13
|
}
|
|
@@ -8,9 +8,9 @@ const stentor_constants_1 = require("stentor-constants");
|
|
|
8
8
|
const stentor_guards_1 = require("stentor-guards");
|
|
9
9
|
const stentor_interaction_model_1 = require("stentor-interaction-model");
|
|
10
10
|
const Constants_1 = require("../Constants");
|
|
11
|
-
const TemplateFactory_1 = require("../TemplateFactory");
|
|
12
11
|
const Constants_2 = require("./Constants");
|
|
13
|
-
|
|
12
|
+
const MediaTemplateFactory_1 = require("../MediaTemplateFactory");
|
|
13
|
+
class RadioTemplateFactory extends MediaTemplateFactory_1.MediaTemplateFactory {
|
|
14
14
|
generateTemplate(app, handlers = []) {
|
|
15
15
|
let template = Object.assign(Object.assign(Object.assign({}, Constants_1.TEMPLATE_DEFAULTS), app), {
|
|
16
16
|
// Template type
|
|
@@ -75,6 +75,15 @@ class RadioTemplateFactory extends TemplateFactory_1.TemplateFactory {
|
|
|
75
75
|
// concat with the old ones and return
|
|
76
76
|
return handlers.concat([newLaunchRequestHandler]);
|
|
77
77
|
}
|
|
78
|
+
generateIntentsAndHandlers(template, handlers) {
|
|
79
|
+
return this.generateHandlers(template, handlers);
|
|
80
|
+
}
|
|
81
|
+
generateEntities() {
|
|
82
|
+
return [];
|
|
83
|
+
}
|
|
84
|
+
generateUtterancesTests() {
|
|
85
|
+
return [];
|
|
86
|
+
}
|
|
78
87
|
}
|
|
79
88
|
exports.RadioTemplateFactory = RadioTemplateFactory;
|
|
80
89
|
//# sourceMappingURL=RadioTemplateFactory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioTemplateFactory.js","sourceRoot":"","sources":["../../src/radio/RadioTemplateFactory.ts"],"names":[],"mappings":";;;AAAA,oCAAoC;AACpC,6CAA+G;AAC/G,+DAA4D;AAC5D,yDAA+D;AAC/D,mDAA2C;AAC3C,yEAAsF;
|
|
1
|
+
{"version":3,"file":"RadioTemplateFactory.js","sourceRoot":"","sources":["../../src/radio/RadioTemplateFactory.ts"],"names":[],"mappings":";;;AAAA,oCAAoC;AACpC,6CAA+G;AAC/G,+DAA4D;AAC5D,yDAA+D;AAC/D,mDAA2C;AAC3C,yEAAsF;AAEtF,4CAAiD;AACjD,2CAAoG;AACpG,kEAA+D;AAG/D,MAAa,oBAAqB,SAAQ,2CAAmC;IACzE,gBAAgB,CAAC,GAAY,EAAE,WAAiC,EAAE;QAC9D,IAAI,QAAQ,iDAEL,6BAAiB,GAEjB,GAAG;YACN,gBAAgB;YAChB,YAAY,EAAE,0BAAc;YAC5B,uCAAuC;YACvC,aAAa,EAAE,EAAE,EACjB,YAAY,EAAE,EAAE,EAChB,aAAa,EAAE,qCAAiB,EAChC,QAAQ,EAAE,mCAAuB,CAAC,KAAK,EAAE,GAC5C,CAAC;QAEF,QAAQ,GAAG,KAAK,CAAC,oBAAoB,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;QAErD,IAAI,QAAQ,EAAE;YACV,6CAA6C;YAC7C,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;gBACvB,IAAI,0BAAS,CAAC,OAAO,CA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@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "restricted"
|
|
6
6
|
},
|
|
7
|
-
"version": "1.27.
|
|
7
|
+
"version": "1.27.7",
|
|
8
8
|
"description": "Custom App templates for OVAI stentor",
|
|
9
9
|
"types": "lib/index",
|
|
10
10
|
"main": "lib/index",
|
|
@@ -19,18 +19,20 @@
|
|
|
19
19
|
"@xapp/config": "0.2.3",
|
|
20
20
|
"chai": "4.2.0",
|
|
21
21
|
"mocha": "7.2.0",
|
|
22
|
-
"stentor-models": "1.35.
|
|
22
|
+
"stentor-models": "1.35.5",
|
|
23
23
|
"ts-node": "9.0.0",
|
|
24
24
|
"typescript": "4.0.5"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@xapp/
|
|
28
|
-
"@xapp/
|
|
29
|
-
"@xapp/stentor-
|
|
30
|
-
"stentor-
|
|
31
|
-
"stentor-
|
|
32
|
-
"stentor-
|
|
33
|
-
"stentor-
|
|
27
|
+
"@xapp/oc-studio-starter": "1.1.9",
|
|
28
|
+
"@xapp/ovai-lib": "1.27.7",
|
|
29
|
+
"@xapp/stentor-alexa-lib": "1.27.7",
|
|
30
|
+
"@xapp/stentor-app": "1.27.7",
|
|
31
|
+
"@xapp/stentor-interaction-model-profiler": "1.27.7",
|
|
32
|
+
"stentor-constants": "1.35.5",
|
|
33
|
+
"stentor-guards": "1.35.5",
|
|
34
|
+
"stentor-interaction-model": "1.35.5",
|
|
35
|
+
"stentor-request": "1.35.5"
|
|
34
36
|
},
|
|
35
37
|
"peerDependencies": {
|
|
36
38
|
"stentor-models": "1.x"
|
|
@@ -40,5 +42,5 @@
|
|
|
40
42
|
"clean": "rm -rf ./lib/*",
|
|
41
43
|
"test": "mocha --recursive -r ts-node/register \"./src/**/*.test.ts\""
|
|
42
44
|
},
|
|
43
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "383b1d361d3e86b20e23543bdee14afc6f1a6320"
|
|
44
46
|
}
|