@uptime.app/contracts 1.0.21-rc.0 → 1.0.21

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.
Files changed (66) hide show
  1. package/package.json +2 -2
  2. package/src/access-control/collection-access-control.ts +28 -28
  3. package/src/access-control/hack-access-control.ts +29 -29
  4. package/src/app-hack/app-full-hack.ts +9 -9
  5. package/src/app-hack/app-hack-metadata.ts +56 -56
  6. package/src/app-hack/app-restricted-hack.ts +22 -22
  7. package/src/b2b-organisation/b2b-organisation-events.ts +21 -21
  8. package/src/b2b-organisation/b2b-organisation-member-events.ts +21 -21
  9. package/src/b2b-organisation/b2b-organisation-member.ts +8 -8
  10. package/src/b2b-organisation/b2b-organisation.ts +14 -14
  11. package/src/brand/brand-events.ts +21 -21
  12. package/src/brand/brand.ts +8 -8
  13. package/src/collection/collection-events.ts +21 -21
  14. package/src/collection/collection.ts +58 -58
  15. package/src/collection/enriched-collection-events.ts +18 -18
  16. package/src/collection/enriched-collection.ts +64 -64
  17. package/src/distribution/collection-distribution.ts +17 -17
  18. package/src/distribution/distribution-events.ts +61 -61
  19. package/src/distribution/hack-distribution.ts +18 -18
  20. package/src/draft-hack/draft-hack-events.ts +21 -21
  21. package/src/draft-hack/draft-hack.ts +184 -184
  22. package/src/draft-hack-generation/draft-hack-generation-events.ts +42 -42
  23. package/src/draft-hack-generation/draft-hack-generation.ts +38 -38
  24. package/src/enriched-hack/enriched-hack-events.ts +21 -21
  25. package/src/enriched-hack/enriched-hack.ts +101 -101
  26. package/src/entitlement/user-entitlements-events.ts +20 -20
  27. package/src/entitlement/user-entitlements.ts +17 -17
  28. package/src/hack/extracted-subject.ts +31 -31
  29. package/src/hack/hack-events.ts +21 -21
  30. package/src/hack/hack-with-voice-events.ts +20 -20
  31. package/src/hack/hack-with-voice.ts +33 -33
  32. package/src/hack/hack.ts +114 -114
  33. package/src/hack-metadata/hack-metadata-events.ts +21 -21
  34. package/src/hack-metadata/hack-metadata.ts +17 -17
  35. package/src/index.ts +84 -84
  36. package/src/knowledge-source/knowledge-source-events.ts +21 -21
  37. package/src/knowledge-source/knowledge-source.ts +43 -43
  38. package/src/localisation/live-locales.ts +32 -32
  39. package/src/localisation/locale-language.ts +4 -4
  40. package/src/localisation/supported-languages.ts +11 -11
  41. package/src/localisation/supported-locales.ts +43 -43
  42. package/src/pending-hack/pending-hack-events.ts +20 -20
  43. package/src/pending-hack/pending-hack-with-voice-events.ts +20 -20
  44. package/src/pending-hack/pending-hack-with-voice.ts +25 -25
  45. package/src/pending-hack/pending-hack.ts +75 -75
  46. package/src/profile/profile-events.ts +41 -41
  47. package/src/profile/profile.ts +27 -27
  48. package/src/profile/translated-profile.ts +13 -13
  49. package/src/segment/segment-commands.ts +70 -70
  50. package/src/segment/segment-events.ts +42 -42
  51. package/src/segment/segment-with-voice.ts +8 -8
  52. package/src/segment/segment.ts +82 -82
  53. package/src/skin/skin-events.ts +21 -21
  54. package/src/skin/skin.ts +6 -6
  55. package/src/text-to-speech/create-speech-commands.ts +20 -20
  56. package/src/text-to-speech/speech-created-events.ts +10 -10
  57. package/src/text-to-speech/supported-voices.ts +101 -101
  58. package/src/text-to-speech/text-segment.ts +29 -29
  59. package/src/theme/theme-events.ts +21 -21
  60. package/src/theme/theme.ts +68 -68
  61. package/src/trending/trending-events.ts +21 -21
  62. package/src/trending/trending-hacks.ts +8 -8
  63. package/src/user-context/user-context-events.ts +21 -21
  64. package/src/user-context/user-context.ts +16 -16
  65. package/tsconfig.cjs.json +7 -7
  66. package/tsconfig.npm.json +21 -21
@@ -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,43 +1,43 @@
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
- /** Norwegian */
33
- noNO = 'no-NO'
34
- }
35
-
36
- /**
37
- * All supported locale codes. Use allLiveLocaleCodes() instead when checking for locale codes supported by the app
38
- */
39
- export function allSupportedLocaleCodes(): string[] {
40
- return Object.values(SupportedLocale);
41
- }
42
-
43
- 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
+ /** Norwegian */
33
+ noNO = 'no-NO'
34
+ }
35
+
36
+ /**
37
+ * All supported locale codes. Use allLiveLocaleCodes() instead when checking for locale codes supported by the app
38
+ */
39
+ export function allSupportedLocaleCodes(): string[] {
40
+ return Object.values(SupportedLocale);
41
+ }
42
+
43
+ export const DEFAULT_LOCALE = SupportedLocale.enUS;
@@ -1,21 +1,21 @@
1
- import { PendingHack } from './pending-hack';
2
-
3
- export interface PendingHackCreatedEvent {
4
- id: string;
5
- type: 'PendingHackCreated';
6
- payload: PendingHack;
7
- }
8
-
9
- export interface PendingHackUpdatedEvent {
10
- id: string;
11
- type: 'PendingHackUpdated';
12
- payload: PendingHack;
13
- }
14
-
15
- export interface PendingHackDeletedEvent {
16
- id: string;
17
- type: 'PendingHackDeleted';
18
- payload: PendingHack;
19
- }
20
-
1
+ import { PendingHack } from './pending-hack';
2
+
3
+ export interface PendingHackCreatedEvent {
4
+ id: string;
5
+ type: 'PendingHackCreated';
6
+ payload: PendingHack;
7
+ }
8
+
9
+ export interface PendingHackUpdatedEvent {
10
+ id: string;
11
+ type: 'PendingHackUpdated';
12
+ payload: PendingHack;
13
+ }
14
+
15
+ export interface PendingHackDeletedEvent {
16
+ id: string;
17
+ type: 'PendingHackDeleted';
18
+ payload: PendingHack;
19
+ }
20
+
21
21
  export type PendingHackChangedEvent = PendingHackCreatedEvent | PendingHackUpdatedEvent | PendingHackDeletedEvent;
@@ -1,21 +1,21 @@
1
- import { PendingHackWithVoice } from './pending-hack-with-voice';
2
-
3
- export interface PendingHackWithVoiceCreatedEvent {
4
- id: string;
5
- type: 'PendingHackWithVoiceCreated';
6
- payload: PendingHackWithVoice;
7
- }
8
-
9
- export interface PendingHackWithVoiceUpdatedEvent {
10
- id: string;
11
- type: 'PendingHackWithVoiceUpdated';
12
- payload: PendingHackWithVoice;
13
- }
14
-
15
- export interface PendingHackWithVoiceDeletedEvent {
16
- id: string;
17
- type: 'PendingHackWithVoiceDeleted';
18
- payload: PendingHackWithVoice;
19
- }
20
-
1
+ import { PendingHackWithVoice } from './pending-hack-with-voice';
2
+
3
+ export interface PendingHackWithVoiceCreatedEvent {
4
+ id: string;
5
+ type: 'PendingHackWithVoiceCreated';
6
+ payload: PendingHackWithVoice;
7
+ }
8
+
9
+ export interface PendingHackWithVoiceUpdatedEvent {
10
+ id: string;
11
+ type: 'PendingHackWithVoiceUpdated';
12
+ payload: PendingHackWithVoice;
13
+ }
14
+
15
+ export interface PendingHackWithVoiceDeletedEvent {
16
+ id: string;
17
+ type: 'PendingHackWithVoiceDeleted';
18
+ payload: PendingHackWithVoice;
19
+ }
20
+
21
21
  export type PendingHackWithVoiceChangedEvent = PendingHackWithVoiceCreatedEvent | PendingHackWithVoiceUpdatedEvent | PendingHackWithVoiceDeletedEvent;
@@ -1,25 +1,25 @@
1
- /* eslint-disable @typescript-eslint/ban-types */
2
- import { Segment } from '../segment/segment';
3
- import { CompletePendingHack, PendingHack } from './pending-hack';
4
-
5
- export interface PendingHackWithVoice {
6
- id: string;
7
- v: number;
8
- createdAt: string;
9
- updatedAt: string;
10
- voiceId: string;
11
- isDefaultVoice: boolean;
12
- hackId: string;
13
- baseLocaleHackId: string;
14
- segments: PendingHack['segments'];
15
- }
16
-
17
- export interface CompletePendingHackWithVoice extends PendingHackWithVoice {
18
- segments: CompletePendingHack['segments'];
19
- }
20
-
21
- export type CompletePendingHackWithVoiceWithPutInAction = CompletePendingHackWithVoice & {
22
- segments: {
23
- putInAction: Segment;
24
- }
25
- };
1
+ /* eslint-disable @typescript-eslint/ban-types */
2
+ import { Segment } from '../segment/segment';
3
+ import { CompletePendingHack, PendingHack } from './pending-hack';
4
+
5
+ export interface PendingHackWithVoice {
6
+ id: string;
7
+ v: number;
8
+ createdAt: string;
9
+ updatedAt: string;
10
+ voiceId: string;
11
+ isDefaultVoice: boolean;
12
+ hackId: string;
13
+ baseLocaleHackId: string;
14
+ segments: PendingHack['segments'];
15
+ }
16
+
17
+ export interface CompletePendingHackWithVoice extends PendingHackWithVoice {
18
+ segments: CompletePendingHack['segments'];
19
+ }
20
+
21
+ export type CompletePendingHackWithVoiceWithPutInAction = CompletePendingHackWithVoice & {
22
+ segments: {
23
+ putInAction: Segment;
24
+ }
25
+ };
@@ -1,75 +1,75 @@
1
- /* eslint-disable @typescript-eslint/ban-types */
2
- import { ExtractedSubject } from '../hack/extracted-subject';
3
- import { HackAffiliate, HackContributor, HackType, HackSourceData, HackTopic, HackExternalLink } from '../hack/hack';
4
- import { Segment } from '../segment/segment';
5
-
6
- export interface PendingHack {
7
- id: string;
8
- /** use @uptime.app/localisation-contracts */
9
- locale: string;
10
- baseLocaleHackId: string;
11
- v: number;
12
- createdAt: string;
13
- updatedAt: string;
14
- owner?: string;
15
- draftHackId: string;
16
- draftHackVersion: number;
17
- hackId: string;
18
- sourceId?: string;
19
- title: string;
20
- themeId: string;
21
- coverUrl?: string;
22
- affiliate?: HackAffiliate;
23
- topics: HackTopic[];
24
- contributors: HackContributor[];
25
- type: HackType;
26
- sourceData?: HackSourceData;
27
- notifications?: {
28
- aiGeneratedText?: string;
29
- humanCuratedText?: string;
30
- };
31
- segments: {
32
- favouriteQuote: Segment | {};
33
- inANutshell: Segment | {};
34
- introduction: Segment | {};
35
- insights: [
36
- (Segment | {}),
37
- (Segment | {}),
38
- (Segment | {})
39
- ];
40
- conclusion: Segment | {};
41
- // composite segments
42
- overview: Segment | {};
43
- shareableOverview: Segment | {};
44
- hereAreTheInsights: Segment | {};
45
- putInAction?: Segment | {};
46
- };
47
- externalLink?: HackExternalLink;
48
- subjects?: ExtractedSubject[];
49
- }
50
-
51
- export interface CompletePendingHack extends PendingHack {
52
- segments: {
53
- favouriteQuote: Segment;
54
- inANutshell: Segment;
55
- introduction: Segment;
56
- insights: [
57
- Segment,
58
- Segment,
59
- Segment
60
- ];
61
- conclusion: Segment;
62
- // composite segments
63
- overview: Segment;
64
- shareableOverview: Segment;
65
- hereAreTheInsights: Segment;
66
- putInAction?: Segment;
67
- };
68
- subjects: ExtractedSubject[];
69
- }
70
-
71
- export type CompletePendingHackWithPutInAction = CompletePendingHack & {
72
- segments: {
73
- putInAction: Segment;
74
- }
75
- };
1
+ /* eslint-disable @typescript-eslint/ban-types */
2
+ import { ExtractedSubject } from '../hack/extracted-subject';
3
+ import { HackAffiliate, HackContributor, HackType, HackSourceData, HackTopic, HackExternalLink } from '../hack/hack';
4
+ import { Segment } from '../segment/segment';
5
+
6
+ export interface PendingHack {
7
+ id: string;
8
+ /** use @uptime.app/localisation-contracts */
9
+ locale: string;
10
+ baseLocaleHackId: string;
11
+ v: number;
12
+ createdAt: string;
13
+ updatedAt: string;
14
+ owner?: string;
15
+ draftHackId: string;
16
+ draftHackVersion: number;
17
+ hackId: string;
18
+ sourceId?: string;
19
+ title: string;
20
+ themeId: string;
21
+ coverUrl?: string;
22
+ affiliate?: HackAffiliate;
23
+ topics: HackTopic[];
24
+ contributors: HackContributor[];
25
+ type: HackType;
26
+ sourceData?: HackSourceData;
27
+ notifications?: {
28
+ aiGeneratedText?: string;
29
+ humanCuratedText?: string;
30
+ };
31
+ segments: {
32
+ favouriteQuote: Segment | {};
33
+ inANutshell: Segment | {};
34
+ introduction: Segment | {};
35
+ insights: [
36
+ (Segment | {}),
37
+ (Segment | {}),
38
+ (Segment | {})
39
+ ];
40
+ conclusion: Segment | {};
41
+ // composite segments
42
+ overview: Segment | {};
43
+ shareableOverview: Segment | {};
44
+ hereAreTheInsights: Segment | {};
45
+ putInAction?: Segment | {};
46
+ };
47
+ externalLink?: HackExternalLink;
48
+ subjects?: ExtractedSubject[];
49
+ }
50
+
51
+ export interface CompletePendingHack extends PendingHack {
52
+ segments: {
53
+ favouriteQuote: Segment;
54
+ inANutshell: Segment;
55
+ introduction: Segment;
56
+ insights: [
57
+ Segment,
58
+ Segment,
59
+ Segment
60
+ ];
61
+ conclusion: Segment;
62
+ // composite segments
63
+ overview: Segment;
64
+ shareableOverview: Segment;
65
+ hereAreTheInsights: Segment;
66
+ putInAction?: Segment;
67
+ };
68
+ subjects: ExtractedSubject[];
69
+ }
70
+
71
+ export type CompletePendingHackWithPutInAction = CompletePendingHack & {
72
+ segments: {
73
+ putInAction: Segment;
74
+ }
75
+ };
@@ -1,41 +1,41 @@
1
- import { Profile } from './profile';
2
- import { TranslatedProfile } from './translated-profile';
3
-
4
- export interface ProfileCreatedEvent {
5
- id: string;
6
- type: 'ProfileCreated';
7
- payload: Profile;
8
- }
9
-
10
- export interface ProfileUpdatedEvent {
11
- id: string;
12
- type: 'ProfileUpdated';
13
- payload: Profile;
14
- }
15
-
16
- export interface ProfileDeletedEvent {
17
- id: string;
18
- type: 'ProfileDeleted';
19
- payload: Profile;
20
- }
21
-
22
- export interface TranslatedProfileCreatedEvent {
23
- id: string;
24
- type: 'TranslatedProfileCreated';
25
- payload: TranslatedProfile;
26
- }
27
-
28
- export interface TranslatedProfileUpdatedEvent {
29
- id: string;
30
- type: 'TranslatedProfileUpdated';
31
- payload: TranslatedProfile;
32
- }
33
-
34
- export interface TranslatedProfileDeletedEvent {
35
- id: string;
36
- type: 'TranslatedProfileDeleted';
37
- payload: TranslatedProfile;
38
- }
39
-
40
- export type ProfileChangedEvent = ProfileCreatedEvent | ProfileUpdatedEvent | ProfileDeletedEvent;
41
- export type TranslatedProfileChangedEvent = TranslatedProfileCreatedEvent | TranslatedProfileUpdatedEvent | TranslatedProfileDeletedEvent;
1
+ import { Profile } from './profile';
2
+ import { TranslatedProfile } from './translated-profile';
3
+
4
+ export interface ProfileCreatedEvent {
5
+ id: string;
6
+ type: 'ProfileCreated';
7
+ payload: Profile;
8
+ }
9
+
10
+ export interface ProfileUpdatedEvent {
11
+ id: string;
12
+ type: 'ProfileUpdated';
13
+ payload: Profile;
14
+ }
15
+
16
+ export interface ProfileDeletedEvent {
17
+ id: string;
18
+ type: 'ProfileDeleted';
19
+ payload: Profile;
20
+ }
21
+
22
+ export interface TranslatedProfileCreatedEvent {
23
+ id: string;
24
+ type: 'TranslatedProfileCreated';
25
+ payload: TranslatedProfile;
26
+ }
27
+
28
+ export interface TranslatedProfileUpdatedEvent {
29
+ id: string;
30
+ type: 'TranslatedProfileUpdated';
31
+ payload: TranslatedProfile;
32
+ }
33
+
34
+ export interface TranslatedProfileDeletedEvent {
35
+ id: string;
36
+ type: 'TranslatedProfileDeleted';
37
+ payload: TranslatedProfile;
38
+ }
39
+
40
+ export type ProfileChangedEvent = ProfileCreatedEvent | ProfileUpdatedEvent | ProfileDeletedEvent;
41
+ export type TranslatedProfileChangedEvent = TranslatedProfileCreatedEvent | TranslatedProfileUpdatedEvent | TranslatedProfileDeletedEvent;
@@ -1,27 +1,27 @@
1
- import { SupportedLocale } from '../localisation/supported-locales';
2
-
3
- export interface StoredProfile {
4
- id: string;
5
- v: number;
6
- createdAt: string;
7
- updatedAt: string;
8
- avatarUrl: string;
9
- name: string;
10
- owner: string;
11
- handle: string;
12
- _sanitisedHandle?: string; // use to determinate uniqueness for a handle, despite the case of it
13
- headerImageUrl?: string;
14
- tags?: string[];
15
- links?: ProfileLink[];
16
- tagline: string;
17
- description?: string;
18
- /** The locale (language and region) of the draft hack e.g. fr-FR. Mandatory property since 12/05/2023. */
19
- locale: SupportedLocale;
20
- }
21
-
22
- export type Profile = Omit<StoredProfile, '_sanitisedHandle'>;
23
-
24
- export interface ProfileLink {
25
- type: 'Other' | 'Twitter' | 'Facebook' | 'Youtube' | 'Medium' | 'Instagram' | 'Patreon' | 'TikTok' | 'LinkedIn' | 'LinkTree';
26
- url: string;
27
- }
1
+ import { SupportedLocale } from '../localisation/supported-locales';
2
+
3
+ export interface StoredProfile {
4
+ id: string;
5
+ v: number;
6
+ createdAt: string;
7
+ updatedAt: string;
8
+ avatarUrl: string;
9
+ name: string;
10
+ owner: string;
11
+ handle: string;
12
+ _sanitisedHandle?: string; // use to determinate uniqueness for a handle, despite the case of it
13
+ headerImageUrl?: string;
14
+ tags?: string[];
15
+ links?: ProfileLink[];
16
+ tagline: string;
17
+ description?: string;
18
+ /** The locale (language and region) of the draft hack e.g. fr-FR. Mandatory property since 12/05/2023. */
19
+ locale: SupportedLocale;
20
+ }
21
+
22
+ export type Profile = Omit<StoredProfile, '_sanitisedHandle'>;
23
+
24
+ export interface ProfileLink {
25
+ type: 'Other' | 'Twitter' | 'Facebook' | 'Youtube' | 'Medium' | 'Instagram' | 'Patreon' | 'TikTok' | 'LinkedIn' | 'LinkTree';
26
+ url: string;
27
+ }
@@ -1,13 +1,13 @@
1
- import { SupportedLocale } from '../localisation/supported-locales';
2
-
3
- export interface TranslatedProfile {
4
- id: string;
5
- v: number;
6
- createdAt: string;
7
- updatedAt: string;
8
- profileId: string;
9
- locale: SupportedLocale;
10
- tagline: string;
11
- description?: string;
12
- tags?: string[];
13
- }
1
+ import { SupportedLocale } from '../localisation/supported-locales';
2
+
3
+ export interface TranslatedProfile {
4
+ id: string;
5
+ v: number;
6
+ createdAt: string;
7
+ updatedAt: string;
8
+ profileId: string;
9
+ locale: SupportedLocale;
10
+ tagline: string;
11
+ description?: string;
12
+ tags?: string[];
13
+ }