Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@adobe/ccweb-add-on-analytics",
"comment": "Manifest update",
"type": "minor"
}
],
"packageName": "@adobe/ccweb-add-on-analytics"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@adobe/ccweb-add-on-core",
"comment": "Manifest update",
"type": "minor"
}
],
"packageName": "@adobe/ccweb-add-on-core"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@adobe/ccweb-add-on-manifest",
"comment": "Manifest update",
"type": "minor"
}
],
"packageName": "@adobe/ccweb-add-on-manifest"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@adobe/ccweb-add-on-scaffolder",
"comment": "Manifest update",
"type": "minor"
}
],
"packageName": "@adobe/ccweb-add-on-scaffolder"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@adobe/ccweb-add-on-scripts",
"comment": "Manifest update",
"type": "minor"
}
],
"packageName": "@adobe/ccweb-add-on-scripts"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@adobe/ccweb-add-on-ssl",
"comment": "Manifest update",
"type": "minor"
}
],
"packageName": "@adobe/ccweb-add-on-ssl"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@adobe/create-ccweb-add-on",
"comment": "Manifest update",
"type": "minor"
}
],
"packageName": "@adobe/create-ccweb-add-on"
}
7 changes: 6 additions & 1 deletion packages/add-on-manifest/.mocharc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"extension": ["ts"],
"node-option": ["experimental-specifier-resolution=node", "loader=ts-node/esm", "no-warnings"],
"node-option": [
"experimental-specifier-resolution=node",
"loader=ts-node/esm",
"enable-source-maps",
"no-warnings"
],
"spec": ["src/test/**/*.spec.ts"]
}
2 changes: 1 addition & 1 deletion packages/add-on-manifest/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@adobe/ccweb-add-on-manifest",
"version": "2.4.1",
"version": "2.5.0",
"author": "Adobe",
"license": "MIT",
"description": "Manifest models and validation rules for Adobe Creative Cloud Web Add-on.",
Expand Down
15 changes: 14 additions & 1 deletion packages/add-on-manifest/scripts/AddOnManifestSchemaTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
* SOFTWARE.
********************************************************************************/

const typePattern = "^(panel|share|content-hub|mobile.your-stuff.files|mobile.media.audio|mobile.more)$";
const typePattern =
"^(panel|command|share|content-hub|mobile.your-stuff.files|mobile.media.audio|mobile.more|schedule|contextual.replace|contextual.upload|contextual.bulk-create)$";
const sandboxPattern = "^(allow-popups|allow-presentation|allow-downloads|allow-popups-to-escape-sandbox|allow-forms)$";
const clipboardPattern = "^(clipboard-write|clipboard-read)$";
const iconPattern = "^(lightest|light|medium|dark|darkest|all)$";
Expand Down Expand Up @@ -62,6 +63,17 @@ export const AuthorInfoSchema = {
additionalProperties: false
};

export const CommandSchema = {
type: "object",
properties: {
name: { type: "string" },
supportedMimeTypes: { type: "array", items: { type: "string" } },
discoverable: { type: "boolean" }
},
required: ["name"],
additionalProperties: false
};

export const EntrypointSchemaV1 = {
type: "object",
properties: {
Expand Down Expand Up @@ -103,6 +115,7 @@ export const EntrypointSchemaV2 = {
script: { type: "string" },
documentSandbox: { type: "string" },
hostDomain: { type: "string" },
commands: { type: "array", items: CommandSchema },
permissions: {
type: "object",
properties: {
Expand Down
2 changes: 1 addition & 1 deletion packages/add-on-manifest/src/AddOnManifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export class AddOnManifest {
}
}

get entryPoints(): Readonly<AddOnManifestEntrypoint[]> {
get entryPoints(): readonly AddOnManifestEntrypoint[] {
if (!this._entrypoints.length) {
this._manifest.entryPoints.forEach(entrypoint => {
this._entrypoints.push(new AddOnManifestEntrypoint(this._manifest.manifestVersion, entrypoint));
Expand Down
18 changes: 16 additions & 2 deletions packages/add-on-manifest/src/AddOnManifestTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ export type Permissions = {
readonly clipboard?: string[];
};

export type Command = {
readonly name: string;
readonly supportedMimeTypes?: string[];
readonly discoverable?: boolean;
};

export type EntrypointV1 = {
readonly type: string;
readonly id: string;
Expand All @@ -118,7 +124,11 @@ export type EntrypointV2 = Omit<EntrypointV1, "label"> & {
readonly hostDomain?: string;
};

export type ManifestEntrypoint = EntrypointV1 | EntrypointV2;
export type CommandEntrypoint = EntrypointV2 & {
readonly commands: Command[];
};

export type ManifestEntrypoint = EntrypointV1 | EntrypointV2 | CommandEntrypoint;
export type ManifestRequirements = RequirementsV1 | RequirementsV2;

/**
Expand All @@ -138,7 +148,11 @@ export enum EntrypointType {
CONTENT_HUB = "content-hub",
MOBILE_MEDIA_AUDIO = "mobile.media.audio",
MOBILE_YOUR_STUFF_FILES = "mobile.your-stuff.files",
MOBILE_MORE = "mobile.more"
MOBILE_MORE = "mobile.more",
SCHEDULE = "schedule",
CONTEXTUAL_REPLACE = "contextual.replace",
CONTEXTUAL_UPLOAD = "contextual.upload",
CONTEXTUAL_BULK_CREATE = "contextual.bulk-create"
}

export type AuthorInfo = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class AddOnManifestApp {
return this._app.apiVersion;
}

get supportedDeviceClass(): Readonly<string[]> {
get supportedDeviceClass(): readonly string[] {
return this._app.supportedDeviceClass || DEFAULT_SUPPORTED_DEVICE_CLASS;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@

import { ManifestVersion } from "../AddOnManifest.js";
import {
Command,
EntrypointV1,
EntrypointV2,
CommandEntrypoint,
LocalisedStrings,
ManifestEntrypoint,
Permissions,
Expand All @@ -34,7 +36,7 @@ import {

interface ManifestEntrypointTypeMap {
[ManifestVersion.V1]: EntrypointV1;
[ManifestVersion.V2]: EntrypointV2;
[ManifestVersion.V2]: EntrypointV2 | CommandEntrypoint;
}

export type ManifestEntrypointType<T extends ManifestVersion> = ManifestEntrypointTypeMap[T];
Expand Down Expand Up @@ -124,4 +126,15 @@ export class AddOnManifestEntrypoint {
}
}
}

get commands(): Command[] | undefined {
switch (this._manifestVersion) {
case ManifestVersion.V1: {
return undefined;
}
default: {
return (this._entrypoint as ManifestEntrypointType<ManifestVersion.V2> as CommandEntrypoint)?.commands;
}
}
}
}
5 changes: 4 additions & 1 deletion packages/add-on-manifest/src/test/AddOnManifest.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
********************************************************************************/

import { assert } from "chai";
import "mocha";
import sinon from "sinon";
import { AddOnManifest, ManifestVersion } from "../AddOnManifest.js";
import { AddOnLogAction, AddOnLogLevel, OTHER_MANIFEST_ERRORS } from "../AddOnManifestTypes.js";
Expand Down Expand Up @@ -90,6 +91,7 @@ describe("AddOnManifest", () => {

assert.equal(manifest.entryPoints[0].label, testManifest.entryPoints[0].label);
assert.equal(manifest.entryPoints[0].defaultSize, testManifest.entryPoints[0].defaultSize);
assert.equal(manifest.entryPoints[0].commands, undefined);
assert.equal(manifest.requirements.apps, testManifest.requirements.apps);
assert.equal(manifest.requirements.privilegedApis, false);
assert.equal(false, manifest.requirements.supportsTouch);
Expand All @@ -114,6 +116,7 @@ describe("AddOnManifest", () => {

assert.equal(manifest.entryPoints[0].label, undefined);
assert.equal(manifest.entryPoints[0].defaultSize, testManifest.entryPoints[0].defaultSize);
assert.deepEqual(manifest.entryPoints[1].commands, testManifest.entryPoints[1].commands);

const apps = manifest.requirements.apps as AddOnManifestApp[];
assert.equal(testManifest.requirements.supportsTouch, manifest.requirements.supportsTouch);
Expand All @@ -129,7 +132,7 @@ describe("AddOnManifest", () => {
assert.equal(apps[1].supportedDeviceClass, DEFAULT_SUPPORTED_DEVICE_CLASS);
});

it("should return deafult manifestVersion for dev AddOn", () => {
it("should return default manifestVersion for dev AddOn", () => {
const devManifest = getTestDeveloperManifestV1() as ReturnType<typeof JSON.parse>;
delete devManifest.manifestVersion;
const { manifest } = AddOnManifest.createManifest(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
********************************************************************************/

import { assert } from "chai";
import "mocha";
import { OTHER_MANIFEST_ERRORS } from "../AddOnManifestTypes.js";
import { AddOnManifestValidator } from "../AddOnManifestValidator.js";
import {
Expand Down
23 changes: 19 additions & 4 deletions packages/add-on-manifest/src/test/ManifestSchemaTests.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
********************************************************************************/

import { assert } from "chai";
import "mocha";
import sinon from "sinon";
import { AddOnManifestType, ManifestVersion } from "../AddOnManifest.js";
import {
Expand Down Expand Up @@ -213,8 +214,15 @@ describe("ManifestSchema Validations - Version 1", () => {
});

it("should have a valid entry point type", () => {
const validTypePatterns = ["panel", "mobile.media.audio", "mobile.your-stuff.files"];
const invalidTypePatterns = ["widgets", "panels", "mobile.media", "mobile.your-stuff"];
const validTypePatterns = [
"panel",
"mobile.media.audio",
"mobile.your-stuff.files",
"contextual.replace",
"contextual.upload",
"contextual.bulk-create"
];
const invalidTypePatterns = ["widgets", "panels", "mobile.media", "mobile.your-stuff", "contextual.insert"];

const testFn = (manifest: ReturnType<typeof JSON.parse>, value: string) => {
(manifest.entryPoints[0] as MutableObject<ManifestEntrypoint>).type = value;
Expand Down Expand Up @@ -704,8 +712,15 @@ describe("ManifestSchema Validations - Version 2", () => {
});

it("should have a valid entry point type", () => {
const validTypePatterns = ["panel", "mobile.media.audio", "mobile.your-stuff.files"];
const invalidTypePatterns = ["widgets", "panels", "mobile.media", "mobile.your-stuff"];
const validTypePatterns = [
"panel",
"mobile.media.audio",
"mobile.your-stuff.files",
"contextual.replace",
"contextual.upload",
"contextual.bulk-create"
];
const invalidTypePatterns = ["widgets", "panels", "mobile.media", "mobile.your-stuff", "contextual.insert"];

const testFn = (manifest: ReturnType<typeof JSON.parse>, value: string) => {
(manifest.entryPoints[0] as MutableObject<ManifestEntrypoint>).type = value;
Expand Down
45 changes: 45 additions & 0 deletions packages/add-on-manifest/src/test/utils/TestManifests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,21 @@ export function getTestManifestV1(privileged?: boolean): AddOnManifestV1 {
type: EntrypointType.MOBILE_YOUR_STUFF_FILES,
id: `mobile-your-stuff-files-${count}`,
...entryPointDetails
},
{
type: EntrypointType.CONTEXTUAL_REPLACE,
id: `contextual-replace-${count}`,
...entryPointDetails
},
{
type: EntrypointType.CONTEXTUAL_UPLOAD,
id: `contextual-upload-${count}`,
...entryPointDetails
},
{
type: EntrypointType.CONTEXTUAL_BULK_CREATE,
id: `contextual-bulk-create-${count}`,
...entryPointDetails
}
],
icon: [
Expand Down Expand Up @@ -199,6 +214,21 @@ export function getTestManifestV2(privileged?: boolean): AddOnManifestV2 {
discoverable: true,
hostDomain: "https://localhost.adobe.com"
},
{
type: EntrypointType.COMMAND,
id: "assetProvider",
main: "command.html",
commands: [
{
name: "assetProvider.getAssets",
supportedMimeTypes: ["image/jpeg", "image/png", "image/bmp"],
discoverable: true
}
],
permissions: {
oauth: ["accounts.google.com"]
}
},
{
type: EntrypointType.MOBILE_MEDIA_AUDIO,
id: `mobile-media-audio-${count}`,
Expand All @@ -208,6 +238,21 @@ export function getTestManifestV2(privileged?: boolean): AddOnManifestV2 {
type: EntrypointType.MOBILE_YOUR_STUFF_FILES,
id: `mobile-your-stuff-files-${count}`,
main: "index.html"
},
{
type: EntrypointType.CONTEXTUAL_REPLACE,
id: `contextual-replace-${count}`,
main: "index.html"
},
{
type: EntrypointType.CONTEXTUAL_UPLOAD,
id: `contextual-upload-${count}`,
main: "index.html"
},
{
type: EntrypointType.CONTEXTUAL_BULK_CREATE,
id: `contextual-bulk-create-${count}`,
main: "index.html"
}
]
};
Expand Down
2 changes: 1 addition & 1 deletion packages/create-ccweb-add-on/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@adobe/create-ccweb-add-on",
"version": "2.4.2",
"version": "2.5.0",
"author": "Adobe",
"license": "MIT",
"description": "Create an Adobe Creative Cloud Web Add-on.",
Expand Down
2 changes: 1 addition & 1 deletion packages/wxp-add-on-scaffolder/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@adobe/ccweb-add-on-scaffolder",
"version": "2.4.1",
"version": "2.5.0",
"author": "Adobe",
"license": "MIT",
"description": "Scaffolding libraries for Adobe Creative Cloud Web Add-on.",
Expand Down
Loading