We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 9a83f0e + 8b1b5ec commit 18c55baCopy full SHA for 18c55ba
package-lock.json
package.json
@@ -150,7 +150,7 @@
150
"@vue/eslint-config-prettier": "^6.0.0",
151
"@vue/eslint-config-typescript": "^5.0.2",
152
"@vue/test-utils": "^1.0.2",
153
- "axios": "^0.19.2",
+ "axios": "^0.21.1",
154
"babel-cli": "^6.26.0",
155
"babel-core": "^6.26.3",
156
"babel-eslint": "^10.1.0",
src/make-find-mixin.ts
@@ -45,7 +45,7 @@ export default function makeFindMixin(options) {
45
name = 'service'
46
}
47
48
- const nameToUse = (name || service).replace('-', '_')
+ const nameToUse = (name || service).replace(/-/g, '_')
49
const prefix = getServicePrefix(nameToUse)
50
const capitalized = getServiceCapitalization(nameToUse)
51
const SERVICE_NAME = `${prefix}ServiceName`
src/make-get-mixin.ts
@@ -38,7 +38,7 @@ export default function makeFindMixin(options) {
38
39
40
41
42
const singularized = inflection.singularize(nameToUse)
43
const prefix = inflection.camelize(singularized, true)
44
const capitalized = prefix.charAt(0).toUpperCase() + prefix.slice(1)
src/service-module/make-base-model.ts
@@ -421,7 +421,7 @@ export default function makeBaseModel(options: FeathersVuexOptions) {
421
const { idField, _dispatch } = this.constructor as typeof BaseModel
422
const id = getId(this, idField)
423
424
- if (!id) {
+ if (id !== 0 && !id) {
425
const error = new Error(
426
`Missing ${idField} property. You must create the data before you can update with this data`
427
)
src/service-module/make-service-module.ts
@@ -23,7 +23,7 @@ export default function makeServiceModule(
23
state: makeDefaultState(options),
24
getters: makeGetters(),
25
mutations: makeMutations(),
26
- actions: makeActions(service)
+ actions: makeActions({service, options})
27
28
const fromOptions = _pick(options, [
29
'state',
src/service-module/service-module.actions.ts
@@ -6,8 +6,14 @@ eslint
6
import fastCopy from 'fast-copy'
7
import { getId } from '../utils'
8
import { Service } from '@feathersjs/feathers'
9
+import { MakeServicePluginOptions } from './types'
10
-export default function makeServiceActions(service: Service<any>) {
11
+interface serviceAndOptions {
12
+ service: Service<any>
13
+ options: MakeServicePluginOptions
14
+}
15
+
16
+export default function makeServiceActions({service, options}: serviceAndOptions) {
17
const serviceActions = {
18
find({ commit, dispatch }, params) {
19
params = params || {}
@@ -322,9 +328,9 @@ export default function makeServiceActions(service: Service<any>) {
322
328
commit('removeItems', toRemove) // commit removal
323
329
324
330
325
- if (service.FeathersVuexModel) {
331
+ if (options.Model) {
326
332
toAdd.forEach((item, index) => {
327
- toAdd[index] = new service.FeathersVuexModel(item, { commit: false })
333
+ toAdd[index] = new options.Model(item, { commit: false })
334
})
335
336
src/utils.ts
@@ -274,7 +274,7 @@ export function getServicePrefix(servicePath) {
274
const parts = servicePath.split('/')
275
let name = parts[parts.length - 1]
276
// name = inflection.underscore(name)
277
- name = name.replace('-', '_')
+ name = name.replace(/-/g, '_')
278
name = inflection.camelize(name, true)
279
return name
280
@@ -283,7 +283,7 @@ export function getServiceCapitalization(servicePath) {
283
284
285
286
287
name = inflection.camelize(name)
288
289
test/utils.test.ts
@@ -162,7 +162,8 @@ describe('Utils', function () {
162
['environment-Panos', 'environmentPanos'],
163
['env-panos', 'envPanos'],
164
['envPanos', 'envPanos'],
165
- ['api/v1/env-panos', 'envPanos']
+ ['api/v1/env-panos', 'envPanos'],
166
+ ['very-long-service', 'veryLongService']
167
]
168
decisionTable.forEach(([path, prefix]) => {
169
assert(
@@ -181,7 +182,8 @@ describe('Utils', function () {
181
182
['environment-Panos', 'EnvironmentPanos'],
183
['env-panos', 'EnvPanos'],
184
['envPanos', 'EnvPanos'],
- ['api/v1/env-panos', 'EnvPanos']
185
+ ['api/v1/env-panos', 'EnvPanos'],
186
+ ['very-long-service', 'VeryLongService']
187
188
189
0 commit comments