@sprucelabs/spruce-templates 14.28.7 → 14.29.2

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/build/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { Schema, SchemaTemplateItem, FieldTemplateItem } from '@sprucelabs/schem
2
2
  import { TemplateRenderAs } from '@sprucelabs/schema';
3
3
  import handlebars from 'handlebars';
4
4
  import { FieldDefinitions } from '#spruce/schemas/fields/fields.types';
5
- import { DirectoryTemplateCode, DirectoryTemplateContextMap, ValueTypes, SchemaBuilderTemplateItem, ErrorOptions, ErrorTemplateItem, TestOptions, EventListenerOptions, EventContractTemplateItem, EventPayloadOptions, StoreTemplateOptions, StoreTemplateItem, ViewsOptions } from './types/templates.types';
5
+ import { DirectoryTemplateCode, DirectoryTemplateContextMap, ValueTypes, SchemaBuilderTemplateItem, ErrorOptions, ErrorTemplateItem, TestOptions, EventListenerOptions, EventContractTemplateItem, EventPayloadOptions, StoreTemplateOptions, StoreTemplateItem, ViewsOptions, ListenerTemplateItem } from './types/templates.types';
6
6
  export declare const templates: {
7
7
  schemasTypes(options: {
8
8
  schemaTemplateItems: SchemaTemplateItem[];
@@ -54,6 +54,9 @@ export declare const templates: {
54
54
  launchConfig(): string;
55
55
  vsCodeSettings(): string;
56
56
  listener(options: EventListenerOptions): string;
57
+ listeners(options: {
58
+ listeners: ListenerTemplateItem[];
59
+ }): string;
57
60
  eventContract(options: EventContractTemplateItem & {
58
61
  schemaTemplateItems: SchemaTemplateItem[];
59
62
  }): string;
package/build/index.js CHANGED
@@ -134,6 +134,12 @@ exports.templates = {
134
134
  ...options,
135
135
  });
136
136
  },
137
+ listeners(options) {
138
+ const template = templateImporter_utility_1.default.getTemplate('event/listeners.ts.hbs');
139
+ return template({
140
+ ...options,
141
+ });
142
+ },
137
143
  eventContract(options) {
138
144
  const template = templateImporter_utility_1.default.getTemplate('event/event.contract.ts.hbs');
139
145
  return template(options);
@@ -0,0 +1,14 @@
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
+ },
11
+ {{/each}}
12
+ ]
13
+
14
+ export default listeners
@@ -1,5 +1,9 @@
1
+ {{#each stores}}
2
+ import {{namePascalPlural}}Store from '{{path}}'
3
+ {{/each}}
4
+
1
5
  export default {
2
6
  {{#each stores}}
3
- {{nameCamelPlural}}: {{namePascalPlural}}Store
7
+ {{nameCamelPlural}}: {{namePascalPlural}}Store,
4
8
  {{/each}}
5
9
  }
@@ -1,10 +1,9 @@
1
1
  import {{#unless (isDefined parentTestClass)}}AbstractSpruceTest, {{/unless}}{ test, assert } from '@sprucelabs/test'
2
- {{#if (isDefined parentTestClass)}}import {{#if parentTestClass.isDefaultExport}}{{parentTestClass.name}}{{else}}{ {{parentTestClass.name}} }{{/if}} from '{{parentTestClass.importPath}}'{{/if}}
3
-
2
+ {{#if (isDefined parentTestClass)}}import {{#if parentTestClass.isDefaultExport}}{{parentTestClass.name}}{{else}}{ {{parentTestClass.name}} }{{/if}} from '{{parentTestClass.importPath}}'
3
+ {{/if}}
4
4
  class {{namePascal}} {}
5
5
 
6
6
  export default class {{namePascal}}Test extends {{#if (isDefined parentTestClass)}}{{parentTestClass.name}}{{else}}AbstractSpruceTest{{/if}} {
7
-
8
7
  @test()
9
8
  protected static async canCreate{{namePascal}}() {
10
9
  const {{nameCamel}} = new {{namePascal}}()
@@ -1,5 +1,6 @@
1
1
  import { EventContract, EventSignature } from '@sprucelabs/mercury-types';
2
2
  import { SchemaTemplateItem } from '@sprucelabs/schema';
3
+ import { EventFeatureListener } from '@sprucelabs/spruce-event-utils';
3
4
  import { SchemaImport } from '../utilities/importExtractor.utility';
4
5
  export declare enum DirectoryTemplateCode {
5
6
  Skill = "skill",
@@ -121,3 +122,6 @@ export interface ViewsOptions {
121
122
  svcTemplateItems: VcTemplateItem[];
122
123
  vcTemplateItems: VcTemplateItem[];
123
124
  }
125
+ export declare type ListenerTemplateItem = Omit<EventFeatureListener, 'callback'> & {
126
+ path: string;
127
+ };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "14.28.7",
6
+ "version": "14.29.2",
7
7
  "files": [
8
8
  "build/**/*",
9
9
  "tsconfig.json",
@@ -58,6 +58,7 @@
58
58
  "dependencies": {
59
59
  "@sprucelabs/mercury-types": "^26.1.992",
60
60
  "@sprucelabs/schema": "^25.4.67",
61
+ "@sprucelabs/spruce-event-utils": "^17.1.272",
61
62
  "@sprucelabs/spruce-skill-utils": "^22.1.50",
62
63
  "globby": "^11.0.4",
63
64
  "handlebars": "^4.7.7",
@@ -78,5 +79,5 @@
78
79
  "globby"
79
80
  ]
80
81
  },
81
- "gitHead": "7e3efcf5136eb41be381f196473cd3526c59ca9d"
82
+ "gitHead": "0f8f6dd87e9cb555da15d985236cd190a9ab1d51"
82
83
  }