@sprucelabs/spruce-templates 23.1.0 → 24.1.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.
Files changed (208) hide show
  1. package/LICENSE +21 -0
  2. package/build/index.js +4 -1
  3. package/build/templates/typescript/sandbox/will-boot.listener.ts.hbs +136 -73
  4. package/build/templates/typescript/test/Test.test.ts.hbs +4 -3
  5. package/build/types/templates.types.d.ts +1 -0
  6. package/package.json +9 -9
  7. package/build/addons/eq.addon.js.map +0 -1
  8. package/build/addons/escape.addon.js.map +0 -1
  9. package/build/addons/fieldDefinitionBodyPartial.addon.js.map +0 -1
  10. package/build/addons/fieldDefinitionOptions.addon.js.map +0 -1
  11. package/build/addons/fieldTypeEnum.addon.js.map +0 -1
  12. package/build/addons/fieldValue.addon.js.map +0 -1
  13. package/build/addons/gt.addon.js.map +0 -1
  14. package/build/addons/hasKeys.addon.js.map +0 -1
  15. package/build/addons/hasNoneCoreSchemaTemplateItems.addon.js.map +0 -1
  16. package/build/addons/importRelatedSchemas.addon.js.map +0 -1
  17. package/build/addons/index.js.map +0 -1
  18. package/build/addons/isDefined.addon.js.map +0 -1
  19. package/build/addons/json.addon.js.map +0 -1
  20. package/build/addons/neq.addon.js.map +0 -1
  21. package/build/addons/operators.addon.js.map +0 -1
  22. package/build/addons/pascalCase.addon.js.map +0 -1
  23. package/build/addons/permissionContractBuilder.addon.js.map +0 -1
  24. package/build/addons/schemaBodyPartial.addon.js.map +0 -1
  25. package/build/addons/schemaNamespacePath.addon.js.map +0 -1
  26. package/build/addons/schemaValuesPartial.addon.js.map +0 -1
  27. package/build/addons/valueTypeGenerator.addon.js.map +0 -1
  28. package/build/addons/valueTypeLiteral.addon.js.map +0 -1
  29. package/build/addons/valueTypeMapper.addon.js.map +0 -1
  30. package/build/dist/templates/directories/skill/.nvmrc +0 -1
  31. package/build/dist/templates/directories/skill/README.md +0 -4
  32. package/build/dist/templates/directories/skill/eslint.config.mjs +0 -3
  33. package/build/dist/templates/directories/skill/package.json.hbs +0 -15
  34. package/build/dist/templates/directories/skill/src/errors/SpruceError.ts.hbs +0 -20
  35. package/build/dist/templates/directories/skill/tsconfig.json +0 -39
  36. package/build/dist/templates/directories/vscode/.vscode/launch.json +0 -58
  37. package/build/dist/templates/directories/vscode/.vscode/settings.json +0 -67
  38. package/build/dist/templates/directories/vscode/.vscode/tasks.json +0 -112
  39. package/build/dist/templates/typescript/conversation/conversation.plugin.ts.hbs +0 -1
  40. package/build/dist/templates/typescript/conversation/conversation.topic.ts.hbs +0 -19
  41. package/build/dist/templates/typescript/deploy/deploy.plugin.ts.hbs +0 -1
  42. package/build/dist/templates/typescript/error/SpruceError.ts.hbs +0 -31
  43. package/build/dist/templates/typescript/error/error.plugin.ts.hbs +0 -78
  44. package/build/dist/templates/typescript/error/example.ts.hbs +0 -10
  45. package/build/dist/templates/typescript/error/options.types.ts.hbs +0 -12
  46. package/build/dist/templates/typescript/event/event.contract.ts.hbs +0 -26
  47. package/build/dist/templates/typescript/event/event.options.ts.hbs +0 -11
  48. package/build/dist/templates/typescript/event/events.contract.ts.hbs +0 -24
  49. package/build/dist/templates/typescript/event/listener.ts.hbs +0 -23
  50. package/build/dist/templates/typescript/event/listeners.ts.hbs +0 -15
  51. package/build/dist/templates/typescript/event/payload.builder.ts.hbs +0 -15
  52. package/build/dist/templates/typescript/log/transport.plugin.ts.hbs +0 -14
  53. package/build/dist/templates/typescript/permissions/contract.builder.ts.hbs +0 -36
  54. package/build/dist/templates/typescript/permissions/permission.plugin.ts.hbs +0 -1
  55. package/build/dist/templates/typescript/permissions/permissions.ts.hbs +0 -13
  56. package/build/dist/templates/typescript/permissions/permissions.types.ts.hbs +0 -14
  57. package/build/dist/templates/typescript/polish/polish.ts.hbs +0 -67
  58. package/build/dist/templates/typescript/sandbox/will-boot.listener.ts.hbs +0 -109
  59. package/build/dist/templates/typescript/schema/builder.ts.hbs +0 -24
  60. package/build/dist/templates/typescript/schema/core.schemas.types.ts.hbs +0 -34
  61. package/build/dist/templates/typescript/schema/example.ts.hbs +0 -20
  62. package/build/dist/templates/typescript/schema/fields/fieldClassMap.ts.hbs +0 -16
  63. package/build/dist/templates/typescript/schema/fields/fields.types.ts.hbs +0 -1
  64. package/build/dist/templates/typescript/schema/imported.schema.ts.hbs +0 -1
  65. package/build/dist/templates/typescript/schema/partials/fieldDefinitionBody.ts.hbs +0 -12
  66. package/build/dist/templates/typescript/schema/partials/schemaBody.ts.hbs +0 -20
  67. package/build/dist/templates/typescript/schema/partials/schemaValues.ts.hbs +0 -7
  68. package/build/dist/templates/typescript/schema/schema.plugin.ts.hbs +0 -101
  69. package/build/dist/templates/typescript/schema/schema.ts.hbs +0 -12
  70. package/build/dist/templates/typescript/schema/schemas.types.ts.hbs +0 -44
  71. package/build/dist/templates/typescript/schema/valueTypes.ts.hbs +0 -67
  72. package/build/dist/templates/typescript/store/Store.store.ts.hbs +0 -95
  73. package/build/dist/templates/typescript/store/store.plugin.ts.hbs +0 -1
  74. package/build/dist/templates/typescript/store/stores.ts.hbs +0 -9
  75. package/build/dist/templates/typescript/store/stores.types.ts.hbs +0 -17
  76. package/build/dist/templates/typescript/view/App.ac.ts.hbs +0 -6
  77. package/build/dist/templates/typescript/view/View.svc.ts.hbs +0 -23
  78. package/build/dist/templates/typescript/view/View.vc.ts.hbs +0 -17
  79. package/build/dist/templates/typescript/view/skill.theme.ts.hbs +0 -70
  80. package/build/dist/templates/typescript/view/view.plugin.ts.hbs +0 -1
  81. package/build/dist/templates/typescript/view/viewController.plugin.ts.hbs +0 -3
  82. package/build/dist/templates/typescript/view/views.ts.hbs +0 -93
  83. package/build/esm/addons/eq.addon.d.ts +0 -1
  84. package/build/esm/addons/eq.addon.js +0 -4
  85. package/build/esm/addons/escape.addon.d.ts +0 -1
  86. package/build/esm/addons/escape.addon.js +0 -5
  87. package/build/esm/addons/fieldDefinitionBodyPartial.addon.d.ts +0 -1
  88. package/build/esm/addons/fieldDefinitionBodyPartial.addon.js +0 -8
  89. package/build/esm/addons/fieldDefinitionOptions.addon.d.ts +0 -1
  90. package/build/esm/addons/fieldDefinitionOptions.addon.js +0 -66
  91. package/build/esm/addons/fieldTypeEnum.addon.d.ts +0 -1
  92. package/build/esm/addons/fieldTypeEnum.addon.js +0 -9
  93. package/build/esm/addons/fieldValue.addon.d.ts +0 -1
  94. package/build/esm/addons/fieldValue.addon.js +0 -8
  95. package/build/esm/addons/gt.addon.d.ts +0 -1
  96. package/build/esm/addons/gt.addon.js +0 -4
  97. package/build/esm/addons/hasKeys.addon.d.ts +0 -1
  98. package/build/esm/addons/hasKeys.addon.js +0 -4
  99. package/build/esm/addons/hasNoneCoreSchemaTemplateItems.addon.d.ts +0 -1
  100. package/build/esm/addons/hasNoneCoreSchemaTemplateItems.addon.js +0 -6
  101. package/build/esm/addons/importRelatedSchemas.addon.d.ts +0 -1
  102. package/build/esm/addons/importRelatedSchemas.addon.js +0 -34
  103. package/build/esm/addons/index.d.ts +0 -23
  104. package/build/esm/addons/index.js +0 -23
  105. package/build/esm/addons/isDefined.addon.d.ts +0 -1
  106. package/build/esm/addons/isDefined.addon.js +0 -5
  107. package/build/esm/addons/json.addon.d.ts +0 -1
  108. package/build/esm/addons/json.addon.js +0 -7
  109. package/build/esm/addons/neq.addon.d.ts +0 -1
  110. package/build/esm/addons/neq.addon.js +0 -4
  111. package/build/esm/addons/operators.addon.d.ts +0 -1
  112. package/build/esm/addons/operators.addon.js +0 -15
  113. package/build/esm/addons/pascalCase.addon.d.ts +0 -1
  114. package/build/esm/addons/pascalCase.addon.js +0 -6
  115. package/build/esm/addons/permissionContractBuilder.addon.d.ts +0 -1
  116. package/build/esm/addons/permissionContractBuilder.addon.js +0 -4
  117. package/build/esm/addons/schemaBodyPartial.addon.d.ts +0 -1
  118. package/build/esm/addons/schemaBodyPartial.addon.js +0 -8
  119. package/build/esm/addons/schemaNamespacePath.addon.d.ts +0 -1
  120. package/build/esm/addons/schemaNamespacePath.addon.js +0 -18
  121. package/build/esm/addons/schemaValuesPartial.addon.d.ts +0 -1
  122. package/build/esm/addons/schemaValuesPartial.addon.js +0 -8
  123. package/build/esm/addons/valueTypeGenerator.addon.d.ts +0 -1
  124. package/build/esm/addons/valueTypeGenerator.addon.js +0 -15
  125. package/build/esm/addons/valueTypeLiteral.addon.d.ts +0 -1
  126. package/build/esm/addons/valueTypeLiteral.addon.js +0 -32
  127. package/build/esm/addons/valueTypeMapper.addon.d.ts +0 -1
  128. package/build/esm/addons/valueTypeMapper.addon.js +0 -9
  129. package/build/esm/index.d.ts +0 -141
  130. package/build/esm/index.js +0 -255
  131. package/build/esm/templates/directories/skill/.nvmrc +0 -1
  132. package/build/esm/templates/directories/skill/README.md +0 -4
  133. package/build/esm/templates/directories/skill/eslint.config.mjs +0 -3
  134. package/build/esm/templates/directories/skill/package.json.hbs +0 -15
  135. package/build/esm/templates/directories/skill/src/.spruce/errors/options.types.ts +0 -6
  136. package/build/esm/templates/directories/skill/src/.spruce/features/event.plugin.ts +0 -1
  137. package/build/esm/templates/directories/skill/src/.spruce/skill.ts +0 -8
  138. package/build/esm/templates/directories/skill/src/errors/SpruceError.ts.hbs +0 -20
  139. package/build/esm/templates/directories/skill/src/index.ts +0 -35
  140. package/build/esm/templates/directories/skill/tsconfig.json +0 -39
  141. package/build/esm/templates/directories/vscode/.vscode/launch.json +0 -58
  142. package/build/esm/templates/directories/vscode/.vscode/settings.json +0 -67
  143. package/build/esm/templates/directories/vscode/.vscode/tasks.json +0 -112
  144. package/build/esm/templates/typescript/conversation/conversation.plugin.ts.hbs +0 -1
  145. package/build/esm/templates/typescript/conversation/conversation.topic.ts.hbs +0 -19
  146. package/build/esm/templates/typescript/deploy/deploy.plugin.ts.hbs +0 -1
  147. package/build/esm/templates/typescript/error/SpruceError.ts.hbs +0 -31
  148. package/build/esm/templates/typescript/error/error.plugin.ts.hbs +0 -78
  149. package/build/esm/templates/typescript/error/example.ts.hbs +0 -10
  150. package/build/esm/templates/typescript/error/options.types.ts.hbs +0 -12
  151. package/build/esm/templates/typescript/event/event.contract.ts.hbs +0 -26
  152. package/build/esm/templates/typescript/event/event.options.ts.hbs +0 -11
  153. package/build/esm/templates/typescript/event/events.contract.ts.hbs +0 -24
  154. package/build/esm/templates/typescript/event/listener.ts.hbs +0 -23
  155. package/build/esm/templates/typescript/event/listeners.ts.hbs +0 -15
  156. package/build/esm/templates/typescript/event/payload.builder.ts.hbs +0 -15
  157. package/build/esm/templates/typescript/log/transport.plugin.ts.hbs +0 -14
  158. package/build/esm/templates/typescript/permissions/contract.builder.ts.hbs +0 -36
  159. package/build/esm/templates/typescript/permissions/permission.plugin.ts.hbs +0 -1
  160. package/build/esm/templates/typescript/permissions/permissions.ts.hbs +0 -13
  161. package/build/esm/templates/typescript/permissions/permissions.types.ts.hbs +0 -14
  162. package/build/esm/templates/typescript/polish/polish.ts.hbs +0 -67
  163. package/build/esm/templates/typescript/sandbox/will-boot.listener.ts.hbs +0 -109
  164. package/build/esm/templates/typescript/schema/builder.ts.hbs +0 -24
  165. package/build/esm/templates/typescript/schema/core.schemas.types.ts.hbs +0 -34
  166. package/build/esm/templates/typescript/schema/example.ts.hbs +0 -20
  167. package/build/esm/templates/typescript/schema/fields/fieldClassMap.ts.hbs +0 -16
  168. package/build/esm/templates/typescript/schema/fields/fields.types.ts.hbs +0 -1
  169. package/build/esm/templates/typescript/schema/imported.schema.ts.hbs +0 -1
  170. package/build/esm/templates/typescript/schema/partials/fieldDefinitionBody.ts.hbs +0 -12
  171. package/build/esm/templates/typescript/schema/partials/schemaBody.ts.hbs +0 -20
  172. package/build/esm/templates/typescript/schema/partials/schemaValues.ts.hbs +0 -7
  173. package/build/esm/templates/typescript/schema/schema.plugin.ts.hbs +0 -101
  174. package/build/esm/templates/typescript/schema/schema.ts.hbs +0 -12
  175. package/build/esm/templates/typescript/schema/schemas.types.ts.hbs +0 -44
  176. package/build/esm/templates/typescript/schema/valueTypes.ts.hbs +0 -67
  177. package/build/esm/templates/typescript/store/Store.store.ts.hbs +0 -95
  178. package/build/esm/templates/typescript/store/store.plugin.ts.hbs +0 -1
  179. package/build/esm/templates/typescript/store/stores.ts.hbs +0 -9
  180. package/build/esm/templates/typescript/store/stores.types.ts.hbs +0 -17
  181. package/build/esm/templates/typescript/test/Test.test.ts.hbs +0 -20
  182. package/build/esm/templates/typescript/view/App.ac.ts.hbs +0 -6
  183. package/build/esm/templates/typescript/view/View.svc.ts.hbs +0 -23
  184. package/build/esm/templates/typescript/view/View.vc.ts.hbs +0 -17
  185. package/build/esm/templates/typescript/view/skill.theme.ts.hbs +0 -70
  186. package/build/esm/templates/typescript/view/view.plugin.ts.hbs +0 -1
  187. package/build/esm/templates/typescript/view/viewController.plugin.ts.hbs +0 -3
  188. package/build/esm/templates/typescript/view/views.ts.hbs +0 -93
  189. package/build/esm/types/templates.types.d.ts +0 -121
  190. package/build/esm/types/templates.types.js +0 -5
  191. package/build/esm/utilities/DirectoryTemplateUtility.d.ts +0 -15
  192. package/build/esm/utilities/DirectoryTemplateUtility.js +0 -79
  193. package/build/esm/utilities/KeyGeneratorUtility.d.ts +0 -5
  194. package/build/esm/utilities/KeyGeneratorUtility.js +0 -6
  195. package/build/esm/utilities/importExtractor.utility.d.ts +0 -10
  196. package/build/esm/utilities/importExtractor.utility.js +0 -32
  197. package/build/esm/utilities/templateImporter.utility.d.ts +0 -4
  198. package/build/esm/utilities/templateImporter.utility.js +0 -18
  199. package/build/esm/utilities/templateItem.utility.d.ts +0 -6
  200. package/build/esm/utilities/templateItem.utility.js +0 -25
  201. package/build/index.js.map +0 -1
  202. package/build/types/templates.types.js.map +0 -1
  203. package/build/utilities/DirectoryTemplateUtility.js.map +0 -1
  204. package/build/utilities/KeyGeneratorUtility.js.map +0 -1
  205. package/build/utilities/importExtractor.utility.js.map +0 -1
  206. package/build/utilities/templateImporter.utility.js.map +0 -1
  207. package/build/utilities/templateItem.utility.js.map +0 -1
  208. /package/build/{dist/templates/typescript/test/Test.test.ts.hbs → templates/typescript/test/StaticTest.test.ts.hbs} +0 -0
@@ -1,112 +0,0 @@
1
- {
2
- "version": "2.0.0",
3
- "tasks": [
4
- {
5
- "type": "npm",
6
- "script": "watch.build.dev",
7
- "group": "build",
8
- "label": "watch.build.dev & problem.watcher",
9
- "isBackground": true,
10
- "runOptions": {
11
- "runOn": "folderOpen"
12
- },
13
- "promptOnClose": false,
14
- "presentation": {
15
- "focus": false,
16
- "reveal": "never"
17
- },
18
- "problemMatcher": {
19
- "base": "$tsc-watch",
20
- "applyTo": "allDocuments"
21
- }
22
- },
23
- {
24
- "label": "test.file",
25
- "command": "spruce",
26
- "args": [
27
- "test",
28
- "--inspect",
29
- "5200",
30
- "--pattern",
31
- "${fileBasenameNoExtension}",
32
- "--watchMode",
33
- "standard"
34
- ],
35
- "promptOnClose": false,
36
- "group": {
37
- "kind": "test",
38
- "isDefault": true
39
- },
40
- "presentation": {
41
- "reveal": "always",
42
- "panel": "dedicated",
43
- },
44
- "problemMatcher": []
45
- },
46
- {
47
- "label": "test.reporter",
48
- "command": "spruce",
49
- "args": [
50
- "test",
51
- "--shouldHoldAtStart",
52
- "true",
53
- "--watchMode",
54
- "smart"
55
- ],
56
- "promptOnClose": false,
57
- "group": "test",
58
- "runOptions": {
59
- "runOn": "folderOpen"
60
- },
61
- "presentation": {
62
- "panel": "shared",
63
- "focus": true,
64
- "reveal": "always"
65
- }
66
- },
67
- {
68
- "label": "spruce",
69
- "type": "shell",
70
- "command": "spruce ${input:spruceCommand}",
71
- "problemMatcher": [],
72
- "presentation": {
73
- "reveal": "always",
74
- "focus": true,
75
- "panel": "new",
76
- "clear": false
77
- }
78
- },
79
- {
80
- "label": "shell",
81
- "type": "shell",
82
- "command": "${input:command} ${input:optionsCommand}",
83
- "problemMatcher": [],
84
- "presentation": {
85
- "reveal": "always",
86
- "focus": true,
87
- "panel": "new",
88
- "clear": false
89
- }
90
- }
91
- ],
92
- "inputs": [
93
- {
94
- "id": "spruceCommand",
95
- "description": "spruce command",
96
- "default": "create.test",
97
- "type": "promptString"
98
- },
99
- {
100
- "id": "command",
101
- "description": "command",
102
- "default": "yarn",
103
- "type": "promptString"
104
- },
105
- {
106
- "id": "optionsCommand",
107
- "description": "optionsCommand",
108
- "default": "add",
109
- "type": "promptString"
110
- }
111
- ]
112
- }
@@ -1 +0,0 @@
1
- export { plugin as default } from '@sprucelabs/spruce-conversation-plugin'
@@ -1,19 +0,0 @@
1
- import { TopicDefinition } from '@sprucelabs/spruce-conversation-plugin'
2
-
3
- const topicDefinition: TopicDefinition = {
4
- label: '{{nameReadable}}',
5
- utterances: ['book appointment', 'Can i book my appointment?', 'book now', 'do you have any times available?', 'what is the wait time?'],
6
- script: ['Sweet, lets book!', 'Lemme find your appointment!', async (options) => {
7
- const confirm = await options.ui.confirm('Ok, you ready to do this?')
8
- if (!confirm) {
9
- await options.ui.renderLine('Ok, see you later!')
10
- return {
11
- transitionConversationTo: 'discovery'
12
- }
13
- }
14
-
15
- return
16
- }],
17
- }
18
-
19
- export default topicDefinition
@@ -1 +0,0 @@
1
- export { plugin as default } from '@sprucelabs/spruce-deploy-plugin'
@@ -1,31 +0,0 @@
1
- {{#if renderClassDefinition}}
2
- import BaseSpruceError from '@sprucelabs/error'
3
- import ErrorOptions from '#spruce/errors/options.types'
4
-
5
- export default class SpruceError extends BaseSpruceError<ErrorOptions>{
6
-
7
- /** an easy to understand version of the errors */
8
- public friendlyMessage():string {
9
-
10
- const { options } = this
11
- let message
12
- switch (options?.code) {
13
- {{/if}}
14
- {{#each errors}}
15
- case '{{code}}':
16
- message = '{{#if description}}{{{escape description}}}{{else}}A {{{escape nameReadable}}} just happened!{{/if}}'
17
- break
18
- {{/each}}
19
- {{#if renderClassDefinition}}
20
- default:
21
- message = super.friendlyMessage()
22
- }
23
-
24
- const fullMessage = options.friendlyMessage
25
- ? options.friendlyMessage
26
- : message
27
-
28
- return fullMessage
29
- }
30
- }
31
- {{/if}}
@@ -1,78 +0,0 @@
1
- import globby from '@sprucelabs/globby'
2
- import {
3
- ErrorHealthCheckItem,
4
- SkillFeature,
5
- Skill,
6
- diskUtil,
7
- HASH_SPRUCE_DIR_NAME,
8
- BootCallback,
9
- } from '@sprucelabs/spruce-skill-utils'
10
-
11
- class ErrorSkillFeature implements SkillFeature {
12
- private skill: Skill
13
- private _isBooted = false
14
- private bootHandler?: BootCallback
15
-
16
- public constructor(skill: Skill) {
17
- this.skill = skill
18
- }
19
-
20
- public onBoot(cb: BootCallback) {
21
- this.bootHandler = cb
22
- }
23
-
24
- public execute = async () => {
25
- this._isBooted = true
26
- void this.bootHandler?.()
27
- }
28
-
29
- public checkHealth = async () => {
30
- const errorFiles = await this.getErrors()
31
-
32
- const errors = errorFiles.map((path) => {
33
- const schema = require(path).default
34
-
35
- return {
36
- id: schema.id,
37
- name: schema.name,
38
- description: schema.description,
39
- }
40
- })
41
-
42
- const health: ErrorHealthCheckItem = {
43
- status: 'passed',
44
- errorSchemas: errors,
45
- }
46
-
47
- return health
48
- }
49
-
50
- public isInstalled = async () => {
51
- return true
52
- }
53
-
54
- public async destroy() {
55
- this._isBooted = false
56
- }
57
-
58
- public isBooted() {
59
- return this._isBooted
60
- }
61
-
62
- private async getErrors() {
63
- const schemaFiles = await globby(
64
- diskUtil.resolvePath(
65
- this.skill.activeDir,
66
- HASH_SPRUCE_DIR_NAME,
67
- 'errors',
68
- '**/*.schema.[t|j]s'
69
- )
70
- )
71
- return schemaFiles
72
- }
73
- }
74
-
75
- export default (skill: Skill) => {
76
- const feature = new ErrorSkillFeature(skill)
77
- skill.registerFeature('error', feature)
78
- }
@@ -1,10 +0,0 @@
1
- // import your error
2
- import SpruceError from '../errors/Error'
3
-
4
- // throw your error
5
- throw new SpruceError({
6
- code: '{{nameConst}}'',
7
- {{#each schema.fields}}
8
- {{@key}}: ...,
9
- {{/each}}
10
- })
@@ -1,12 +0,0 @@
1
- import { SpruceErrors } from "#spruce/errors/errors.types"
2
- import { ErrorOptions as ISpruceErrorOptions} from "@sprucelabs/error"
3
-
4
- {{#each options}}
5
- export interface {{namePascal}}ErrorOptions extends SpruceErrors.{{namespace}}.{{namePascal}}, ISpruceErrorOptions {
6
- code: '{{code}}'
7
- }
8
- {{/each}}
9
-
10
- type ErrorOptions = {{#each options}} | {{namePascal}}ErrorOptions {{/each}}
11
-
12
- export default ErrorOptions
@@ -1,26 +0,0 @@
1
- import '#spruce/permissions/permissions.types'
2
- {{#each imports}}
3
- import {{importAs}} from '{{package}}'
4
- {{/each}}
5
-
6
-
7
- const {{nameCamel}}EventContract = buildEventContract({
8
- eventSignatures: {
9
- {{#each eventSignatures}}
10
- '{{@key}}': {
11
- {{#if isGlobal}}isGlobal: true,{{/if}}
12
- {{#if description}}description: `{{{description}}}`,{{/if}}
13
- {{#if aiInstructions}}aiInstructions: `{{{aiInstructions}}}`,{{/if}}
14
- {{#if emitPermissions}}emitPermissions: {{{json emitPermissions}}},{{/if}}
15
- {{#if listenPermissions}}listenPermissions: {{{json listenPermissions}}},{{/if}}
16
- {{#if emitPayloadSchema}}emitPayloadSchema: {{emitPayloadSchema.nameCamel}}Schema,{{/if}}
17
- {{#if responsePayloadSchema}}responsePayloadSchema: {{responsePayloadSchema.nameCamel}}Schema,{{/if}}
18
- {{#if emitPermissionContract}}emitPermissionContract: {{{ permissionContractBuilder emitPermissionContract }}},{{/if}}
19
- {{#if listenPermissionContract}}listenPermissionContract: {{{ permissionContractBuilder listenPermissionContract }}},{{/if}}
20
- }
21
- {{/each}}
22
- }
23
- })
24
- export default {{nameCamel}}EventContract
25
-
26
- export type {{namePascal}}EventContract = typeof {{nameCamel}}EventContract
@@ -1,11 +0,0 @@
1
- import { EventSignature } from '@sprucelabs/mercury-types'
2
- import '#spruce/permissions/permissions.types'
3
- import '@sprucelabs/mercury-core-events'
4
-
5
- type Options = Omit<EventSignature, 'responsePayloadSchema'| 'emitPayloadSchema'| 'listenPermissionContract'| 'emitPermissionContract' >
6
-
7
- const eventOptions: Options = {
8
- isGlobal: {{isGlobal}},
9
- }
10
-
11
- export default eventOptions
@@ -1,24 +0,0 @@
1
- {{#if shouldImportCoreEvents}}import { coreEventContracts } from '@sprucelabs/mercury-core-events'{{/if}}
2
-
3
- {{#each contracts}}
4
- import {{namespaceCamel}}{{namePascal}}EventContract_{{version}}, { {{namePascal}}EventContract as {{namespacePascal}}{{namePascal}}EventContract_{{version}} } from '#spruce/events/{{ namespaceCamel }}/{{ nameCamel }}.{{ version }}.contract'
5
- {{/each}}
6
-
7
- export default [
8
- {{#each contracts}}
9
- {{namespaceCamel}}{{namePascal}}EventContract_{{version}},
10
- {{/each}}
11
- {{#if shouldImportCoreEvents}}...coreEventContracts,{{/if}}
12
- ]
13
-
14
- declare module '{{skillEventContractTypesFile}}' {
15
- interface SkillEventSignatures {
16
- {{#each contracts}}
17
-
18
- {{#each eventSignatures}}
19
- '{{@key}}': {{../namespacePascal}}{{../namePascal}}EventContract_{{../version}}['eventSignatures']['{{@key}}'],
20
- {{/each}}
21
-
22
- {{/each}}
23
- }
24
- }
@@ -1,23 +0,0 @@
1
- import SpruceError from '#spruce/../errors/SpruceError'
2
- import { SpruceEvent, SpruceEventResponse } from '@sprucelabs/spruce-event-utils'
3
- {{#if emitPayloadSchemaTemplateItem}}import { SkillEventContract } from '@sprucelabs/mercury-types'{{/if}}
4
- {{#if shouldImportGlobalSchema}}import { {{globalSchemaNamespace}} } from '{{schemaTypesFile}}'{{/if}}
5
-
6
- export default async (event: SpruceEvent{{#if emitPayloadSchemaTemplateItem}}<SkillEventContract, EmitPayload>{{/if}}): SpruceEventResponse{{#if responsePayloadSchemaTemplateItem}}<ResponsePayload>{{/if}} => {
7
- console.log(event)
8
-
9
- throw new SpruceError({
10
- //@ts-ignore
11
- code: 'LISTENER_NOT_IMPLEMENTED',
12
- //@ts-ignore
13
- fullyQualifiedEventName: '{{fullyQualifiedEventName}}'
14
- })
15
-
16
- //return {}
17
- }
18
-
19
- {{#if emitPayloadSchemaTemplateItem}}
20
- type EmitPayload = {{{ schemaNamespacePath schemaTemplateItem=emitPayloadSchemaTemplateItem }}}
21
- {{/if}}{{#if responsePayloadSchemaTemplateItem}}
22
- type ResponsePayload = {{{ schemaNamespacePath schemaTemplateItem=responsePayloadSchemaTemplateItem }}}
23
- {{/if}}
@@ -1,15 +0,0 @@
1
- import { EventFeatureListener } from '@sprucelabs/spruce-event-utils'
2
-
3
- const listeners: EventFeatureListener[] = [
4
- {{#each listeners}}
5
- {
6
- eventName: '{{eventName}}',
7
- eventNamespace: '{{eventNamespace}}',
8
- version: '{{version}}',
9
- callback: require('{{path}}').default,
10
- isGlobal: require('{{path}}').isGlobal,
11
- },
12
- {{/each}}
13
- ]
14
-
15
- export default listeners
@@ -1,15 +0,0 @@
1
- import {
2
- buildSchema
3
- } from '@sprucelabs/schema'
4
-
5
- const {{nameCamel}}{{actionCamel}}Builder = buildSchema({
6
- id: '{{nameCamel}}{{actionCamel}}',
7
- fields: {
8
- aTextField: {
9
- type: 'text',
10
- label: 'Update me',
11
- }
12
- }
13
- })
14
-
15
- export default {{nameCamel}}{{actionCamel}}Builder
@@ -1,14 +0,0 @@
1
- import { Level, LogTransport } from '@sprucelabs/spruce-skill-utils'
2
-
3
- export default function (): {
4
- levels: Level[]
5
- transport: LogTransport
6
- } | null {
7
- return {
8
- levels: [],
9
- transport: (...messageParts: string[]) => {
10
- const message = messageParts.join(' ')
11
- console.log(message)
12
- },
13
- }
14
- }
@@ -1,36 +0,0 @@
1
- import {
2
- buildPermissionContract
3
- } from '@sprucelabs/mercury-types'
4
-
5
- const {{ nameCamel }}Permissions = buildPermissionContract({
6
- id: '{{nameKebab}}',
7
- name: '{{{escape nameReadable}}}',
8
- description: '{{{escape description}}}',
9
- requireAllPermissions: false,
10
- permissions: [
11
- {
12
- id: 'can-high-five',
13
- name: 'Can give high five',
14
- description: 'Will this person be allowed to high five?',
15
-
16
- defaults: {
17
- /**
18
- Uncomment this comment to set which roles will pass by default. Keep
19
- in mind this is overridden by the people who install your skill.
20
-
21
- guest: { onPrem: true },
22
- owner: { onPrem: true },
23
- groupManager: { onPrem: true },
24
- manager: { onPrem: true },
25
- teammate: { onPrem: true },
26
- anonymous: { default: false },
27
-
28
- **/
29
- skill: false,
30
- },
31
- requireAllStatuses: false,
32
- }
33
- ]
34
- })
35
-
36
- export default {{ nameCamel }}Permissions
@@ -1 +0,0 @@
1
- export { plugin as default } from '@sprucelabs/spruce-permission-plugin'
@@ -1,13 +0,0 @@
1
- import { PermissionContract } from "@sprucelabs/mercury-types"
2
- {{#each contracts}}
3
- import {{nameCamel}}PermissionContract from '{{path}}'
4
- {{/each}}
5
-
6
- const contracts: PermissionContract[] = [
7
- {{#each contracts}}
8
- {{nameCamel}}PermissionContract,
9
- {{/each}}
10
- ]
11
-
12
-
13
- export default contracts
@@ -1,14 +0,0 @@
1
- import '@sprucelabs/mercury-types'
2
-
3
- declare module '@sprucelabs/mercury-types/build/types/mercury.types' {
4
- interface PermissionContractMap {
5
- {{#each contracts}}
6
- '{{@key}}': [
7
- {{#each this}}'{{this}}',{{/each}}
8
- ]
9
- {{/each}}
10
- }
11
- }
12
-
13
-
14
- export interface PermissionContractMap {}
@@ -1,67 +0,0 @@
1
- import { PolishStep } from '@sprucelabs/heartwood-polish'
2
-
3
- // Documentation: https://developer.spruce.ai/#/polish/index
4
-
5
- const script: PolishStep[] = [
6
- /**{
7
- redirect: {
8
- id: 'heartwood.root',
9
- },
10
- },
11
- {
12
- typeText: {
13
- target: [['Field', 'phone']],
14
- text: '5555555555',
15
- },
16
- },
17
- {
18
- assert: {
19
- target: [['Field', 'phone']],
20
- inputValue: {
21
- equals: '+1 555-555-5555',
22
- },
23
- },
24
- },
25
- {
26
- click: {
27
- target: [['Button', 'primary']],
28
- },
29
- },
30
- {
31
- typeText: {
32
- target: [['Field', 'code']],
33
- text: '5555',
34
- },
35
- },
36
- {
37
- click: {
38
- target: [['NavMenu', 'settings']],
39
- },
40
- },
41
- {
42
- click: {
43
- target: [['NavLink', 'logout']],
44
- },
45
- },
46
- {
47
- click: {
48
- target: [['Dialog', 'primary']],
49
- },
50
- },
51
- {
52
- typeText: {
53
- target: [['Field', 'phone']],
54
- text: '555-555-2323',
55
- },
56
- },
57
- {
58
- assert: {
59
- target: [['Field', 'phone']],
60
- inputValue: {
61
- equals: '+1 555-555-2323',
62
- },
63
- },
64
- },**/
65
- ]
66
-
67
- export default script
@@ -1,109 +0,0 @@
1
- import { SchemaError } from '@sprucelabs/schema'
2
- import { EventFeature } from '@sprucelabs/spruce-event-plugin'
3
- import {
4
- SpruceEvent,
5
- SpruceEventResponse,
6
- eventResponseUtil,
7
- } from '@sprucelabs/spruce-event-utils'
8
- import { EnvService } from '@sprucelabs/spruce-skill-utils'
9
-
10
- export default async (event: SpruceEvent): SpruceEventResponse => {
11
- const sandboxNumber = process.env.SANDBOX_DEMO_NUMBER
12
-
13
- if (sandboxNumber && process.env.SKILL_ID) {
14
- const log = event.log.buildLog('Sandbox')
15
-
16
- log.info('Demo sandbox number detected. Checking skill status.')
17
-
18
- const events = event.skill.getFeatureByCode('event') as EventFeature
19
-
20
- const env = new EnvService(event.skill.rootDir)
21
-
22
- process.env.SKILL_ID = (env.get('SKILL_ID') ??
23
- process.env.SKILL_ID) as string
24
- process.env.SKILL_API_KEY = (env.get('SKILL_API_KEY') ??
25
- process.env.SKILL_API_KEY) as string
26
-
27
- try {
28
- await events.connectToApi({ shouldWaitForWillBoot: false })
29
- return
30
- // eslint-disable-next-line no-empty
31
- } catch {}
32
-
33
- log.warn('It looks like sandbox was reset. Re-registering.')
34
-
35
- const name = process.env.SKILL_NAME as string
36
- const slug = process.env.SKILL_SLUG as string
37
-
38
- assertRequiredParams(name, slug)
39
-
40
- delete process.env.SKILL_ID
41
- delete process.env.SKILL_API_KEY
42
-
43
- const client = (await events.connectToApi({
44
- shouldWaitForWillBoot: false,
45
- })) as any
46
-
47
- const requestResults = await client.emit('request-pin::v2020_12_25', {
48
- payload: {
49
- phone: sandboxNumber,
50
- },
51
- })
52
-
53
- const { challenge } =
54
- eventResponseUtil.getFirstResponseOrThrow(requestResults)
55
-
56
- const confirmResults = await client.emit('confirm-pin::v2020_12_25', {
57
- payload: {
58
- challenge,
59
- pin: sandboxNumber.substr(-4),
60
- },
61
- })
62
-
63
- eventResponseUtil.getFirstResponseOrThrow(confirmResults)
64
-
65
- const results = await client.emit('register-skill::v2020_12_25', {
66
- payload: {
67
- name,
68
- description: 'Auto-generate for sandbox',
69
- slug,
70
- },
71
- })
72
-
73
- const { skill } = eventResponseUtil.getFirstResponseOrThrow(results)
74
-
75
- process.env.SKILL_ID = skill.id
76
- process.env.SKILL_API_KEY = skill.apiKey
77
-
78
- await client.emit(`logout::v2020_12_25`)
79
-
80
- await client.authenticate({
81
- skillId: skill.id,
82
- apiKey: skill.apiKey,
83
- })
84
-
85
- env.set('SKILL_ID', skill.id)
86
- env.set('SKILL_API_KEY', skill.apiKey)
87
- }
88
-
89
- return
90
- }
91
-
92
- function assertRequiredParams(
93
- name: string | undefined,
94
- slug: string | undefined
95
- ) {
96
- const missing: string[] = []
97
-
98
- if (!name) {
99
- missing.push('env.SKILL_NAME')
100
- }
101
-
102
- if (!slug) {
103
- missing.push('env.SKILL_SLUG')
104
- }
105
-
106
- if (missing.length > 0) {
107
- throw new SchemaError({ code: 'MISSING_PARAMETERS', parameters: missing })
108
- }
109
- }
@@ -1,24 +0,0 @@
1
- import { {{builderFunction}} } from '@sprucelabs/schema'
2
-
3
-
4
- export default {{builderFunction}}({
5
- id: '{{nameCamel}}',
6
- name: '{{{escape nameReadable}}}',{{#if description}}
7
- description: '{{{escape description}}}',{{/if}}{{#if moduleToImportFromWhenRemote}}
8
- moduleToImportFromWhenRemote: '{{{escape moduleToImportFromWhenRemote}}}',{{/if}}
9
- fields: {
10
- fieldName1: {
11
- type: 'text',
12
- label: 'First Field',
13
- isRequired: true
14
- },
15
- fieldName2: {
16
- type: 'number',
17
- label: 'Second Field',
18
- isRequired: true,
19
- hint:
20
- 'A hint'
21
- }
22
- }
23
- })
24
-