@starlightcms/js-sdk 0.3.1 → 0.3.5
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 +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/visual.d.ts +23 -3
- package/dist/types/visual.d.ts.map +1 -1
- package/dist/types/visual.js.map +1 -1
- package/package.json +3 -5
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { makeClient } from './client';
|
|
|
2
2
|
export { DefaultModelDefinition } from './types';
|
|
3
3
|
export { StarlightError } from './errors';
|
|
4
4
|
export * from './types/fields';
|
|
5
|
+
export * from './types/visual';
|
|
5
6
|
declare const Starlight: import("./types").ProxiedStarlightClient<import("./types").DefaultModelDefinition>;
|
|
6
7
|
export { makeClient as makeStarlightClient };
|
|
7
8
|
export default Starlight;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACrC,OAAO,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AACzC,cAAc,gBAAgB,CAAA;AAE9B,QAAA,MAAM,SAAS,oFAAe,CAAA;AAE9B,OAAO,EAAE,UAAU,IAAI,mBAAmB,EAAE,CAAA;AAE5C,eAAe,SAAS,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACrC,OAAO,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AACzC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAE9B,QAAA,MAAM,SAAS,oFAAe,CAAA;AAE9B,OAAO,EAAE,UAAU,IAAI,mBAAmB,EAAE,CAAA;AAE5C,eAAe,SAAS,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -16,6 +16,7 @@ Object.defineProperty(exports, "makeStarlightClient", { enumerable: true, get: f
|
|
|
16
16
|
var errors_1 = require("./errors");
|
|
17
17
|
Object.defineProperty(exports, "StarlightError", { enumerable: true, get: function () { return errors_1.StarlightError; } });
|
|
18
18
|
__exportStar(require("./types/fields"), exports);
|
|
19
|
+
__exportStar(require("./types/visual"), exports);
|
|
19
20
|
const Starlight = (0, client_1.makeClient)();
|
|
20
21
|
exports.default = Starlight;
|
|
21
22
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qCAAqC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qCAAqC;AAQd,oGARd,mBAAU,OAQuB;AAN1C,mCAAyC;AAAhC,wGAAA,cAAc,OAAA;AACvB,iDAA8B;AAC9B,iDAA8B;AAE9B,MAAM,SAAS,GAAG,IAAA,mBAAU,GAAE,CAAA;AAI9B,kBAAe,SAAS,CAAA","sourcesContent":["import { makeClient } from './client'\nexport { DefaultModelDefinition } from './types'\nexport { StarlightError } from './errors'\nexport * from './types/fields'\nexport * from './types/visual'\n\nconst Starlight = makeClient()\n\nexport { makeClient as makeStarlightClient }\n\nexport default Starlight\n"]}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import ModelSelector from '../selectors/ModelSelector';
|
|
|
3
3
|
import { SerializedData } from './entities';
|
|
4
4
|
export * from './fields';
|
|
5
5
|
export * from './entities';
|
|
6
|
+
export * from './visual';
|
|
6
7
|
declare type BaseUrl = 'https://query.starlight.sh/v2' | string;
|
|
7
8
|
export declare type StarlightConfig = {
|
|
8
9
|
workspace?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,4BAA4B,CAAA;AACtD,OAAO,aAAa,MAAM,4BAA4B,CAAA;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAE3C,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,4BAA4B,CAAA;AACtD,OAAO,aAAa,MAAM,4BAA4B,CAAA;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAE3C,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AAExB,aAAK,OAAO,GAAG,+BAA+B,GAAG,MAAM,CAAA;AAEvD,oBAAY,eAAe,GAAG;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB,CAAA;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CAAA;IAExC,GAAG,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,GAAG,cAAc,EAAE,OAAO,EAAE,GAAG,IAAI,CAAA;IAE1D,UAAU,IAAI,MAAM,CAAA;IAEpB,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,CAAC,CAAC,CAAA;IAEb,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,CAAA;IAE7C,MAAM,IAAI,aAAa,CAAA;CACxB;AAED,oBAAY,sBAAsB,CAAC,CAAC,SAAS,wBAAwB,IACnE,eAAe,GAAG;KACf,CAAC,IAAI,MAAM,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACpC,CAAA;AAEH,MAAM,WAAW,qBAAqB,CAAC,CAAC;IACtC,IAAI,EAAE,CAAC,CAAA;CACR;AAED,MAAM,WAAW,qBAAqB,CAAC,CAAC;IACtC,IAAI,EAAE,CAAC,EAAE,CAAA;IACT,KAAK,EAAE;QACL,KAAK,EAAE,MAAM,CAAA;QACb,IAAI,EAAE,MAAM,CAAA;QACZ,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,IAAI,CAAC,EAAE,MAAM,CAAA;KACd,CAAA;IACD,IAAI,EAAE;QACJ,YAAY,EAAE,MAAM,CAAA;QACpB,SAAS,EAAE,MAAM,CAAA;QACjB,IAAI,EAAE,MAAM,CAAA;QACZ,EAAE,EAAE,MAAM,CAAA;QACV,QAAQ,EAAE,MAAM,CAAA;QAChB,KAAK,EAAE,MAAM,CAAA;KACd,CAAA;CACF;AAGD,MAAM,WAAW,sBAAuB,SAAQ,wBAAwB;CAAG;AAE3E,MAAM,WAAW,wBAAwB;IACvC,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAAA;CAC/B"}
|
package/dist/types/index.js
CHANGED
|
@@ -12,4 +12,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
__exportStar(require("./fields"), exports);
|
|
14
14
|
__exportStar(require("./entities"), exports);
|
|
15
|
+
__exportStar(require("./visual"), exports);
|
|
15
16
|
//# sourceMappingURL=index.js.map
|
package/dist/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,2CAAwB;AACxB,6CAA0B","sourcesContent":["import EntrySelector from '../selectors/EntrySelector'\nimport ModelSelector from '../selectors/ModelSelector'\nimport { SerializedData } from './entities'\n\nexport * from './fields'\nexport * from './entities'\n\ntype BaseUrl = 'https://query.starlight.sh/v2' | string\n\nexport type StarlightConfig = {\n workspace?: string\n baseUrl?: BaseUrl\n debug?: boolean\n}\n\nexport interface StarlightClient {\n configure(config: StarlightConfig): void\n\n log(message?: unknown, ...optionalParams: unknown[]): void\n\n getBaseUrl(): string\n\n get<T = Record<string, unknown>>(\n path: string,\n options?: RequestInit\n ): Promise<T>\n\n getEntrySelector(slug: string): EntrySelector\n\n models(): ModelSelector\n}\n\nexport type ProxiedStarlightClient<T extends WorkspaceModelDefinition> =\n StarlightClient & {\n [K in keyof T]: EntrySelector<T[K]>\n }\n\nexport interface StarlightItemResponse<T> {\n data: T\n}\n\nexport interface StarlightListResponse<T> {\n data: T[]\n links: {\n first: string\n last: string\n prev?: string\n next?: string\n }\n meta: {\n current_page: number\n last_page: number\n from: number\n to: number\n per_page: number\n total: number\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface DefaultModelDefinition extends WorkspaceModelDefinition {}\n\nexport interface WorkspaceModelDefinition {\n [slug: string]: SerializedData\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,2CAAwB;AACxB,6CAA0B;AAC1B,2CAAwB","sourcesContent":["import EntrySelector from '../selectors/EntrySelector'\nimport ModelSelector from '../selectors/ModelSelector'\nimport { SerializedData } from './entities'\n\nexport * from './fields'\nexport * from './entities'\nexport * from './visual'\n\ntype BaseUrl = 'https://query.starlight.sh/v2' | string\n\nexport type StarlightConfig = {\n workspace?: string\n baseUrl?: BaseUrl\n debug?: boolean\n}\n\nexport interface StarlightClient {\n configure(config: StarlightConfig): void\n\n log(message?: unknown, ...optionalParams: unknown[]): void\n\n getBaseUrl(): string\n\n get<T = Record<string, unknown>>(\n path: string,\n options?: RequestInit\n ): Promise<T>\n\n getEntrySelector(slug: string): EntrySelector\n\n models(): ModelSelector\n}\n\nexport type ProxiedStarlightClient<T extends WorkspaceModelDefinition> =\n StarlightClient & {\n [K in keyof T]: EntrySelector<T[K]>\n }\n\nexport interface StarlightItemResponse<T> {\n data: T\n}\n\nexport interface StarlightListResponse<T> {\n data: T[]\n links: {\n first: string\n last: string\n prev?: string\n next?: string\n }\n meta: {\n current_page: number\n last_page: number\n from: number\n to: number\n per_page: number\n total: number\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface DefaultModelDefinition extends WorkspaceModelDefinition {}\n\nexport interface WorkspaceModelDefinition {\n [slug: string]: SerializedData\n}\n"]}
|
package/dist/types/visual.d.ts
CHANGED
|
@@ -1,10 +1,30 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
1
|
+
export declare type BlockType = 'paragraph' | 'quote' | 'header' | 'image';
|
|
2
|
+
interface BlockData {
|
|
3
|
+
[key: string]: unknown;
|
|
4
|
+
}
|
|
5
|
+
export interface ParagraphBlock extends BlockData {
|
|
6
|
+
text: string;
|
|
7
|
+
}
|
|
8
|
+
export interface HeaderBlock extends BlockData {
|
|
9
|
+
text: string;
|
|
10
|
+
level: number;
|
|
11
|
+
}
|
|
12
|
+
export interface QuoteBlock extends BlockData {
|
|
13
|
+
text: string;
|
|
14
|
+
caption: string;
|
|
15
|
+
alignment: 'left' | 'center';
|
|
16
|
+
}
|
|
17
|
+
export interface ImageBlock extends BlockData {
|
|
18
|
+
url: string;
|
|
19
|
+
}
|
|
20
|
+
export interface VisualDataBlock<D extends BlockData = BlockData> {
|
|
21
|
+
type: BlockType;
|
|
3
22
|
data: D;
|
|
4
23
|
}
|
|
5
24
|
export interface VisualData {
|
|
6
25
|
time?: number;
|
|
7
26
|
version?: string;
|
|
8
|
-
blocks:
|
|
27
|
+
blocks: VisualDataBlock[];
|
|
9
28
|
}
|
|
29
|
+
export {};
|
|
10
30
|
//# sourceMappingURL=visual.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visual.d.ts","sourceRoot":"","sources":["../../src/types/visual.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"visual.d.ts","sourceRoot":"","sources":["../../src/types/visual.ts"],"names":[],"mappings":"AAAA,oBAAY,SAAS,GAAG,WAAW,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAA;AAElE,UAAU,SAAS;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED,MAAM,WAAW,cAAe,SAAQ,SAAS;IAC/C,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,UAAW,SAAQ,SAAS;IAC3C,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,GAAG,QAAQ,CAAA;CAC7B;AAED,MAAM,WAAW,UAAW,SAAQ,SAAS;IAC3C,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS;IAC9D,IAAI,EAAE,SAAS,CAAA;IACf,IAAI,EAAE,CAAC,CAAA;CACR;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,eAAe,EAAE,CAAA;CAC1B"}
|
package/dist/types/visual.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visual.js","sourceRoot":"","sources":["../../src/types/visual.ts"],"names":[],"mappings":"","sourcesContent":["export
|
|
1
|
+
{"version":3,"file":"visual.js","sourceRoot":"","sources":["../../src/types/visual.ts"],"names":[],"mappings":"","sourcesContent":["export type BlockType = 'paragraph' | 'quote' | 'header' | 'image'\n\ninterface BlockData {\n [key: string]: unknown\n}\n\nexport interface ParagraphBlock extends BlockData {\n text: string\n}\n\nexport interface HeaderBlock extends BlockData {\n text: string\n level: number\n}\n\nexport interface QuoteBlock extends BlockData {\n text: string\n caption: string\n alignment: 'left' | 'center'\n}\n\nexport interface ImageBlock extends BlockData {\n url: string\n}\n\nexport interface VisualDataBlock<D extends BlockData = BlockData> {\n type: BlockType\n data: D\n}\n\nexport interface VisualData {\n time?: number\n version?: string\n blocks: VisualDataBlock[]\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@starlightcms/js-sdk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"description": "The Starlight SDK for JavaScript",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -36,15 +36,13 @@
|
|
|
36
36
|
"husky": "^7.0.2",
|
|
37
37
|
"lint-staged": "^11.1.2",
|
|
38
38
|
"prettier": "2.4.1",
|
|
39
|
-
"typescript": "^4.4.3"
|
|
39
|
+
"typescript": "^4.4.3",
|
|
40
|
+
"rimraf": "^3.0.2"
|
|
40
41
|
},
|
|
41
42
|
"lint-staged": {
|
|
42
43
|
"*.{ts}": [
|
|
43
44
|
"eslint --cache --fix",
|
|
44
45
|
"prettier --write"
|
|
45
46
|
]
|
|
46
|
-
},
|
|
47
|
-
"dependencies": {
|
|
48
|
-
"rimraf": "^3.0.2"
|
|
49
47
|
}
|
|
50
48
|
}
|