contentful-ui-extensions-sdk 4.13.0 → 4.14.0

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/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { KnownSDK } from './types';
2
2
  export * from './types';
3
3
  export { default as locations } from './locations';
4
- declare type Init = <T extends KnownSDK = KnownSDK>(initCallback: (sdk: T) => any, options?: {
4
+ type Init = <T extends KnownSDK = KnownSDK>(initCallback: (sdk: T) => any, options?: {
5
5
  supressIframeWarning?: boolean;
6
6
  }) => void;
7
7
  export declare const init: Init;
@@ -107,15 +107,15 @@ export interface SharedEditorSDK {
107
107
  /** Information about the content type of the entry. */
108
108
  contentType: ContentTypeAPI;
109
109
  }
110
- export declare type CrudAction = 'create' | 'read' | 'update' | 'delete';
111
- export declare type PublishableAction = 'publish' | 'unpublish';
112
- export declare type ArchiveableAction = 'archive' | 'unarchive';
113
- export declare type JSONPatchItem = {
110
+ export type CrudAction = 'create' | 'read' | 'update' | 'delete';
111
+ export type PublishableAction = 'publish' | 'unpublish';
112
+ export type ArchiveableAction = 'archive' | 'unarchive';
113
+ export type JSONPatchItem = {
114
114
  op: 'remove' | 'replace' | 'add';
115
115
  path: string;
116
116
  value?: any;
117
117
  };
118
- declare type PatchEntity = Entry | Task | Asset | WorkflowDefinition;
118
+ type PatchEntity = Entry | Task | Asset | WorkflowDefinition;
119
119
  export interface AccessAPI {
120
120
  can(action: 'read' | 'update', entity: 'EditorInterface' | EditorInterface): Promise<boolean>;
121
121
  can<T = Object>(action: CrudAction, entity: 'ContentType' | ContentType | 'Asset' | 'Entry' | T): Promise<boolean>;
@@ -125,7 +125,7 @@ export interface AccessAPI {
125
125
  /** Whether the current user can edit app config */
126
126
  canEditAppConfig: () => Promise<boolean>;
127
127
  }
128
- declare type EntryScopedIds = 'field' | 'entry' | 'contentType';
128
+ type EntryScopedIds = 'field' | 'entry' | 'contentType';
129
129
  export interface BaseExtensionSDK {
130
130
  /** @deprecated since version 4.0.0 consider using the CMA instead
131
131
  * See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
@@ -152,17 +152,17 @@ export interface BaseExtensionSDK {
152
152
  /** Adapter to be injected in contentful-management client */
153
153
  cmaAdapter: Adapter;
154
154
  }
155
- export declare type EditorExtensionSDK = Omit<BaseExtensionSDK, 'ids'> & SharedEditorSDK & {
155
+ export type EditorExtensionSDK = Omit<BaseExtensionSDK, 'ids'> & SharedEditorSDK & {
156
156
  /** A set of IDs for the app */
157
157
  ids: Omit<IdsAPI, 'field'>;
158
158
  };
159
- export declare type SidebarExtensionSDK = Omit<BaseExtensionSDK, 'ids'> & SharedEditorSDK & {
159
+ export type SidebarExtensionSDK = Omit<BaseExtensionSDK, 'ids'> & SharedEditorSDK & {
160
160
  /** A set of IDs for the app */
161
161
  ids: Omit<IdsAPI, 'field'>;
162
162
  /** Methods to update the size of the iframe the app is contained within. */
163
163
  window: WindowAPI;
164
164
  };
165
- export declare type FieldExtensionSDK = BaseExtensionSDK & SharedEditorSDK & {
165
+ export type FieldExtensionSDK = BaseExtensionSDK & SharedEditorSDK & {
166
166
  /** A set of IDs for the app */
167
167
  ids: IdsAPI;
168
168
  /** Gives you access to the value and metadata of the field the app is attached to. */
@@ -170,7 +170,7 @@ export declare type FieldExtensionSDK = BaseExtensionSDK & SharedEditorSDK & {
170
170
  /** Methods to update the size of the iframe the app is contained within. */
171
171
  window: WindowAPI;
172
172
  };
173
- export declare type DialogExtensionSDK = Omit<BaseExtensionSDK, 'ids'> & {
173
+ export type DialogExtensionSDK = Omit<BaseExtensionSDK, 'ids'> & {
174
174
  /** A set of IDs for the app */
175
175
  ids: Omit<IdsAPI, EntryScopedIds>;
176
176
  /** Closes the dialog and resolves openCurrentApp promise with data */
@@ -178,21 +178,21 @@ export declare type DialogExtensionSDK = Omit<BaseExtensionSDK, 'ids'> & {
178
178
  /** Methods to update the size of the iframe the app is contained within. */
179
179
  window: WindowAPI;
180
180
  };
181
- export declare type PageExtensionSDK = Omit<BaseExtensionSDK, 'ids'> & {
181
+ export type PageExtensionSDK = Omit<BaseExtensionSDK, 'ids'> & {
182
182
  /** A set of IDs actual for the app */
183
183
  ids: Omit<IdsAPI, EntryScopedIds>;
184
184
  };
185
- export declare type HomeExtensionSDK = Omit<BaseExtensionSDK, 'ids'> & {
185
+ export type HomeExtensionSDK = Omit<BaseExtensionSDK, 'ids'> & {
186
186
  ids: Omit<IdsAPI, EntryScopedIds>;
187
187
  };
188
- export declare type AppExtensionSDK = Omit<BaseExtensionSDK, 'ids'> & {
188
+ export type AppExtensionSDK = Omit<BaseExtensionSDK, 'ids'> & {
189
189
  /** A set of IDs actual for the app */
190
190
  ids: Omit<IdsAPI, EntryScopedIds | 'extension' | 'app'> & {
191
191
  app: string;
192
192
  };
193
193
  app: AppConfigAPI;
194
194
  };
195
- export declare type KnownSDK = FieldExtensionSDK | SidebarExtensionSDK | DialogExtensionSDK | EditorExtensionSDK | PageExtensionSDK | AppExtensionSDK | HomeExtensionSDK;
195
+ export type KnownSDK = FieldExtensionSDK | SidebarExtensionSDK | DialogExtensionSDK | EditorExtensionSDK | PageExtensionSDK | AppExtensionSDK | HomeExtensionSDK;
196
196
  export interface Locations {
197
197
  LOCATION_ENTRY_FIELD: 'entry-field';
198
198
  LOCATION_ENTRY_FIELD_SIDEBAR: 'entry-field-sidebar';
@@ -20,11 +20,11 @@ interface AppStateEditorInterfaceItem {
20
20
  export interface AppState {
21
21
  EditorInterface: Record<ContentType['sys']['id'], AppStateEditorInterfaceItem>;
22
22
  }
23
- export declare type OnConfigureHandlerReturn = {
23
+ export type OnConfigureHandlerReturn = {
24
24
  parameters?: KeyValueMap | null;
25
25
  targetState?: AppState | null;
26
26
  } | false;
27
- export declare type OnConfigureHandler = () => OnConfigureHandlerReturn | Promise<OnConfigureHandlerReturn>;
27
+ export type OnConfigureHandler = () => OnConfigureHandlerReturn | Promise<OnConfigureHandlerReturn>;
28
28
  export interface AppConfigAPI {
29
29
  /** Tells the web app that the app is loaded */
30
30
  setReady: () => Promise<void>;
@@ -0,0 +1,31 @@
1
+ import { PlainClientAPI } from 'contentful-management';
2
+ export type CMAClient = {
3
+ appAction: Pick<PlainClientAPI['appAction'], 'get' | 'getMany' | 'getManyForEnvironment'>;
4
+ appDefinition: Pick<PlainClientAPI['appDefinition'], 'get' | 'getInstallationsForOrg'>;
5
+ appInstallation: Pick<PlainClientAPI['appInstallation'], 'getForOrganization'>;
6
+ asset: PlainClientAPI['asset'];
7
+ assetKey: PlainClientAPI['assetKey'];
8
+ appSignedRequest: Pick<PlainClientAPI['appSignedRequest'], 'create'>;
9
+ bulkAction: PlainClientAPI['bulkAction'];
10
+ comment: PlainClientAPI['comment'];
11
+ contentType: PlainClientAPI['contentType'];
12
+ editorInterface: PlainClientAPI['editorInterface'];
13
+ environment: Pick<PlainClientAPI['environment'], 'get'>;
14
+ environmentAlias: Pick<PlainClientAPI['environmentAlias'], 'get'>;
15
+ entry: PlainClientAPI['entry'];
16
+ locale: PlainClientAPI['locale'];
17
+ release: PlainClientAPI['release'];
18
+ releaseAction: PlainClientAPI['releaseAction'];
19
+ role: Pick<PlainClientAPI['role'], 'get' | 'getMany'>;
20
+ scheduledActions: PlainClientAPI['scheduledActions'];
21
+ snapshot: PlainClientAPI['snapshot'];
22
+ space: Pick<PlainClientAPI['space'], 'get'>;
23
+ upload: PlainClientAPI['upload'];
24
+ user: Pick<PlainClientAPI['user'], 'getManyForSpace' | 'getForSpace'>;
25
+ usage: Pick<PlainClientAPI['usage'], 'getManyForSpace'>;
26
+ team: Pick<PlainClientAPI['team'], 'getManyForSpace'>;
27
+ task: PlainClientAPI['task'];
28
+ tag: PlainClientAPI['tag'];
29
+ uiConfig: PlainClientAPI['uiConfig'];
30
+ userUIConfig: PlainClientAPI['userUIConfig'];
31
+ };
@@ -6,7 +6,7 @@ export interface OpenAlertOptions {
6
6
  shouldCloseOnEscapePress?: boolean;
7
7
  shouldCloseOnOverlayClick?: boolean;
8
8
  }
9
- export declare type OpenConfirmOptions = OpenAlertOptions & {
9
+ export type OpenConfirmOptions = OpenAlertOptions & {
10
10
  cancelLabel?: string;
11
11
  intent?: 'primary' | 'positive' | 'negative';
12
12
  };
@@ -1,7 +1,7 @@
1
1
  import { Metadata, Task } from './entities';
2
2
  import { EntryFieldAPI } from './field.types';
3
3
  import { CollectionResponse, ContentEntitySys, SearchQuery } from './utils';
4
- declare type TaskState = 'active' | 'resolved';
4
+ type TaskState = 'active' | 'resolved';
5
5
  export interface TaskInputData {
6
6
  assignedToId: string;
7
7
  assignedToType?: 'User' | 'Team';
@@ -10,3 +10,4 @@ export type { SpaceAPI } from './space.types';
10
10
  export type { SearchQuery, CollectionResponse, ContentEntitySys, ContentEntityType, Items, Link, WithOptionalId, WithId, SerializedJSONValue, } from './utils';
11
11
  export type { DateRangeValidationError, InValidationError, LinkContentTypeValidationError, LinkMimetypeGroupValidationError, NotResolvableValidationError, ProhibitRegexpValidationError, RangeValidationError, RegexpValidationError, RequiredValidationError, SizeValidationError, TypeValidationError, UniqueValidationError, UnknownValidationError, ValidationError, } from './validation-error';
12
12
  export type { WindowAPI } from './window.types';
13
+ export type { CMAClient } from './cmaClient.types';
@@ -1,6 +1,6 @@
1
1
  import { Asset, CanonicalRequest, ContentType, EditorInterface, ScheduledAction, Tag, Team, User, TagVisibility, KeyValueMap, Entry, QueryOptions, Upload } from './entities';
2
2
  import { CollectionResponse, ContentEntityType, Link, WithOptionalId, SearchQuery } from './utils';
3
- declare type Snapshot<T> = {
3
+ type Snapshot<T> = {
4
4
  sys: {
5
5
  space?: Link;
6
6
  status?: Link;
@@ -1,22 +1,22 @@
1
1
  import { ContentTypeFieldValidation } from './entities';
2
- declare type Sys = {
2
+ type Sys = {
3
3
  id: string;
4
4
  type: string;
5
5
  [key: string]: any;
6
6
  };
7
- declare type Entity = {
7
+ type Entity = {
8
8
  sys: Sys;
9
9
  [key: string]: any;
10
10
  };
11
- declare type Optional<Type, Keys extends keyof Type> = Partial<Type> & Omit<Type, Keys>;
12
- export declare type WithSysWithAtLeastId = {
11
+ type Optional<Type, Keys extends keyof Type> = Partial<Type> & Omit<Type, Keys>;
12
+ export type WithSysWithAtLeastId = {
13
13
  sys: {
14
14
  id: string;
15
15
  [key: string]: any;
16
16
  };
17
17
  };
18
- export declare type WithId<Type extends Entity> = Omit<Type, 'sys'> & WithSysWithAtLeastId;
19
- export declare type WithOptionalId<Type extends Entity> = Optional<Type, 'sys'> | WithId<Type>;
18
+ export type WithId<Type extends Entity> = Omit<Type, 'sys'> & WithSysWithAtLeastId;
19
+ export type WithOptionalId<Type extends Entity> = Optional<Type, 'sys'> | WithId<Type>;
20
20
  export interface Link<LinkType = string, Type = string> {
21
21
  sys: {
22
22
  id: string;
@@ -33,7 +33,7 @@ export interface CollectionResponse<T> {
33
33
  type: string;
34
34
  };
35
35
  }
36
- export declare type ContentEntityType = 'Entry' | 'Asset';
36
+ export type ContentEntityType = 'Entry' | 'Asset';
37
37
  export interface ContentEntitySys {
38
38
  space: Link;
39
39
  id: string;
@@ -64,7 +64,7 @@ export interface SearchQuery {
64
64
  limit?: number;
65
65
  [key: string]: any;
66
66
  }
67
- export declare type SerializedJSONValue = null | string | number | boolean | Array<SerializedJSONValue> | {
67
+ export type SerializedJSONValue = null | string | number | boolean | Array<SerializedJSONValue> | {
68
68
  [key: string]: SerializedJSONValue;
69
69
  };
70
70
  export {};
@@ -60,4 +60,4 @@ export interface TypeValidationError extends BaseValidationError {
60
60
  name: 'type';
61
61
  type: string;
62
62
  }
63
- export declare type ValidationError = SizeValidationError | RangeValidationError | InValidationError | RequiredValidationError | UniqueValidationError | RegexpValidationError | ProhibitRegexpValidationError | LinkMimetypeGroupValidationError | LinkContentTypeValidationError | DateRangeValidationError | NotResolvableValidationError | UnknownValidationError | TypeValidationError | BaseValidationError;
63
+ export type ValidationError = SizeValidationError | RangeValidationError | InValidationError | RequiredValidationError | UniqueValidationError | RegexpValidationError | ProhibitRegexpValidationError | LinkMimetypeGroupValidationError | LinkContentTypeValidationError | DateRangeValidationError | NotResolvableValidationError | UnknownValidationError | TypeValidationError | BaseValidationError;
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"contentful-ui-extensions-sdk","description":"SDK to develop custom UI Extension for the Contentful Web App","version":"4.13.0","author":"Contentful GmbH","license":"MIT","sideEffects":true,"repository":{"url":"https://github.com/contentful/ui-extensions-sdk.git","type":"git"},"homepage":"https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/","main":"dist/cf-extension-api.js","types":"dist/index.d.ts","files":["dist/cf-extension-api.js","dist/cf-extension-api.js.map","dist/cf-extension.css","dist/**/*.d.ts"],"scripts":{"test":"ts-mocha -p tsconfig.test.json 'test/unit/*.[jt]s' --reporter mocha-multi-reporters --reporter-options configFile=mocha.unit-reporters.json","lint":"eslint '{lib,test}/**/*.{t,j}s'","lint:fix":"npm run lint -- --fix","build":"npm run check-types && rollup -c --compact","build:debug":"npm run build -- --sourcemap","prepublishOnly":"npm run build","size":"echo \"Gzipped, estimate: $(gzip -9 -c dist/cf-extension-api.js | wc -c) bytes\"","semantic-release":"semantic-release","publish-all":"node ./scripts/publish.js","verify":"node ./scripts/verify.js","check-types":"tsc --noEmit -m commonjs","prepare":"husky install","lint-staged":"lint-staged"},"devDependencies":{"@semantic-release/changelog":"6.0.1","@semantic-release/exec":"6.0.3","@semantic-release/git":"10.0.1","@testing-library/dom":"8.19.0","@types/chai-as-promised":"7.1.5","@types/cross-spawn":"6.0.2","@types/fs-extra":"9.0.13","@types/jsdom":"20.0.0","@types/mocha":"10.0.0","@types/nanoid":"3.0.0","@types/sinon":"^10.0.0","@types/sinon-chai":"^3.2.5","@typescript-eslint/eslint-plugin":"4.33.0","@typescript-eslint/parser":"4.33.0","babel-eslint":"10.1.0","chai":"4.3.6","chai-as-promised":"7.1.1","contentful-management":"10.18.2","cross-spawn":"7.0.3","eslint":"7.32.0","eslint-config-prettier":"8.5.0","eslint-config-standard":"16.0.3","eslint-plugin-import":"2.26.0","eslint-plugin-node":"11.1.0","eslint-plugin-prettier":"4.2.1","eslint-plugin-promise":"6.1.1","eslint-plugin-react":"7.31.10","eslint-plugin-standard":"5.0.0","fs-extra":"10.1.0","husky":"8.0.1","jsdom":"20.0.1","lint-staged":"13.0.3","mocha":"10.1.0","mocha-junit-reporter":"2.1.0","mocha-multi-reporters":"1.5.1","mochawesome":"7.1.3","mochawesome-merge":"4.2.1","mochawesome-report-generator":"6.2.0","prettier":"2.7.1","rollup":"2.79.1","rollup-plugin-terser":"7.0.2","rollup-plugin-typescript2":"0.34.1","semantic-release":"19.0.5","sinon":"14.0.1","sinon-chai":"3.7.0","ts-mocha":"10.0.0","tslib":"2.4.0","typescript":"4.8.4"},"lint-staged":{"*.ts":["prettier --write","eslint --fix","git add"],"*.md":["prettier --write","git add"]},"release":{"branches":["master",{"name":"canary","channel":"canary","prerelease":"alpha"}],"plugins":["@semantic-release/commit-analyzer","@semantic-release/release-notes-generator","@semantic-release/changelog",["@semantic-release/npm",{"npmPublish":false}],["@semantic-release/exec",{"verifyConditionsCmd":"node ./scripts/verify.js","publishCmd":"npm run publish-all"}],["@semantic-release/git",{"message":"chore: ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}","assets":["CHANGELOG.md","package.json","package-lock.json"]}],"@semantic-release/github"]},"peerDependencies":{"contentful-management":">=7.30.0"}}
1
+ {"name":"contentful-ui-extensions-sdk","description":"SDK to develop custom UI Extension for the Contentful Web App","version":"4.14.0","author":"Contentful GmbH","license":"MIT","sideEffects":true,"repository":{"url":"https://github.com/contentful/ui-extensions-sdk.git","type":"git"},"homepage":"https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/","main":"dist/cf-extension-api.js","types":"dist/index.d.ts","files":["dist/cf-extension-api.js","dist/cf-extension-api.js.map","dist/cf-extension.css","dist/**/*.d.ts"],"scripts":{"test":"ts-mocha -p tsconfig.test.json 'test/unit/*.[jt]s' --reporter mocha-multi-reporters --reporter-options configFile=mocha.unit-reporters.json","lint":"eslint '{lib,test}/**/*.{t,j}s'","lint:fix":"npm run lint -- --fix","build":"npm run check-types && rollup -c --compact","build:debug":"npm run build -- --sourcemap","prepublishOnly":"npm run build","size":"echo \"Gzipped, estimate: $(gzip -9 -c dist/cf-extension-api.js | wc -c) bytes\"","semantic-release":"semantic-release","publish-all":"node ./scripts/publish.js","verify":"node ./scripts/verify.js","check-types":"tsc --noEmit -m commonjs","prepare":"husky install","lint-staged":"lint-staged"},"devDependencies":{"@semantic-release/changelog":"6.0.2","@semantic-release/exec":"6.0.3","@semantic-release/git":"10.0.1","@testing-library/dom":"8.19.0","@types/chai-as-promised":"7.1.5","@types/cross-spawn":"6.0.2","@types/fs-extra":"9.0.13","@types/jsdom":"20.0.1","@types/mocha":"10.0.1","@types/nanoid":"3.0.0","@types/sinon":"^10.0.0","@types/sinon-chai":"^3.2.5","@typescript-eslint/eslint-plugin":"4.33.0","@typescript-eslint/parser":"4.33.0","babel-eslint":"10.1.0","chai":"4.3.7","chai-as-promised":"7.1.1","contentful-management":"10.25.0","cross-spawn":"7.0.3","eslint":"7.32.0","eslint-config-prettier":"8.5.0","eslint-config-standard":"16.0.3","eslint-plugin-import":"2.26.0","eslint-plugin-node":"11.1.0","eslint-plugin-prettier":"4.2.1","eslint-plugin-promise":"6.1.1","eslint-plugin-react":"7.31.11","eslint-plugin-standard":"5.0.0","fs-extra":"11.1.0","husky":"8.0.2","jsdom":"20.0.3","lint-staged":"13.1.0","mocha":"10.2.0","mocha-junit-reporter":"2.2.0","mocha-multi-reporters":"1.5.1","mochawesome":"7.1.3","mochawesome-merge":"4.2.2","mochawesome-report-generator":"6.2.0","prettier":"2.8.1","rollup":"2.79.1","rollup-plugin-terser":"7.0.2","rollup-plugin-typescript2":"0.34.1","semantic-release":"19.0.5","sinon":"15.0.1","sinon-chai":"3.7.0","ts-mocha":"10.0.0","tslib":"2.4.1","typescript":"4.9.4"},"lint-staged":{"*.ts":["prettier --write","eslint --fix","git add"],"*.md":["prettier --write","git add"]},"release":{"branches":["master",{"name":"canary","channel":"canary","prerelease":"alpha"}],"plugins":["@semantic-release/commit-analyzer","@semantic-release/release-notes-generator","@semantic-release/changelog",["@semantic-release/npm",{"npmPublish":false}],["@semantic-release/exec",{"verifyConditionsCmd":"node ./scripts/verify.js","publishCmd":"npm run publish-all"}],["@semantic-release/git",{"message":"chore: ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}","assets":["CHANGELOG.md","package.json","package-lock.json"]}],"@semantic-release/github"]},"peerDependencies":{"contentful-management":">=7.30.0"}}