@chili-publish/studio-connectors 1.7.4
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/Connector.Shared.d.ts +68 -0
- package/dist/FontConnector.d.ts +35 -0
- package/dist/MediaConnector.d.ts +34 -0
- package/dist/index.d.ts +3 -0
- package/package.json +17 -0
- package/readme.md +45 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export interface Dictionary {
|
|
2
|
+
[Key: string]: string;
|
|
3
|
+
}
|
|
4
|
+
export type ChiliPlatform = 'web' | 'server';
|
|
5
|
+
export interface ConnectorRuntimeContext {
|
|
6
|
+
options: Dictionary;
|
|
7
|
+
fetch(url: string, init: ChiliRequestInit): Promise<ChiliResponse>;
|
|
8
|
+
logError(msg: string): void;
|
|
9
|
+
platform: ChiliPlatform;
|
|
10
|
+
sdkVersion: string;
|
|
11
|
+
}
|
|
12
|
+
export type QueryOptions = {
|
|
13
|
+
sortOrder: string | null;
|
|
14
|
+
collection: string | null;
|
|
15
|
+
filter: string[] | null;
|
|
16
|
+
pageToken: string | null;
|
|
17
|
+
pageSize: number;
|
|
18
|
+
sortBy: string | null;
|
|
19
|
+
};
|
|
20
|
+
export interface ChiliRequestInit {
|
|
21
|
+
/**
|
|
22
|
+
* A BodyInit object or null to set request's body.
|
|
23
|
+
*/
|
|
24
|
+
body?: string | null;
|
|
25
|
+
/**
|
|
26
|
+
* A Headers object, an object literal, or an array of two-item arrays to set request's headers.
|
|
27
|
+
*/
|
|
28
|
+
headers?: Dictionary;
|
|
29
|
+
/**
|
|
30
|
+
* A cryptographic hash of the resource to be fetched by request. Sets request's integrity.
|
|
31
|
+
*/
|
|
32
|
+
integrity?: string;
|
|
33
|
+
/**
|
|
34
|
+
* A string to set request's method.
|
|
35
|
+
*/
|
|
36
|
+
method?: string;
|
|
37
|
+
/**
|
|
38
|
+
* A string indicating whether request follows redirects, results in an error upon encountering a redirect, or returns the redirect (in an opaque fashion). Sets request's redirect.
|
|
39
|
+
*/
|
|
40
|
+
redirect?: 'error' | 'follow' | 'manual';
|
|
41
|
+
/**
|
|
42
|
+
* A string whose value is a same-origin URL, "about:client", or the empty string, to set request's referrer.
|
|
43
|
+
*/
|
|
44
|
+
referrer?: string;
|
|
45
|
+
}
|
|
46
|
+
export interface ChiliBody {
|
|
47
|
+
arrayBuffer: ArrayBufferPointer;
|
|
48
|
+
text: string;
|
|
49
|
+
}
|
|
50
|
+
export type ArrayBufferPointer = {
|
|
51
|
+
id: string;
|
|
52
|
+
bytes: number;
|
|
53
|
+
};
|
|
54
|
+
export interface ChiliResponse extends ChiliBody {
|
|
55
|
+
readonly headers: Dictionary;
|
|
56
|
+
readonly ok: boolean;
|
|
57
|
+
readonly redirected: boolean;
|
|
58
|
+
readonly status: number;
|
|
59
|
+
readonly statusText: string;
|
|
60
|
+
readonly type: 'basic' | 'cors' | 'default' | 'error' | 'opaque' | 'opaqueredirect';
|
|
61
|
+
readonly url: string;
|
|
62
|
+
}
|
|
63
|
+
export type ConnectorConfigValueType = 'text' | 'boolean';
|
|
64
|
+
export interface ConnectorConfigValue {
|
|
65
|
+
readonly name: string;
|
|
66
|
+
readonly displayName: string;
|
|
67
|
+
readonly type: ConnectorConfigValueType;
|
|
68
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ArrayBufferPointer, ConnectorConfigValue, Dictionary, QueryOptions } from './Connector.Shared';
|
|
2
|
+
export interface GrafxFontConnector {
|
|
3
|
+
detail(connectorId: string, fontFamilyId: string, context: Dictionary): Promise<FontStyle[]>;
|
|
4
|
+
query(connectorId: string, queryOptions: QueryOptions, context: Dictionary): Promise<FontFamilyPage>;
|
|
5
|
+
download(styleId: string, context: Dictionary): Promise<ArrayBufferPointer>;
|
|
6
|
+
preview(familyId: string, previewFormat: FontPreviewFormat, context: Dictionary): Promise<ArrayBufferPointer>;
|
|
7
|
+
getConfigurationOptions(): ConnectorConfigValue[] | null;
|
|
8
|
+
getCapabilities(): FontConnectorCapabilities;
|
|
9
|
+
}
|
|
10
|
+
export type FontPreviewFormat = 'square' | 'line';
|
|
11
|
+
export interface FontFamilyPage {
|
|
12
|
+
pageSize: number;
|
|
13
|
+
data: FontFamily[];
|
|
14
|
+
links: {
|
|
15
|
+
nextPage: string;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export interface FontFamily {
|
|
19
|
+
id: string;
|
|
20
|
+
name: string;
|
|
21
|
+
fontStylesCount: number;
|
|
22
|
+
extensions: string[];
|
|
23
|
+
}
|
|
24
|
+
export interface FontStyle {
|
|
25
|
+
id: string;
|
|
26
|
+
name: string;
|
|
27
|
+
familyId: string;
|
|
28
|
+
familyName: string;
|
|
29
|
+
}
|
|
30
|
+
export type FontConnectorCapabilities = {
|
|
31
|
+
query: boolean;
|
|
32
|
+
detail: boolean;
|
|
33
|
+
preview: boolean;
|
|
34
|
+
filtering: boolean;
|
|
35
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ArrayBufferPointer, ConnectorConfigValue, Dictionary, QueryOptions } from './Connector.Shared';
|
|
2
|
+
export interface MediaConnector {
|
|
3
|
+
detail(id: string, context: Dictionary): Promise<MediaDetail>;
|
|
4
|
+
query(options: QueryOptions, context: Dictionary): Promise<MediaPage>;
|
|
5
|
+
download(id: string, previewType: DownloadType, intent: DownloadIntent, context: Dictionary): Promise<ArrayBufferPointer>;
|
|
6
|
+
getConfigurationOptions(): ConnectorConfigValue[] | null;
|
|
7
|
+
getCapabilities(): MediaConnectorCapabilities;
|
|
8
|
+
}
|
|
9
|
+
export type DownloadIntent = 'web' | 'print' | 'animation';
|
|
10
|
+
export type DownloadType = 'thumbnail' | 'mediumres' | 'highres' | 'fullres' | 'original';
|
|
11
|
+
export interface MediaPage {
|
|
12
|
+
pageSize: number;
|
|
13
|
+
data: Media[];
|
|
14
|
+
links: {
|
|
15
|
+
nextPage: string;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export interface Media {
|
|
19
|
+
id: string;
|
|
20
|
+
name: string;
|
|
21
|
+
relativePath: string;
|
|
22
|
+
type: number;
|
|
23
|
+
metaData: Dictionary;
|
|
24
|
+
extension?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface MediaDetail extends Media {
|
|
27
|
+
width?: number;
|
|
28
|
+
height?: number;
|
|
29
|
+
}
|
|
30
|
+
export type MediaConnectorCapabilities = {
|
|
31
|
+
query: boolean;
|
|
32
|
+
detail: boolean;
|
|
33
|
+
filtering: boolean;
|
|
34
|
+
};
|
package/dist/index.d.ts
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@chili-publish/studio-connectors",
|
|
3
|
+
"version": "1.7.4",
|
|
4
|
+
"types": "dist/index.d.ts",
|
|
5
|
+
"files": [
|
|
6
|
+
"dist"
|
|
7
|
+
],
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"devDependencies": {
|
|
10
|
+
"prettier": "^3.0.3",
|
|
11
|
+
"typescript": "^5.2.2"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "tsc",
|
|
15
|
+
"prepare-upload": "yarn build && yarn pack && mkdir ./upload/connectors/ -p && cp *.tgz ./upload/connectors/"
|
|
16
|
+
}
|
|
17
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# GraFx Studio Connectors
|
|
2
|
+
|
|
3
|
+
[](https://github.com/chili-publish/grafx-connector-template/blob/main/LICENSE)
|
|
4
|
+
|
|
5
|
+
GraFx Studio Connectors is an innovative concept that enables seamless integration with any third-party application capable of serving Studio-compliant resources. We aim to provide a solution that is simple to explain, easy to develop, and maintainable.
|
|
6
|
+
|
|
7
|
+
## π General Connector Concept
|
|
8
|
+
|
|
9
|
+
Our high-level technical goals for the Studio Connectors are:
|
|
10
|
+
|
|
11
|
+
- Written in popular and easily understood scripting languages (TS, JS).
|
|
12
|
+
- Capable of running connector logic in both client (browser) and server contexts.
|
|
13
|
+
- Secure and isolated from the browser.
|
|
14
|
+
- Enforces memory and CPU limits to ensure an optimal user experience.
|
|
15
|
+
- Small footprint with high performance.
|
|
16
|
+
|
|
17
|
+
### π Schematic
|
|
18
|
+

|
|
19
|
+
|
|
20
|
+
### π Authentication
|
|
21
|
+
We've decoupled authentication and authorization from the connector. You should not store application secrets or anything that allows malicious use of the API you want to connect to inside the connector code. We support several basic authentication methods:
|
|
22
|
+
|
|
23
|
+
- HTTP Header
|
|
24
|
+
- OAuth2 Client Credentials
|
|
25
|
+
- OAuth2 Resource Owner Password Credentials
|
|
26
|
+
|
|
27
|
+
You can choose an authentication method for both client (browser) and server side individually. We provide the tools for secure implementation, but the end responsibility lies with the connector author.
|
|
28
|
+
|
|
29
|
+
### QuickJs
|
|
30
|
+
We use [QuickJS](https://bellard.org/quickjs/) to execute all user-provided scripts, which acts as a Virtual Machine, ensuring the script can never access anything outside the VM. This allows us to restrict the available APIs to the connector developers, ensuring the connector code can safely run both on client (browser) and server (during output generation).
|
|
31
|
+
|
|
32
|
+
## Connector.js
|
|
33
|
+
This repository contains examples of Typescript connectors that can be transpiled to a Javascript module. The current connector API is in version 1.0 and is the minimal APIs needed for a full-featured Media browser and things like Dynamic Asset Providers. We need your feedback! If you think you're missing critical stuff to implement your connector, let us know! Feel free to [open a ticket on the SDK repo](https://github.com/chili-publish/editor-sdk/issues/new/choose).
|
|
34
|
+
|
|
35
|
+
## Connector.json
|
|
36
|
+
This is the wrapper adding metadata to the connector script. This Json can be uploadded using the experimental Connector endpoints of the Environment API. Reach out to your Customer Success contacts to help you set this up. Later this year we will provide a UI to manage connectors on the GraFx platform.
|
|
37
|
+
|
|
38
|
+
## π SDK Documentation
|
|
39
|
+
[Check out the official SDK documentation on GitHub](https://chili-publish.github.io/studio-sdk/)
|
|
40
|
+
|
|
41
|
+
## π¬ Feedback?
|
|
42
|
+
We'd love to hear from you! If you have any technical feedback, feature requests, bugs to report, or general technical questions, donβt hesitate to [create a new issue in the SDK repository](https://github.com/chili-publish/editor-sdk/issues/new/choose).
|
|
43
|
+
|
|
44
|
+
## π License
|
|
45
|
+
This project is [MIT licensed](https://github.com/chili-publish/grafx-connector-template/blob/main/LICENSE).
|