Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: lg naming migration #2597

Merged
merged 43 commits into from
Apr 20, 2020
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
d2590dc
change - in template name to _ for all sample bots
cosmicshuai Apr 10, 2020
14e32c9
update lg naming pattern
zhixzhan Apr 10, 2020
4404067
update tests
zhixzhan Apr 10, 2020
7ef61eb
add method to convert template name when loading
cosmicshuai Apr 10, 2020
3ba6acc
Merge branch 'lg-naming-migration' of github.com:microsoft/BotFramewo…
cosmicshuai Apr 10, 2020
03c3e02
Inline LU naming conventions in the prompts
zhixzhan Apr 13, 2020
694b3a3
update lg name pattern
zhixzhan Apr 13, 2020
5286a6b
replace bfdactivity -> SendActivity
zhixzhan Apr 13, 2020
ab7f5ad
activity -> SendActivity
zhixzhan Apr 13, 2020
cde458e
bfdprompt_1234 -> TextInput_Prompt_1234
zhixzhan Apr 13, 2020
8218e92
designerId no dash -
zhixzhan Apr 14, 2020
f4a7d0f
lgField use schema.$kind as lgNameType
zhixzhan Apr 14, 2020
cdb2d88
use standalone method generate designer id
zhixzhan Apr 14, 2020
997ae11
Update packages
luhan2017 Apr 14, 2020
3e7f2f5
Update sdk.schema
luhan2017 Apr 14, 2020
8d12e03
more replacement
zhixzhan Apr 14, 2020
71be4a7
Merge branch 'lg-naming-migration' of https://github.com/microsoft/Bo…
zhixzhan Apr 14, 2020
7aa02a1
Merge branch 'master' into lg-naming-migration
zhixzhan Apr 14, 2020
bd5ce85
change LG package version
cosmicshuai Apr 14, 2020
4a3b2a7
upgrade lg package
zhixzhan Apr 14, 2020
07e19b2
fix api of Expression
cosmicshuai Apr 14, 2020
66e3330
Merge branch 'lg-naming-migration' of github.com:microsoft/BotFramewo…
cosmicshuai Apr 14, 2020
174ea22
Update BotProject.csproj
luhan2017 Apr 15, 2020
5ccc274
Merge branch 'master' into lg-naming-migration
luhan2017 Apr 15, 2020
05ab8df
update sample bot
zhixzhan Apr 15, 2020
90fe6a0
use SDKKinds
zhixzhan Apr 15, 2020
bed71e6
use shared lu name builder
zhixzhan Apr 15, 2020
4aceffb
Merge branch 'master' into lg-naming-migration
zhixzhan Apr 15, 2020
26513ca
Merge branch 'master' into lg-naming-migration
zhixzhan Apr 16, 2020
b0aab33
Merge branch 'master' into lg-naming-migration
cwhitten Apr 16, 2020
f496659
Update LanguagePolicy and IRecognzier
luhan2017 Apr 16, 2020
935f940
Recognizer -> IRecognizer
zhixzhan Apr 16, 2020
da71cce
Update to the latest 200416
luhan2017 Apr 16, 2020
ea93471
Merge branch 'master' into lg-naming-migration
luhan2017 Apr 16, 2020
e29a469
Merge branch 'master' into lg-naming-migration
zhixzhan Apr 17, 2020
88fd61b
Fix for skill AutoEndDialog
luhan2017 Apr 17, 2020
4d856c7
upgrade luis package
zhixzhan Apr 17, 2020
26fa66e
replace cover ${ } and @{ } expression syntax
zhixzhan Apr 17, 2020
550e910
upgrade luis package fix dash -
zhixzhan Apr 17, 2020
5665b29
Merge branch 'master' into lg-naming-migration
zhixzhan Apr 18, 2020
5292ee9
Merge branch 'master' into lg-naming-migration
luhan2017 Apr 18, 2020
b83ce5c
handle file write error
zhixzhan Apr 19, 2020
3823239
use a placeholder luSectionName
zhixzhan Apr 19, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ describe('delete node flow', () => {
expect(result).toEqual({ foo: {} });
expect(removedDataFn).toBeCalledWith(dialog.foo.bar);
});
it("removeLgTemplate function should be called when targetNode's $kind is 'Microsoft.SendActivity' && activity includes '[bfdactivity-'", () => {
dialog.foo.activityNode = { $kind: 'Microsoft.SendActivity', activity: '[bfdactivity-a]' };
it("removeLgTemplate function should be called when targetNode's $kind is 'Microsoft.SendActivity' && activity includes '[SendActivity_'", () => {
dialog.foo.activityNode = { $kind: 'Microsoft.SendActivity', activity: '[SendActivity_a]' };
path = 'foo.activityNode';
const result = deleteNode(dialog, path, removedDataFn);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"updatedAt": "2019-08-02T22:36:20.947Z",
"id": "157674"
},
"activity": "[bfdactivity-157674]"
"activity": "[SendActivity_157674]"
}
]
},
Expand Down Expand Up @@ -135,7 +135,7 @@
"updatedAt": "2019-08-01T23:44:57.629Z",
"id": "696707"
},
"activity": "[bfdactivity-696707]"
"activity": "[SendActivity_696707]"
}
],
"intent": "HelpIntent"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"updatedAt": "2019-07-16T20:01:26.980Z",
"id": "116673"
},
"activity": "[bfdactivity-116673]"
"activity": "[SendActivity_116673]"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"updatedAt": "2019-07-16T20:01:43.249Z",
"id": "832307"
},
"activity": "[bfdactivity-832307]"
"activity": "[SendActivity_832307]"
}
],
"elseActions": [
Expand All @@ -54,7 +54,7 @@
"updatedAt": "2019-07-16T20:01:47.803Z",
"id": "983761"
},
"activity": "[bfdactivity-983761]"
"activity": "[SendActivity_983761]"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"updatedAt": "2019-07-16T20:02:14.365Z",
"id": "725469"
},
"activity": "[bfdactivity-725469]"
"activity": "[SendActivity_725469]"
}
],
"elseActions": [
Expand All @@ -79,7 +79,7 @@
"updatedAt": "2019-07-16T20:02:19.199Z",
"id": "549615"
},
"activity": "[bfdactivity-549615]"
"activity": "[SendActivity_549615]"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"id": "339580",
"name": "Send an Activity"
},
"activity": "[bfdactivity-339580]"
"activity": "[SendActivity_339580]"
}
],
"elseActions": [
Expand All @@ -45,7 +45,7 @@
"id": "662084",
"name": "Send an Activity"
},
"activity": "[bfdactivity-662084]"
"activity": "[SendActivity_662084]"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"updatedAt": "2019-08-02T22:36:20.947Z",
"id": "157674"
},
"activity": "[bfdactivity-157674]"
"activity": "[SendActivity_157674]"
}
]
},
Expand Down Expand Up @@ -135,7 +135,7 @@
"updatedAt": "2019-08-01T23:44:57.629Z",
"id": "696707"
},
"activity": "[bfdactivity-696707]"
"activity": "[SendActivity_696707]"
}
],
"intent": "HelpIntent"
Expand Down
18 changes: 9 additions & 9 deletions Composer/packages/lib/code-editor/demo/src/lgEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,31 +45,31 @@ const content = `# Hello
-I can help you yes I can
-Help, we don't need no stinkin' help!

# bfdactivity-116673
# SendActivity_116673
-Successfully added a todo named @{dialog.todo}

# bfdactivity-832307
# SendActivity_832307
-Successfully cleared items in the Todo List.

# bfdactivity-983761
# SendActivity_983761
-You don't have any items in the Todo List.

# bfdactivity-725469
# SendActivity_725469
-Successfully removed a todo named @{dialog.todo}

# bfdactivity-549615
# SendActivity_549615
-@{dialog.todo} is not in the Todo List

# bfdactivity-339580
# SendActivity_339580
-You have no todos.

# bfdactivity-662084
# SendActivity_662084
-@{ShowTodo}

# bfdactivity-696707
# SendActivity_696707
-@{help}

# bfdactivity-157674
# SendActivity_157674
- Hi! I'm a ToDo bot. Say "add a todo named first" to get started.
`;

Expand Down
18 changes: 9 additions & 9 deletions Composer/packages/lib/code-editor/demo/src/lgJsonEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,31 +69,31 @@ const lgContent = `# Hello
-I can help you yes I can
-Help, we don't need no stinkin' help!

# bfdactivity-116673
# SendActivity_116673
-Successfully added a todo named {dialog.todo}

# bfdactivity-832307
# SendActivity_832307
-Successfully cleared items in the Todo List.

# bfdactivity-983761
# SendActivity_983761
-You don't have any items in the Todo List.

# bfdactivity-725469
# SendActivity_725469
-Successfully removed a todo named {dialog.todo}

# bfdactivity-549615
# SendActivity_549615
-{dialog.todo} is not in the Todo List

# bfdactivity-339580
# SendActivity_339580
-You have no todos.

# bfdactivity-662084
# SendActivity_662084
-[ShowTodo]

# bfdactivity-696707
# SendActivity_696707
-[help]

# bfdactivity-157674
# SendActivity_157674
- Hi! I'm a ToDo bot. Say "add a todo named first" to get started.
`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('#copyIfCondition', () => {
elseActions: [
{
$kind: 'Microsoft.SendActivity',
activity: '[bfdactivity-1234]',
activity: '[SendActivity_1234]',
},
],
};
Expand All @@ -44,7 +44,7 @@ describe('#copyIfCondition', () => {
$designer: {
id: '5678',
},
activity: '[bfdactivity-1234]',
activity: '[SendActivity_1234]',
},
],
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ describe('shallowCopyAdaptiveAction', () => {
alwaysPrompt: false,
allowInterruptions: 'true',
outputFormat: 'none',
prompt: '[bfdprompt-1234]',
invalidPrompt: '[bfdinvalidPrompt-1234]',
unrecognizedPrompt: '[bfdunrecognizedPrompt-1234]',
defaultValueResponse: '[bfddefaultValueResponse-1234]',
prompt: '[TextInput_Prompt_1234]',
invalidPrompt: '[TextInput_InvalidPrompt_1234]',
unrecognizedPrompt: '[TextInput_UnrecognizedPrompt_1234]',
defaultValueResponse: '[TextInput_DefaultValueResponse_1234]',
};

expect(await copyInputDialog(promptText as any, externalApiWithLgCopy)).toEqual({
Expand All @@ -37,10 +37,10 @@ describe('shallowCopyAdaptiveAction', () => {
alwaysPrompt: false,
allowInterruptions: 'true',
outputFormat: 'none',
prompt: '[bfdprompt-1234](copy)',
invalidPrompt: '[bfdinvalidPrompt-1234](copy)',
unrecognizedPrompt: '[bfdunrecognizedPrompt-1234](copy)',
defaultValueResponse: '[bfddefaultValueResponse-1234](copy)',
prompt: '[TextInput_Prompt_1234](copy)',
invalidPrompt: '[TextInput_InvalidPrompt_1234](copy)',
unrecognizedPrompt: '[TextInput_UnrecognizedPrompt_1234](copy)',
defaultValueResponse: '[TextInput_DefaultValueResponse_1234](copy)',
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ describe('copySendActivity', () => {
it('can copy SendActivity', async () => {
const sendActivity = {
$kind: 'Microsoft.SendActivity',
activity: '[bfdactivity-1234]',
activity: '[SendActivity_1234]',
};

expect(await copySendActivity(sendActivity, externalApiWithLgCopy)).toEqual({
$kind: 'Microsoft.SendActivity',
$designer: { id: '5678' },
activity: '[bfdactivity-1234](copy)',
activity: '[SendActivity_1234](copy)',
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('#copySwitchCondition', () => {
actions: [
{
$kind: 'Microsoft.SendActivity',
activity: '[bfdactivity-1234]',
activity: '[SendActivity_1234]',
},
],
},
Expand Down Expand Up @@ -73,7 +73,7 @@ describe('#copySwitchCondition', () => {
$designer: {
id: '5678',
},
activity: '[bfdactivity-1234]',
activity: '[SendActivity_1234]',
},
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ import { LgMetaData } from '../../../src';

describe('LgMetaData', () => {
it('can construct an instance via constructor', () => {
const instance = new LgMetaData('activity', '123456');
const instance = new LgMetaData('SendActivity', '1Xkg4a');

expect(instance.type).toEqual('activity');
expect(instance.designerId).toEqual('123456');
expect(instance.type).toEqual('SendActivity');
expect(instance.designerId).toEqual('1Xkg4a');
expect(instance.toString).toBeDefined();
});

it('can generate correct output strings', () => {
const instance = new LgMetaData('activity', '123456');
const instance = new LgMetaData('SendActivity', '1Xkg4a');

expect(instance.toString()).toEqual('bfdactivity-123456');
expect(instance.toString()).toEqual('SendActivity_1Xkg4a');
});

it('can construct instance via `parse()` method', () => {
expect(LgMetaData.parse('bfdactivity-123456')).toBeInstanceOf(LgMetaData);
expect(LgMetaData.parse('SendActivity_1Xkg4a')).toBeInstanceOf(LgMetaData);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ describe('LgTemplateRef#', () => {
});

it('should return LgTemplateRef when inputs are valid', () => {
const a = LgTemplateRef.parse('${bfdactivity-123456()}');
expect(a).toEqual(new LgTemplateRef('bfdactivity-123456'));
const a = LgTemplateRef.parse('${SendActivity_1Xkg4a()}');
expect(a).toEqual(new LgTemplateRef('SendActivity_1Xkg4a'));

const a2 = LgTemplateRef.parse('${bfdactivity-123456()}');
expect(a2).toEqual(new LgTemplateRef('bfdactivity-123456'));
const a2 = LgTemplateRef.parse('${SendActivity_1Xkg4a()}');
expect(a2).toEqual(new LgTemplateRef('SendActivity_1Xkg4a'));

const b = LgTemplateRef.parse('${greeting(1,2)}');
expect(b).toEqual(new LgTemplateRef('greeting', ['1', '2']));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ describe('parseLgTemplateName', () => {
});

it('should return LgMetaData when inputs are valid', () => {
const result = parseLgTemplateName('bfdactivity-123456');
const result = parseLgTemplateName('SendActivity_1Xkg4a');
expect(result).toBeInstanceOf(LgMetaData);
expect((result as LgMetaData).designerId).toEqual('123456');
expect((result as LgMetaData).type).toEqual('activity');
expect((result as LgMetaData).designerId).toEqual('1Xkg4a');
expect((result as LgMetaData).type).toEqual('SendActivity');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ describe('parseLgTemplateRef', () => {
});

it('should return LgTemplateRef when inputs are valid', () => {
const a = parseLgTemplateRef('${bfdactivity-123456()}');
expect(a).toEqual(new LgTemplateRef('bfdactivity-123456'));
const a = parseLgTemplateRef('${SendActivity_1Xkg4a()}');
expect(a).toEqual(new LgTemplateRef('SendActivity_1Xkg4a'));

const b = parseLgTemplateRef('${greeting(1,2)}');
expect(b).toEqual(new LgTemplateRef('greeting', ['1', '2']));
Expand All @@ -24,7 +24,7 @@ describe('parseLgTemplateRef', () => {
describe('extractLgTemplateRefs', () => {
it('can extract lg refs from input string', () => {
expect(extractLgTemplateRefs('Hi')).toEqual([]);
expect(extractLgTemplateRefs('${bfdactivity-123456()}')).toEqual([new LgTemplateRef('bfdactivity-123456')]);
expect(extractLgTemplateRefs('${SendActivity_1Xkg4a()}')).toEqual([new LgTemplateRef('SendActivity_1Xkg4a')]);
expect(extractLgTemplateRefs(`-\${Greeting()}, I'm a fancy bot, \${Bye()}`)).toEqual([
new LgTemplateRef('Greeting'),
new LgTemplateRef('Bye'),
Expand Down
2 changes: 1 addition & 1 deletion Composer/packages/lib/shared/src/deleteUtils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const collectLuIntents = (action: any, outputTemplates: string[]) => {
case SDKKinds.NumberInput:
case SDKKinds.TextInput: {
const [, promptType] = action.$kind.split('.');
const intentName = `${promptType}.response-${action?.$designer?.id}`;
const intentName = `${promptType}_Response_${action?.$designer?.id}`;
promptType && intentName && outputTemplates.push(intentName);
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import buildLgTemplateName from '../stringBuilders/buildLgTemplateName';
import { LgTemplateName } from './stringTypes';

/**
* LgMetaData can be converted from & to Lg name. Such as 'bfdactivity-1234'.
* LgMetaData can be converted from & to Lg name. Such as 'SendActivity_1234'.
* It's created by Composer, contains designerId and filed type.
*/
export default class LgMetaData {
Expand Down
Loading