@sogni-ai/sogni-client 5.81.0 → 5.83.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.
Files changed (196) hide show
  1. package/AGENTS.md +3 -0
  2. package/CHANGELOG.md +15 -0
  3. package/README.md +132 -1
  4. package/dist/Account/TwoFactorRequiredError.d.ts +8 -0
  5. package/dist/Account/TwoFactorRequiredError.js +14 -0
  6. package/dist/Account/TwoFactorRequiredError.js.map +1 -0
  7. package/dist/Account/index.d.ts +43 -0
  8. package/dist/Account/index.js +97 -13
  9. package/dist/Account/index.js.map +1 -1
  10. package/dist/ApiClient/WebSocketClient/BrowserWebSocketClient/ChannelCoordinator.js +6 -5
  11. package/dist/ApiClient/WebSocketClient/BrowserWebSocketClient/ChannelCoordinator.js.map +1 -1
  12. package/dist/ApiClient/WebSocketClient/BrowserWebSocketClient/index.d.ts +11 -0
  13. package/dist/ApiClient/WebSocketClient/BrowserWebSocketClient/index.js +43 -5
  14. package/dist/ApiClient/WebSocketClient/BrowserWebSocketClient/index.js.map +1 -1
  15. package/dist/ApiClient/WebSocketClient/events.d.ts +12 -0
  16. package/dist/ApiClient/WebSocketClient/index.d.ts +13 -0
  17. package/dist/ApiClient/WebSocketClient/index.js +33 -1
  18. package/dist/ApiClient/WebSocketClient/index.js.map +1 -1
  19. package/dist/ApiClient/WebSocketClient/messages.d.ts +4 -0
  20. package/dist/ApiClient/WebSocketClient/types.d.ts +4 -0
  21. package/dist/ApiClient/index.d.ts +19 -1
  22. package/dist/ApiClient/index.js +23 -1
  23. package/dist/ApiClient/index.js.map +1 -1
  24. package/dist/Changelog/index.d.ts +28 -0
  25. package/dist/Changelog/index.js +81 -0
  26. package/dist/Changelog/index.js.map +1 -0
  27. package/dist/Changelog/types.d.ts +83 -0
  28. package/dist/Changelog/types.js +3 -0
  29. package/dist/Changelog/types.js.map +1 -0
  30. package/dist/MediaEncryption/index.d.ts +153 -0
  31. package/dist/MediaEncryption/index.js +434 -0
  32. package/dist/MediaEncryption/index.js.map +1 -0
  33. package/dist/Projects/Job.d.ts +10 -0
  34. package/dist/Projects/Job.js +22 -2
  35. package/dist/Projects/Job.js.map +1 -1
  36. package/dist/Projects/Project.d.ts +9 -0
  37. package/dist/Projects/Project.js +13 -0
  38. package/dist/Projects/Project.js.map +1 -1
  39. package/dist/Projects/index.d.ts +30 -1
  40. package/dist/Projects/index.js +214 -59
  41. package/dist/Projects/index.js.map +1 -1
  42. package/dist/Projects/recovery.js +4 -0
  43. package/dist/Projects/recovery.js.map +1 -1
  44. package/dist/Projects/types/JobProvenance.d.ts +2 -0
  45. package/dist/Projects/types/RawProject.d.ts +2 -0
  46. package/dist/Projects/types/index.d.ts +24 -0
  47. package/dist/Projects/types/index.js.map +1 -1
  48. package/dist/browser/mediaEncryptionPlayback/encryptedMediaResponse.d.ts +11 -0
  49. package/dist/browser/mediaEncryptionPlayback/encryptedMediaResponse.js +97 -0
  50. package/dist/browser/mediaEncryptionPlayback/encryptedMediaResponse.js.map +1 -0
  51. package/dist/browser/mediaEncryptionPlayback/encryptedMediaWorker.d.ts +5 -0
  52. package/dist/browser/mediaEncryptionPlayback/encryptedMediaWorker.js +109 -0
  53. package/dist/browser/mediaEncryptionPlayback/encryptedMediaWorker.js.map +1 -0
  54. package/dist/browser/mediaEncryptionPlayback/encryptedPlayback.d.ts +12 -0
  55. package/dist/browser/mediaEncryptionPlayback/encryptedPlayback.js +169 -0
  56. package/dist/browser/mediaEncryptionPlayback/encryptedPlayback.js.map +1 -0
  57. package/dist/browser/mediaEncryptionPlayback/index.d.ts +3 -0
  58. package/dist/browser/mediaEncryptionPlayback/index.js +20 -0
  59. package/dist/browser/mediaEncryptionPlayback/index.js.map +1 -0
  60. package/dist/index.d.ts +53 -4
  61. package/dist/index.js +25 -8
  62. package/dist/index.js.map +1 -1
  63. package/dist/lib/RestClient.d.ts +6 -0
  64. package/dist/lib/RestClient.js +12 -0
  65. package/dist/lib/RestClient.js.map +1 -1
  66. package/dist/lib/mediaEncryption/capability.d.ts +16 -0
  67. package/dist/lib/mediaEncryption/capability.js +12 -0
  68. package/dist/lib/mediaEncryption/capability.js.map +1 -0
  69. package/dist/lib/mediaEncryption/crypto.d.ts +36 -0
  70. package/dist/lib/mediaEncryption/crypto.js +169 -0
  71. package/dist/lib/mediaEncryption/crypto.js.map +1 -0
  72. package/dist/lib/mediaEncryption/format.d.ts +62 -0
  73. package/dist/lib/mediaEncryption/format.js +167 -0
  74. package/dist/lib/mediaEncryption/format.js.map +1 -0
  75. package/dist/lib/mediaEncryption/index.d.ts +12 -0
  76. package/dist/lib/mediaEncryption/index.js +46 -0
  77. package/dist/lib/mediaEncryption/index.js.map +1 -0
  78. package/dist/lib/mediaEncryption/inputKeys.d.ts +24 -0
  79. package/dist/lib/mediaEncryption/inputKeys.js +102 -0
  80. package/dist/lib/mediaEncryption/inputKeys.js.map +1 -0
  81. package/dist/lib/mediaEncryption/networks.d.ts +14 -0
  82. package/dist/lib/mediaEncryption/networks.js +22 -0
  83. package/dist/lib/mediaEncryption/networks.js.map +1 -0
  84. package/dist/lib/mediaEncryption/recipient.d.ts +17 -0
  85. package/dist/lib/mediaEncryption/recipient.js +106 -0
  86. package/dist/lib/mediaEncryption/recipient.js.map +1 -0
  87. package/dist/lib/mediaEncryption/redact.d.ts +5 -0
  88. package/dist/lib/mediaEncryption/redact.js +34 -0
  89. package/dist/lib/mediaEncryption/redact.js.map +1 -0
  90. package/dist/lib/mediaEncryption/remote.d.ts +18 -0
  91. package/dist/lib/mediaEncryption/remote.js +243 -0
  92. package/dist/lib/mediaEncryption/remote.js.map +1 -0
  93. package/dist/types/ErrorData.d.ts +15 -0
  94. package/dist/types/ErrorData.js +15 -1
  95. package/dist/types/ErrorData.js.map +1 -1
  96. package/dist/version.d.ts +1 -1
  97. package/dist/version.js +1 -1
  98. package/dist-esm/Account/TwoFactorRequiredError.js +11 -0
  99. package/dist-esm/Account/TwoFactorRequiredError.js.map +1 -0
  100. package/dist-esm/Account/index.js +97 -13
  101. package/dist-esm/Account/index.js.map +1 -1
  102. package/dist-esm/ApiClient/WebSocketClient/BrowserWebSocketClient/ChannelCoordinator.js +6 -5
  103. package/dist-esm/ApiClient/WebSocketClient/BrowserWebSocketClient/ChannelCoordinator.js.map +1 -1
  104. package/dist-esm/ApiClient/WebSocketClient/BrowserWebSocketClient/index.js +43 -5
  105. package/dist-esm/ApiClient/WebSocketClient/BrowserWebSocketClient/index.js.map +1 -1
  106. package/dist-esm/ApiClient/WebSocketClient/index.js +33 -1
  107. package/dist-esm/ApiClient/WebSocketClient/index.js.map +1 -1
  108. package/dist-esm/ApiClient/index.js +23 -1
  109. package/dist-esm/ApiClient/index.js.map +1 -1
  110. package/dist-esm/Changelog/index.js +76 -0
  111. package/dist-esm/Changelog/index.js.map +1 -0
  112. package/dist-esm/Changelog/types.js +2 -0
  113. package/dist-esm/Changelog/types.js.map +1 -0
  114. package/dist-esm/MediaEncryption/index.js +429 -0
  115. package/dist-esm/MediaEncryption/index.js.map +1 -0
  116. package/dist-esm/Projects/Job.js +22 -2
  117. package/dist-esm/Projects/Job.js.map +1 -1
  118. package/dist-esm/Projects/Project.js +13 -0
  119. package/dist-esm/Projects/Project.js.map +1 -1
  120. package/dist-esm/Projects/index.js +174 -19
  121. package/dist-esm/Projects/index.js.map +1 -1
  122. package/dist-esm/Projects/recovery.js +4 -0
  123. package/dist-esm/Projects/recovery.js.map +1 -1
  124. package/dist-esm/Projects/types/index.js.map +1 -1
  125. package/dist-esm/browser/mediaEncryptionPlayback/encryptedMediaResponse.js +93 -0
  126. package/dist-esm/browser/mediaEncryptionPlayback/encryptedMediaResponse.js.map +1 -0
  127. package/dist-esm/browser/mediaEncryptionPlayback/encryptedMediaWorker.js +106 -0
  128. package/dist-esm/browser/mediaEncryptionPlayback/encryptedMediaWorker.js.map +1 -0
  129. package/dist-esm/browser/mediaEncryptionPlayback/encryptedPlayback.js +166 -0
  130. package/dist-esm/browser/mediaEncryptionPlayback/encryptedPlayback.js.map +1 -0
  131. package/dist-esm/browser/mediaEncryptionPlayback/index.js +4 -0
  132. package/dist-esm/browser/mediaEncryptionPlayback/index.js.map +1 -0
  133. package/dist-esm/index.js +17 -4
  134. package/dist-esm/index.js.map +1 -1
  135. package/dist-esm/lib/RestClient.js +12 -0
  136. package/dist-esm/lib/RestClient.js.map +1 -1
  137. package/dist-esm/lib/mediaEncryption/capability.js +9 -0
  138. package/dist-esm/lib/mediaEncryption/capability.js.map +1 -0
  139. package/dist-esm/lib/mediaEncryption/crypto.js +157 -0
  140. package/dist-esm/lib/mediaEncryption/crypto.js.map +1 -0
  141. package/dist-esm/lib/mediaEncryption/format.js +157 -0
  142. package/dist-esm/lib/mediaEncryption/format.js.map +1 -0
  143. package/dist-esm/lib/mediaEncryption/index.js +17 -0
  144. package/dist-esm/lib/mediaEncryption/index.js.map +1 -0
  145. package/dist-esm/lib/mediaEncryption/inputKeys.js +94 -0
  146. package/dist-esm/lib/mediaEncryption/inputKeys.js.map +1 -0
  147. package/dist-esm/lib/mediaEncryption/networks.js +17 -0
  148. package/dist-esm/lib/mediaEncryption/networks.js.map +1 -0
  149. package/dist-esm/lib/mediaEncryption/recipient.js +100 -0
  150. package/dist-esm/lib/mediaEncryption/recipient.js.map +1 -0
  151. package/dist-esm/lib/mediaEncryption/redact.js +31 -0
  152. package/dist-esm/lib/mediaEncryption/redact.js.map +1 -0
  153. package/dist-esm/lib/mediaEncryption/remote.js +240 -0
  154. package/dist-esm/lib/mediaEncryption/remote.js.map +1 -0
  155. package/dist-esm/types/ErrorData.js +14 -0
  156. package/dist-esm/types/ErrorData.js.map +1 -1
  157. package/dist-esm/version.js +1 -1
  158. package/llms-full.txt +52 -1
  159. package/llms.txt +19 -1
  160. package/package.json +15 -4
  161. package/src/Account/TwoFactorRequiredError.ts +12 -0
  162. package/src/Account/index.ts +183 -3
  163. package/src/ApiClient/WebSocketClient/BrowserWebSocketClient/ChannelCoordinator.ts +9 -5
  164. package/src/ApiClient/WebSocketClient/BrowserWebSocketClient/index.ts +42 -4
  165. package/src/ApiClient/WebSocketClient/events.ts +12 -0
  166. package/src/ApiClient/WebSocketClient/index.ts +32 -1
  167. package/src/ApiClient/WebSocketClient/messages.ts +2 -0
  168. package/src/ApiClient/WebSocketClient/types.ts +4 -0
  169. package/src/ApiClient/index.ts +31 -1
  170. package/src/Changelog/index.ts +75 -0
  171. package/src/Changelog/types.ts +96 -0
  172. package/src/MediaEncryption/index.ts +500 -0
  173. package/src/Projects/Job.ts +23 -2
  174. package/src/Projects/Project.ts +15 -0
  175. package/src/Projects/index.ts +195 -21
  176. package/src/Projects/recovery.ts +4 -0
  177. package/src/Projects/types/JobProvenance.ts +2 -0
  178. package/src/Projects/types/RawProject.ts +2 -0
  179. package/src/Projects/types/index.ts +24 -0
  180. package/src/browser/mediaEncryptionPlayback/encryptedMediaResponse.ts +88 -0
  181. package/src/browser/mediaEncryptionPlayback/encryptedMediaWorker.ts +103 -0
  182. package/src/browser/mediaEncryptionPlayback/encryptedPlayback.ts +166 -0
  183. package/src/browser/mediaEncryptionPlayback/index.ts +3 -0
  184. package/src/index.ts +78 -3
  185. package/src/lib/RestClient.ts +13 -0
  186. package/src/lib/mediaEncryption/capability.ts +17 -0
  187. package/src/lib/mediaEncryption/crypto.ts +217 -0
  188. package/src/lib/mediaEncryption/format.ts +209 -0
  189. package/src/lib/mediaEncryption/index.ts +43 -0
  190. package/src/lib/mediaEncryption/inputKeys.ts +130 -0
  191. package/src/lib/mediaEncryption/networks.ts +31 -0
  192. package/src/lib/mediaEncryption/recipient.ts +118 -0
  193. package/src/lib/mediaEncryption/redact.ts +30 -0
  194. package/src/lib/mediaEncryption/remote.ts +259 -0
  195. package/src/types/ErrorData.ts +18 -0
  196. package/src/version.ts +1 -1
@@ -0,0 +1,28 @@
1
+ import ApiGroup from '../ApiGroup.js';
2
+ import type { ChangelogEntry, ChangelogProduct, ListChangelogOptions, ListChangelogResult } from './types.js';
3
+ /**
4
+ * The public Sogni changelog (`/v1/changelog`): what changed on Sogni for
5
+ * artists, developers and worker operators.
6
+ *
7
+ * These reads need no sign-in, so they work on a client that is not
8
+ * authenticated. Responses may be up to five minutes old; poll no more often
9
+ * than that. A refused request throws `ApiError` with the API's status and
10
+ * message.
11
+ *
12
+ * Full contract: https://docs.sogni.ai/api-reference/changelog/
13
+ */
14
+ declare class ChangelogApi extends ApiGroup {
15
+ /**
16
+ * One page of published entries, newest first. Pass the returned
17
+ * `nextCursor` as `cursor`, with the same filters, for the next page.
18
+ */
19
+ list(options?: ListChangelogOptions): Promise<ListChangelogResult>;
20
+ /**
21
+ * One published entry by its id. An id with no published entry throws
22
+ * `ApiError` with status `404` and `payload.errorCode` `204`.
23
+ */
24
+ get(id: string): Promise<ChangelogEntry>;
25
+ /** The products entries can name, in display order. */
26
+ products(): Promise<ChangelogProduct[]>;
27
+ }
28
+ export default ChangelogApi;
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const ApiGroup_js_1 = __importDefault(require("../ApiGroup.js"));
16
+ const index_js_1 = require("../ApiClient/index.js");
17
+ function joined(value) {
18
+ return Array.isArray(value) ? value.join(',') : value;
19
+ }
20
+ /**
21
+ * The public Sogni changelog (`/v1/changelog`): what changed on Sogni for
22
+ * artists, developers and worker operators.
23
+ *
24
+ * These reads need no sign-in, so they work on a client that is not
25
+ * authenticated. Responses may be up to five minutes old; poll no more often
26
+ * than that. A refused request throws `ApiError` with the API's status and
27
+ * message.
28
+ *
29
+ * Full contract: https://docs.sogni.ai/api-reference/changelog/
30
+ */
31
+ class ChangelogApi extends ApiGroup_js_1.default {
32
+ /**
33
+ * One page of published entries, newest first. Pass the returned
34
+ * `nextCursor` as `cursor`, with the same filters, for the next page.
35
+ */
36
+ list() {
37
+ return __awaiter(this, arguments, void 0, function* (options = {}) {
38
+ const res = yield this.client.rest.get('/v1/changelog', {
39
+ audience: joined(options.audience),
40
+ product: joined(options.product),
41
+ type: joined(options.type),
42
+ since: options.since,
43
+ until: options.until,
44
+ actionRequired: options.actionRequired ? 'true' : undefined,
45
+ limit: options.limit,
46
+ cursor: options.cursor
47
+ });
48
+ return res.data;
49
+ });
50
+ }
51
+ /**
52
+ * One published entry by its id. An id with no published entry throws
53
+ * `ApiError` with status `404` and `payload.errorCode` `204`.
54
+ */
55
+ get(id) {
56
+ return __awaiter(this, void 0, void 0, function* () {
57
+ var _a;
58
+ const res = yield this.client.rest.get(`/v1/changelog/${encodeURIComponent(id)}`);
59
+ const entry = (_a = res.data) === null || _a === void 0 ? void 0 : _a.entry;
60
+ if (!entry) {
61
+ // An empty id requests the list itself, and `products` or `feed.json` the
62
+ // product list or the feed; none of them is an entry.
63
+ throw new index_js_1.ApiError(404, {
64
+ status: 'error',
65
+ message: 'Changelog entry not found',
66
+ errorCode: 204
67
+ });
68
+ }
69
+ return entry;
70
+ });
71
+ }
72
+ /** The products entries can name, in display order. */
73
+ products() {
74
+ return __awaiter(this, void 0, void 0, function* () {
75
+ const res = yield this.client.rest.get('/v1/changelog/products');
76
+ return res.data.products;
77
+ });
78
+ }
79
+ }
80
+ exports.default = ChangelogApi;
81
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Changelog/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,iEAAsC;AACtC,oDAA8D;AAQ9D,SAAS,MAAM,CAAC,KAAoC;IAClD,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AACxD,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,YAAa,SAAQ,qBAAQ;IACjC;;;OAGG;IACG,IAAI;6DAAC,UAAgC,EAAE;YAC3C,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAmC,eAAe,EAAE;gBACxF,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC;gBAClC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;gBAChC,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC;gBAC1B,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,cAAc,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;gBAC3D,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,MAAM,EAAE,OAAO,CAAC,MAAM;aACvB,CAAC,CAAC;YACH,OAAO,GAAG,CAAC,IAAI,CAAC;QAClB,CAAC;KAAA;IAED;;;OAGG;IACG,GAAG,CAAC,EAAU;;;YAClB,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CACpC,iBAAiB,kBAAkB,CAAC,EAAE,CAAC,EAAE,CAC1C,CAAC;YACF,MAAM,KAAK,GAAG,MAAA,GAAG,CAAC,IAAI,0CAAE,KAAK,CAAC;YAC9B,IAAI,CAAC,KAAK,EAAE,CAAC;gBACX,0EAA0E;gBAC1E,sDAAsD;gBACtD,MAAM,IAAI,mBAAQ,CAAC,GAAG,EAAE;oBACtB,MAAM,EAAE,OAAO;oBACf,OAAO,EAAE,2BAA2B;oBACpC,SAAS,EAAE,GAAG;iBACf,CAAC,CAAC;YACL,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC;KAAA;IAED,uDAAuD;IACjD,QAAQ;;YACZ,MAAM,GAAG,GACP,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CACxB,wBAAwB,CACzB,CAAC;YACJ,OAAO,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC;QAC3B,CAAC;KAAA;CACF;AAED,kBAAe,YAAY,CAAC"}
@@ -0,0 +1,83 @@
1
+ /** Who a changelog entry is for. */
2
+ export type ChangelogAudience = 'artist' | 'developer' | 'worker';
3
+ /**
4
+ * The kind of change. Every entry has exactly one:
5
+ * - `new`: something you could not do before
6
+ * - `improved`: a change to something that already worked
7
+ * - `fixed`: a fix
8
+ * - `release`: a versioned release, such as a worker or SDK version
9
+ * - `deprecated`: still works, until `effectiveAt`
10
+ * - `removed`: no longer available
11
+ * - `notice`: anything else you should know
12
+ */
13
+ export type ChangelogEntryType = 'new' | 'improved' | 'fixed' | 'release' | 'deprecated' | 'removed' | 'notice';
14
+ /** A page related to a changelog entry. */
15
+ export interface ChangelogLink {
16
+ label: string;
17
+ url: string;
18
+ }
19
+ /** One published changelog entry. Times are ISO 8601 UTC strings. */
20
+ export interface ChangelogEntry {
21
+ /** Permanent identifier. It does not change once the entry is published. */
22
+ id: string;
23
+ /** The entry's page on sogni.ai. */
24
+ url: string;
25
+ title: string;
26
+ /** Short summary in plain text. */
27
+ summary: string;
28
+ /** The full text in Markdown. */
29
+ bodyMarkdown: string | null;
30
+ type: ChangelogEntryType;
31
+ audiences: ChangelogAudience[];
32
+ /** Product ids, as listed by `changelog.products()`. */
33
+ products: string[];
34
+ /** The product version the change shipped in. */
35
+ version: string | null;
36
+ links: ChangelogLink[];
37
+ /** `true` when you need to change something, such as for a model retirement. */
38
+ actionRequired: boolean;
39
+ /** When the change takes effect. For a deprecation or removal, the day the old behavior stops working. */
40
+ effectiveAt: string | null;
41
+ /** When the entry was published. Lists sort and filter on it. */
42
+ publishedAt: string;
43
+ /** When any public field of the entry last changed. */
44
+ updatedAt: string;
45
+ }
46
+ /** A product that changelog entries can name. */
47
+ export interface ChangelogProduct {
48
+ /** The id to use with the `product` filter. */
49
+ id: string;
50
+ /** Display name. */
51
+ label: string;
52
+ audiences: ChangelogAudience[];
53
+ }
54
+ /**
55
+ * Filters and paging for `changelog.list()`. Every field is optional. An entry
56
+ * must match every filter given; a filter given several values matches entries
57
+ * that have any of them (at most 20 values per filter).
58
+ */
59
+ export interface ListChangelogOptions {
60
+ audience?: ChangelogAudience | ChangelogAudience[];
61
+ /** Product ids from `changelog.products()`. */
62
+ product?: string | string[];
63
+ type?: ChangelogEntryType | ChangelogEntryType[];
64
+ /**
65
+ * Entries published at or after this time: an ISO 8601 date (`'2026-11-01'`,
66
+ * read as midnight UTC) or a date-time with a zone (`'2026-11-01T17:00:00Z'`).
67
+ */
68
+ since?: string;
69
+ /** Entries published before this time, in the same format as `since`. */
70
+ until?: string;
71
+ /** `true` lists only the entries you need to act on. */
72
+ actionRequired?: boolean;
73
+ /** Entries per page. The API defaults to 50 and returns at most 100. */
74
+ limit?: number;
75
+ /** The previous page's `nextCursor`. Send the same filters with it. */
76
+ cursor?: string;
77
+ }
78
+ /** One page of changelog entries, newest first. */
79
+ export interface ListChangelogResult {
80
+ entries: ChangelogEntry[];
81
+ /** Pass as `cursor` to get the next page. `null` on the last page. */
82
+ nextCursor: string | null;
83
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/Changelog/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,153 @@
1
+ import ApiGroup, { ApiConfig } from '../ApiGroup.js';
2
+ import { type DecryptedMediaReader } from '../lib/mediaEncryption/remote.js';
3
+ import { MediaSource } from '../lib/mediaEncryption/index.js';
4
+ export interface MediaEncryptionApiEvents {
5
+ /** An account key became available to this client. */
6
+ unlocked: void;
7
+ /** This client let go of the account key. Encrypted media stays encrypted. */
8
+ locked: void;
9
+ /** The server's answer to whether this account may encrypt changed. */
10
+ availabilityChanged: boolean;
11
+ }
12
+ /** `mediaEncryption` field of the `jobRequest` socket message. */
13
+ export interface MediaEncryptionWireParams {
14
+ version: number;
15
+ /** Base64 project key. */
16
+ key: string;
17
+ /** Base64 recipient record. */
18
+ recipient: string;
19
+ /** Base64 keys of the project's input files. */
20
+ inputKeys?: string[];
21
+ }
22
+ /**
23
+ * Encrypts one project's uploads.
24
+ * @internal
25
+ */
26
+ export interface ProjectMediaEncryption {
27
+ /** The job request's field. Complete only once every input has been encrypted. */
28
+ wire(): MediaEncryptionWireParams;
29
+ /** Encrypt one input. Asking again for the same media object returns the same file. */
30
+ encrypt(media: MediaSource, contentType?: string): Promise<Blob>;
31
+ }
32
+ /**
33
+ * Optional encryption of project media for the signed-in account.
34
+ *
35
+ * Create the client with `mediaEncryption: 'auto'` to encrypt every eligible
36
+ * project once media encryption is available for the account. Without it, the
37
+ * client works as before. See {@link SogniClientConfig.mediaEncryption}.
38
+ *
39
+ * @example Encrypt every eligible project, and read a result
40
+ * ```typescript
41
+ * const sogni = await SogniClient.createInstance({ appId, mediaEncryption: 'auto' });
42
+ * await sogni.account.login('username', 'password');
43
+ * const project = await sogni.projects.create(params);
44
+ * await project.waitForCompletion();
45
+ * const image = await project.jobs[0].getResultData(); // decrypted Blob
46
+ * ```
47
+ */
48
+ declare class MediaEncryptionApi extends ApiGroup<MediaEncryptionApiEvents> {
49
+ private keyring;
50
+ /** Invalidates asynchronous key work when the key is replaced or dropped. */
51
+ private keyGeneration;
52
+ private readonly mediaReaders;
53
+ /** The last `mediaEncryptionAvailable` the server sent on this connection. */
54
+ private serverAvailable;
55
+ /** The account-key request in flight, for the session that started it. */
56
+ private keyRequest;
57
+ /** No new account-key request before this time, unless the account signs in again. */
58
+ private keyRetryAt;
59
+ /** Media encryption was turned off for the account: no key is requested again this session. */
60
+ private keyTurnedOff;
61
+ constructor(config: ApiConfig);
62
+ /**
63
+ * `true` when this client was created with `mediaEncryption: 'auto'`.
64
+ * @internal
65
+ */
66
+ get automatic(): boolean;
67
+ /** An 'auto' client that tells the servers it reads encrypted media. */
68
+ private get declaresCapability();
69
+ /**
70
+ * Whether media encryption is available for this account right now. A
71
+ * client created with `mediaEncryption: 'auto'` encrypts new projects only
72
+ * while this is `true`.
73
+ */
74
+ get available(): boolean;
75
+ private setServerAvailable;
76
+ /** True when this data starts with the encrypted-media signature. Needs the first 8 bytes. */
77
+ isEncrypted(bytes: Uint8Array | ArrayBuffer): boolean;
78
+ /** Whether this client can open the signed-in account's encrypted media. */
79
+ isUnlocked(): Promise<boolean>;
80
+ /**
81
+ * Use these 32 bytes as the signed-in account's media key. A client created
82
+ * with `mediaEncryption: 'auto'` manages the key itself. The key is dropped
83
+ * when the account signs out or changes.
84
+ */
85
+ setAccountKey(secret: Uint8Array): Promise<void>;
86
+ /**
87
+ * Drop the account key from this client. With `mediaEncryption: 'auto'` it
88
+ * is obtained again the next time it is needed.
89
+ */
90
+ lock(): Promise<void>;
91
+ /**
92
+ * Decrypt media downloaded from a result, preview or input URL. Returns a
93
+ * Blob typed with the media's real MIME type. Pass `key` only for media that
94
+ * the account key cannot open.
95
+ */
96
+ decrypt(media: MediaSource, options?: {
97
+ key?: Uint8Array;
98
+ }): Promise<Blob>;
99
+ /**
100
+ * Open encrypted video/audio for seeking without downloading the whole file.
101
+ * The URL must support HTTP byte ranges and expose Content-Range to this
102
+ * origin. Close the reader when playback no longer needs it; locking or
103
+ * changing the account also closes it and aborts pending requests.
104
+ *
105
+ * Ranges use [start, end) offsets in the DECRYPTED file. Apps can serve these
106
+ * through their service worker to a normal audio/video element. Prefer
107
+ * `stream()` for long ranges; `read()` collects the requested range in memory.
108
+ */
109
+ openDecrypted(url: string, options?: {
110
+ init?: RequestInit;
111
+ }): Promise<DecryptedMediaReader>;
112
+ /**
113
+ * Download a URL and return its content decrypted. Content that is not
114
+ * encrypted is returned as downloaded, so callers can use one path for both.
115
+ * Pass `requireEncrypted` to treat unencrypted content as an error instead.
116
+ */
117
+ fetchDecrypted(url: string, options?: {
118
+ init?: RequestInit;
119
+ requireEncrypted?: boolean;
120
+ }): Promise<Blob>;
121
+ /**
122
+ * Decrypt downloaded media when it is encrypted, and return anything else as it is.
123
+ * @internal
124
+ */
125
+ _openIfEncrypted(blob: Blob, requireEncrypted?: boolean): Promise<Blob>;
126
+ /**
127
+ * For `mediaEncryption: 'auto'`: whether a project submitted now can be encrypted.
128
+ * @internal
129
+ */
130
+ _canEncryptAutomatically(): Promise<boolean>;
131
+ /**
132
+ * Start encrypting a new project.
133
+ * @internal
134
+ */
135
+ _createProjectEncryption(): Promise<ProjectMediaEncryption>;
136
+ private holdsKey;
137
+ /**
138
+ * For `mediaEncryption: 'auto'`: get the signed-in account's key once media
139
+ * encryption is available for it. Resolves `false`, and never throws, when
140
+ * there is no key to use.
141
+ */
142
+ private ensureAccountKey;
143
+ private fetchAccountKey;
144
+ private resolveProjectKey;
145
+ private requireAccountKeys;
146
+ private setKeyring;
147
+ private forgetKeys;
148
+ private beginKeyChange;
149
+ private closeMediaReaders;
150
+ private captureMediaSession;
151
+ private assertCurrentKeyChange;
152
+ }
153
+ export default MediaEncryptionApi;