@sprucelabs/spruce-templates 18.4.0 → 19.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.
@@ -1,3 +1,5 @@
1
+ import '@sprucelabs/mercury-types'
2
+
1
3
  declare module '@sprucelabs/mercury-types/build/types/mercury.types' {
2
4
  interface PermissionContractMap {
3
5
  {{#each contracts}}
@@ -1,6 +1,47 @@
1
1
  import { AbstractStore, UniversalStoreOptions, PrepareOptions, PrepareResults } from '@sprucelabs/data-stores'
2
2
  import { buildSchema, dropFields, makeFieldsOptional, SchemaValues, SchemaFieldNames } from '@sprucelabs/schema'
3
3
 
4
+ export default class {{namePascalPlural}}Store extends AbstractStore<
5
+ FullSchema,
6
+ CreateSchema,
7
+ UpdateSchema,
8
+ DatabaseSchema
9
+ > {
10
+ public name = '{{namePascalPlural}}'
11
+ protected collectionName = '{{nameSnakePlural}}'
12
+
13
+ protected createSchema = createSchema
14
+ protected updateSchema = updateSchema
15
+ protected fullSchema = fullSchema
16
+ protected databaseSchema = databaseSchema
17
+
18
+ public static Store(options: {{namePascal}}StoreOptions & UniversalStoreOptions) {
19
+ return new this(options.db)
20
+ }
21
+
22
+ protected async willCreate(
23
+ values: Create{{namePascal}}
24
+ ): Promise<Omit<Database{{namePascal}}, 'id'>> {
25
+ return values
26
+ }
27
+
28
+ protected async willUpdate(values: Update{{namePascal}}) {
29
+ return values as Partial<Database{{namePascal}}>
30
+ }
31
+
32
+
33
+ protected async prepareRecord<
34
+ IncludePrivateFields extends boolean,
35
+ F extends SchemaFieldNames<FullSchema> = SchemaFieldNames<FullSchema>
36
+ >(
37
+ record: Database{{namePascal}},
38
+ _options?: PrepareOptions<IncludePrivateFields, FullSchema, F>
39
+ ) {
40
+ return record as PrepareResults<FullSchema, IncludePrivateFields>
41
+ }
42
+
43
+ }
44
+
4
45
  // The structure of the data you'll be returning from finds
5
46
  const fullSchema = buildSchema({
6
47
  id: 'full{{namePascal}}',
@@ -51,45 +92,4 @@ type Update{{namePascal}} = SchemaValues<UpdateSchema>
51
92
  type Database{{namePascal}} = SchemaValues<DatabaseSchema>
52
93
  // type Query{{namePascal}} = Partial<{{namePascal}}>
53
94
 
54
- type {{namePascal}}StoreOptions = UniversalStoreOptions
55
-
56
- export default class {{namePascalPlural}}Store extends AbstractStore<
57
- FullSchema,
58
- CreateSchema,
59
- UpdateSchema,
60
- DatabaseSchema
61
- > {
62
- public name = '{{namePascalPlural}}'
63
- protected collectionName = '{{nameSnakePlural}}'
64
-
65
- protected createSchema = createSchema
66
- protected updateSchema = updateSchema
67
- protected fullSchema = fullSchema
68
- protected databaseSchema = databaseSchema
69
-
70
- public static Store(options: {{namePascal}}StoreOptions & UniversalStoreOptions) {
71
- return new this(options.db)
72
- }
73
-
74
- protected async willCreate(
75
- values: Create{{namePascal}}
76
- ): Promise<Omit<Database{{namePascal}}, 'id'>> {
77
- return values
78
- }
79
-
80
- protected async willUpdate(values: Update{{namePascal}}) {
81
- return values as Partial<Database{{namePascal}}>
82
- }
83
-
84
-
85
- protected async prepareRecord<
86
- IncludePrivateFields extends boolean,
87
- F extends SchemaFieldNames<FullSchema> = SchemaFieldNames<FullSchema>
88
- >(
89
- record: Database{{namePascal}},
90
- _options?: PrepareOptions<IncludePrivateFields, FullSchema, F>
91
- ) {
92
- return record as PrepareResults<FullSchema, IncludePrivateFields>
93
- }
94
-
95
- }
95
+ type {{namePascal}}StoreOptions = UniversalStoreOptions
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "18.4.0",
6
+ "version": "19.1.0",
7
7
  "files": [
8
8
  "build/**/*",
9
9
  "tsconfig.json",
@@ -56,10 +56,10 @@
56
56
  "watch.tsc": "tsc -w"
57
57
  },
58
58
  "dependencies": {
59
- "@sprucelabs/mercury-types": "^38.0.0",
60
- "@sprucelabs/schema": "^28.5.74",
61
- "@sprucelabs/spruce-event-utils": "^30.0.0",
62
- "@sprucelabs/spruce-skill-utils": "^28.1.3",
59
+ "@sprucelabs/mercury-types": "^38.0.27",
60
+ "@sprucelabs/schema": "^28.5.89",
61
+ "@sprucelabs/spruce-event-utils": "^30.0.28",
62
+ "@sprucelabs/spruce-skill-utils": "^28.1.21",
63
63
  "fs-extra": "^10.1.0",
64
64
  "globby": "11.0.4",
65
65
  "handlebars": "^4.7.7",
@@ -69,17 +69,17 @@
69
69
  "devDependencies": {
70
70
  "@types/fs-extra": "^9.0.13",
71
71
  "@types/lodash": "^4.14.191",
72
- "@types/node": "^18.11.10",
72
+ "@types/node": "^18.11.17",
73
73
  "chokidar-cli": "^3.0.0",
74
74
  "concurrently": "^7.6.0",
75
75
  "conventional-changelog-sprucelabs": "^1.1.2",
76
- "prettier": "^2.8.0",
77
- "typescript": "^4.9.3"
76
+ "prettier": "^2.8.1",
77
+ "typescript": "^4.9.4"
78
78
  },
79
79
  "yarn-upgrade-all": {
80
80
  "ignore": [
81
81
  "globby"
82
82
  ]
83
83
  },
84
- "gitHead": "da522d85b8178d456ecda58e41b9b4a7067b9437"
84
+ "gitHead": "135ae3f05901c4c37fb5f70e5051a7fa0ee3a3cb"
85
85
  }