druxt-schema 0.7.10 → 0.9.1

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
@@ -1,5 +1,42 @@
1
1
  # druxt-schema
2
2
 
3
+ ## 0.9.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [45bc0b9]
8
+ - druxt@0.14.0
9
+
10
+ ## 0.9.0
11
+
12
+ ### Minor Changes
13
+
14
+ - 77ab204: Disabled API Proxy when generating schema files
15
+
16
+ ### Patch Changes
17
+
18
+ - d12dfb5: Added missing schemaType prop to DruxtSchemaMixin
19
+ - Updated dependencies [77ab204]
20
+ - druxt@0.13.0
21
+
22
+ ## 0.8.1
23
+
24
+ ### Patch Changes
25
+
26
+ - Updated dependencies [4504a2f]
27
+ - druxt@0.12.0
28
+
29
+ ## 0.8.0
30
+
31
+ ### Minor Changes
32
+
33
+ - dae345e: Added module level options
34
+
35
+ ### Patch Changes
36
+
37
+ - Updated dependencies [dae345e]
38
+ - druxt@0.11.0
39
+
3
40
  ## 0.7.10
4
41
 
5
42
  ### Patch Changes
package/README.md CHANGED
@@ -10,7 +10,8 @@
10
10
  ## Links
11
11
 
12
12
  - Druxt.js: https://druxtjs.org
13
- - Documentation: https://schema.druxtjs.org/
13
+ - Documentation: https://druxtjs.org/modules/schema
14
+ - Community Discord server: https://discord.druxtjs.org
14
15
 
15
16
  ## Install
16
17
 
@@ -220,30 +220,38 @@ class DruxtSchema {
220
220
  }
221
221
  }
222
222
 
223
- const DruxtSchemaNuxtModule = function() {
224
- if (typeof this.options === "undefined" || !this.options.druxt) {
225
- throw new TypeError("Druxt settings missing.");
226
- }
227
- const options = this.options.druxt;
223
+ const DruxtSchemaNuxtModule = function(moduleOptions = {}) {
224
+ const options = {
225
+ baseUrl: moduleOptions.baseUrl,
226
+ ...(this.options || {}).druxt || {},
227
+ schema: {
228
+ ...((this.options || {}).druxt || {}).schema || {},
229
+ ...moduleOptions
230
+ }
231
+ };
228
232
  this.addPlugin({
229
- src: resolve(__dirname, "../nuxt/plugin.js"),
233
+ src: resolve(__dirname, "../templates/plugin.js"),
230
234
  fileName: "druxt-schema.js",
231
235
  options
232
236
  });
237
+ this.options.store = true;
233
238
  this.addPlugin({
234
- src: resolve(__dirname, "../nuxt/store.js"),
239
+ src: resolve(__dirname, "../templates/store.js"),
235
240
  fileName: "store/druxt-schema.js",
236
241
  options
237
242
  });
238
243
  this.nuxt.hook("builder:prepared", async () => {
239
- const druxtSchema = new DruxtSchema(options.baseUrl, options);
244
+ const druxtSchema = new DruxtSchema(options.baseUrl, {
245
+ ...options,
246
+ proxy: { ...options.proxy || {}, api: false }
247
+ });
240
248
  const { schemas } = await druxtSchema.get();
241
249
  for (const name in schemas) {
242
250
  const schema = schemas[name];
243
251
  if (typeof schema === "undefined")
244
252
  continue;
245
253
  this.addTemplate({
246
- src: resolve(__dirname, "../nuxt/schema.json"),
254
+ src: resolve(__dirname, "../templates/schema.json"),
247
255
  fileName: `schemas/${name}.json`,
248
256
  options: { schema }
249
257
  });
@@ -259,13 +267,21 @@ const DruxtSchemaMixin = {
259
267
  type: String,
260
268
  default: "default"
261
269
  },
270
+ schemaType: {
271
+ type: String,
272
+ default: void 0
273
+ },
262
274
  type: {
263
275
  type: String,
264
276
  required: true
265
277
  }
266
278
  },
267
279
  async fetch() {
268
- this.schema = await this.getSchema({ resourceType: this.type, mode: this.mode });
280
+ this.schema = await this.getSchema({
281
+ resourceType: this.type,
282
+ mode: this.mode,
283
+ schemaType: this.schemaType || "view"
284
+ });
269
285
  },
270
286
  data: () => ({
271
287
  schema: false
@@ -228,30 +228,38 @@ class DruxtSchema {
228
228
  }
229
229
  }
230
230
 
231
- const DruxtSchemaNuxtModule = function() {
232
- if (typeof this.options === "undefined" || !this.options.druxt) {
233
- throw new TypeError("Druxt settings missing.");
234
- }
235
- const options = this.options.druxt;
231
+ const DruxtSchemaNuxtModule = function(moduleOptions = {}) {
232
+ const options = {
233
+ baseUrl: moduleOptions.baseUrl,
234
+ ...(this.options || {}).druxt || {},
235
+ schema: {
236
+ ...((this.options || {}).druxt || {}).schema || {},
237
+ ...moduleOptions
238
+ }
239
+ };
236
240
  this.addPlugin({
237
- src: path.resolve(__dirname, "../nuxt/plugin.js"),
241
+ src: path.resolve(__dirname, "../templates/plugin.js"),
238
242
  fileName: "druxt-schema.js",
239
243
  options
240
244
  });
245
+ this.options.store = true;
241
246
  this.addPlugin({
242
- src: path.resolve(__dirname, "../nuxt/store.js"),
247
+ src: path.resolve(__dirname, "../templates/store.js"),
243
248
  fileName: "store/druxt-schema.js",
244
249
  options
245
250
  });
246
251
  this.nuxt.hook("builder:prepared", async () => {
247
- const druxtSchema = new DruxtSchema(options.baseUrl, options);
252
+ const druxtSchema = new DruxtSchema(options.baseUrl, {
253
+ ...options,
254
+ proxy: { ...options.proxy || {}, api: false }
255
+ });
248
256
  const { schemas } = await druxtSchema.get();
249
257
  for (const name in schemas) {
250
258
  const schema = schemas[name];
251
259
  if (typeof schema === "undefined")
252
260
  continue;
253
261
  this.addTemplate({
254
- src: path.resolve(__dirname, "../nuxt/schema.json"),
262
+ src: path.resolve(__dirname, "../templates/schema.json"),
255
263
  fileName: `schemas/${name}.json`,
256
264
  options: { schema }
257
265
  });
@@ -267,13 +275,21 @@ const DruxtSchemaMixin = {
267
275
  type: String,
268
276
  default: "default"
269
277
  },
278
+ schemaType: {
279
+ type: String,
280
+ default: void 0
281
+ },
270
282
  type: {
271
283
  type: String,
272
284
  required: true
273
285
  }
274
286
  },
275
287
  async fetch() {
276
- this.schema = await this.getSchema({ resourceType: this.type, mode: this.mode });
288
+ this.schema = await this.getSchema({
289
+ resourceType: this.type,
290
+ mode: this.mode,
291
+ schemaType: this.schemaType || "view"
292
+ });
277
293
  },
278
294
  data: () => ({
279
295
  schema: false
package/package.json CHANGED
@@ -1,22 +1,30 @@
1
1
  {
2
2
  "name": "druxt-schema",
3
- "version": "0.7.10",
3
+ "version": "0.9.1",
4
4
  "description": "Drupal Content Entity schema generator for Druxt with support for View and Form displays.",
5
5
  "keywords": [
6
+ "cms",
7
+ "decoupled",
6
8
  "drupal",
7
9
  "druxt",
8
- "schema",
9
- "entities",
10
- "field",
11
- "fields",
12
- "nuxt"
10
+ "druxtjs",
11
+ "headless",
12
+ "jsonapi",
13
+ "json:api",
14
+ "nuxt",
15
+ "nuxtjs",
16
+ "module",
17
+ "schema"
13
18
  ],
14
- "license": "MIT",
15
- "author": {
16
- "name": "Stuart Clark",
17
- "email": "stuart@realityloop.com",
18
- "url": "https://realityloop.com"
19
+ "homepage": "https://druxtjs.org",
20
+ "bugs": {
21
+ "url": "https://github.com/druxt/druxt.js/issues"
22
+ },
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/druxt/druxt.js"
19
26
  },
27
+ "license": "MIT",
20
28
  "exports": {
21
29
  ".": {
22
30
  "require": "./dist/druxt-schema.ssr.js",
@@ -28,12 +36,12 @@
28
36
  "module": "dist/druxt-schema.esm.js",
29
37
  "files": [
30
38
  "dist",
31
- "nuxt"
39
+ "templates"
32
40
  ],
33
41
  "dependencies": {
34
42
  "consola": "^2.15.0",
35
43
  "drupal-jsonapi-params": "^1.2.2",
36
- "druxt": "^0.10.0"
44
+ "druxt": "^0.14.0"
37
45
  },
38
46
  "optionalDependencies": {
39
47
  "vue": "^2.6.14",
File without changes
File without changes
File without changes