@uptime.app/contracts 1.0.3 → 1.0.4-rc.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uptime.app/contracts",
3
- "version": "1.0.3",
3
+ "version": "1.0.4-rc.0",
4
4
  "license": "MIT",
5
5
  "types": "./dist/esm/index.d.ts",
6
6
  "main": "./dist/cjs/index.js",
@@ -13,5 +13,5 @@
13
13
  "devDependencies": {
14
14
  "typescript": "^5.4.3"
15
15
  },
16
- "gitHead": "0250cf2a99f7c8e575521b81defbf7e6b962ae99"
16
+ "gitHead": "5795a8e46d9e27099f3ac7c7a63883348eec5a01"
17
17
  }
@@ -1,5 +1,5 @@
1
-
2
- // defined in @uptime.app/subject-extraction-service but trying to avoid too many dependencies
3
- export interface ExtractedSubject {
4
- name: string;
1
+
2
+ // defined in @uptime.app/subject-extraction-service but trying to avoid too many dependencies
3
+ export interface ExtractedSubject {
4
+ name: string;
5
5
  }
@@ -1,21 +1,21 @@
1
- import { Hack } from './hack';
2
-
3
- export interface HackCreatedEvent {
4
- id: string;
5
- type: 'HackCreated';
6
- payload: Hack;
7
- }
8
-
9
- export interface HackUpdatedEvent {
10
- id: string;
11
- type: 'HackUpdated';
12
- payload: Hack;
13
- }
14
-
15
- export interface HackDeletedEvent {
16
- id: string;
17
- type: 'HackDeleted';
18
- payload: Hack;
19
- }
20
-
21
- export type HackChangedEvent = HackCreatedEvent | HackUpdatedEvent | HackDeletedEvent;
1
+ import { Hack } from './hack';
2
+
3
+ export interface HackCreatedEvent {
4
+ id: string;
5
+ type: 'HackCreated';
6
+ payload: Hack;
7
+ }
8
+
9
+ export interface HackUpdatedEvent {
10
+ id: string;
11
+ type: 'HackUpdated';
12
+ payload: Hack;
13
+ }
14
+
15
+ export interface HackDeletedEvent {
16
+ id: string;
17
+ type: 'HackDeleted';
18
+ payload: Hack;
19
+ }
20
+
21
+ export type HackChangedEvent = HackCreatedEvent | HackUpdatedEvent | HackDeletedEvent;
@@ -1,21 +1,21 @@
1
- import { HackWithVoice } from './hack-with-voice';
2
-
3
- export interface HackWithVoiceCreatedEvent {
4
- id: string;
5
- type: 'HackWithVoiceCreated';
6
- payload: HackWithVoice;
7
- }
8
-
9
- export interface HackWithVoiceUpdatedEvent {
10
- id: string;
11
- type: 'HackWithVoiceUpdated';
12
- payload: HackWithVoice;
13
- }
14
-
15
- export interface HackWithVoiceDeletedEvent {
16
- id: string;
17
- type: 'HackWithVoiceDeleted';
18
- payload: HackWithVoice;
19
- }
20
-
1
+ import { HackWithVoice } from './hack-with-voice';
2
+
3
+ export interface HackWithVoiceCreatedEvent {
4
+ id: string;
5
+ type: 'HackWithVoiceCreated';
6
+ payload: HackWithVoice;
7
+ }
8
+
9
+ export interface HackWithVoiceUpdatedEvent {
10
+ id: string;
11
+ type: 'HackWithVoiceUpdated';
12
+ payload: HackWithVoice;
13
+ }
14
+
15
+ export interface HackWithVoiceDeletedEvent {
16
+ id: string;
17
+ type: 'HackWithVoiceDeleted';
18
+ payload: HackWithVoice;
19
+ }
20
+
21
21
  export type HackWithVoiceChangedEvent = HackWithVoiceCreatedEvent | HackWithVoiceUpdatedEvent | HackWithVoiceDeletedEvent;
@@ -1,33 +1,33 @@
1
- import { Segment } from '../segment/segment';
2
-
3
- /**
4
- * HackWithVoice contains the Hack segments a a few basic Hack fields, it does not contain other Hack information.
5
- * This decision was made due to the complexity of editorialTags and updating them.
6
- */
7
- export interface HackWithVoice {
8
- /** NOT the id of the hack. Use hackId. The id cannot be the hackId as otherwise id would be duplicated for each voice which would break message replay */
9
- id: string;
10
- /** The id of the hack */
11
- hackId: string;
12
- baseLocaleHackId: string;
13
- /** The id of voice used to generate the audio */
14
- voiceId: string;
15
- /** True if this is the default voice */
16
- isDefaultVoice: boolean;
17
- v: number;
18
- createdAt: string;
19
- updatedAt: string;
20
-
21
- segments: {
22
- favouriteQuote: Segment;
23
- inANutshell: Segment;
24
- introduction: Segment;
25
- insights: Segment[];
26
- conclusion: Segment;
27
- // composite segments
28
- overview: Segment;
29
- shareableOverview: Segment;
30
- hereAreTheInsights: Segment;
31
- putInAction?: Segment;
32
- }
33
- }
1
+ import { Segment } from '../segment/segment';
2
+
3
+ /**
4
+ * HackWithVoice contains the Hack segments a a few basic Hack fields, it does not contain other Hack information.
5
+ * This decision was made due to the complexity of editorialTags and updating them.
6
+ */
7
+ export interface HackWithVoice {
8
+ /** NOT the id of the hack. Use hackId. The id cannot be the hackId as otherwise id would be duplicated for each voice which would break message replay */
9
+ id: string;
10
+ /** The id of the hack */
11
+ hackId: string;
12
+ baseLocaleHackId: string;
13
+ /** The id of voice used to generate the audio */
14
+ voiceId: string;
15
+ /** True if this is the default voice */
16
+ isDefaultVoice: boolean;
17
+ v: number;
18
+ createdAt: string;
19
+ updatedAt: string;
20
+
21
+ segments: {
22
+ favouriteQuote: Segment;
23
+ inANutshell: Segment;
24
+ introduction: Segment;
25
+ insights: Segment[];
26
+ conclusion: Segment;
27
+ // composite segments
28
+ overview: Segment;
29
+ shareableOverview: Segment;
30
+ hereAreTheInsights: Segment;
31
+ putInAction?: Segment;
32
+ }
33
+ }
package/src/hack/hack.ts CHANGED
@@ -1,114 +1,114 @@
1
- import { ExtractedSubject } from './extracted-subject';
2
- export interface Hack {
3
- /** The unique id of the hack. */
4
- id: string;
5
- /** The locale (language and region) of the hack e.g. fr-FR. Use @uptime.app/localisation-contracts Mandatory property since 12/01/2023. */
6
- locale: string;
7
- /** The id of the hack in its original locale. Mandatory property since 12/01/2023. */
8
- baseLocaleHackId: string;
9
- v: number;
10
- createdAt: string;
11
- updatedAt: string;
12
- owner: string;
13
- sourceId?: string;
14
- title: string;
15
- themeId: string;
16
-
17
- /** introduced Oct 2023 **/
18
- draftHackId: string;
19
- draftHackVersion: number;
20
-
21
- // TODO I'd remove it altogether, but it would be a breaking contract change. Thoughts?
22
- isHidden?: boolean;
23
-
24
- editorialTags?: string[];
25
- coverUrl?: string;
26
- notifications?: {
27
- aiGeneratedText?: string
28
- humanCuratedText?: string;
29
- },
30
- segments: {
31
- favouriteQuote: {
32
- id: string;
33
- /** added 04/2023 */
34
- v?: number;
35
- };
36
- inANutshell: {
37
- id: string;
38
- /** added 04/2023 */
39
- v?: number;
40
- };
41
- introduction: {
42
- id: string;
43
- /** added 04/2023 */
44
- v?: number;
45
- };
46
- insights: {
47
- id: string
48
- /** added 04/2023 */
49
- v?: number;
50
- }[];
51
- conclusion: {
52
- id: string;
53
- /** added 04/2023 */
54
- v?: number;
55
- };
56
-
57
- // composite segments
58
- overview: {
59
- id: string;
60
- /** added 04/2023 */
61
- v?: number;
62
- };
63
- shareableOverview: {
64
- id: string;
65
- /** added 04/2023 */
66
- v?: number;
67
- };
68
- hereAreTheInsights: {
69
- id: string;
70
- /** added 04/2023 */
71
- v?: number;
72
- };
73
- putInAction?: {
74
- id: string;
75
- /** added 04/2023 */
76
- v?: number;
77
- };
78
- };
79
- affiliate?: HackAffiliate;
80
- topics: HackTopic[];
81
- contributors?: HackContributor[];
82
- type: HackType;
83
- sourceData?: HackSourceData;
84
- externalLink?: HackExternalLink;
85
-
86
- /** added Mar 2024 */
87
- // TODO make it mandatory after a republish
88
- subjects?: ExtractedSubject[];
89
- }
90
-
91
- export interface HackContributor {
92
- name: string;
93
- }
94
-
95
- export interface HackTopic {
96
- name: string;
97
- }
98
-
99
- export interface HackAffiliate {
100
- url: string;
101
- name: string;
102
- }
103
-
104
- export declare type HackType = 'book' | 'course' | 'documentary' | 'podcast' | 'original';
105
-
106
- export interface HackSourceData {
107
- episodeTitle?: string;
108
- releaseDate?: string;
109
- }
110
-
111
- export interface HackExternalLink {
112
- url: string;
113
- type: 'Website' | 'Book' | 'Course' | 'Podcast' | 'Video' | 'Other';
114
- }
1
+ import { ExtractedSubject } from './extracted-subject';
2
+ export interface Hack {
3
+ /** The unique id of the hack. */
4
+ id: string;
5
+ /** The locale (language and region) of the hack e.g. fr-FR. Use @uptime.app/localisation-contracts Mandatory property since 12/01/2023. */
6
+ locale: string;
7
+ /** The id of the hack in its original locale. Mandatory property since 12/01/2023. */
8
+ baseLocaleHackId: string;
9
+ v: number;
10
+ createdAt: string;
11
+ updatedAt: string;
12
+ owner: string;
13
+ sourceId?: string;
14
+ title: string;
15
+ themeId: string;
16
+
17
+ /** introduced Oct 2023 **/
18
+ draftHackId: string;
19
+ draftHackVersion: number;
20
+
21
+ // TODO I'd remove it altogether, but it would be a breaking contract change. Thoughts?
22
+ isHidden?: boolean;
23
+
24
+ editorialTags?: string[];
25
+ coverUrl?: string;
26
+ notifications?: {
27
+ aiGeneratedText?: string
28
+ humanCuratedText?: string;
29
+ },
30
+ segments: {
31
+ favouriteQuote: {
32
+ id: string;
33
+ /** added 04/2023 */
34
+ v?: number;
35
+ };
36
+ inANutshell: {
37
+ id: string;
38
+ /** added 04/2023 */
39
+ v?: number;
40
+ };
41
+ introduction: {
42
+ id: string;
43
+ /** added 04/2023 */
44
+ v?: number;
45
+ };
46
+ insights: {
47
+ id: string
48
+ /** added 04/2023 */
49
+ v?: number;
50
+ }[];
51
+ conclusion: {
52
+ id: string;
53
+ /** added 04/2023 */
54
+ v?: number;
55
+ };
56
+
57
+ // composite segments
58
+ overview: {
59
+ id: string;
60
+ /** added 04/2023 */
61
+ v?: number;
62
+ };
63
+ shareableOverview: {
64
+ id: string;
65
+ /** added 04/2023 */
66
+ v?: number;
67
+ };
68
+ hereAreTheInsights: {
69
+ id: string;
70
+ /** added 04/2023 */
71
+ v?: number;
72
+ };
73
+ putInAction?: {
74
+ id: string;
75
+ /** added 04/2023 */
76
+ v?: number;
77
+ };
78
+ };
79
+ affiliate?: HackAffiliate;
80
+ topics: HackTopic[];
81
+ contributors?: HackContributor[];
82
+ type: HackType;
83
+ sourceData?: HackSourceData;
84
+ externalLink?: HackExternalLink;
85
+
86
+ /** added Mar 2024 */
87
+ // TODO make it mandatory after a republish
88
+ subjects?: ExtractedSubject[];
89
+ }
90
+
91
+ export interface HackContributor {
92
+ name: string;
93
+ }
94
+
95
+ export interface HackTopic {
96
+ name: string;
97
+ }
98
+
99
+ export interface HackAffiliate {
100
+ url: string;
101
+ name: string;
102
+ }
103
+
104
+ export declare type HackType = 'book' | 'course' | 'documentary' | 'podcast' | 'original';
105
+
106
+ export interface HackSourceData {
107
+ episodeTitle?: string;
108
+ releaseDate?: string;
109
+ }
110
+
111
+ export interface HackExternalLink {
112
+ url: string;
113
+ type: 'Website' | 'Book' | 'Course' | 'Podcast' | 'Video' | 'Other';
114
+ }
@@ -0,0 +1,17 @@
1
+ import { ExtractedSubject } from '../hack/extracted-subject';
2
+
3
+ export interface HackMetadata {
4
+ // hackId
5
+ id: string;
6
+ v: number;
7
+ createdAt: string;
8
+ updatedAt: string;
9
+
10
+ hackId: string;
11
+ baseLocaleHackId: string;
12
+ draftHackId: string;
13
+ subjects: {
14
+ aiGenerated?: ExtractedSubject[],
15
+ humanCurated?: ExtractedSubject[]
16
+ }
17
+ }
package/src/index.ts CHANGED
@@ -1,23 +1,23 @@
1
- export * from './hack/extracted-subject';
2
- export * from './hack/hack';
3
- export * from './hack/hack-with-voice';
4
- export * from './hack/hack-events';
5
- export * from './hack/hack-with-voice-events';
6
-
7
- export * from './localisation/live-locales';
8
- export * from './localisation/locale-language';
9
- export * from './localisation/supported-languages';
10
- export * from './localisation/supported-locales';
11
-
12
- export * from './pending-hack/pending-hack';
13
- export * from './pending-hack/pending-hack-events';
14
- export * from './pending-hack/pending-hack-with-voice';
15
- export * from './pending-hack/pending-hack-with-voice-events';
16
-
17
- export * from './segment/segment-with-voice';
18
- export * from './segment/segment-commands';
19
- export * from './segment/segment';
20
-
21
- export * from './text-to-speech/create-speech-commands';
22
- export * from './text-to-speech/speech-created-events';
23
- export * from './text-to-speech/text-segment';
1
+ export * from './hack/extracted-subject';
2
+ export * from './hack/hack';
3
+ export * from './hack/hack-with-voice';
4
+ export * from './hack/hack-events';
5
+ export * from './hack/hack-with-voice-events';
6
+
7
+ export * from './localisation/live-locales';
8
+ export * from './localisation/locale-language';
9
+ export * from './localisation/supported-languages';
10
+ export * from './localisation/supported-locales';
11
+
12
+ export * from './pending-hack/pending-hack';
13
+ export * from './pending-hack/pending-hack-events';
14
+ export * from './pending-hack/pending-hack-with-voice';
15
+ export * from './pending-hack/pending-hack-with-voice-events';
16
+
17
+ export * from './segment/segment-with-voice';
18
+ export * from './segment/segment-commands';
19
+ export * from './segment/segment';
20
+
21
+ export * from './text-to-speech/create-speech-commands';
22
+ export * from './text-to-speech/speech-created-events';
23
+ export * from './text-to-speech/text-segment';
@@ -1,33 +1,33 @@
1
- import { DEFAULT_LOCALE, SupportedLocale } from './supported-locales';
2
-
3
- /**
4
- * All locale codes that are live and in use in the app
5
- */
6
- export function allLiveLocaleCodes(): SupportedLocale[] {
7
- return [
8
- SupportedLocale.enGB,
9
- SupportedLocale.enUS,
10
- SupportedLocale.ptBR,
11
- SupportedLocale.es,
12
- SupportedLocale.frFR,
13
- SupportedLocale.itIT,
14
- SupportedLocale.nlNL,
15
- SupportedLocale.deDE,
16
- SupportedLocale.frCA,
17
- SupportedLocale.plPL,
18
- SupportedLocale.svSE,
19
- SupportedLocale.trTR
20
- ];
21
- }
22
-
23
- export function localeCodeIsLive(localeCode: string) {
24
- return allLiveLocaleCodes().includes(localeCode as SupportedLocale);
25
- }
26
-
27
- export function liveLocaleFrom(localeCode?: string): SupportedLocale {
28
- const locale = allLiveLocaleCodes().find(liveLocale => liveLocale == localeCode);
29
- if (!locale) {
30
- return DEFAULT_LOCALE;
31
- }
32
- return locale;
1
+ import { DEFAULT_LOCALE, SupportedLocale } from './supported-locales';
2
+
3
+ /**
4
+ * All locale codes that are live and in use in the app
5
+ */
6
+ export function allLiveLocaleCodes(): SupportedLocale[] {
7
+ return [
8
+ SupportedLocale.enGB,
9
+ SupportedLocale.enUS,
10
+ SupportedLocale.ptBR,
11
+ SupportedLocale.es,
12
+ SupportedLocale.frFR,
13
+ SupportedLocale.itIT,
14
+ SupportedLocale.nlNL,
15
+ SupportedLocale.deDE,
16
+ SupportedLocale.frCA,
17
+ SupportedLocale.plPL,
18
+ SupportedLocale.svSE,
19
+ SupportedLocale.trTR
20
+ ];
21
+ }
22
+
23
+ export function localeCodeIsLive(localeCode: string) {
24
+ return allLiveLocaleCodes().includes(localeCode as SupportedLocale);
25
+ }
26
+
27
+ export function liveLocaleFrom(localeCode?: string): SupportedLocale {
28
+ const locale = allLiveLocaleCodes().find(liveLocale => liveLocale == localeCode);
29
+ if (!locale) {
30
+ return DEFAULT_LOCALE;
31
+ }
32
+ return locale;
33
33
  }
@@ -1,4 +1,4 @@
1
- export function languageOf(locale: string): string {
2
- if (!locale) return ''; // temp: defend against an undefined locale
3
- return locale.split('-')[0];
4
- }
1
+ export function languageOf(locale: string): string {
2
+ if (!locale) return ''; // temp: defend against an undefined locale
3
+ return locale.split('-')[0];
4
+ }
@@ -1,11 +1,11 @@
1
- import { allSupportedLocaleCodes } from './supported-locales';
2
-
3
- export function allSupportedLanguageCodes(): string[] {
4
- const languageCodes = allSupportedLocaleCodes().map(locale => locale.split('-')[0]);
5
- const uniqueLanguageCodes = [...new Set(languageCodes)];
6
-
7
- return uniqueLanguageCodes;
8
- }
9
-
10
- export const ENGLISH_LANGUAGE = 'en';
11
- export const DEFAULT_LANGUAGE = ENGLISH_LANGUAGE;
1
+ import { allSupportedLocaleCodes } from './supported-locales';
2
+
3
+ export function allSupportedLanguageCodes(): string[] {
4
+ const languageCodes = allSupportedLocaleCodes().map(locale => locale.split('-')[0]);
5
+ const uniqueLanguageCodes = [...new Set(languageCodes)];
6
+
7
+ return uniqueLanguageCodes;
8
+ }
9
+
10
+ export const ENGLISH_LANGUAGE = 'en';
11
+ export const DEFAULT_LANGUAGE = ENGLISH_LANGUAGE;
@@ -1,42 +1,42 @@
1
- export enum SupportedLocale {
2
- /** English (United Kingdom) */
3
- enGB = 'en-GB',
4
- /** English (United States) */
5
- enUS = 'en-US',
6
- /** Portuguese (Brazil) */
7
- ptBR = 'pt-BR',
8
- /** Spanish (International) */
9
- es = 'es',
10
- /** French (France) */
11
- frFR = 'fr-FR',
12
- /** Italian */
13
- itIT = 'it-IT',
14
- /** Dutch */
15
- nlNL = 'nl-NL',
16
- /** German */
17
- deDE = 'de-DE',
18
- /** Polish */
19
- plPL = 'pl-PL',
20
- /** Swedish */
21
- svSE = 'sv-SE',
22
- /** Turkish */
23
- trTR = 'tr-TR',
24
- /** Canadian French */
25
- frCA = 'fr-CA',
26
- /** Traditional Chinese */
27
- zhTW = 'zh-TW',
28
- /** Simplified Chinese */
29
- zhCN = 'zh-CN',
30
- /** Malaysian Malay */
31
- msMY = 'ms-MY'
32
-
33
- }
34
-
35
- /**
36
- * All supported locale codes. Use allLiveLocaleCodes() instead when checking for locale codes supported by the app
37
- */
38
- export function allSupportedLocaleCodes(): string[] {
39
- return Object.values(SupportedLocale);
40
- }
41
-
42
- export const DEFAULT_LOCALE = SupportedLocale.enUS;
1
+ export enum SupportedLocale {
2
+ /** English (United Kingdom) */
3
+ enGB = 'en-GB',
4
+ /** English (United States) */
5
+ enUS = 'en-US',
6
+ /** Portuguese (Brazil) */
7
+ ptBR = 'pt-BR',
8
+ /** Spanish (International) */
9
+ es = 'es',
10
+ /** French (France) */
11
+ frFR = 'fr-FR',
12
+ /** Italian */
13
+ itIT = 'it-IT',
14
+ /** Dutch */
15
+ nlNL = 'nl-NL',
16
+ /** German */
17
+ deDE = 'de-DE',
18
+ /** Polish */
19
+ plPL = 'pl-PL',
20
+ /** Swedish */
21
+ svSE = 'sv-SE',
22
+ /** Turkish */
23
+ trTR = 'tr-TR',
24
+ /** Canadian French */
25
+ frCA = 'fr-CA',
26
+ /** Traditional Chinese */
27
+ zhTW = 'zh-TW',
28
+ /** Simplified Chinese */
29
+ zhCN = 'zh-CN',
30
+ /** Malaysian Malay */
31
+ msMY = 'ms-MY'
32
+
33
+ }
34
+
35
+ /**
36
+ * All supported locale codes. Use allLiveLocaleCodes() instead when checking for locale codes supported by the app
37
+ */
38
+ export function allSupportedLocaleCodes(): string[] {
39
+ return Object.values(SupportedLocale);
40
+ }
41
+
42
+ export const DEFAULT_LOCALE = SupportedLocale.enUS;