@content-island/gatsby-source-plugin 0.1.0 → 0.1.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.
@@ -1,3 +1,3 @@
1
- import { Content } from '@content-island/b2b-api-client';
1
+ import { Content } from '@content-island/api-client';
2
2
  import * as model from '../models';
3
3
  export declare const getContentList: (pluginOptions: model.PluginOptionsInternal) => Promise<model.Content[]>;
@@ -10,13 +10,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.getContentList = void 0;
13
- const b2b_api_client_1 = require("@content-island/b2b-api-client");
13
+ const api_client_1 = require("@content-island/api-client");
14
14
  const mappers_1 = require("../mappers");
15
15
  let CONTENT_TYPES = [];
16
16
  // Fetch all content types from Content Island
17
17
  const getContentTypes = (client) => __awaiter(void 0, void 0, void 0, function* () {
18
18
  if (CONTENT_TYPES.length === 0) {
19
- const projects = yield client.get(b2b_api_client_1.API_URLS.projectList());
19
+ const projects = yield client.get(api_client_1.API_URLS.projectList());
20
20
  CONTENT_TYPES = projects.flatMap(p => p.entities);
21
21
  }
22
22
  return CONTENT_TYPES;
@@ -25,10 +25,10 @@ let CONTENT_LIST = [];
25
25
  const getContentList = (pluginOptions) => __awaiter(void 0, void 0, void 0, function* () {
26
26
  if (CONTENT_LIST.length === 0) {
27
27
  const { accessToken } = pluginOptions;
28
- const client = (0, b2b_api_client_1.createContentIslandClient)({ accessToken });
28
+ const client = (0, api_client_1.createContentIslandClient)({ accessToken });
29
29
  const contentTypes = yield getContentTypes(client);
30
30
  for (const contentType of contentTypes) {
31
- const contents = yield client.get(b2b_api_client_1.API_URLS.contentList({ filterList: [`contentType=${contentType.name}`] }));
31
+ const contents = yield client.get(api_client_1.API_URLS.contentList({ filterList: [`contentType=${contentType.name}`] }));
32
32
  CONTENT_LIST = [...CONTENT_LIST, ...(0, mappers_1.mapContentListFromApiToVm)(contents)];
33
33
  }
34
34
  }
@@ -1,5 +1,5 @@
1
1
  import { CreateNodeArgs, SourceNodesArgs } from 'gatsby';
2
- import { Resource } from '@content-island/b2b-api-client';
2
+ import { Resource } from '@content-island/api-client';
3
3
  import { Content, PreprocessedField } from '../models';
4
4
  export declare const contentNodeBuilder: (gatsbyApi: SourceNodesArgs, content: Content) => Promise<void>;
5
5
  export declare const mediaNodeBuilder: (gatsbyApi: CreateNodeArgs, mediaField: PreprocessedField<Resource>) => Promise<void>;
package/dist/mappers.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import * as apiModel from '@content-island/b2b-api-client';
1
+ import * as apiModel from '@content-island/api-client';
2
2
  import { Content } from './models';
3
3
  export declare const mapContentListFromApiToVm: (contentList: apiModel.Content[]) => Content[];
@@ -1,4 +1,4 @@
1
- import { Resource } from '@content-island/b2b-api-client';
1
+ import { Resource } from '@content-island/api-client';
2
2
  export type PreprocessedField<Value> = {
3
3
  name: string;
4
4
  gatsbyNodeType: string;
package/package.json CHANGED
@@ -1,29 +1,32 @@
1
1
  {
2
2
  "name": "@content-island/gatsby-source-plugin",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Content Island - B2B Gatsby Source Plugin",
5
5
  "private": false,
6
6
  "author": "Lemoncode",
7
7
  "license": "MIT",
8
8
  "files": [
9
- "dist",
10
- "gatsby-node.js"
9
+ "dist"
11
10
  ],
12
- "module": "./dist/gatsby-node.js",
13
- "main": "./dist/gatsby-node.js",
11
+ "module": "./dist/index.js",
12
+ "main": "./dist/index.js",
14
13
  "types": "./dist/index.d.ts",
15
14
  "exports": {
16
15
  ".": {
17
- "import": "./dist/gatsby-node.js",
18
- "require": "./dist/gatsby-node.js",
16
+ "import": "./dist/index.js",
17
+ "require": "./dist/index.js",
19
18
  "types": "./dist/index.d.ts"
19
+ },
20
+ "./package.json": {
21
+ "import": "./package.json",
22
+ "require": "./package.json"
20
23
  }
21
24
  },
22
25
  "scripts": {
23
26
  "build": "tsc"
24
27
  },
25
28
  "dependencies": {
26
- "@content-island/b2b-api-client": "*"
29
+ "@content-island/api-client": "*"
27
30
  },
28
31
  "devDependencies": {
29
32
  "gatsby": "^5.12.4",
package/gatsby-node.js DELETED
@@ -1 +0,0 @@
1
- module.exports = require(`./dist/index`);