@uptime.app/contracts 1.0.2 → 1.0.3

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 (186) hide show
  1. package/dist/cjs/hack/extracted-subject.d.ts +4 -0
  2. package/dist/cjs/hack/extracted-subject.d.ts.map +1 -0
  3. package/dist/cjs/hack/extracted-subject.js +3 -0
  4. package/dist/cjs/hack/extracted-subject.js.map +1 -0
  5. package/dist/cjs/hack/hack-events.d.ts +18 -0
  6. package/dist/cjs/hack/hack-events.d.ts.map +1 -0
  7. package/dist/cjs/hack/hack-events.js +3 -0
  8. package/dist/cjs/hack/hack-events.js.map +1 -0
  9. package/dist/cjs/hack/hack-with-voice-events.d.ts +18 -0
  10. package/dist/cjs/hack/hack-with-voice-events.d.ts.map +1 -0
  11. package/dist/cjs/hack/hack-with-voice-events.js +3 -0
  12. package/dist/cjs/hack/hack-with-voice-events.js.map +1 -0
  13. package/dist/cjs/hack/hack-with-voice.d.ts +31 -0
  14. package/dist/cjs/hack/hack-with-voice.d.ts.map +1 -0
  15. package/dist/cjs/hack/hack-with-voice.js +3 -0
  16. package/dist/cjs/hack/hack-with-voice.js.map +1 -0
  17. package/dist/cjs/hack/hack.d.ts +101 -0
  18. package/dist/cjs/hack/hack.d.ts.map +1 -0
  19. package/dist/{esm → cjs/hack}/hack.js.map +1 -1
  20. package/dist/cjs/index.d.ts +19 -1
  21. package/dist/cjs/index.d.ts.map +1 -1
  22. package/dist/cjs/index.js +19 -1
  23. package/dist/cjs/index.js.map +1 -1
  24. package/dist/cjs/localisation/live-locales.d.ts +8 -0
  25. package/dist/cjs/localisation/live-locales.d.ts.map +1 -0
  26. package/dist/cjs/localisation/live-locales.js +37 -0
  27. package/dist/cjs/localisation/live-locales.js.map +1 -0
  28. package/dist/cjs/localisation/locale-language.d.ts +2 -0
  29. package/dist/cjs/localisation/locale-language.d.ts.map +1 -0
  30. package/dist/cjs/localisation/locale-language.js +10 -0
  31. package/dist/cjs/localisation/locale-language.js.map +1 -0
  32. package/dist/cjs/localisation/supported-languages.d.ts +4 -0
  33. package/dist/cjs/localisation/supported-languages.d.ts.map +1 -0
  34. package/dist/cjs/localisation/supported-languages.js +13 -0
  35. package/dist/cjs/localisation/supported-languages.js.map +1 -0
  36. package/dist/cjs/localisation/supported-locales.d.ts +38 -0
  37. package/dist/cjs/localisation/supported-locales.d.ts.map +1 -0
  38. package/dist/cjs/localisation/supported-locales.js +45 -0
  39. package/dist/cjs/localisation/supported-locales.js.map +1 -0
  40. package/dist/cjs/pending-hack/pending-hack-events.d.ts +18 -0
  41. package/dist/cjs/pending-hack/pending-hack-events.d.ts.map +1 -0
  42. package/dist/cjs/pending-hack/pending-hack-events.js +3 -0
  43. package/dist/cjs/pending-hack/pending-hack-events.js.map +1 -0
  44. package/dist/cjs/pending-hack/pending-hack-with-voice-events.d.ts +18 -0
  45. package/dist/cjs/pending-hack/pending-hack-with-voice-events.d.ts.map +1 -0
  46. package/dist/cjs/pending-hack/pending-hack-with-voice-events.js +3 -0
  47. package/dist/cjs/pending-hack/pending-hack-with-voice-events.js.map +1 -0
  48. package/dist/cjs/pending-hack/pending-hack-with-voice.d.ts +22 -0
  49. package/dist/cjs/pending-hack/pending-hack-with-voice.d.ts.map +1 -0
  50. package/dist/cjs/pending-hack/pending-hack-with-voice.js +3 -0
  51. package/dist/cjs/pending-hack/pending-hack-with-voice.js.map +1 -0
  52. package/dist/cjs/pending-hack/pending-hack.d.ts +70 -0
  53. package/dist/cjs/pending-hack/pending-hack.d.ts.map +1 -0
  54. package/dist/cjs/pending-hack/pending-hack.js +3 -0
  55. package/dist/cjs/pending-hack/pending-hack.js.map +1 -0
  56. package/dist/cjs/segment/segment-commands.d.ts +62 -0
  57. package/dist/cjs/segment/segment-commands.d.ts.map +1 -0
  58. package/dist/cjs/segment/segment-commands.js +3 -0
  59. package/dist/cjs/segment/segment-commands.js.map +1 -0
  60. package/dist/cjs/segment/segment-with-voice.d.ts +5 -0
  61. package/dist/cjs/segment/segment-with-voice.d.ts.map +1 -0
  62. package/dist/cjs/segment/segment-with-voice.js +3 -0
  63. package/dist/cjs/segment/segment-with-voice.js.map +1 -0
  64. package/dist/cjs/segment/segment.d.ts +70 -0
  65. package/dist/cjs/segment/segment.d.ts.map +1 -0
  66. package/dist/cjs/segment/segment.js +3 -0
  67. package/dist/cjs/segment/segment.js.map +1 -0
  68. package/dist/cjs/text-to-speech/create-speech-commands.d.ts +19 -0
  69. package/dist/cjs/text-to-speech/create-speech-commands.d.ts.map +1 -0
  70. package/dist/cjs/text-to-speech/create-speech-commands.js +3 -0
  71. package/dist/cjs/text-to-speech/create-speech-commands.js.map +1 -0
  72. package/dist/cjs/text-to-speech/speech-created-events.d.ts +11 -0
  73. package/dist/cjs/text-to-speech/speech-created-events.d.ts.map +1 -0
  74. package/dist/cjs/text-to-speech/speech-created-events.js +3 -0
  75. package/dist/cjs/text-to-speech/speech-created-events.js.map +1 -0
  76. package/dist/cjs/text-to-speech/text-segment.d.ts +25 -0
  77. package/dist/cjs/text-to-speech/text-segment.d.ts.map +1 -0
  78. package/dist/cjs/text-to-speech/text-segment.js +8 -0
  79. package/dist/cjs/text-to-speech/text-segment.js.map +1 -0
  80. package/dist/esm/hack/extracted-subject.d.ts +4 -0
  81. package/dist/esm/hack/extracted-subject.d.ts.map +1 -0
  82. package/dist/esm/hack/extracted-subject.js +2 -0
  83. package/dist/esm/hack/extracted-subject.js.map +1 -0
  84. package/dist/esm/hack/hack-events.d.ts +18 -0
  85. package/dist/esm/hack/hack-events.d.ts.map +1 -0
  86. package/dist/esm/hack/hack-events.js +2 -0
  87. package/dist/esm/hack/hack-events.js.map +1 -0
  88. package/dist/esm/hack/hack-with-voice-events.d.ts +18 -0
  89. package/dist/esm/hack/hack-with-voice-events.d.ts.map +1 -0
  90. package/dist/esm/hack/hack-with-voice-events.js +2 -0
  91. package/dist/esm/hack/hack-with-voice-events.js.map +1 -0
  92. package/dist/esm/hack/hack-with-voice.d.ts +31 -0
  93. package/dist/esm/hack/hack-with-voice.d.ts.map +1 -0
  94. package/dist/esm/hack/hack-with-voice.js +2 -0
  95. package/dist/esm/hack/hack-with-voice.js.map +1 -0
  96. package/dist/esm/hack/hack.d.ts +101 -0
  97. package/dist/esm/hack/hack.d.ts.map +1 -0
  98. package/dist/{cjs → esm/hack}/hack.js.map +1 -1
  99. package/dist/esm/index.d.ts +19 -1
  100. package/dist/esm/index.d.ts.map +1 -1
  101. package/dist/esm/index.js +19 -1
  102. package/dist/esm/index.js.map +1 -1
  103. package/dist/esm/localisation/live-locales.d.ts +8 -0
  104. package/dist/esm/localisation/live-locales.d.ts.map +1 -0
  105. package/dist/esm/localisation/live-locales.js +31 -0
  106. package/dist/esm/localisation/live-locales.js.map +1 -0
  107. package/dist/esm/localisation/locale-language.d.ts +2 -0
  108. package/dist/esm/localisation/locale-language.d.ts.map +1 -0
  109. package/dist/esm/localisation/locale-language.js +6 -0
  110. package/dist/esm/localisation/locale-language.js.map +1 -0
  111. package/dist/esm/localisation/supported-languages.d.ts +4 -0
  112. package/dist/esm/localisation/supported-languages.d.ts.map +1 -0
  113. package/dist/esm/localisation/supported-languages.js +9 -0
  114. package/dist/esm/localisation/supported-languages.js.map +1 -0
  115. package/dist/esm/localisation/supported-locales.d.ts +38 -0
  116. package/dist/esm/localisation/supported-locales.d.ts.map +1 -0
  117. package/dist/esm/localisation/supported-locales.js +41 -0
  118. package/dist/esm/localisation/supported-locales.js.map +1 -0
  119. package/dist/esm/pending-hack/pending-hack-events.d.ts +18 -0
  120. package/dist/esm/pending-hack/pending-hack-events.d.ts.map +1 -0
  121. package/dist/esm/pending-hack/pending-hack-events.js +2 -0
  122. package/dist/esm/pending-hack/pending-hack-events.js.map +1 -0
  123. package/dist/esm/pending-hack/pending-hack-with-voice-events.d.ts +18 -0
  124. package/dist/esm/pending-hack/pending-hack-with-voice-events.d.ts.map +1 -0
  125. package/dist/esm/pending-hack/pending-hack-with-voice-events.js +2 -0
  126. package/dist/esm/pending-hack/pending-hack-with-voice-events.js.map +1 -0
  127. package/dist/esm/pending-hack/pending-hack-with-voice.d.ts +22 -0
  128. package/dist/esm/pending-hack/pending-hack-with-voice.d.ts.map +1 -0
  129. package/dist/esm/pending-hack/pending-hack-with-voice.js +2 -0
  130. package/dist/esm/pending-hack/pending-hack-with-voice.js.map +1 -0
  131. package/dist/esm/pending-hack/pending-hack.d.ts +70 -0
  132. package/dist/esm/pending-hack/pending-hack.d.ts.map +1 -0
  133. package/dist/esm/pending-hack/pending-hack.js +2 -0
  134. package/dist/esm/pending-hack/pending-hack.js.map +1 -0
  135. package/dist/esm/segment/segment-commands.d.ts +62 -0
  136. package/dist/esm/segment/segment-commands.d.ts.map +1 -0
  137. package/dist/esm/segment/segment-commands.js +2 -0
  138. package/dist/esm/segment/segment-commands.js.map +1 -0
  139. package/dist/esm/segment/segment-with-voice.d.ts +5 -0
  140. package/dist/esm/segment/segment-with-voice.d.ts.map +1 -0
  141. package/dist/esm/segment/segment-with-voice.js +2 -0
  142. package/dist/esm/segment/segment-with-voice.js.map +1 -0
  143. package/dist/esm/segment/segment.d.ts +70 -0
  144. package/dist/esm/segment/segment.d.ts.map +1 -0
  145. package/dist/esm/segment/segment.js +2 -0
  146. package/dist/esm/segment/segment.js.map +1 -0
  147. package/dist/esm/text-to-speech/create-speech-commands.d.ts +19 -0
  148. package/dist/esm/text-to-speech/create-speech-commands.d.ts.map +1 -0
  149. package/dist/esm/text-to-speech/create-speech-commands.js +2 -0
  150. package/dist/esm/text-to-speech/create-speech-commands.js.map +1 -0
  151. package/dist/esm/text-to-speech/speech-created-events.d.ts +11 -0
  152. package/dist/esm/text-to-speech/speech-created-events.d.ts.map +1 -0
  153. package/dist/esm/text-to-speech/speech-created-events.js +2 -0
  154. package/dist/esm/text-to-speech/speech-created-events.js.map +1 -0
  155. package/dist/esm/text-to-speech/text-segment.d.ts +25 -0
  156. package/dist/esm/text-to-speech/text-segment.d.ts.map +1 -0
  157. package/dist/esm/text-to-speech/text-segment.js +5 -0
  158. package/dist/esm/text-to-speech/text-segment.js.map +1 -0
  159. package/package.json +2 -2
  160. package/src/hack/extracted-subject.ts +5 -0
  161. package/src/hack/hack-events.ts +21 -0
  162. package/src/hack/hack-with-voice-events.ts +21 -0
  163. package/src/hack/hack-with-voice.ts +33 -0
  164. package/src/hack/hack.ts +114 -0
  165. package/src/index.ts +23 -1
  166. package/src/localisation/live-locales.ts +33 -0
  167. package/src/localisation/locale-language.ts +4 -0
  168. package/src/localisation/supported-languages.ts +11 -0
  169. package/src/localisation/supported-locales.ts +42 -0
  170. package/src/pending-hack/pending-hack-events.ts +21 -0
  171. package/src/pending-hack/pending-hack-with-voice-events.ts +21 -0
  172. package/src/pending-hack/pending-hack-with-voice.ts +25 -0
  173. package/src/pending-hack/pending-hack.ts +75 -0
  174. package/src/segment/segment-commands.ts +70 -0
  175. package/src/segment/segment-with-voice.ts +8 -0
  176. package/src/segment/segment.ts +82 -0
  177. package/src/text-to-speech/create-speech-commands.ts +20 -0
  178. package/src/text-to-speech/speech-created-events.ts +11 -0
  179. package/src/text-to-speech/text-segment.ts +29 -0
  180. package/dist/cjs/hack.d.ts +0 -8
  181. package/dist/cjs/hack.d.ts.map +0 -1
  182. package/dist/esm/hack.d.ts +0 -8
  183. package/dist/esm/hack.d.ts.map +0 -1
  184. package/src/hack.ts +0 -7
  185. /package/dist/cjs/{hack.js → hack/hack.js} +0 -0
  186. /package/dist/esm/{hack.js → hack/hack.js} +0 -0
@@ -0,0 +1,25 @@
1
+ export interface TextSegment {
2
+ parentId: string;
3
+ textSegmentId: string;
4
+ content: string;
5
+ }
6
+ export interface TextSegmentWithSpeech extends TextSegment {
7
+ speech: Speech[];
8
+ spokenContent: string;
9
+ }
10
+ export interface Speech {
11
+ voice: Voice;
12
+ url: string;
13
+ }
14
+ export interface Voice {
15
+ id: string;
16
+ language: string;
17
+ name: string;
18
+ countryCode: string;
19
+ /** use SupportedSpeechProvider */
20
+ speechProvider: string;
21
+ }
22
+ export declare enum SupportedSpeechProvider {
23
+ MicrosoftAzure = "microsoft-azure"
24
+ }
25
+ //# sourceMappingURL=text-segment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-segment.d.ts","sourceRoot":"","sources":["../../../src/text-to-speech/text-segment.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,qBAAsB,SAAQ,WAAW;IACtD,MAAM,EAAE,MAAM,EAAE,CAAC;IAEjB,aAAa,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,MAAM;IACnB,KAAK,EAAE,KAAK,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,KAAK;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,kCAAkC;IAClC,cAAc,EAAE,MAAM,CAAC;CAC1B;AAED,oBAAY,uBAAuB;IAC/B,cAAc,oBAAoB;CACrC"}
@@ -0,0 +1,5 @@
1
+ export var SupportedSpeechProvider;
2
+ (function (SupportedSpeechProvider) {
3
+ SupportedSpeechProvider["MicrosoftAzure"] = "microsoft-azure";
4
+ })(SupportedSpeechProvider || (SupportedSpeechProvider = {}));
5
+ //# sourceMappingURL=text-segment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-segment.js","sourceRoot":"","sources":["../../../src/text-to-speech/text-segment.ts"],"names":[],"mappings":"AA0BA,MAAM,CAAN,IAAY,uBAEX;AAFD,WAAY,uBAAuB;IAC/B,6DAAkC,CAAA;AACtC,CAAC,EAFW,uBAAuB,KAAvB,uBAAuB,QAElC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uptime.app/contracts",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
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": "6a25fc101adc1327b31d6ea4e24aa40d33db03a5"
16
+ "gitHead": "0250cf2a99f7c8e575521b81defbf7e6b962ae99"
17
17
  }
@@ -0,0 +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;
5
+ }
@@ -0,0 +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;
@@ -0,0 +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
+
21
+ export type HackWithVoiceChangedEvent = HackWithVoiceCreatedEvent | HackWithVoiceUpdatedEvent | HackWithVoiceDeletedEvent;
@@ -0,0 +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
+ }
@@ -0,0 +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
+ }
package/src/index.ts CHANGED
@@ -1 +1,23 @@
1
- export * from './hack';
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';
@@ -0,0 +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;
33
+ }
@@ -0,0 +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
+ }
@@ -0,0 +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;
@@ -0,0 +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;
@@ -0,0 +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
+
21
+ export type PendingHackChangedEvent = PendingHackCreatedEvent | PendingHackUpdatedEvent | PendingHackDeletedEvent;
@@ -0,0 +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
+
21
+ export type PendingHackWithVoiceChangedEvent = PendingHackWithVoiceCreatedEvent | PendingHackWithVoiceUpdatedEvent | PendingHackWithVoiceDeletedEvent;
@@ -0,0 +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
+ };
@@ -0,0 +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
+ };
@@ -0,0 +1,70 @@
1
+ import { SupportedLocale } from '../localisation/supported-locales';
2
+ import { SegmentType } from './segment';
3
+
4
+ export interface StandaloneSegmentCard {
5
+ markdown: string;
6
+ }
7
+
8
+ export interface StandaloneSegmentAction {
9
+ title: string;
10
+ cards: StandaloneSegmentCard[];
11
+ }
12
+
13
+ export interface StandaloneSegmentSection {
14
+ heading?: string;
15
+ cards: StandaloneSegmentCard[];
16
+ }
17
+
18
+ export interface CommandSegment {
19
+ type: SegmentType;
20
+ // @deprecated use hackTitle, hackType and hackContributors
21
+ source?: {
22
+ id: string;
23
+ type: string;
24
+ contributors: {
25
+ name: string;
26
+ }[];
27
+ title: string;
28
+ };
29
+ hackCoverUrl?: string;
30
+ hackId: string;
31
+ hackTitle: string;
32
+ hackType: 'book' | 'course' | 'documentary' | 'podcast' | 'original';
33
+ hackContributors: {
34
+ name: string;
35
+ }[];
36
+ locale: SupportedLocale;
37
+ }
38
+ export interface StandaloneSegment extends CommandSegment {
39
+ title?: string;
40
+ keywords?: string[];
41
+ sections: StandaloneSegmentSection[];
42
+ actions?: StandaloneSegmentAction[];
43
+ textSummary?: string;
44
+ }
45
+
46
+ export interface CompositeSegment extends CommandSegment {
47
+ subSegments: StandaloneSegment[];
48
+ }
49
+
50
+ export interface CreateSegmentCommand {
51
+ id: string;
52
+ type: 'CreateSegment';
53
+ payload: (CompositeSegment | StandaloneSegment);
54
+ }
55
+
56
+ export interface UpdateSegmentCommand {
57
+ id: string;
58
+ type: 'UpdateSegment';
59
+ payload: (CompositeSegment | StandaloneSegment) & {
60
+ segmentId: string;
61
+ };
62
+ }
63
+
64
+ export interface DeleteSegmentCommand {
65
+ id: string;
66
+ type: 'DeleteSegment';
67
+ payload: {
68
+ segmentId: string;
69
+ };
70
+ }
@@ -0,0 +1,8 @@
1
+ import { Segment } from './segment';
2
+
3
+ // a segment with audio in a single voice, because having all voices in one segment would make the entity very large
4
+ // the only difference is that it includes a voiceIdAndLanguage field, which can be used as a range key to find the segment for a specific voice
5
+ // segmentsWithVoice may point to default or non-default voices
6
+ export interface SegmentWithVoice extends Segment {
7
+ voiceIdAndLanguage: string;
8
+ }
@@ -0,0 +1,82 @@
1
+ export interface SegmentVoice {
2
+ id: string;
3
+ language: string;
4
+ name: string;
5
+ countryCode: string;
6
+ speechProvider: string;
7
+ }
8
+
9
+ export interface Segment {
10
+ id: string;
11
+ v: number;
12
+ createdAt: string;
13
+ updatedAt: string;
14
+ hackId: string;
15
+ type: SegmentType;
16
+ title: string;
17
+ sections: SegmentSection[];
18
+ keywords: string[];
19
+ actions: SegmentAction[];
20
+ speech: SegmentSpeech[];
21
+ textSummary?: string;
22
+ lastUpdatedFromPendingSegmentId?: string;
23
+ hackType: string;
24
+ /** use @uptime.app/text-to-speech-contracts */
25
+ locale: string;
26
+ }
27
+
28
+ export type SegmentType =
29
+ 'overview' | 'favourite-quote' | 'in-a-nutshell' |
30
+ 'introduction' | 'here-are-the-insights' |
31
+ 'insight-one' | 'insight-two' | 'insight-three' |
32
+ 'put-in-action' | 'conclusion' |
33
+ 'shareable-overview' | 'download-app-to-see-more';
34
+
35
+ export type CardType = 'hack-cover' | 'action';
36
+
37
+ export interface SegmentAction {
38
+ title: string;
39
+ cards: SegmentTextCard[];
40
+ }
41
+
42
+ export interface SegmentTextCard {
43
+ id: string;
44
+ markdown: string;
45
+ segmentType: SegmentType;
46
+ cardType?: CardType;
47
+ isTitle?: boolean;
48
+ speech?: TextCardSpeech[];
49
+ }
50
+
51
+ export interface SegmentSection {
52
+ heading?: string;
53
+ cards: SegmentTextCard[];
54
+ }
55
+
56
+ export interface SegmentSpeech {
57
+ voice: SegmentVoice;
58
+ withHeading: {
59
+ url: string;
60
+ lengthSeconds: number;
61
+ };
62
+ withoutHeading: {
63
+ url: string;
64
+ lengthSeconds: number;
65
+ };
66
+ }
67
+
68
+ export interface TextCardSpeech {
69
+ voiceId: string;
70
+ withHeading: {
71
+ timestamps: {
72
+ startsAt: number;
73
+ endsAt: number;
74
+ };
75
+ };
76
+ withoutHeading: {
77
+ timestamps: {
78
+ startsAt: number;
79
+ endsAt: number;
80
+ };
81
+ };
82
+ }