@microsoft/teams.apps 0.2.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.
Files changed (132) hide show
  1. package/README.md +35 -0
  2. package/dist/api.d.ts +21 -0
  3. package/dist/api.js +66 -0
  4. package/dist/app.d.ts +1137 -0
  5. package/dist/app.embed.d.ts +24 -0
  6. package/dist/app.embed.js +83 -0
  7. package/dist/app.events.d.ts +14 -0
  8. package/dist/app.events.js +51 -0
  9. package/dist/app.js +411 -0
  10. package/dist/app.oauth.d.ts +13 -0
  11. package/dist/app.oauth.js +106 -0
  12. package/dist/app.plugins.d.ts +24 -0
  13. package/dist/app.plugins.js +96 -0
  14. package/dist/app.process.d.ts +11 -0
  15. package/dist/app.process.js +141 -0
  16. package/dist/app.routing.d.ts +22 -0
  17. package/dist/app.routing.js +40 -0
  18. package/dist/container/container.d.ts +37 -0
  19. package/dist/container/container.js +46 -0
  20. package/dist/container/index.d.ts +2 -0
  21. package/dist/container/index.js +19 -0
  22. package/dist/container/provider.d.ts +9 -0
  23. package/dist/container/provider.js +11 -0
  24. package/dist/contexts/activity-error.d.ts +8 -0
  25. package/dist/contexts/activity-error.js +3 -0
  26. package/dist/contexts/activity-signin.d.ts +8 -0
  27. package/dist/contexts/activity-signin.js +3 -0
  28. package/dist/contexts/activity.d.ts +117 -0
  29. package/dist/contexts/activity.js +133 -0
  30. package/dist/contexts/client.d.ts +53 -0
  31. package/dist/contexts/client.js +3 -0
  32. package/dist/contexts/function.d.ts +17 -0
  33. package/dist/contexts/function.js +3 -0
  34. package/dist/contexts/index.d.ts +5 -0
  35. package/dist/contexts/index.js +22 -0
  36. package/dist/events/activity-response.d.ts +16 -0
  37. package/dist/events/activity-response.js +3 -0
  38. package/dist/events/activity-sent.d.ts +16 -0
  39. package/dist/events/activity-sent.js +3 -0
  40. package/dist/events/activity.d.ts +20 -0
  41. package/dist/events/activity.js +3 -0
  42. package/dist/events/error.d.ts +16 -0
  43. package/dist/events/error.js +3 -0
  44. package/dist/events/index.d.ts +18 -0
  45. package/dist/events/index.js +21 -0
  46. package/dist/index.d.ts +7 -0
  47. package/dist/index.js +47 -0
  48. package/dist/manifest.d.ts +1241 -0
  49. package/dist/manifest.js +3 -0
  50. package/dist/middleware/entra-token-validator.d.ts +75 -0
  51. package/dist/middleware/entra-token-validator.js +169 -0
  52. package/dist/middleware/index.d.ts +3 -0
  53. package/dist/middleware/index.js +22 -0
  54. package/dist/middleware/strip-mentions-text.d.ts +3 -0
  55. package/dist/middleware/strip-mentions-text.js +48 -0
  56. package/dist/middleware/with-client-auth.d.ts +13 -0
  57. package/dist/middleware/with-client-auth.js +40 -0
  58. package/dist/oauth.d.ts +9 -0
  59. package/dist/oauth.js +7 -0
  60. package/dist/plugins/http/index.d.ts +2 -0
  61. package/dist/plugins/http/index.js +19 -0
  62. package/dist/plugins/http/plugin.d.ts +986 -0
  63. package/dist/plugins/http/plugin.js +238 -0
  64. package/dist/plugins/http/stream.d.ts +956 -0
  65. package/dist/plugins/http/stream.js +128 -0
  66. package/dist/plugins/index.d.ts +1 -0
  67. package/dist/plugins/index.js +18 -0
  68. package/dist/router.d.ts +34 -0
  69. package/dist/router.js +91 -0
  70. package/dist/routes/activity.d.ts +8 -0
  71. package/dist/routes/activity.js +3 -0
  72. package/dist/routes/conversation-update.d.ts +6 -0
  73. package/dist/routes/conversation-update.js +3 -0
  74. package/dist/routes/event.d.ts +17 -0
  75. package/dist/routes/event.js +11 -0
  76. package/dist/routes/index.d.ts +20 -0
  77. package/dist/routes/index.js +24 -0
  78. package/dist/routes/install.d.ts +8 -0
  79. package/dist/routes/install.js +3 -0
  80. package/dist/routes/invoke/file-consent.d.ts +6 -0
  81. package/dist/routes/invoke/file-consent.js +3 -0
  82. package/dist/routes/invoke/index.d.ts +39 -0
  83. package/dist/routes/invoke/index.js +45 -0
  84. package/dist/routes/invoke/message-extension-submit.d.ts +6 -0
  85. package/dist/routes/invoke/message-extension-submit.js +3 -0
  86. package/dist/routes/invoke/message-submit.d.ts +10 -0
  87. package/dist/routes/invoke/message-submit.js +3 -0
  88. package/dist/routes/message-delete.d.ts +6 -0
  89. package/dist/routes/message-delete.js +3 -0
  90. package/dist/routes/message-update.d.ts +6 -0
  91. package/dist/routes/message-update.js +3 -0
  92. package/dist/types/constructor.d.ts +7 -0
  93. package/dist/types/constructor.js +3 -0
  94. package/dist/types/event-handler.d.ts +1 -0
  95. package/dist/types/event-handler.js +3 -0
  96. package/dist/types/event.d.ts +11 -0
  97. package/dist/types/event.js +3 -0
  98. package/dist/types/index.d.ts +7 -0
  99. package/dist/types/index.js +24 -0
  100. package/dist/types/plugin/decorators/dependency.d.ts +135 -0
  101. package/dist/types/plugin/decorators/dependency.js +49 -0
  102. package/dist/types/plugin/decorators/event.d.ts +18 -0
  103. package/dist/types/plugin/decorators/event.js +24 -0
  104. package/dist/types/plugin/decorators/index.d.ts +3 -0
  105. package/dist/types/plugin/decorators/index.js +12 -0
  106. package/dist/types/plugin/decorators/plugin.d.ts +25 -0
  107. package/dist/types/plugin/decorators/plugin.js +23 -0
  108. package/dist/types/plugin/index.d.ts +8 -0
  109. package/dist/types/plugin/index.js +25 -0
  110. package/dist/types/plugin/plugin-activity-event.d.ts +20 -0
  111. package/dist/types/plugin/plugin-activity-event.js +3 -0
  112. package/dist/types/plugin/plugin-activity-response-event.d.ts +20 -0
  113. package/dist/types/plugin/plugin-activity-response-event.js +3 -0
  114. package/dist/types/plugin/plugin-activity-sent-event.d.ts +16 -0
  115. package/dist/types/plugin/plugin-activity-sent-event.js +3 -0
  116. package/dist/types/plugin/plugin-error-event.d.ts +20 -0
  117. package/dist/types/plugin/plugin-error-event.js +3 -0
  118. package/dist/types/plugin/plugin-start-event.d.ts +11 -0
  119. package/dist/types/plugin/plugin-start-event.js +3 -0
  120. package/dist/types/plugin/plugin.d.ts +74 -0
  121. package/dist/types/plugin/plugin.js +3 -0
  122. package/dist/types/plugin/sender.d.ts +18 -0
  123. package/dist/types/plugin/sender.js +3 -0
  124. package/dist/types/prefixed.d.ts +3 -0
  125. package/dist/types/prefixed.js +3 -0
  126. package/dist/types/route-handler.d.ts +2 -0
  127. package/dist/types/route-handler.js +3 -0
  128. package/dist/types/streamer.d.ts +31 -0
  129. package/dist/types/streamer.js +3 -0
  130. package/dist/types/suffixed.d.ts +3 -0
  131. package/dist/types/suffixed.js +3 -0
  132. package/package.json +70 -0
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./plugin"), exports);
18
+ __exportStar(require("./streamer"), exports);
19
+ __exportStar(require("./event-handler"), exports);
20
+ __exportStar(require("./event"), exports);
21
+ __exportStar(require("./route-handler"), exports);
22
+ __exportStar(require("./prefixed"), exports);
23
+ __exportStar(require("./suffixed"), exports);
24
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdHlwZXMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7OztBQUFBLDJDQUF5QjtBQUN6Qiw2Q0FBMkI7QUFDM0Isa0RBQWdDO0FBQ2hDLDBDQUF3QjtBQUN4QixrREFBZ0M7QUFDaEMsNkNBQTJCO0FBQzNCLDZDQUEyQiJ9
@@ -0,0 +1,135 @@
1
+ import 'reflect-metadata';
2
+ export declare const PLUGIN_DEPENDENCIES_METADATA_KEY = "teams:plugin:dependencies";
3
+ export type DependencyMetadata = {
4
+ /**
5
+ * the property name
6
+ */
7
+ readonly key: string;
8
+ /**
9
+ * the property type
10
+ */
11
+ readonly type: string;
12
+ /**
13
+ * if optional, the app will not throw
14
+ * if the dependency is not found
15
+ */
16
+ readonly optional: boolean;
17
+ };
18
+ /**
19
+ * add plugin dependencies via
20
+ * `@Dependency()`
21
+ */
22
+ export declare function Dependency(options?: DependencyOptions): (target: any, propertyKey: string | ClassFieldDecoratorContext) => void;
23
+ /**
24
+ * inject the `App` `ILogger` instance
25
+ */
26
+ export declare function Logger(): (target: any, propertyKey: string | ClassFieldDecoratorContext) => void;
27
+ /**
28
+ * inject the `App` `IStorage` instance
29
+ */
30
+ export declare function Storage(): (target: any, propertyKey: string | ClassFieldDecoratorContext) => void;
31
+ /**
32
+ * options for a plugins dependency
33
+ * that should get injected into it
34
+ * by the `App`
35
+ */
36
+ export type DependencyOptions = IdDependencyOptions | NameDependencyOptions | ManifestDependencyOptions | CredentialsDependencyOptions | BotTokenDependencyOptions | GraphTokenDependencyOptions | LoggerDependencyOptions | StorageDependencyOptions | PluginDependencyOptions;
37
+ export type IdDependencyOptions = {
38
+ /**
39
+ * the name used to resolve the dependency
40
+ */
41
+ readonly name: 'id';
42
+ /**
43
+ * if optional, the app will not throw
44
+ * if the dependency is not found
45
+ */
46
+ readonly optional: true;
47
+ };
48
+ export type NameDependencyOptions = {
49
+ /**
50
+ * the name used to resolve the dependency
51
+ */
52
+ readonly name: 'name';
53
+ /**
54
+ * if optional, the app will not throw
55
+ * if the dependency is not found
56
+ */
57
+ readonly optional: true;
58
+ };
59
+ export type ManifestDependencyOptions = {
60
+ /**
61
+ * the name used to resolve the dependency
62
+ */
63
+ readonly name: 'manifest';
64
+ /**
65
+ * if optional, the app will not throw
66
+ * if the dependency is not found
67
+ */
68
+ readonly optional?: false;
69
+ };
70
+ export type CredentialsDependencyOptions = {
71
+ /**
72
+ * the name used to resolve the dependency
73
+ */
74
+ readonly name: 'credentials';
75
+ /**
76
+ * if optional, the app will not throw
77
+ * if the dependency is not found
78
+ */
79
+ readonly optional: true;
80
+ };
81
+ export type BotTokenDependencyOptions = {
82
+ /**
83
+ * the name used to resolve the dependency
84
+ */
85
+ readonly name: 'botToken';
86
+ /**
87
+ * if optional, the app will not throw
88
+ * if the dependency is not found
89
+ */
90
+ readonly optional: true;
91
+ };
92
+ export type GraphTokenDependencyOptions = {
93
+ /**
94
+ * the name used to resolve the dependency
95
+ */
96
+ readonly name: 'graphToken';
97
+ /**
98
+ * if optional, the app will not throw
99
+ * if the dependency is not found
100
+ */
101
+ readonly optional: true;
102
+ };
103
+ export type LoggerDependencyOptions = {
104
+ /**
105
+ * the name used to resolve the dependency
106
+ */
107
+ readonly name: 'ILogger';
108
+ /**
109
+ * if optional, the app will not throw
110
+ * if the dependency is not found
111
+ */
112
+ readonly optional?: false;
113
+ };
114
+ export type StorageDependencyOptions = {
115
+ /**
116
+ * the name used to resolve the dependency
117
+ */
118
+ readonly name: 'IStorage';
119
+ /**
120
+ * if optional, the app will not throw
121
+ * if the dependency is not found
122
+ */
123
+ readonly optional?: false;
124
+ };
125
+ export type PluginDependencyOptions = {
126
+ /**
127
+ * the name used to resolve the dependency
128
+ */
129
+ readonly name?: Omit<string, 'id' | 'name' | 'manifest' | 'credentials' | 'botToken' | 'graphToken' | 'ILogger' | 'IStorage'>;
130
+ /**
131
+ * if optional, the app will not throw
132
+ * if the dependency is not found
133
+ */
134
+ readonly optional?: boolean;
135
+ };
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PLUGIN_DEPENDENCIES_METADATA_KEY = void 0;
4
+ exports.Dependency = Dependency;
5
+ exports.Logger = Logger;
6
+ exports.Storage = Storage;
7
+ require("reflect-metadata");
8
+ const plugin_1 = require("./plugin");
9
+ exports.PLUGIN_DEPENDENCIES_METADATA_KEY = 'teams:plugin:dependencies';
10
+ /**
11
+ * add plugin dependencies via
12
+ * `@Dependency()`
13
+ */
14
+ function Dependency(options = {}) {
15
+ const name = options.name;
16
+ const optional = options.optional || false;
17
+ return (target, propertyKey) => {
18
+ if (typeof propertyKey === 'string') {
19
+ const TargetType = target.constructor;
20
+ const FieldType = Reflect.getMetadata('design:type', target, propertyKey);
21
+ let fieldTypeKey = name || FieldType.name;
22
+ // if plugin, resolve using the plugins name
23
+ if (Reflect.hasMetadata(plugin_1.PLUGIN_METADATA_KEY, FieldType)) {
24
+ const meta = Reflect.getMetadata(plugin_1.PLUGIN_METADATA_KEY, FieldType);
25
+ fieldTypeKey = meta.name;
26
+ }
27
+ const targetFieldsMetadata = Reflect.getOwnMetadata(exports.PLUGIN_DEPENDENCIES_METADATA_KEY, TargetType) || [];
28
+ targetFieldsMetadata.push({
29
+ key: propertyKey,
30
+ type: fieldTypeKey,
31
+ optional,
32
+ });
33
+ Reflect.defineMetadata(exports.PLUGIN_DEPENDENCIES_METADATA_KEY, targetFieldsMetadata, TargetType);
34
+ }
35
+ };
36
+ }
37
+ /**
38
+ * inject the `App` `ILogger` instance
39
+ */
40
+ function Logger() {
41
+ return Dependency({ name: 'ILogger' });
42
+ }
43
+ /**
44
+ * inject the `App` `IStorage` instance
45
+ */
46
+ function Storage() {
47
+ return Dependency({ name: 'IStorage' });
48
+ }
49
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVwZW5kZW5jeS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy90eXBlcy9wbHVnaW4vZGVjb3JhdG9ycy9kZXBlbmRlbmN5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQTJCQSxnQ0E0QkM7QUFLRCx3QkFFQztBQUtELDBCQUVDO0FBckVELDRCQUEwQjtBQUMxQixxQ0FBOEQ7QUFFakQsUUFBQSxnQ0FBZ0MsR0FBRywyQkFBMkIsQ0FBQztBQW9CNUU7OztHQUdHO0FBQ0gsU0FBZ0IsVUFBVSxDQUFDLFVBQTZCLEVBQUU7SUFDeEQsTUFBTSxJQUFJLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQztJQUMxQixNQUFNLFFBQVEsR0FBRyxPQUFPLENBQUMsUUFBUSxJQUFJLEtBQUssQ0FBQztJQUUzQyxPQUFPLENBQUMsTUFBVyxFQUFFLFdBQWdELEVBQUUsRUFBRTtRQUN2RSxJQUFJLE9BQU8sV0FBVyxLQUFLLFFBQVEsRUFBRSxDQUFDO1lBQ3BDLE1BQU0sVUFBVSxHQUFHLE1BQU0sQ0FBQyxXQUFXLENBQUM7WUFDdEMsTUFBTSxTQUFTLEdBQUcsT0FBTyxDQUFDLFdBQVcsQ0FBQyxhQUFhLEVBQUUsTUFBTSxFQUFFLFdBQVcsQ0FBQyxDQUFDO1lBQzFFLElBQUksWUFBWSxHQUFHLElBQUksSUFBSSxTQUFTLENBQUMsSUFBSSxDQUFDO1lBRTFDLDRDQUE0QztZQUM1QyxJQUFJLE9BQU8sQ0FBQyxXQUFXLENBQUMsNEJBQW1CLEVBQUUsU0FBUyxDQUFDLEVBQUUsQ0FBQztnQkFDeEQsTUFBTSxJQUFJLEdBQWtCLE9BQU8sQ0FBQyxXQUFXLENBQUMsNEJBQW1CLEVBQUUsU0FBUyxDQUFDLENBQUM7Z0JBQ2hGLFlBQVksR0FBRyxJQUFJLENBQUMsSUFBSSxDQUFDO1lBQzNCLENBQUM7WUFFRCxNQUFNLG9CQUFvQixHQUN4QixPQUFPLENBQUMsY0FBYyxDQUFDLHdDQUFnQyxFQUFFLFVBQVUsQ0FBQyxJQUFJLEVBQUUsQ0FBQztZQUU3RSxvQkFBb0IsQ0FBQyxJQUFJLENBQUM7Z0JBQ3hCLEdBQUcsRUFBRSxXQUFXO2dCQUNoQixJQUFJLEVBQUUsWUFBWTtnQkFDbEIsUUFBUTthQUNULENBQUMsQ0FBQztZQUVILE9BQU8sQ0FBQyxjQUFjLENBQUMsd0NBQWdDLEVBQUUsb0JBQW9CLEVBQUUsVUFBVSxDQUFDLENBQUM7UUFDN0YsQ0FBQztJQUNILENBQUMsQ0FBQztBQUNKLENBQUM7QUFFRDs7R0FFRztBQUNILFNBQWdCLE1BQU07SUFDcEIsT0FBTyxVQUFVLENBQUMsRUFBRSxJQUFJLEVBQUUsU0FBUyxFQUFFLENBQUMsQ0FBQztBQUN6QyxDQUFDO0FBRUQ7O0dBRUc7QUFDSCxTQUFnQixPQUFPO0lBQ3JCLE9BQU8sVUFBVSxDQUFDLEVBQUUsSUFBSSxFQUFFLFVBQVUsRUFBRSxDQUFDLENBQUM7QUFDMUMsQ0FBQyJ9
@@ -0,0 +1,18 @@
1
+ import 'reflect-metadata';
2
+ export declare const PLUGIN_EVENTS_METADATA_KEY = "teams:plugin:events";
3
+ export type PluginEventName = 'error' | 'activity';
4
+ export type EventMetadata = {
5
+ /**
6
+ * the property name
7
+ */
8
+ readonly key: string;
9
+ /**
10
+ * the event name
11
+ */
12
+ readonly name: PluginEventName;
13
+ };
14
+ /**
15
+ * add an event emitter to your plugin
16
+ * via `@Event(...)`
17
+ */
18
+ export declare function Event(name: PluginEventName): (target: any, propertyKey: string | ClassFieldDecoratorContext) => void;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PLUGIN_EVENTS_METADATA_KEY = void 0;
4
+ exports.Event = Event;
5
+ require("reflect-metadata");
6
+ exports.PLUGIN_EVENTS_METADATA_KEY = 'teams:plugin:events';
7
+ /**
8
+ * add an event emitter to your plugin
9
+ * via `@Event(...)`
10
+ */
11
+ function Event(name) {
12
+ return (target, propertyKey) => {
13
+ if (typeof propertyKey === 'string') {
14
+ const TargetType = target.constructor;
15
+ const targetEventsMetadata = Reflect.getOwnMetadata(exports.PLUGIN_EVENTS_METADATA_KEY, TargetType) || [];
16
+ targetEventsMetadata.push({
17
+ key: propertyKey,
18
+ name,
19
+ });
20
+ Reflect.defineMetadata(exports.PLUGIN_EVENTS_METADATA_KEY, targetEventsMetadata, TargetType);
21
+ }
22
+ };
23
+ }
24
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXZlbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvdHlwZXMvcGx1Z2luL2RlY29yYXRvcnMvZXZlbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBb0JBLHNCQWVDO0FBbkNELDRCQUEwQjtBQUViLFFBQUEsMEJBQTBCLEdBQUcscUJBQXFCLENBQUM7QUFjaEU7OztHQUdHO0FBQ0gsU0FBZ0IsS0FBSyxDQUFDLElBQXFCO0lBQ3pDLE9BQU8sQ0FBQyxNQUFXLEVBQUUsV0FBZ0QsRUFBRSxFQUFFO1FBQ3ZFLElBQUksT0FBTyxXQUFXLEtBQUssUUFBUSxFQUFFLENBQUM7WUFDcEMsTUFBTSxVQUFVLEdBQUcsTUFBTSxDQUFDLFdBQVcsQ0FBQztZQUN0QyxNQUFNLG9CQUFvQixHQUN4QixPQUFPLENBQUMsY0FBYyxDQUFDLGtDQUEwQixFQUFFLFVBQVUsQ0FBQyxJQUFJLEVBQUUsQ0FBQztZQUV2RSxvQkFBb0IsQ0FBQyxJQUFJLENBQUM7Z0JBQ3hCLEdBQUcsRUFBRSxXQUFXO2dCQUNoQixJQUFJO2FBQ0wsQ0FBQyxDQUFDO1lBRUgsT0FBTyxDQUFDLGNBQWMsQ0FBQyxrQ0FBMEIsRUFBRSxvQkFBb0IsRUFBRSxVQUFVLENBQUMsQ0FBQztRQUN2RixDQUFDO0lBQ0gsQ0FBQyxDQUFDO0FBQ0osQ0FBQyJ9
@@ -0,0 +1,3 @@
1
+ export { Plugin, PluginOptions } from './plugin';
2
+ export { Dependency, DependencyOptions, Logger, Storage } from './dependency';
3
+ export { Event } from './event';
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Event = exports.Storage = exports.Logger = exports.Dependency = exports.Plugin = void 0;
4
+ var plugin_1 = require("./plugin");
5
+ Object.defineProperty(exports, "Plugin", { enumerable: true, get: function () { return plugin_1.Plugin; } });
6
+ var dependency_1 = require("./dependency");
7
+ Object.defineProperty(exports, "Dependency", { enumerable: true, get: function () { return dependency_1.Dependency; } });
8
+ Object.defineProperty(exports, "Logger", { enumerable: true, get: function () { return dependency_1.Logger; } });
9
+ Object.defineProperty(exports, "Storage", { enumerable: true, get: function () { return dependency_1.Storage; } });
10
+ var event_1 = require("./event");
11
+ Object.defineProperty(exports, "Event", { enumerable: true, get: function () { return event_1.Event; } });
12
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvdHlwZXMvcGx1Z2luL2RlY29yYXRvcnMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsbUNBQWlEO0FBQXhDLGdHQUFBLE1BQU0sT0FBQTtBQUNmLDJDQUE4RTtBQUFyRSx3R0FBQSxVQUFVLE9BQUE7QUFBcUIsb0dBQUEsTUFBTSxPQUFBO0FBQUUscUdBQUEsT0FBTyxPQUFBO0FBQ3ZELGlDQUFnQztBQUF2Qiw4RkFBQSxLQUFLLE9BQUEifQ==
@@ -0,0 +1,25 @@
1
+ import 'reflect-metadata';
2
+ import { Constructor } from '../../constructor';
3
+ export declare const PLUGIN_METADATA_KEY = "teams:plugin";
4
+ /**
5
+ * options for the plugins
6
+ */
7
+ export type PluginOptions = {
8
+ /**
9
+ * the unique plugin name
10
+ */
11
+ readonly name: string;
12
+ /**
13
+ * the plugin version
14
+ */
15
+ readonly version: string;
16
+ /**
17
+ * the plugin description
18
+ */
19
+ readonly description?: string;
20
+ };
21
+ /**
22
+ * turn any class into a plugin via
23
+ * `@Plugin({ ... })`
24
+ */
25
+ export declare function Plugin(metadata?: Partial<PluginOptions>): <T extends Constructor<{}>>(Base: T) => T;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PLUGIN_METADATA_KEY = void 0;
4
+ exports.Plugin = Plugin;
5
+ require("reflect-metadata");
6
+ exports.PLUGIN_METADATA_KEY = 'teams:plugin';
7
+ /**
8
+ * turn any class into a plugin via
9
+ * `@Plugin({ ... })`
10
+ */
11
+ function Plugin(metadata = {}) {
12
+ return (Base) => {
13
+ const name = metadata.name || Base.name;
14
+ const version = metadata.version || '0.0.0';
15
+ Reflect.defineMetadata(exports.PLUGIN_METADATA_KEY, {
16
+ name,
17
+ version,
18
+ description: metadata.description,
19
+ }, Base);
20
+ return Base;
21
+ };
22
+ }
23
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGx1Z2luLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL3R5cGVzL3BsdWdpbi9kZWNvcmF0b3JzL3BsdWdpbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUE4QkEsd0JBaUJDO0FBL0NELDRCQUEwQjtBQUliLFFBQUEsbUJBQW1CLEdBQUcsY0FBYyxDQUFDO0FBc0JsRDs7O0dBR0c7QUFDSCxTQUFnQixNQUFNLENBQUMsV0FBbUMsRUFBRTtJQUMxRCxPQUFPLENBQTRCLElBQU8sRUFBRSxFQUFFO1FBQzVDLE1BQU0sSUFBSSxHQUFHLFFBQVEsQ0FBQyxJQUFJLElBQUksSUFBSSxDQUFDLElBQUksQ0FBQztRQUN4QyxNQUFNLE9BQU8sR0FBRyxRQUFRLENBQUMsT0FBTyxJQUFJLE9BQU8sQ0FBQztRQUU1QyxPQUFPLENBQUMsY0FBYyxDQUNwQiwyQkFBbUIsRUFDbkI7WUFDRSxJQUFJO1lBQ0osT0FBTztZQUNQLFdBQVcsRUFBRSxRQUFRLENBQUMsV0FBVztTQUNsQyxFQUNELElBQUksQ0FDTCxDQUFDO1FBRUYsT0FBTyxJQUFJLENBQUM7SUFDZCxDQUFDLENBQUM7QUFDSixDQUFDIn0=
@@ -0,0 +1,8 @@
1
+ export * from './plugin';
2
+ export * from './plugin-activity-event';
3
+ export * from './plugin-activity-sent-event';
4
+ export * from './plugin-activity-response-event';
5
+ export * from './plugin-error-event';
6
+ export * from './plugin-start-event';
7
+ export * from './sender';
8
+ export * from './decorators';
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./plugin"), exports);
18
+ __exportStar(require("./plugin-activity-event"), exports);
19
+ __exportStar(require("./plugin-activity-sent-event"), exports);
20
+ __exportStar(require("./plugin-activity-response-event"), exports);
21
+ __exportStar(require("./plugin-error-event"), exports);
22
+ __exportStar(require("./plugin-start-event"), exports);
23
+ __exportStar(require("./sender"), exports);
24
+ __exportStar(require("./decorators"), exports);
25
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvdHlwZXMvcGx1Z2luL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBQSwyQ0FBeUI7QUFDekIsMERBQXdDO0FBQ3hDLCtEQUE2QztBQUM3QyxtRUFBaUQ7QUFDakQsdURBQXFDO0FBQ3JDLHVEQUFxQztBQUNyQywyQ0FBeUI7QUFDekIsK0NBQTZCIn0=
@@ -0,0 +1,20 @@
1
+ import { Activity, ConversationReference, IToken } from '@microsoft/teams.api';
2
+ import { ISender } from './sender';
3
+ /**
4
+ * the event emitted by a plugin
5
+ * when an activity is received
6
+ */
7
+ export interface IPluginActivityEvent extends ConversationReference {
8
+ /**
9
+ * the sender
10
+ */
11
+ readonly sender: ISender;
12
+ /**
13
+ * inbound request token
14
+ */
15
+ readonly token: IToken;
16
+ /**
17
+ * inbound request activity payload
18
+ */
19
+ readonly activity: Activity;
20
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGx1Z2luLWFjdGl2aXR5LWV2ZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3R5cGVzL3BsdWdpbi9wbHVnaW4tYWN0aXZpdHktZXZlbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
@@ -0,0 +1,20 @@
1
+ import { Activity, ConversationReference, InvokeResponse } from '@microsoft/teams.api';
2
+ import { ISender } from './sender';
3
+ /**
4
+ * the event emitted by a plugin
5
+ * before an activity response is sent
6
+ */
7
+ export interface IPluginActivityResponseEvent extends ConversationReference {
8
+ /**
9
+ * the sender
10
+ */
11
+ readonly sender: ISender;
12
+ /**
13
+ * inbound request activity payload
14
+ */
15
+ readonly activity: Activity;
16
+ /**
17
+ * the response
18
+ */
19
+ readonly response: InvokeResponse;
20
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGx1Z2luLWFjdGl2aXR5LXJlc3BvbnNlLWV2ZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3R5cGVzL3BsdWdpbi9wbHVnaW4tYWN0aXZpdHktcmVzcG9uc2UtZXZlbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
@@ -0,0 +1,16 @@
1
+ import { ConversationReference, SentActivity } from '@microsoft/teams.api';
2
+ import { ISender } from './sender';
3
+ /**
4
+ * the event emitted by a plugin
5
+ * when an activity is sent
6
+ */
7
+ export interface IPluginActivitySentEvent extends ConversationReference {
8
+ /**
9
+ * the sender of the activity
10
+ */
11
+ readonly sender: ISender;
12
+ /**
13
+ * the sent activity
14
+ */
15
+ readonly activity: SentActivity;
16
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGx1Z2luLWFjdGl2aXR5LXNlbnQtZXZlbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvdHlwZXMvcGx1Z2luL3BsdWdpbi1hY3Rpdml0eS1zZW50LWV2ZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIifQ==
@@ -0,0 +1,20 @@
1
+ import { Activity } from '@microsoft/teams.api';
2
+ import { IPlugin } from './plugin';
3
+ /**
4
+ * the event emitted when an
5
+ * error occurs
6
+ */
7
+ export interface IPluginErrorEvent {
8
+ /**
9
+ * the sender
10
+ */
11
+ readonly sender?: IPlugin;
12
+ /**
13
+ * the error
14
+ */
15
+ readonly error: Error;
16
+ /**
17
+ * the activity
18
+ */
19
+ readonly activity?: Activity;
20
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGx1Z2luLWVycm9yLWV2ZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3R5cGVzL3BsdWdpbi9wbHVnaW4tZXJyb3ItZXZlbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
@@ -0,0 +1,11 @@
1
+ /**
2
+ * the event emitted when a plugin
3
+ * is started
4
+ */
5
+ export interface IPluginStartEvent {
6
+ /**
7
+ * the port given to the
8
+ * `app.start()` method
9
+ */
10
+ readonly port: number;
11
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGx1Z2luLXN0YXJ0LWV2ZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3R5cGVzL3BsdWdpbi9wbHVnaW4tc3RhcnQtZXZlbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
@@ -0,0 +1,74 @@
1
+ import { ActivityParams, ConversationReference, SentActivity } from '@microsoft/teams.api';
2
+ import { IStreamer } from '../streamer';
3
+ import { IActivityEvent, IErrorEvent } from '../../events';
4
+ import { IPluginStartEvent } from './plugin-start-event';
5
+ import { IPluginErrorEvent } from './plugin-error-event';
6
+ import { IPluginActivityEvent } from './plugin-activity-event';
7
+ import { IPluginActivitySentEvent } from './plugin-activity-sent-event';
8
+ import { IPluginActivityResponseEvent } from './plugin-activity-response-event';
9
+ /**
10
+ * represents a plugins
11
+ * unique name
12
+ */
13
+ export type PluginName = 'http' | Omit<string, 'http'>;
14
+ /**
15
+ * emitted when the plugin
16
+ * encounters an error
17
+ */
18
+ export type OnErrorPluginEvent = (event: IErrorEvent) => void;
19
+ /**
20
+ * emitted when the plugin
21
+ * receives an activity
22
+ */
23
+ export type OnActivityPluginEvent = (event: IActivityEvent) => void;
24
+ /**
25
+ * a component for extending the base
26
+ * `App` functionality
27
+ */
28
+ export interface IPlugin {
29
+ /**
30
+ * lifecycle method called by the `App`
31
+ * once during initialization
32
+ */
33
+ onInit?(): void | Promise<void>;
34
+ /**
35
+ * lifecycle method called by the `App`
36
+ * once during startup
37
+ */
38
+ onStart?(event: IPluginStartEvent): void | Promise<void>;
39
+ /**
40
+ * lifecycle method called by the `App`
41
+ * once during shutdown
42
+ */
43
+ onStop?(): void | Promise<void>;
44
+ /**
45
+ * called by the `App`
46
+ * when an error occurs
47
+ */
48
+ onError?(event: IPluginErrorEvent): void | Promise<void>;
49
+ /**
50
+ * called by the `App`
51
+ * when an activity is received
52
+ */
53
+ onActivity?(event: IPluginActivityEvent): void | Promise<void>;
54
+ /**
55
+ * called by the `App`
56
+ * when an activity is sent
57
+ */
58
+ onActivitySent?(event: IPluginActivitySentEvent): void | Promise<void>;
59
+ /**
60
+ * called by the `App`
61
+ * when an activity response is sent
62
+ */
63
+ onActivityResponse?(event: IPluginActivityResponseEvent): void | Promise<void>;
64
+ /**
65
+ * called by the `App`
66
+ * to send an activity
67
+ */
68
+ send?(activity: ActivityParams, ref: ConversationReference): Promise<SentActivity>;
69
+ /**
70
+ * called by the `App`
71
+ * to create a new activity stream
72
+ */
73
+ createStream?(ref: ConversationReference): IStreamer;
74
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGx1Z2luLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3R5cGVzL3BsdWdpbi9wbHVnaW4udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
@@ -0,0 +1,18 @@
1
+ import { ActivityParams, ConversationReference, SentActivity } from '@microsoft/teams.api';
2
+ import { IStreamer } from '../streamer';
3
+ import { IPlugin } from './plugin';
4
+ /**
5
+ * a plugin that can send activities
6
+ */
7
+ export interface ISender extends IPlugin {
8
+ /**
9
+ * called by the `App`
10
+ * to send an activity
11
+ */
12
+ send(activity: ActivityParams, ref: ConversationReference): Promise<SentActivity>;
13
+ /**
14
+ * called by the `App`
15
+ * to create a new activity stream
16
+ */
17
+ createStream(ref: ConversationReference): IStreamer;
18
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VuZGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3R5cGVzL3BsdWdpbi9zZW5kZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
@@ -0,0 +1,3 @@
1
+ export type Prefixed<T, P extends string | undefined = undefined> = {
2
+ [K in Extract<keyof T, string> as P extends string ? `${P}${K}` : K]?: T[K];
3
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJlZml4ZWQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdHlwZXMvcHJlZml4ZWQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
@@ -0,0 +1,2 @@
1
+ import { IActivityContext } from '../contexts';
2
+ export type RouteHandler<In extends IActivityContext<any>, Out = void> = (ctx: In) => Out | Promise<Out>;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicm91dGUtaGFuZGxlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90eXBlcy9yb3V0ZS1oYW5kbGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIifQ==
@@ -0,0 +1,31 @@
1
+ import { IMessageActivity, ITypingActivity, SentActivity } from '@microsoft/teams.api';
2
+ import { IEventEmitter } from '@microsoft/teams.common';
3
+ /**
4
+ * the minimum events a streamer
5
+ * should support
6
+ */
7
+ export interface IStreamerEvents {
8
+ /**
9
+ * emitted for each chunk sent
10
+ */
11
+ readonly chunk: SentActivity;
12
+ /**
13
+ * emitted once on stream close
14
+ */
15
+ readonly close: SentActivity;
16
+ }
17
+ /**
18
+ * component that can send streamed chunks of an activity
19
+ */
20
+ export interface IStreamer {
21
+ readonly events: Omit<IEventEmitter<IStreamerEvents>, 'emit'>;
22
+ /**
23
+ * emit an activity chunk
24
+ * @param activity the activity to send
25
+ */
26
+ emit(activity: Partial<IMessageActivity | ITypingActivity> | string): void;
27
+ /**
28
+ * close the stream
29
+ */
30
+ close(): void | Promise<void>;
31
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RyZWFtZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdHlwZXMvc3RyZWFtZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
@@ -0,0 +1,3 @@
1
+ export type Suffixed<T, S extends string | undefined = undefined> = {
2
+ [K in Extract<keyof T, string> as S extends string ? `${K}${S}` : K]?: T[K];
3
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3VmZml4ZWQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdHlwZXMvc3VmZml4ZWQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9