@mapomodule/core 1.0.0-alpha.31 → 1.0.0-alpha.39

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/CHANGELOG.md CHANGED
@@ -3,6 +3,28 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [1.0.0-alpha.39](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.38...v1.0.0-alpha.39) (2022-12-03)
7
+
8
+
9
+ ### Features
10
+
11
+ * give the option to rewrite form fields components defaults in nuxt.config.js ([c4e76b1](https://github.com/lotrekagency/mapo/commit/c4e76b153b145cc670ef988e9501e1a8fbc0005e))
12
+
13
+
14
+
15
+
16
+
17
+ # [1.0.0-alpha.34](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.33...v1.0.0-alpha.34) (2022-11-11)
18
+
19
+
20
+ ### Features
21
+
22
+ * default upload in multipart autodiscover ([b153307](https://github.com/lotrekagency/mapo/commit/b15330725a64a0931d2de49929a01e3a7319b382))
23
+
24
+
25
+
26
+
27
+
6
28
  # [1.0.0-alpha.31](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.30...v1.0.0-alpha.31) (2022-09-14)
7
29
 
8
30
 
package/api/crud.js CHANGED
@@ -2,8 +2,8 @@ const transformRequestInMultipart = require('@mapomodule/core/api/multipart')
2
2
  const trimslashes = (str) => (str || "").replace(/^\/|\/$/g, '')
3
3
  const preparePayload = (payload, options) => {
4
4
  const { multipart } = (options || {})
5
- if (!(payload instanceof FormData) && (typeof multipart === 'string') && multipart !== 'disable') {
6
- payload = transformRequestInMultipart(payload, multipart);
5
+ if (!(payload instanceof FormData) && multipart !== 'disable') {
6
+ payload = transformRequestInMultipart(payload, multipart || 'auto');
7
7
  }
8
8
  return payload
9
9
  }
package/index.js CHANGED
@@ -2,6 +2,12 @@ import createRepository from '@mapomodule/core/api/crud'
2
2
  import transformRequestInMultipart from '@mapomodule/core/api/multipart'
3
3
  import initInterceptors from '@mapomodule/core/interceptor'
4
4
 
5
+ try {
6
+ var options = require('./options').default;
7
+ } catch (error) {
8
+ var options = {};
9
+ }
10
+
5
11
  function getRouteMiddlewares(route) {
6
12
  const meta = Array.isArray(route?.meta) ? route.meta[0] : route.meta
7
13
  const { middleware } = meta || {}
@@ -13,7 +19,7 @@ export default (ctx, inject) => {
13
19
 
14
20
  initInterceptors(ctx)
15
21
 
16
- inject('mapo', {
22
+ const mapo = {
17
23
  /**
18
24
  * From here you can reach some utilities that simplify the interaction with the backend api.
19
25
  */
@@ -102,8 +108,12 @@ export default (ctx, inject) => {
102
108
  * @function
103
109
  */
104
110
  close: null
105
- }
106
- })
111
+ },
112
+ $options: options
113
+ };
114
+
115
+ inject('mapo', mapo);
116
+ ctx.$mapo = mapo;
107
117
  }
108
118
 
109
119
  /**
package/module.js CHANGED
@@ -33,7 +33,11 @@ export default async function (moduleOptions) {
33
33
  })
34
34
  }
35
35
 
36
-
36
+ this.addTemplate({
37
+ src: path.resolve(__dirname, './templates/options.js'),
38
+ fileName: path.join(namespace, 'options.js'),
39
+ options: moduleOptions
40
+ })
37
41
 
38
42
  }
39
43
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mapomodule/core",
3
- "version": "1.0.0-alpha.31",
3
+ "version": "1.0.0-alpha.39",
4
4
  "description": "This is part of Mapo nuxt module. Injects the core mapo plugin helpers.",
5
5
  "author": "bnznamco <gabriele.baldi.01@gmail.com>",
6
6
  "keywords": [
@@ -13,10 +13,10 @@
13
13
  "repository": "https://github.com/lotrekagency/mapo",
14
14
  "main": "./module.js",
15
15
  "dependencies": {
16
- "@mapomodule/utils": "^1.0.0-alpha.30"
16
+ "@mapomodule/utils": "^1.0.0-alpha.34"
17
17
  },
18
18
  "publishConfig": {
19
19
  "access": "public"
20
20
  },
21
- "gitHead": "fe25f51c0ef03764bca9d9b2b123f0729d71d13e"
21
+ "gitHead": "11018687c8ee01a219dadc2f770c9f6b09be9f49"
22
22
  }
@@ -0,0 +1 @@
1
+ export default <%= serializeFunction(options) %>;