@nascentdigital/funnel-cms 4.4.4 → 4.4.10

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.
@@ -126,6 +126,7 @@ export declare namespace PageClient {
126
126
  slug?: string;
127
127
  publication?: number | null;
128
128
  errors: boolean;
129
+ updatedOn: number;
129
130
  updates: ReadonlyArray<Schema.Page.Update>;
130
131
  };
131
132
  namespace GetOverview {
@@ -30,7 +30,7 @@ export declare namespace IStrapiContentClient {
30
30
  method?: 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE';
31
31
  onError?: Callback<TError>;
32
32
  };
33
- type CustomCommand = 'changeset/query' | 'changeset/commit' | 'changeset/revert' | 'query/pages' | 'query/rank-pages' | 'query/collections' | 'query/collection' | 'publish' | 'unpublish' | 'version';
33
+ type CustomCommand = 'changeset/query' | 'changeset/commit' | 'changeset/revert' | 'page/update' | 'query/pages' | 'query/rank-pages' | 'query/collections' | 'query/collection' | 'publish' | 'unpublish' | 'version';
34
34
  type UnpublishErrorData = Jsonify<{
35
35
  error: true;
36
36
  pageRefs: PageData.Ref[];
@@ -14,7 +14,7 @@ export declare class StrapiPageClient implements PageClient {
14
14
  create(args: PageClient.Create.Args): Promise<PageClient.Create.Result>;
15
15
  duplicate({ source: pageId, targetPage, targetLanguage, targetSlug }: PageClient.Duplicate.Args): Promise<PageClient.Duplicate.Result>;
16
16
  touch({ id: pageId, version: status }: PageClient.Touch.Args): Promise<PageClient.Touch.Result>;
17
- update({ id: pageId, slug: pageSlug, publication: pagePublication, errors, updates }: PageClient.Update.Args): Promise<PageClient.Update.Result>;
17
+ update(args: PageClient.Update.Args): Promise<PageClient.Update.Result>;
18
18
  replace({ page, version, skipSync }: PageClient.Replace.Args): Promise<PageClient.Replace.Result>;
19
19
  unpublish(pageId: PageClient.Unpublish.Args): Promise<PageClient.Unpublish.Result>;
20
20
  getDependants({ id: pageId, version }: PageClient.GetDependants.Args): Promise<PageClient.GetDependants.Result>;
@@ -616,8 +616,19 @@ class StrapiPageClient {
616
616
  // return page ref
617
617
  return serialization_1.PageData.deserializeRef(updatedData);
618
618
  }
619
- async update({ id: pageId, slug: pageSlug, publication: pagePublication, errors, updates }) {
619
+ async update(args) {
620
+ // TODO: migrating towards this as the new method for ALL updates in the future
621
+ if (args.updates.length === 1 && args.updates[0].type === 'section.blockName') {
622
+ // publish changeset (transactional)
623
+ const data = await this.provider.customRequest({
624
+ command: 'page/update',
625
+ method: 'POST',
626
+ data: JSON.stringify(args)
627
+ });
628
+ console.debug('[StrapiPageClient/update] custom update result: ', data);
629
+ }
620
630
  // resolve current user (or throw)
631
+ const { id: pageId, slug: pageSlug, publication: pagePublication, errors, updates } = args;
621
632
  const { client, users } = this.provider;
622
633
  const strapiUrl = client.baseURL;
623
634
  const user = await users.me();
@@ -671,7 +682,6 @@ class StrapiPageClient {
671
682
  page.changeSetId = changeSet.id;
672
683
  // save page
673
684
  const update = serialization_1.PageData.serialize(page);
674
- console.debug(`[StrapiPageClient/update] sending update`, JSON.stringify(update, undefined, ' '));
675
685
  const { data: updatedData } = await collection.update(page.id, Object.assign(Object.assign({}, update), { state: 'draft' }), {
676
686
  status: 'draft',
677
687
  populate: serialization_1.PageData.Populate.full
package/package.json CHANGED
@@ -1,10 +1,13 @@
1
1
  {
2
2
  "name": "@nascentdigital/funnel-cms",
3
- "version": "4.4.4",
3
+ "version": "4.4.10",
4
4
  "repository": {
5
- "url": "https://github.com/nascentdigital/funnel.git",
5
+ "url": "git+https://github.com/nascentdigital/funnel.git",
6
6
  "directory": "libs/cms"
7
7
  },
8
+ "publishConfig": {
9
+ "registry": "https://npmjs.org"
10
+ },
8
11
  "main": "dist/index.js",
9
12
  "types": "dist/index.d.ts",
10
13
  "exports": {
@@ -38,5 +41,5 @@
38
41
  "ts-jest": "^29",
39
42
  "type-fest": "^4"
40
43
  },
41
- "gitHead": "debc0f359106c88e8444638236f7ed7a4f77ec5a"
44
+ "gitHead": "3aa36fa46c32ad625f569ea4b9e43aab80937ff4"
42
45
  }
@@ -1,23 +0,0 @@
1
- /**
2
- * Provides access to (and management of) {@link Site} related models.
3
- */
4
- export interface SiteClient {
5
- /**
6
- * Fetches the details for a specific Site for a given brand
7
- */
8
- get(args: SiteClient.Get.Args): Promise<SiteClient.Get.Result>;
9
- /**
10
- * Updates an existing site.
11
- */
12
- update(args: SiteClient.Update.Args): Promise<SiteClient.Update.Result>;
13
- }
14
- export declare namespace SiteClient {
15
- namespace Get {
16
- type Args = {};
17
- type Result = {};
18
- }
19
- namespace Get {
20
- type Args = {};
21
- type Result = {};
22
- }
23
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });