@omerlo/omerlo-webkit 0.0.39 → 0.0.41
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/omerlo/reader/endpoints/categories.js +15 -11
- package/dist/omerlo/reader/endpoints/contents.d.ts +10 -5
- package/dist/omerlo/reader/endpoints/contents.js +2 -2
- package/dist/omerlo/reader/endpoints/profiles.d.ts +0 -4
- package/dist/omerlo/reader/endpoints/profiles.js +0 -12
- package/dist/omerlo/reader/utils/guards.d.ts +9 -0
- package/dist/omerlo/reader/utils/guards.js +12 -0
- package/dist/omerlo/reader/utils/index.d.ts +1 -0
- package/dist/omerlo/reader/utils/index.js +1 -0
- package/package.json +5 -1
- package/dist/omerlo/index.d.ts +0 -41
- package/dist/omerlo/reader/fetchers.d.ts +0 -41
|
@@ -21,19 +21,23 @@ export function listCategories(f) {
|
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
export function parseCategory(data, _assoc) {
|
|
24
|
-
let meta;
|
|
25
24
|
// NOTE: this is to support publisher public api v2 but also reader api v1
|
|
26
|
-
if (data.
|
|
27
|
-
|
|
25
|
+
if (data.localized) {
|
|
26
|
+
return {
|
|
27
|
+
id: data.id,
|
|
28
|
+
name: data.localized.name,
|
|
29
|
+
svg: data.svg_icon,
|
|
30
|
+
meta: buildMeta(data.localized.locale),
|
|
31
|
+
updatedAt: data.updated_at
|
|
32
|
+
};
|
|
28
33
|
}
|
|
29
34
|
else {
|
|
30
|
-
|
|
35
|
+
return {
|
|
36
|
+
id: data.id,
|
|
37
|
+
name: data.name,
|
|
38
|
+
svg: data.svg_icon,
|
|
39
|
+
meta: { locales: parseLocalesMetadata(data.meta) },
|
|
40
|
+
updatedAt: data.updated_at
|
|
41
|
+
};
|
|
31
42
|
}
|
|
32
|
-
return {
|
|
33
|
-
id: data.id,
|
|
34
|
-
name: data.name,
|
|
35
|
-
svg: data.svg_icon,
|
|
36
|
-
meta,
|
|
37
|
-
updatedAt: data.updated_at
|
|
38
|
-
};
|
|
39
43
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { Category } from './categories';
|
|
2
2
|
import type { ContentBlockTemplate, ContentTemplate } from './content-templates';
|
|
3
3
|
import { type Visual, type Slideshow, type Image, type Video } from './visuals';
|
|
4
|
-
import { type ApiAssocs, type ApiData, type PagingParams } from '../utils/api';
|
|
4
|
+
import { type ApiAssocs, type ApiData, type ApiParams, type PagingParams } from '../utils/api';
|
|
5
5
|
import { type LocalesMetadata } from '../utils/response';
|
|
6
6
|
import type { PersonSummary } from './person';
|
|
7
7
|
import type { OrganizationSummary } from './organizations';
|
|
8
8
|
export type AuthorSummary = PersonSummary | OrganizationSummary;
|
|
9
9
|
export declare const contentsFetchers: (f: typeof fetch) => {
|
|
10
|
-
getContent: (id: string) => Promise<import("../utils/api").ApiResponse<Content>>;
|
|
11
|
-
listContents: (params?: Partial<
|
|
10
|
+
getContent: (id: string, params?: Partial<ApiParams>) => Promise<import("../utils/api").ApiResponse<Content>>;
|
|
11
|
+
listContents: (params?: Partial<ListContentParams>) => Promise<import("../utils/api").ApiResponse<ContentSummary[]>>;
|
|
12
12
|
};
|
|
13
13
|
export interface ContentSeo {
|
|
14
14
|
title: string | null;
|
|
@@ -117,8 +117,13 @@ export type ContentBlockVideo = {
|
|
|
117
117
|
};
|
|
118
118
|
export type ContentBlock = ContentBlockRichtext | ContentBlockData | ContentBlockHTML | ContentBlockQuote | ContentBlockRelatedContents | ContentBlockQuestion | ContentBlockImage | ContentBlockSlideshow | ContentBlockVideo;
|
|
119
119
|
export type ContentBlockType = 'richtext' | 'data' | 'html' | 'quote' | 'related_contents' | 'question' | 'image' | 'slideshow' | 'video';
|
|
120
|
-
export declare function getContent(f: typeof fetch): (id: string) => Promise<import("../utils/api").ApiResponse<Content>>;
|
|
121
|
-
|
|
120
|
+
export declare function getContent(f: typeof fetch): (id: string, params?: Partial<ApiParams>) => Promise<import("../utils/api").ApiResponse<Content>>;
|
|
121
|
+
interface ListContentParams extends PagingParams {
|
|
122
|
+
author_ids?: string | null;
|
|
123
|
+
category_ids?: string | null;
|
|
124
|
+
}
|
|
125
|
+
export declare function listContents(f: typeof fetch): (params?: Partial<ListContentParams>) => Promise<import("../utils/api").ApiResponse<ContentSummary[]>>;
|
|
122
126
|
export declare function parseContentSummary(data: ApiData, assocs: ApiAssocs): ContentSummary;
|
|
123
127
|
export declare function parseContent(data: ApiData, assocs: ApiAssocs): Content;
|
|
124
128
|
export declare function parseContentBlock(block: ApiData, assocs: ApiAssocs): ContentBlock | null;
|
|
129
|
+
export {};
|
|
@@ -19,8 +19,8 @@ function baseBlock(data, assocs) {
|
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
export function getContent(f) {
|
|
22
|
-
return async (id) => {
|
|
23
|
-
const opts = { parser: parseContent };
|
|
22
|
+
return async (id, params) => {
|
|
23
|
+
const opts = { parser: parseContent, queryParams: params };
|
|
24
24
|
return requestPublisher(f, `media/contents/${id}`, opts);
|
|
25
25
|
// TODO: switch to Reader API (this API is already completed and documented)
|
|
26
26
|
// return request(f, `/contents/${id}`, opts)
|
|
@@ -68,7 +68,3 @@ export declare function parseProfileAddress(data: ApiData, _assocs: ApiAssocs):
|
|
|
68
68
|
export declare function parseProfileContact(data: ApiData, _assocs: ApiAssocs): ProfileContact;
|
|
69
69
|
export declare function parseProfileDescriptionBlock(data: ApiData, assocs: ApiAssocs): ProfileDescriptionBlock;
|
|
70
70
|
export declare function parseProfileDescription(data: ApiData, assocs: ApiAssocs): ProfileDescription;
|
|
71
|
-
export declare function isEvent(profile: ProfileSummary): profile is EventSummary;
|
|
72
|
-
export declare function isOrganization(profile: ProfileSummary): profile is OrganizationSummary;
|
|
73
|
-
export declare function isPerson(profile: ProfileSummary): profile is PersonSummary;
|
|
74
|
-
export declare function isProject(profile: ProfileSummary): profile is ProjectSummary;
|
|
@@ -95,15 +95,3 @@ export function parseProfileDescription(data, assocs) {
|
|
|
95
95
|
blocks
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
|
-
export function isEvent(profile) {
|
|
99
|
-
return profile.kind === 'event';
|
|
100
|
-
}
|
|
101
|
-
export function isOrganization(profile) {
|
|
102
|
-
return profile.kind === 'organization';
|
|
103
|
-
}
|
|
104
|
-
export function isPerson(profile) {
|
|
105
|
-
return profile.kind === 'person';
|
|
106
|
-
}
|
|
107
|
-
export function isProject(profile) {
|
|
108
|
-
return profile.kind === 'project';
|
|
109
|
-
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { EventSummary } from '../endpoints/events';
|
|
2
|
+
import type { OrganizationSummary } from '../endpoints/organizations';
|
|
3
|
+
import type { PersonSummary } from '../endpoints/person';
|
|
4
|
+
import type { ProfileSummary } from '../endpoints/profiles';
|
|
5
|
+
import type { ProjectSummary } from '../endpoints/projects';
|
|
6
|
+
export declare function isEvent(profile: ProfileSummary): profile is EventSummary;
|
|
7
|
+
export declare function isOrganization(profile: ProfileSummary): profile is OrganizationSummary;
|
|
8
|
+
export declare function isPerson(profile: ProfileSummary): profile is PersonSummary;
|
|
9
|
+
export declare function isProject(profile: ProfileSummary): profile is ProjectSummary;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function isEvent(profile) {
|
|
2
|
+
return profile.kind === 'event';
|
|
3
|
+
}
|
|
4
|
+
export function isOrganization(profile) {
|
|
5
|
+
return profile.kind === 'organization';
|
|
6
|
+
}
|
|
7
|
+
export function isPerson(profile) {
|
|
8
|
+
return profile.kind === 'person';
|
|
9
|
+
}
|
|
10
|
+
export function isProject(profile) {
|
|
11
|
+
return profile.kind === 'project';
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './guards';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './guards';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omerlo/omerlo-webkit",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.41",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "vite dev",
|
|
6
6
|
"build": "vite build && npm run package",
|
|
@@ -35,6 +35,10 @@
|
|
|
35
35
|
"./reader/server": {
|
|
36
36
|
"types": "./dist/omerlo/reader/server/index.d.ts",
|
|
37
37
|
"svelte": "./dist/omerlo/reader/server/index.js"
|
|
38
|
+
},
|
|
39
|
+
"./reader/utils": {
|
|
40
|
+
"types": "./dist/omerlo/reader/utils/index.d.ts",
|
|
41
|
+
"svelte": "./dist/omerlo/reader/utils/index.js"
|
|
38
42
|
}
|
|
39
43
|
},
|
|
40
44
|
"peerDependencies": {
|
package/dist/omerlo/index.d.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
export declare const useReader: (f: typeof fetch) => {
|
|
2
|
-
notifications: {
|
|
3
|
-
listTopics: (params?: Partial<import("./reader/utils/api").PagingParams>) => Promise<import("./reader/utils/api").ApiResponse<import("./reader").TopicSummary[]>>;
|
|
4
|
-
subscribeToTopic: (params: import("./reader").SubscriptionParams) => Promise<import("./reader/utils/api").ApiResponse<unknown>>;
|
|
5
|
-
unsubscribeFromTopic: (params: import("./reader").SubscriptionParams) => Promise<import("./reader/utils/api").ApiResponse<unknown>>;
|
|
6
|
-
};
|
|
7
|
-
magazines: {
|
|
8
|
-
listReleases: (distributionId: string, params?: Partial<import("./reader/utils/api").PagingParams>) => Promise<import("./reader/utils/api").ApiResponse<import("./reader").Release[]>>;
|
|
9
|
-
getIssue: (id: string) => Promise<import("./reader/utils/api").ApiResponse<import("./reader").Issue>>;
|
|
10
|
-
getBlocks: (sectionId: string) => Promise<import("./reader/utils/api").ApiResponse<import("./reader").IssueBlock[]>>;
|
|
11
|
-
searchContents: (issueId: string, q: string) => Promise<import("./reader/utils/api").ApiResponse<import("./reader").SectionContent[]>>;
|
|
12
|
-
getSectionContents: (sectionId: string) => Promise<import("./reader/utils/api").ApiResponse<import("./reader").ContentSummary[]>>;
|
|
13
|
-
};
|
|
14
|
-
getReference: (key: string) => Promise<import("./reader/utils/api").ApiResponse<import("./reader/endpoints/integration").Reference>>;
|
|
15
|
-
listProjects: (params?: Partial<import("./reader/utils/api").PagingParams>) => Promise<import("./reader/utils/api").ApiResponse<import("./reader").ProjectSummary[]>>;
|
|
16
|
-
getProject: (id: string) => Promise<import("./reader/utils/api").ApiResponse<import("./reader").Project>>;
|
|
17
|
-
listPeople: (params?: Partial<import("./reader/utils/api").PagingParams>) => Promise<import("./reader/utils/api").ApiResponse<import("./reader").PersonSummary[]>>;
|
|
18
|
-
getPerson: (id: string) => Promise<import("./reader/utils/api").ApiResponse<import("./reader").Person>>;
|
|
19
|
-
listEvents: (params?: Partial<import("./reader/utils/api").PagingParams>) => Promise<import("./reader/utils/api").ApiResponse<import("./reader").EventSummary[]>>;
|
|
20
|
-
getEvent: (id: string) => Promise<import("./reader/utils/api").ApiResponse<import("./reader").Event>>;
|
|
21
|
-
allEventBlocks: (id: string, params?: Partial<import("./reader/utils/api").PagingParams>) => Promise<import("./reader/utils/api").ApiResponse<import("./reader").ProfileBlockKind[]>>;
|
|
22
|
-
listOrganizations: (params?: Partial<import("./reader/utils/api").PagingParams>) => Promise<import("./reader/utils/api").ApiResponse<import("./reader").OrganizationSummary[]>>;
|
|
23
|
-
getOrganization: (id: string) => Promise<import("./reader/utils/api").ApiResponse<import("./reader").Organization>>;
|
|
24
|
-
listWebpages: (params?: Partial<import("./reader/utils/api").PagingParams>) => Promise<import("./reader/utils/api").ApiResponse<import("./reader").WebpageSummary[]>>;
|
|
25
|
-
getWebpage: (slug: string) => Promise<import("./reader/utils/api").ApiResponse<import("./reader").OrgWebpage>>;
|
|
26
|
-
getMenu: (key: string) => Promise<import("./reader/utils/api").ApiResponse<import("./reader").Menu>>;
|
|
27
|
-
listMenus: (params?: Partial<import("./reader/utils/api").PagingParams>) => Promise<import("./reader/utils/api").ApiResponse<import("./reader").MenuSummary[]>>;
|
|
28
|
-
getMedia: () => Promise<import("./reader/utils/api").ApiResponse<import("./reader").Media>>;
|
|
29
|
-
getMediaSection: (id: string) => Promise<import("./reader/utils/api").ApiResponse<import("./reader").MediaSection>>;
|
|
30
|
-
getMediaBlock: (id: string) => Promise<import("./reader/utils/api").ApiResponse<import("./reader").MediaBlock>>;
|
|
31
|
-
listMediaSectionContents: (sectionId: string, params?: Partial<import("./reader/utils/api").PagingParams>) => Promise<import("./reader/utils/api").ApiResponse<import("./reader").ContentSummary[]>>;
|
|
32
|
-
getContent: (id: string) => Promise<import("./reader/utils/api").ApiResponse<import("./reader").Content>>;
|
|
33
|
-
listContents: (params?: Partial<import("./reader/utils/api").PagingParams>) => Promise<import("./reader/utils/api").ApiResponse<import("./reader").ContentSummary[]>>;
|
|
34
|
-
listCategories: (params?: Partial<import("./reader/utils/api").PagingParams>) => Promise<import("./reader/utils/api").ApiResponse<import("./reader").Category[]>>;
|
|
35
|
-
getCategory: (id: string) => Promise<import("./reader/utils/api").ApiResponse<import("./reader").Category>>;
|
|
36
|
-
listOauthProviders: (params?: Partial<import("./reader/utils/api").PagingParams>) => Promise<import("./reader/utils/api").ApiResponse<import("./reader").OauthProviderSummary[]>>;
|
|
37
|
-
getOauthUser: () => Promise<import("./reader/utils/api").ApiResponse<import("./reader").OauthUser>>;
|
|
38
|
-
registerDevice: (params: import("./reader").DeviceParams) => Promise<import("./reader/utils/api").ApiResponse<unknown>>;
|
|
39
|
-
userInfo: () => Promise<import("./reader/utils/api").ApiResponse<import("./reader").UserInfo>>;
|
|
40
|
-
userEntitlements: () => Promise<import("./reader/utils/api").ApiResponse<import("./reader").UserEntitlement[]>>;
|
|
41
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
export declare const fetchers: (f: typeof fetch) => {
|
|
2
|
-
notifications: {
|
|
3
|
-
listTopics: (params?: Partial<import("./utils/api").PagingParams>) => Promise<import("./utils/api").ApiResponse<import("./endpoints/notification").TopicSummary[]>>;
|
|
4
|
-
subscribeToTopic: (params: import("./endpoints/notification").SubscriptionParams) => Promise<import("./utils/api").ApiResponse<unknown>>;
|
|
5
|
-
unsubscribeFromTopic: (params: import("./endpoints/notification").SubscriptionParams) => Promise<import("./utils/api").ApiResponse<unknown>>;
|
|
6
|
-
};
|
|
7
|
-
magazines: {
|
|
8
|
-
listReleases: (distributionId: string, params?: Partial<import("./utils/api").PagingParams>) => Promise<import("./utils/api").ApiResponse<import("./endpoints/distributions").Release[]>>;
|
|
9
|
-
getIssue: (id: string) => Promise<import("./utils/api").ApiResponse<import("./endpoints/magazines").Issue>>;
|
|
10
|
-
getBlocks: (sectionId: string) => Promise<import("./utils/api").ApiResponse<import("./endpoints/magazines").IssueBlock[]>>;
|
|
11
|
-
searchContents: (issueId: string, q: string) => Promise<import("./utils/api").ApiResponse<import("./endpoints/magazines").SectionContent[]>>;
|
|
12
|
-
getSectionContents: (sectionId: string) => Promise<import("./utils/api").ApiResponse<import("./endpoints/contents").ContentSummary[]>>;
|
|
13
|
-
};
|
|
14
|
-
getReference: (key: string) => Promise<import("./utils/api").ApiResponse<import("./endpoints/integration").Reference>>;
|
|
15
|
-
listProjects: (params?: Partial<import("./utils/api").PagingParams>) => Promise<import("./utils/api").ApiResponse<import("./endpoints/projects").ProjectSummary[]>>;
|
|
16
|
-
getProject: (id: string) => Promise<import("./utils/api").ApiResponse<import("./endpoints/projects").Project>>;
|
|
17
|
-
listPeople: (params?: Partial<import("./utils/api").PagingParams>) => Promise<import("./utils/api").ApiResponse<import("./endpoints/person").PersonSummary[]>>;
|
|
18
|
-
getPerson: (id: string) => Promise<import("./utils/api").ApiResponse<import("./endpoints/person").Person>>;
|
|
19
|
-
listEvents: (params?: Partial<import("./utils/api").PagingParams>) => Promise<import("./utils/api").ApiResponse<import("./endpoints/events").EventSummary[]>>;
|
|
20
|
-
getEvent: (id: string) => Promise<import("./utils/api").ApiResponse<import("./endpoints/events").Event>>;
|
|
21
|
-
allEventBlocks: (id: string, params?: Partial<import("./utils/api").PagingParams>) => Promise<import("./utils/api").ApiResponse<import(".").ProfileBlockKind[]>>;
|
|
22
|
-
listOrganizations: (params?: Partial<import("./utils/api").PagingParams>) => Promise<import("./utils/api").ApiResponse<import("./endpoints/organizations").OrganizationSummary[]>>;
|
|
23
|
-
getOrganization: (id: string) => Promise<import("./utils/api").ApiResponse<import("./endpoints/organizations").Organization>>;
|
|
24
|
-
listWebpages: (params?: Partial<import("./utils/api").PagingParams>) => Promise<import("./utils/api").ApiResponse<import("./endpoints/webpage").WebpageSummary[]>>;
|
|
25
|
-
getWebpage: (slug: string) => Promise<import("./utils/api").ApiResponse<import("./endpoints/webpage").OrgWebpage>>;
|
|
26
|
-
getMenu: (key: string) => Promise<import("./utils/api").ApiResponse<import("./endpoints/menu").Menu>>;
|
|
27
|
-
listMenus: (params?: Partial<import("./utils/api").PagingParams>) => Promise<import("./utils/api").ApiResponse<import("./endpoints/menu").MenuSummary[]>>;
|
|
28
|
-
getMedia: () => Promise<import("./utils/api").ApiResponse<import("./endpoints/media").Media>>;
|
|
29
|
-
getMediaSection: (id: string) => Promise<import("./utils/api").ApiResponse<import("./endpoints/media").MediaSection>>;
|
|
30
|
-
getMediaBlock: (id: string) => Promise<import("./utils/api").ApiResponse<import("./endpoints/media").MediaBlock>>;
|
|
31
|
-
listMediaSectionContents: (sectionId: string, params?: Partial<import("./utils/api").PagingParams>) => Promise<import("./utils/api").ApiResponse<import("./endpoints/contents").ContentSummary[]>>;
|
|
32
|
-
getContent: (id: string) => Promise<import("./utils/api").ApiResponse<import("./endpoints/contents").Content>>;
|
|
33
|
-
listContents: (params?: Partial<import("./utils/api").PagingParams>) => Promise<import("./utils/api").ApiResponse<import("./endpoints/contents").ContentSummary[]>>;
|
|
34
|
-
listCategories: (params?: Partial<import("./utils/api").PagingParams>) => Promise<import("./utils/api").ApiResponse<import("./endpoints/categories").Category[]>>;
|
|
35
|
-
getCategory: (id: string) => Promise<import("./utils/api").ApiResponse<import("./endpoints/categories").Category>>;
|
|
36
|
-
listOauthProviders: (params?: Partial<import("./utils/api").PagingParams>) => Promise<import("./utils/api").ApiResponse<import("./endpoints/oauth").OauthProviderSummary[]>>;
|
|
37
|
-
getOauthUser: () => Promise<import("./utils/api").ApiResponse<import("./endpoints/oauth").OauthUser>>;
|
|
38
|
-
registerDevice: (params: import("./endpoints/device").DeviceParams) => Promise<import("./utils/api").ApiResponse<unknown>>;
|
|
39
|
-
userInfo: () => Promise<import("./utils/api").ApiResponse<import("./endpoints/accounts").UserInfo>>;
|
|
40
|
-
userEntitlements: () => Promise<import("./utils/api").ApiResponse<import("./endpoints/accounts").UserEntitlement[]>>;
|
|
41
|
-
};
|