@whizzes/wsfc 0.0.1-early-dev-10 → 0.0.1-early-dev-12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whizzes/wsfc",
3
- "version": "0.0.1-early-dev-10",
3
+ "version": "0.0.1-early-dev-12",
4
4
  "main": "./src/index.ts",
5
5
  "module": "./src/index.ts",
6
6
  "types": "./src/index.d.ts",
@@ -0,0 +1,9 @@
1
+ query ContentImagesList($channel: ChannelCode!) {
2
+ contentImages(channelCode: $channel) {
3
+ edges {
4
+ node {
5
+ ...ContentImagesListFields
6
+ }
7
+ }
8
+ }
9
+ }
@@ -0,0 +1,21 @@
1
+ fragment ContentImagesListFields on ContentImage {
2
+ channelCode
3
+ slug
4
+ imageId
5
+ image {
6
+ id
7
+ channelCode
8
+ alt
9
+ height
10
+ width
11
+ url
12
+ thumbnailUrl
13
+ size
14
+ mimeType
15
+ useCase
16
+ createdAt
17
+ updatedAt
18
+ }
19
+ createdAt
20
+ updatedAt
21
+ }
@@ -0,0 +1,9 @@
1
+ query EntriesList($channel: ChannelCode!, $filter: EntriesFilterInput!) {
2
+ entries(channelCode: $channel, filter: $filter) {
3
+ edges {
4
+ node {
5
+ ...EntriesListFields
6
+ }
7
+ }
8
+ }
9
+ }
@@ -0,0 +1,8 @@
1
+ fragment EntriesListFields on Entry {
2
+ channelCode
3
+ id
4
+ collectionSlug
5
+ value
6
+ createdAt
7
+ updatedAt
8
+ }
@@ -0,0 +1 @@
1
+ export { CmsService } from './service';
@@ -0,0 +1,57 @@
1
+ import { WizardGraphQLClient } from "../../client";
2
+ import {
3
+ ContentImagesListDocument,
4
+ EntriesListDocument,
5
+ } from "../../types";
6
+
7
+ import type { Client } from "@urql/core";
8
+ import type {
9
+ ContentImagesListFieldsFragment,
10
+ EntriesFilterInput,
11
+ EntriesListFieldsFragment,
12
+ } from "../../types";
13
+
14
+ export class CmsService extends WizardGraphQLClient<unknown> {
15
+ private channel: string;
16
+
17
+ constructor(urqlClient: Client, channel: string) {
18
+ super(urqlClient);
19
+
20
+ this.channel = channel;
21
+ }
22
+
23
+ async listEntries(
24
+ filter: EntriesFilterInput
25
+ ): Promise<EntriesListFieldsFragment[]> {
26
+ const response = await this.client
27
+ .query(EntriesListDocument, {
28
+ channel: this.channel,
29
+ filter,
30
+ })
31
+ .toPromise();
32
+
33
+ this.unwrapError(response, "entries");
34
+
35
+ return (
36
+ response.data?.entries?.edges?.map(
37
+ (edge: { node: EntriesListFieldsFragment }) => edge.node,
38
+ ) || []
39
+ );
40
+ }
41
+
42
+ async listContentImages(): Promise<ContentImagesListFieldsFragment[]> {
43
+ const response = await this.client
44
+ .query(ContentImagesListDocument, {
45
+ channel: this.channel,
46
+ })
47
+ .toPromise();
48
+
49
+ this.unwrapError(response, "contentImages");
50
+
51
+ return (
52
+ response.data?.contentImages?.edges?.map(
53
+ (edge: { node: ContentImagesListFieldsFragment }) => edge.node,
54
+ ) || []
55
+ );
56
+ }
57
+ }
package/src/index.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from './core/product';
2
2
 
3
3
  import { CategoryService } from './core/category';
4
+ import { CmsService } from './core/cms';
4
5
  import { ProductService } from './core/product';
5
6
 
6
7
  import type { Client as URQLClient } from '@urql/core';
@@ -9,12 +10,14 @@ export class WizardStorefrontClient {
9
10
  readonly baseURL: URL;
10
11
  readonly urqlClient: URQLClient;
11
12
  readonly category: CategoryService;
13
+ readonly cms: CmsService;
12
14
  readonly product: ProductService;
13
15
 
14
16
  constructor(baseURL: URL, graphQLClient: URQLClient, channelCode: string) {
15
17
  this.baseURL = baseURL;
16
18
  this.urqlClient = graphQLClient;
17
19
  this.category = new CategoryService(graphQLClient, channelCode);
20
+ this.cms = new CmsService(graphQLClient, channelCode);
18
21
  this.product = new ProductService(graphQLClient, channelCode);
19
22
  }
20
23
  }
@@ -58,6 +58,74 @@ export type CategoryEdge = {
58
58
  node: Category;
59
59
  };
60
60
 
61
+ /** CMS Image */
62
+ export type ContentImage = {
63
+ __typename?: 'ContentImage';
64
+ channelCode: Scalars['ChannelCode']['output'];
65
+ createdAt: Scalars['DateTime']['output'];
66
+ image: Image;
67
+ imageId: Scalars['UUID']['output'];
68
+ slug: Scalars['Slug']['output'];
69
+ updatedAt: Scalars['DateTime']['output'];
70
+ };
71
+
72
+ export type ContentImageConnection = {
73
+ __typename?: 'ContentImageConnection';
74
+ /** A list of edges. */
75
+ edges: Array<ContentImageEdge>;
76
+ /** A list of nodes. */
77
+ nodes: Array<ContentImage>;
78
+ /** Information to aid in pagination. */
79
+ pageInfo: PageInfo;
80
+ totalCount: Scalars['Int']['output'];
81
+ totalPages: Scalars['Int']['output'];
82
+ };
83
+
84
+ /** An edge in a connection. */
85
+ export type ContentImageEdge = {
86
+ __typename?: 'ContentImageEdge';
87
+ /** A cursor for use in pagination */
88
+ cursor: Scalars['String']['output'];
89
+ /** The item at the end of the edge */
90
+ node: ContentImage;
91
+ };
92
+
93
+ export type EntriesFilterInput = {
94
+ collectionSlug: Scalars['Slug']['input'];
95
+ };
96
+
97
+ /** CMS Entry */
98
+ export type Entry = {
99
+ __typename?: 'Entry';
100
+ channelCode: Scalars['ChannelCode']['output'];
101
+ collectionSlug: Scalars['Slug']['output'];
102
+ createdAt: Scalars['DateTime']['output'];
103
+ id: Scalars['UUID']['output'];
104
+ updatedAt: Scalars['DateTime']['output'];
105
+ value: Scalars['JsonString']['output'];
106
+ };
107
+
108
+ export type EntryConnection = {
109
+ __typename?: 'EntryConnection';
110
+ /** A list of edges. */
111
+ edges: Array<EntryEdge>;
112
+ /** A list of nodes. */
113
+ nodes: Array<Entry>;
114
+ /** Information to aid in pagination. */
115
+ pageInfo: PageInfo;
116
+ totalCount: Scalars['Int']['output'];
117
+ totalPages: Scalars['Int']['output'];
118
+ };
119
+
120
+ /** An edge in a connection. */
121
+ export type EntryEdge = {
122
+ __typename?: 'EntryEdge';
123
+ /** A cursor for use in pagination */
124
+ cursor: Scalars['String']['output'];
125
+ /** The item at the end of the edge */
126
+ node: Entry;
127
+ };
128
+
61
129
  /** Platform Image */
62
130
  export type Image = {
63
131
  __typename?: 'Image';
@@ -192,6 +260,10 @@ export type Query = {
192
260
  __typename?: 'Query';
193
261
  /** Retrieves Categories */
194
262
  categories: CategoryConnection;
263
+ /** Retrieves CMS Content Images */
264
+ contentImages: ContentImageConnection;
265
+ /** Retrieves CMS Entries */
266
+ entries: EntryConnection;
195
267
  /** Retrieves Products */
196
268
  products: ProductConnection;
197
269
  };
@@ -206,6 +278,25 @@ export type QueryCategoriesArgs = {
206
278
  };
207
279
 
208
280
 
281
+ export type QueryContentImagesArgs = {
282
+ after?: InputMaybe<Scalars['String']['input']>;
283
+ before?: InputMaybe<Scalars['String']['input']>;
284
+ channelCode: Scalars['ChannelCode']['input'];
285
+ first?: InputMaybe<Scalars['Int']['input']>;
286
+ last?: InputMaybe<Scalars['Int']['input']>;
287
+ };
288
+
289
+
290
+ export type QueryEntriesArgs = {
291
+ after?: InputMaybe<Scalars['String']['input']>;
292
+ before?: InputMaybe<Scalars['String']['input']>;
293
+ channelCode: Scalars['ChannelCode']['input'];
294
+ filter: EntriesFilterInput;
295
+ first?: InputMaybe<Scalars['Int']['input']>;
296
+ last?: InputMaybe<Scalars['Int']['input']>;
297
+ };
298
+
299
+
209
300
  export type QueryProductsArgs = {
210
301
  after?: InputMaybe<Scalars['String']['input']>;
211
302
  before?: InputMaybe<Scalars['String']['input']>;
@@ -249,6 +340,25 @@ export type CategoriesListQuery = { __typename?: 'Query', categories: { __typena
249
340
 
250
341
  export type CategoriesListFieldsFragment = { __typename?: 'Category', channelCode: any, id: any, name: string, description: any, path: Array<any>, position: number, isActive: boolean, createdAt: any, updatedAt: any };
251
342
 
343
+ export type ContentImagesListQueryVariables = Exact<{
344
+ channel: Scalars['ChannelCode']['input'];
345
+ }>;
346
+
347
+
348
+ export type ContentImagesListQuery = { __typename?: 'Query', contentImages: { __typename?: 'ContentImageConnection', edges: Array<{ __typename?: 'ContentImageEdge', node: { __typename?: 'ContentImage', channelCode: any, slug: any, imageId: any, createdAt: any, updatedAt: any, image: { __typename?: 'Image', id: any, channelCode: any, alt?: string | null, height: number, width: number, url: string, thumbnailUrl?: string | null, size: number, mimeType: MimeType, useCase: UseCase, createdAt: any, updatedAt: any } } }> } };
349
+
350
+ export type ContentImagesListFieldsFragment = { __typename?: 'ContentImage', channelCode: any, slug: any, imageId: any, createdAt: any, updatedAt: any, image: { __typename?: 'Image', id: any, channelCode: any, alt?: string | null, height: number, width: number, url: string, thumbnailUrl?: string | null, size: number, mimeType: MimeType, useCase: UseCase, createdAt: any, updatedAt: any } };
351
+
352
+ export type EntriesListQueryVariables = Exact<{
353
+ channel: Scalars['ChannelCode']['input'];
354
+ filter: EntriesFilterInput;
355
+ }>;
356
+
357
+
358
+ export type EntriesListQuery = { __typename?: 'Query', entries: { __typename?: 'EntryConnection', edges: Array<{ __typename?: 'EntryEdge', node: { __typename?: 'Entry', channelCode: any, id: any, collectionSlug: any, value: any, createdAt: any, updatedAt: any } }> } };
359
+
360
+ export type EntriesListFieldsFragment = { __typename?: 'Entry', channelCode: any, id: any, collectionSlug: any, value: any, createdAt: any, updatedAt: any };
361
+
252
362
  export type ProductsListQueryVariables = Exact<{
253
363
  channel: Scalars['ChannelCode']['input'];
254
364
  }>;
@@ -271,6 +381,39 @@ export const CategoriesListFieldsFragmentDoc = gql`
271
381
  updatedAt
272
382
  }
273
383
  `;
384
+ export const ContentImagesListFieldsFragmentDoc = gql`
385
+ fragment ContentImagesListFields on ContentImage {
386
+ channelCode
387
+ slug
388
+ imageId
389
+ image {
390
+ id
391
+ channelCode
392
+ alt
393
+ height
394
+ width
395
+ url
396
+ thumbnailUrl
397
+ size
398
+ mimeType
399
+ useCase
400
+ createdAt
401
+ updatedAt
402
+ }
403
+ createdAt
404
+ updatedAt
405
+ }
406
+ `;
407
+ export const EntriesListFieldsFragmentDoc = gql`
408
+ fragment EntriesListFields on Entry {
409
+ channelCode
410
+ id
411
+ collectionSlug
412
+ value
413
+ createdAt
414
+ updatedAt
415
+ }
416
+ `;
274
417
  export const ProductsListFieldsFragmentDoc = gql`
275
418
  fragment ProductsListFields on Product {
276
419
  channelCode
@@ -329,6 +472,28 @@ export const CategoriesListDocument = gql`
329
472
  }
330
473
  }
331
474
  ${CategoriesListFieldsFragmentDoc}`;
475
+ export const ContentImagesListDocument = gql`
476
+ query ContentImagesList($channel: ChannelCode!) {
477
+ contentImages(channelCode: $channel) {
478
+ edges {
479
+ node {
480
+ ...ContentImagesListFields
481
+ }
482
+ }
483
+ }
484
+ }
485
+ ${ContentImagesListFieldsFragmentDoc}`;
486
+ export const EntriesListDocument = gql`
487
+ query EntriesList($channel: ChannelCode!, $filter: EntriesFilterInput!) {
488
+ entries(channelCode: $channel, filter: $filter) {
489
+ edges {
490
+ node {
491
+ ...EntriesListFields
492
+ }
493
+ }
494
+ }
495
+ }
496
+ ${EntriesListFieldsFragmentDoc}`;
332
497
  export const ProductsListDocument = gql`
333
498
  query ProductsList($channel: ChannelCode!) {
334
499
  products(channelCode: $channel) {