scribase 0.1.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 (162) hide show
  1. package/README.md +220 -0
  2. package/dist/cli/credentials.d.ts +35 -0
  3. package/dist/cli/credentials.d.ts.map +1 -0
  4. package/dist/cli/credentials.js +125 -0
  5. package/dist/cli/credentials.js.map +1 -0
  6. package/dist/cli/envfile.d.ts +20 -0
  7. package/dist/cli/envfile.d.ts.map +1 -0
  8. package/dist/cli/envfile.js +86 -0
  9. package/dist/cli/envfile.js.map +1 -0
  10. package/dist/cli/framework.d.ts +45 -0
  11. package/dist/cli/framework.d.ts.map +1 -0
  12. package/dist/cli/framework.js +107 -0
  13. package/dist/cli/framework.js.map +1 -0
  14. package/dist/cli/index.d.ts +8 -0
  15. package/dist/cli/index.d.ts.map +1 -0
  16. package/dist/cli/index.js +239 -0
  17. package/dist/cli/index.js.map +1 -0
  18. package/dist/cli/init.d.ts +118 -0
  19. package/dist/cli/init.d.ts.map +1 -0
  20. package/dist/cli/init.js +455 -0
  21. package/dist/cli/init.js.map +1 -0
  22. package/dist/cli/login.d.ts +104 -0
  23. package/dist/cli/login.d.ts.map +1 -0
  24. package/dist/cli/login.js +306 -0
  25. package/dist/cli/login.js.map +1 -0
  26. package/dist/cli/pow.d.ts +9 -0
  27. package/dist/cli/pow.d.ts.map +1 -0
  28. package/dist/cli/pow.js +31 -0
  29. package/dist/cli/pow.js.map +1 -0
  30. package/dist/cli/vercel.d.ts +92 -0
  31. package/dist/cli/vercel.d.ts.map +1 -0
  32. package/dist/cli/vercel.js +230 -0
  33. package/dist/cli/vercel.js.map +1 -0
  34. package/dist/client.d.ts +137 -0
  35. package/dist/client.d.ts.map +1 -0
  36. package/dist/client.js +311 -0
  37. package/dist/client.js.map +1 -0
  38. package/dist/errors.d.ts +79 -0
  39. package/dist/errors.d.ts.map +1 -0
  40. package/dist/errors.js +139 -0
  41. package/dist/errors.js.map +1 -0
  42. package/dist/evidence.d.ts +78 -0
  43. package/dist/evidence.d.ts.map +1 -0
  44. package/dist/evidence.js +36 -0
  45. package/dist/evidence.js.map +1 -0
  46. package/dist/idempotency.d.ts +24 -0
  47. package/dist/idempotency.d.ts.map +1 -0
  48. package/dist/idempotency.js +59 -0
  49. package/dist/idempotency.js.map +1 -0
  50. package/dist/importers/firebase.d.ts +101 -0
  51. package/dist/importers/firebase.d.ts.map +1 -0
  52. package/dist/importers/firebase.js +251 -0
  53. package/dist/importers/firebase.js.map +1 -0
  54. package/dist/importers/index.d.ts +11 -0
  55. package/dist/importers/index.d.ts.map +1 -0
  56. package/dist/importers/index.js +9 -0
  57. package/dist/importers/index.js.map +1 -0
  58. package/dist/importers/instantdb.d.ts +76 -0
  59. package/dist/importers/instantdb.d.ts.map +1 -0
  60. package/dist/importers/instantdb.js +152 -0
  61. package/dist/importers/instantdb.js.map +1 -0
  62. package/dist/index.d.ts +78 -0
  63. package/dist/index.d.ts.map +1 -0
  64. package/dist/index.js +53 -0
  65. package/dist/index.js.map +1 -0
  66. package/dist/pagination.d.ts +33 -0
  67. package/dist/pagination.d.ts.map +1 -0
  68. package/dist/pagination.js +68 -0
  69. package/dist/pagination.js.map +1 -0
  70. package/dist/resources/account.d.ts +156 -0
  71. package/dist/resources/account.d.ts.map +1 -0
  72. package/dist/resources/account.js +114 -0
  73. package/dist/resources/account.js.map +1 -0
  74. package/dist/resources/audit.d.ts +26 -0
  75. package/dist/resources/audit.d.ts.map +1 -0
  76. package/dist/resources/audit.js +43 -0
  77. package/dist/resources/audit.js.map +1 -0
  78. package/dist/resources/auth.d.ts +149 -0
  79. package/dist/resources/auth.d.ts.map +1 -0
  80. package/dist/resources/auth.js +70 -0
  81. package/dist/resources/auth.js.map +1 -0
  82. package/dist/resources/backups.d.ts +117 -0
  83. package/dist/resources/backups.d.ts.map +1 -0
  84. package/dist/resources/backups.js +92 -0
  85. package/dist/resources/backups.js.map +1 -0
  86. package/dist/resources/branches.d.ts +151 -0
  87. package/dist/resources/branches.d.ts.map +1 -0
  88. package/dist/resources/branches.js +62 -0
  89. package/dist/resources/branches.js.map +1 -0
  90. package/dist/resources/database.d.ts +107 -0
  91. package/dist/resources/database.d.ts.map +1 -0
  92. package/dist/resources/database.js +54 -0
  93. package/dist/resources/database.js.map +1 -0
  94. package/dist/resources/environments.d.ts +106 -0
  95. package/dist/resources/environments.d.ts.map +1 -0
  96. package/dist/resources/environments.js +131 -0
  97. package/dist/resources/environments.js.map +1 -0
  98. package/dist/resources/export.d.ts +101 -0
  99. package/dist/resources/export.d.ts.map +1 -0
  100. package/dist/resources/export.js +89 -0
  101. package/dist/resources/export.js.map +1 -0
  102. package/dist/resources/functions.d.ts +75 -0
  103. package/dist/resources/functions.d.ts.map +1 -0
  104. package/dist/resources/functions.js +58 -0
  105. package/dist/resources/functions.js.map +1 -0
  106. package/dist/resources/imports.d.ts +183 -0
  107. package/dist/resources/imports.d.ts.map +1 -0
  108. package/dist/resources/imports.js +168 -0
  109. package/dist/resources/imports.js.map +1 -0
  110. package/dist/resources/insights.d.ts +50 -0
  111. package/dist/resources/insights.d.ts.map +1 -0
  112. package/dist/resources/insights.js +21 -0
  113. package/dist/resources/insights.js.map +1 -0
  114. package/dist/resources/metrics.d.ts +61 -0
  115. package/dist/resources/metrics.d.ts.map +1 -0
  116. package/dist/resources/metrics.js +23 -0
  117. package/dist/resources/metrics.js.map +1 -0
  118. package/dist/resources/migrations.d.ts +24 -0
  119. package/dist/resources/migrations.d.ts.map +1 -0
  120. package/dist/resources/migrations.js +29 -0
  121. package/dist/resources/migrations.js.map +1 -0
  122. package/dist/resources/operations.d.ts +37 -0
  123. package/dist/resources/operations.d.ts.map +1 -0
  124. package/dist/resources/operations.js +81 -0
  125. package/dist/resources/operations.js.map +1 -0
  126. package/dist/resources/organizations.d.ts +171 -0
  127. package/dist/resources/organizations.d.ts.map +1 -0
  128. package/dist/resources/organizations.js +180 -0
  129. package/dist/resources/organizations.js.map +1 -0
  130. package/dist/resources/previews.d.ts +49 -0
  131. package/dist/resources/previews.d.ts.map +1 -0
  132. package/dist/resources/previews.js +62 -0
  133. package/dist/resources/previews.js.map +1 -0
  134. package/dist/resources/projects.d.ts +73 -0
  135. package/dist/resources/projects.d.ts.map +1 -0
  136. package/dist/resources/projects.js +84 -0
  137. package/dist/resources/projects.js.map +1 -0
  138. package/dist/resources/queues.d.ts +100 -0
  139. package/dist/resources/queues.d.ts.map +1 -0
  140. package/dist/resources/queues.js +77 -0
  141. package/dist/resources/queues.js.map +1 -0
  142. package/dist/resources/realtime.d.ts +37 -0
  143. package/dist/resources/realtime.d.ts.map +1 -0
  144. package/dist/resources/realtime.js +23 -0
  145. package/dist/resources/realtime.js.map +1 -0
  146. package/dist/resources/restores.d.ts +67 -0
  147. package/dist/resources/restores.d.ts.map +1 -0
  148. package/dist/resources/restores.js +90 -0
  149. package/dist/resources/restores.js.map +1 -0
  150. package/dist/resources/storage.d.ts +50 -0
  151. package/dist/resources/storage.d.ts.map +1 -0
  152. package/dist/resources/storage.js +38 -0
  153. package/dist/resources/storage.js.map +1 -0
  154. package/dist/resources/usage.d.ts +85 -0
  155. package/dist/resources/usage.d.ts.map +1 -0
  156. package/dist/resources/usage.js +37 -0
  157. package/dist/resources/usage.js.map +1 -0
  158. package/dist/types.gen.d.ts +473 -0
  159. package/dist/types.gen.d.ts.map +1 -0
  160. package/dist/types.gen.js +8 -0
  161. package/dist/types.gen.js.map +1 -0
  162. package/package.json +53 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projects.js","sourceRoot":"","sources":["../../src/resources/projects.ts"],"names":[],"mappings":"AAoDA;;;;GAIG;AACH,MAAM,OAAO,gBAAgB;IAClB,KAAK,CAAgB;IAE9B,YAAY,IAAmB;QAC7B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED,4EAA4E;IAC5E,KAAK,CAAC,GAAG,CACP,cAAkC,EAClC,SAA6B,EAC7B,IAAuB;QAEvB,MAAM,MAAM,GAAG,MAA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G,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAgB;YAClD,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,qBAAqB,kBAAkB,CAC3C,cAAc,CACf,aAAa,kBAAkB,CAAC,SAAS,CAAC,SAAS;SACrD,CAAC,CAAC;QACH,OAAO,MAAM,CAAC,IAAI,CAAC;IACrB,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,SAAS,CACb,cAAkC,EAClC,SAA6B,EAC7B,SAAyB;QAEzB,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAC1C,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzB,MAAM,IAAI,UAAU,CAAC,yCAAyC,CAAC,CAAC;QAClE,CAAC;QACD,KAAK,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,OAAO,EAAE,CAAC;YACpC,IAAI,GAAG,KAAK,IAAI,IAAI,CAAC,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC;gBAClF,MAAM,IAAI,UAAU,CAAC,GAAG,MAAM,wCAAwC,CAAC,CAAC;YAC1E,CAAC;QACH,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAgB;YAClD,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,qBAAqB,kBAAkB,CAC3C,cAAc,CACf,aAAa,kBAAkB,CAAC,SAAS,CAAC,SAAS;YACpD,IAAI,EAAE,EAAE,SAAS,EAAE;SACpB,CAAC,CAAC;QACH,OAAO,MAAM,CAAC,IAAI,CAAC;IACrB,CAAC;CACF"}
@@ -0,0 +1,100 @@
1
+ import type { HttpTransport } from '../client.js';
2
+ import type { EnvironmentRef } from './environments.js';
3
+ /** Result of {@link QueuesResource.create}. */
4
+ export interface QueueCreated {
5
+ /** True once the queue is present (creation is idempotent). */
6
+ created: boolean;
7
+ }
8
+ /** Result of {@link QueuesResource.send}. */
9
+ export interface SentMessage {
10
+ /** The queue-assigned message identifier. */
11
+ msg_id: number;
12
+ }
13
+ /** A leased message returned by {@link QueuesResource.read}. */
14
+ export interface QueueMessage {
15
+ /** The queue-assigned identifier. */
16
+ msg_id: number;
17
+ /** How many times the message has been read (delivery attempts). */
18
+ read_ct: number;
19
+ /** When the message was first enqueued, in Unix seconds. */
20
+ enqueued_at: number;
21
+ /** The current visibility deadline, in Unix seconds. */
22
+ vt: number;
23
+ /** The opaque message payload. */
24
+ message: unknown;
25
+ }
26
+ /** Result of {@link QueuesResource.read}: the leased batch, possibly empty. */
27
+ export interface ReadMessages {
28
+ messages: QueueMessage[];
29
+ }
30
+ /** Result of {@link QueuesResource.archive}. */
31
+ export interface ArchivedMessage {
32
+ /** True when the message existed and was archived. */
33
+ archived: boolean;
34
+ }
35
+ /** Result of {@link QueuesResource.delete}. */
36
+ export interface DeletedMessage {
37
+ /** True when the message existed and was deleted. */
38
+ deleted: boolean;
39
+ }
40
+ /** Result of {@link QueuesResource.purge}. */
41
+ export interface PurgedQueue {
42
+ /** The number of messages removed. */
43
+ purged: number;
44
+ }
45
+ /** Options for {@link QueuesResource.send}. */
46
+ export interface SendOptions {
47
+ /** Delay before the message becomes visible, in seconds. */
48
+ delaySeconds?: number;
49
+ }
50
+ /** Options for {@link QueuesResource.read}. */
51
+ export interface ReadOptions {
52
+ /** How long each leased message stays invisible, in seconds (default 30). */
53
+ visibilityTimeoutSeconds?: number;
54
+ /** How many messages to lease (default 1). */
55
+ quantity?: number;
56
+ }
57
+ /** One queue and its current depth, from {@link QueuesResource.list}. */
58
+ export interface QueueSummary {
59
+ queue_name: string;
60
+ /** Messages currently on the queue. */
61
+ length: number;
62
+ /** Present when the queue is non-empty. */
63
+ oldest_msg_id?: number;
64
+ newest_msg_id?: number;
65
+ }
66
+ /** Options for {@link QueuesResource.peek}. */
67
+ export interface PeekOptions {
68
+ limit?: number;
69
+ offset?: number;
70
+ }
71
+ /**
72
+ * Queues — pgmq message queues under an environment. Every verb is a single
73
+ * `POST …/queues/{queue}` whose body carries the action; the queue name is the
74
+ * only value in the path. Message bodies are opaque JSON, sent as-is and
75
+ * returned verbatim.
76
+ */
77
+ export declare class QueuesResource {
78
+ #private;
79
+ constructor(http: HttpTransport);
80
+ /** `GET …/environments/{env}/queues` — every queue with its depth. Read-only. */
81
+ list(ref: EnvironmentRef): Promise<QueueSummary[]>;
82
+ /**
83
+ * `GET …/queues/{queue}/messages` — look at messages without leasing them
84
+ * (visibility and read count are unchanged).
85
+ */
86
+ peek(ref: EnvironmentRef, queue: string, options?: PeekOptions): Promise<QueueMessage[]>;
87
+ /** `POST …/queues/{queue}` `create` — create the queue if it does not exist. */
88
+ create(ref: EnvironmentRef, queue: string): Promise<QueueCreated>;
89
+ /** `POST …/queues/{queue}` `send` — enqueue one message. */
90
+ send(ref: EnvironmentRef, queue: string, message: unknown, options?: SendOptions): Promise<SentMessage>;
91
+ /** `POST …/queues/{queue}` `read` — lease up to `quantity` visible messages. */
92
+ read(ref: EnvironmentRef, queue: string, options?: ReadOptions): Promise<QueueMessage[]>;
93
+ /** `POST …/queues/{queue}` `archive` — move one message to the archive table. */
94
+ archive(ref: EnvironmentRef, queue: string, msgId: number): Promise<ArchivedMessage>;
95
+ /** `POST …/queues/{queue}` `delete` — delete one message outright. */
96
+ delete(ref: EnvironmentRef, queue: string, msgId: number): Promise<DeletedMessage>;
97
+ /** `POST …/queues/{queue}` `purge` — delete every message on the queue. */
98
+ purge(ref: EnvironmentRef, queue: string): Promise<PurgedQueue>;
99
+ }
100
+ //# sourceMappingURL=queues.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queues.d.ts","sourceRoot":"","sources":["../../src/resources/queues.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,KAAK,EAAE,cAAc,EAAE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CAYtE"}
@@ -0,0 +1,77 @@
1
+ import { environmentPath } from './environments.js';
2
+ /**
3
+ * Queues — pgmq message queues under an environment. Every verb is a single
4
+ * `POST …/queues/{queue}` whose body carries the action; the queue name is the
5
+ * only value in the path. Message bodies are opaque JSON, sent as-is and
6
+ * returned verbatim.
7
+ */
8
+ export class QueuesResource {
9
+ #http;
10
+ constructor(http) {
11
+ this.#http = http;
12
+ }
13
+ /** `GET …/environments/{env}/queues` — every queue with its depth. Read-only. */
14
+ async list(ref) {
15
+ const result = await this.#http.send({
16
+ method: 'GET',
17
+ path: `${environmentPath(ref)}/queues`,
18
+ });
19
+ return result.data.queues;
20
+ }
21
+ /**
22
+ * `GET …/queues/{queue}/messages` — look at messages without leasing them
23
+ * (visibility and read count are unchanged).
24
+ */
25
+ async peek(ref, queue, options) {
26
+ const result = await this.#http.send({
27
+ method: 'GET',
28
+ path: `${environmentPath(ref)}/queues/${encodeURIComponent(queue)}/messages`,
29
+ query: { limit: options?.limit, offset: options?.offset },
30
+ });
31
+ return result.data.messages;
32
+ }
33
+ /** `POST …/queues/{queue}` `create` — create the queue if it does not exist. */
34
+ async create(ref, queue) {
35
+ return this.#post(ref, queue, { action: 'create' });
36
+ }
37
+ /** `POST …/queues/{queue}` `send` — enqueue one message. */
38
+ async send(ref, queue, message, options) {
39
+ return this.#post(ref, queue, {
40
+ action: 'send',
41
+ message,
42
+ ...(options?.delaySeconds !== undefined ? { delay_seconds: options.delaySeconds } : {}),
43
+ });
44
+ }
45
+ /** `POST …/queues/{queue}` `read` — lease up to `quantity` visible messages. */
46
+ async read(ref, queue, options) {
47
+ const result = await this.#post(ref, queue, {
48
+ action: 'read',
49
+ ...(options?.visibilityTimeoutSeconds !== undefined
50
+ ? { visibility_timeout_seconds: options.visibilityTimeoutSeconds }
51
+ : {}),
52
+ ...(options?.quantity !== undefined ? { quantity: options.quantity } : {}),
53
+ });
54
+ return result.messages;
55
+ }
56
+ /** `POST …/queues/{queue}` `archive` — move one message to the archive table. */
57
+ async archive(ref, queue, msgId) {
58
+ return this.#post(ref, queue, { action: 'archive', msg_id: msgId });
59
+ }
60
+ /** `POST …/queues/{queue}` `delete` — delete one message outright. */
61
+ async delete(ref, queue, msgId) {
62
+ return this.#post(ref, queue, { action: 'delete', msg_id: msgId });
63
+ }
64
+ /** `POST …/queues/{queue}` `purge` — delete every message on the queue. */
65
+ async purge(ref, queue) {
66
+ return this.#post(ref, queue, { action: 'purge' });
67
+ }
68
+ async #post(ref, queue, body) {
69
+ const result = await this.#http.send({
70
+ method: 'POST',
71
+ path: `${environmentPath(ref)}/queues/${encodeURIComponent(queue)}`,
72
+ body,
73
+ });
74
+ return result.data;
75
+ }
76
+ }
77
+ //# sourceMappingURL=queues.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queues.js","sourceRoot":"","sources":["../../src/resources/queues.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAkFpD;;;;;GAKG;AACH,MAAM,OAAO,cAAc;IAChB,KAAK,CAAgB;IAE9B,YAAY,IAAmB;QAC7B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED,iFAAiF;IACjF,KAAK,CAAC,IAAI,CAAC,GAAmB;QAC5B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAA6B;YAC/D,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,GAAG,eAAe,CAAC,GAAG,CAAC,SAAS;SACvC,CAAC,CAAC;QACH,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,IAAI,CAAC,GAAmB,EAAE,KAAa,EAAE,OAAqB;QAClE,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAe;YACjD,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,GAAG,eAAe,CAAC,GAAG,CAAC,WAAW,kBAAkB,C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AAC,QAAQ,CAAC;IACzB,CAAC;IAED,iFAAiF;IACjF,KAAK,CAAC,OAAO,CAAC,GAAmB,EAAE,KAAa,EAAE,KAAa;QAC7D,OAAO,IAAI,CAAC,KAAK,CAAkB,GAAG,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IACvF,CAAC;IAED,sEAAsE;IACtE,KAAK,CAAC,MAAM,CAAC,GAAmB,EAAE,KAAa,EAAE,KAAa;QAC5D,OAAO,IAAI,CAAC,KAAK,CAAiB,GAAG,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IACrF,CAAC;IAED,2EAA2E;IAC3E,KAAK,CAAC,KAAK,CAAC,GAAmB,EAAE,KAAa;QAC5C,OAAO,IAAI,CAAC,KAAK,CAAc,GAAG,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;IAClE,CAAC;IAED,KAAK,CAAC,KAAK,CAAI,GAAmB,EAAE,KAAa,EAAE,IAA6B;QAC9E,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAI;YACtC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,GAAG,eAAe,CAAC,GAAG,CAAC,WAAW,kBAAkB,CAAC,KAAK,CAAC,EAAE;YACnE,IAAI;SACL,CAAC,CAAC;QACH,OAAO,MAAM,CAAC,IAAI,CAAC;IACrB,CAAC;CACF"}
@@ -0,0 +1,37 @@
1
+ import type { HttpTransport } from '../client.js';
2
+ import type { EnvironmentRef } from './environments.js';
3
+ /** One active Realtime channel and its live subscription count. */
4
+ export interface Channel {
5
+ /** The channel's display name, e.g. `room:1`. */
6
+ name: string;
7
+ /** The channel's live subscription count. */
8
+ subscriptions: number;
9
+ }
10
+ /** Response of {@link RealtimeResource.channels}. */
11
+ export interface ChannelList {
12
+ /** The active channels. Empty when Realtime is unreachable or idle. */
13
+ channels: Channel[];
14
+ /** Number of active channels (the length of `channels`). */
15
+ total_channels: number;
16
+ /** Sum of subscriptions across all active channels. */
17
+ total_subscriptions: number;
18
+ /**
19
+ * Present only when the list was degraded to empty; explains why. `null` on a
20
+ * healthy response.
21
+ */
22
+ notes: string | null;
23
+ }
24
+ /**
25
+ * Realtime — the read-only Realtime surface for an environment. Lists the
26
+ * environment Realtime service's active channels and their subscription counts
27
+ * via the control plane's Realtime proxy. The read degrades softly: an undeployed,
28
+ * unreachable, or unconfigured Realtime service yields a valid empty document
29
+ * whose `notes` field explains the empty state.
30
+ */
31
+ export declare class RealtimeResource {
32
+ #private;
33
+ constructor(http: HttpTransport);
34
+ /** `GET …/environments/{env}/realtime/channels` — the active channels. */
35
+ channels(ref: EnvironmentRef): Promise<ChannelList>;
36
+ }
37
+ //# sourceMappingURL=realtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"realtime.d.ts","sourceRoot":"","sources":["../../src/resources/realtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD,mEAAmE;AACnE,MAAM,WAAW,OAAO;IACtB,iDAAiD;IACjD,IAAI,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,qDAAqD;AACrD,MAAM,WAAW,WAAW;IAC1B,uEAAuE;IACvE,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,4DAA4D;IAC5D,cAAc,EAAE,MAAM,CAAC;IACvB,uDAAuD;IACvD,mBAAmB,EAAE,MAAM,CAAC;IAC5B;;;OAGG;IACH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED;;;;;;GAMG;AACH,qBAAa,gBAAgB;;gBAGf,IAAI,EAAE,aAAa;IAI/B,0EAA0E;IACpE,QAAQ,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC;CAO1D"}
@@ -0,0 +1,23 @@
1
+ import { environmentPath } from './environments.js';
2
+ /**
3
+ * Realtime — the read-only Realtime surface for an environment. Lists the
4
+ * environment Realtime service's active channels and their subscription counts
5
+ * via the control plane's Realtime proxy. The read degrades softly: an undeployed,
6
+ * unreachable, or unconfigured Realtime service yields a valid empty document
7
+ * whose `notes` field explains the empty state.
8
+ */
9
+ export class RealtimeResource {
10
+ #http;
11
+ constructor(http) {
12
+ this.#http = http;
13
+ }
14
+ /** `GET …/environments/{env}/realtime/channels` — the active channels. */
15
+ async channels(ref) {
16
+ const result = await this.#http.send({
17
+ method: 'GET',
18
+ path: `${environmentPath(ref)}/realtime/channels`,
19
+ });
20
+ return result.data;
21
+ }
22
+ }
23
+ //# sourceMappingURL=realtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"realtime.js","sourceRoot":"","sources":["../../src/resources/realtime.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AA0BpD;;;;;;GAMG;AACH,MAAM,OAAO,gBAAgB;IAClB,KAAK,CAAgB;IAE9B,YAAY,IAAmB;QAC7B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED,0EAA0E;IAC1E,KAAK,CAAC,QAAQ,CAAC,GAAmB;QAChC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAc;YAChD,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,GAAG,eAAe,CAAC,GAAG,CAAC,oBAAoB;SAClD,CAAC,CAAC;QACH,OAAO,MAAM,CAAC,IAAI,CAAC;IACrB,CAAC;CACF"}
@@ -0,0 +1,67 @@
1
+ import type { HttpTransport } from '../client.js';
2
+ import type { AcceptedRestore, Restore } from './backups.js';
3
+ import type { EnvironmentRef, MutationOptions } from './environments.js';
4
+ import type { PortableIdentifier } from '../types.gen.js';
5
+ export type { Restore, RestoreStatus, AcceptedRestore } from './backups.js';
6
+ /** Body of {@link RestoresResource.start}. */
7
+ export interface RestoreRequest {
8
+ /** The `available` backup to restore, taken in the source environment. */
9
+ backupId: PortableIdentifier;
10
+ /**
11
+ * The environment the backup lands in (same organization and project). A
12
+ * restore never overwrites its source in place; restore into a fresh preview
13
+ * to prove a backup, and into production only with human approval.
14
+ */
15
+ targetEnvironmentId: PortableIdentifier;
16
+ }
17
+ /** The evidence a finished restore carries, when the worker has produced it. */
18
+ export interface RestoreEvidence {
19
+ relationCount: number;
20
+ rlsRelationCount: number;
21
+ evidenceSha256: string;
22
+ restoredAtEpochSeconds: number;
23
+ }
24
+ /**
25
+ * Verified restore — the restore half of the backup contract. This is a
26
+ * restore-shaped convenience over
27
+ * `POST …/projects/{project}/backups/{backup}/restore?environment={source}`
28
+ * (the same call as {@link BackupsResource.restore}), so callers can think in
29
+ * "restore X into Y" terms.
30
+ */
31
+ export declare class RestoresResource {
32
+ #private;
33
+ constructor(http: HttpTransport);
34
+ /**
35
+ * `GET …/environments/{env}/restores` — every restore whose target is `target`,
36
+ * newest first (up to 200).
37
+ */
38
+ list(target: EnvironmentRef): Promise<Restore[]>;
39
+ /**
40
+ * `GET …/environments/{env}/restores/{restoreId}` — one restore into `target`.
41
+ * Poll this until `status` leaves `pending`, then read {@link restoreEvidence}.
42
+ */
43
+ get(target: EnvironmentRef, restoreId: PortableIdentifier): Promise<Restore>;
44
+ /**
45
+ * Poll {@link get} until the restore is no longer `pending`, then resolve with
46
+ * the final record. Rejects when `timeoutMs` elapses first.
47
+ */
48
+ waitForCompletion(target: EnvironmentRef, restoreId: PortableIdentifier, options?: {
49
+ intervalMs?: number;
50
+ timeoutMs?: number;
51
+ signal?: AbortSignal;
52
+ }): Promise<Restore>;
53
+ /**
54
+ * Request a restore of `request.backupId` (taken in `source`) into
55
+ * `request.targetEnvironmentId`. Resolves with the accepted, `pending`
56
+ * {@link Restore}.
57
+ */
58
+ start(source: EnvironmentRef, request: RestoreRequest, options?: MutationOptions): Promise<AcceptedRestore>;
59
+ }
60
+ /**
61
+ * The restore's proof, or `null` while it is still pending or when it failed.
62
+ * A restore counts as proven only when it reached `restored` with every
63
+ * evidence field present — the same contract the control plane enforces before
64
+ * it will mark a record `restored`.
65
+ */
66
+ export declare function restoreEvidence(restore: Restore): RestoreEvidence | null;
67
+ //# sourceMappingURL=restores.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"restores.d.ts","sourceRoot":"","sources":["../../src/resources/restores.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE7D,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE5E,8CAA8C;AAC9C,MAAM,WAAW,cAAc;IAC7B,0EAA0E;IAC1E,QAAQ,EAAE,kBAAkB,CAAC;IAC7B;;;;OAIG;IACH,mBAAmB,EAAE,kBAAkB,CAAC;CACzC;AAED,gFAAgF;AAChF,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,sBAAsB,EAAE,MAAM,CAAC;CAChC;AAED;;;;;;GAMG;AACH,qBAAa,gBAAgB;;gBAIf,IAAI,EAAE,aAAa;IAK/B;;;OAGG;IACG,IAAI,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAQtD;;;OAGG;IACG,GAAG,CAAC,MAAM,EAAE,cAAc,EAAE,SAAS,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC;IAQlF;;;OAGG;IACG,iBAAiB,CACrB,MAAM,EAAE,cAAc,EACtB,SAAS,EAAE,kBAAkB,EAC7B,OAAO,GAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,WAAW,CAAA;KAAO,GAC9E,OAAO,CAAC,OAAO,CAAC;IAkBnB;;;;OAIG;IACG,KAAK,CACT,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,cAAc,EACvB,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,eAAe,CAAC;CAQ5B;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,eAAe,GAAG,IAAI,CAgBxE"}
@@ -0,0 +1,90 @@
1
+ import { BackupsResource } from './backups.js';
2
+ import { environmentPath } from './environments.js';
3
+ /**
4
+ * Verified restore — the restore half of the backup contract. This is a
5
+ * restore-shaped convenience over
6
+ * `POST …/projects/{project}/backups/{backup}/restore?environment={source}`
7
+ * (the same call as {@link BackupsResource.restore}), so callers can think in
8
+ * "restore X into Y" terms.
9
+ */
10
+ export class RestoresResource {
11
+ #http;
12
+ #backups;
13
+ constructor(http) {
14
+ this.#http = http;
15
+ this.#backups = new BackupsResource(http);
16
+ }
17
+ /**
18
+ * `GET …/environments/{env}/restores` — every restore whose target is `target`,
19
+ * newest first (up to 200).
20
+ */
21
+ async list(target) {
22
+ const result = await this.#http.send({
23
+ method: 'GET',
24
+ path: `${environmentPath(target)}/restores`,
25
+ });
26
+ return result.data.items;
27
+ }
28
+ /**
29
+ * `GET …/environments/{env}/restores/{restoreId}` — one restore into `target`.
30
+ * Poll this until `status` leaves `pending`, then read {@link restoreEvidence}.
31
+ */
32
+ async get(target, restoreId) {
33
+ const result = await this.#http.send({
34
+ method: 'GET',
35
+ path: `${environmentPath(target)}/restores/${encodeURIComponent(restoreId)}`,
36
+ });
37
+ return result.data;
38
+ }
39
+ /**
40
+ * Poll {@link get} until the restore is no longer `pending`, then resolve with
41
+ * the final record. Rejects when `timeoutMs` elapses first.
42
+ */
43
+ async waitForCompletion(target, restoreId, options = {}) {
44
+ const interval = options.intervalMs ?? 2000;
45
+ const deadline = Date.now() + (options.timeoutMs ?? 30 * 60 * 1000);
46
+ for (;;) {
47
+ if (options.signal?.aborted) {
48
+ throw options.signal.reason ?? new Error('restore wait aborted');
49
+ }
50
+ const restore = await this.get(target, restoreId);
51
+ if (restore.status !== 'pending') {
52
+ return restore;
53
+ }
54
+ if (Date.now() + interval > deadline) {
55
+ throw new Error(`restore ${restoreId} did not finish before the timeout`);
56
+ }
57
+ await new Promise((resolve) => setTimeout(resolve, interval));
58
+ }
59
+ }
60
+ /**
61
+ * Request a restore of `request.backupId` (taken in `source`) into
62
+ * `request.targetEnvironmentId`. Resolves with the accepted, `pending`
63
+ * {@link Restore}.
64
+ */
65
+ async start(source, request, options) {
66
+ return this.#backups.restore(source, request.backupId, request.targetEnvironmentId, options);
67
+ }
68
+ }
69
+ /**
70
+ * The restore's proof, or `null` while it is still pending or when it failed.
71
+ * A restore counts as proven only when it reached `restored` with every
72
+ * evidence field present — the same contract the control plane enforces before
73
+ * it will mark a record `restored`.
74
+ */
75
+ export function restoreEvidence(restore) {
76
+ if (restore.status !== 'restored' ||
77
+ restore.relation_count === undefined ||
78
+ restore.rls_relation_count === undefined ||
79
+ restore.evidence_sha256 === undefined ||
80
+ restore.restored_at_epoch_seconds === undefined) {
81
+ return null;
82
+ }
83
+ return {
84
+ relationCount: restore.relation_count,
85
+ rlsRelationCount: restore.rls_relation_count,
86
+ evidenceSha256: restore.evidence_sha256,
87
+ restoredAtEpochSeconds: restore.restored_at_epoch_seconds,
88
+ };
89
+ }
90
+ //# sourceMappingURL=restores.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"restores.js","sourceRoot":"","sources":["../../src/resources/restores.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,M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;KAC1D,CAAC;AACJ,CAAC"}
@@ -0,0 +1,50 @@
1
+ import type { HttpTransport } from '../client.js';
2
+ import type { EnvironmentRef } from './environments.js';
3
+ /** Response of {@link StorageResource.listBuckets}. */
4
+ export interface BucketList {
5
+ /**
6
+ * The environment's Storage buckets, opaque Storage bucket records. Empty when
7
+ * Storage is unreachable or has no buckets yet.
8
+ */
9
+ buckets: unknown[];
10
+ /** Present only when the list was degraded to empty; explains why. */
11
+ notes?: string;
12
+ }
13
+ /** Response of {@link StorageResource.listObjects}. */
14
+ export interface ObjectList {
15
+ /** The bucket the objects were listed from. */
16
+ bucket: string;
17
+ /**
18
+ * The bucket's objects, opaque Storage object records. Empty when Storage is
19
+ * unreachable or the bucket has no objects under the prefix.
20
+ */
21
+ objects: unknown[];
22
+ /** Present only when the list was degraded to empty; explains why. */
23
+ notes?: string;
24
+ }
25
+ /** Optional paging controls for {@link StorageResource.listObjects}. */
26
+ export interface ListObjectsOptions {
27
+ /** Restrict the listing to object keys under this prefix. */
28
+ prefix?: string;
29
+ /** Cap the number of objects returned. The service bounds this server-side. */
30
+ limit?: number;
31
+ }
32
+ /**
33
+ * Storage — the read-only Storage surface for an environment. Lists the
34
+ * environment's buckets and the objects in one bucket via the control plane's
35
+ * server-side proxy to the per-env Storage admin API. Both reads degrade softly:
36
+ * an undeployed or unreachable Storage service yields an empty list plus a
37
+ * `notes` string explaining the empty state.
38
+ */
39
+ export declare class StorageResource {
40
+ #private;
41
+ constructor(http: HttpTransport);
42
+ /** `GET …/environments/{env}/storage/buckets` — the environment's buckets. */
43
+ listBuckets(ref: EnvironmentRef): Promise<BucketList>;
44
+ /**
45
+ * `GET …/environments/{env}/storage/buckets/{bucket}/objects` — the objects in
46
+ * one bucket, optionally filtered by `prefix` and capped by `limit`.
47
+ */
48
+ listObjects(ref: EnvironmentRef, bucket: string, options?: ListObjectsOptions): Promise<ObjectList>;
49
+ }
50
+ //# sourceMappingURL=storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/resources/storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD,uDAAuD;AACvD,MAAM,WAAW,UAAU;IACzB;;;OAGG;IACH,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,sEAAsE;IACtE,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,uDAAuD;AACvD,MAAM,WAAW,UAAU;IACzB,+CAA+C;IAC/C,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,sEAAsE;IACtE,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wEAAwE;AACxE,MAAM,WAAW,kBAAkB;IACjC,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+EAA+E;IAC/E,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;GAMG;AACH,qBAAa,eAAe;;gBAGd,IAAI,EAAE,aAAa;IAI/B,8EAA8E;IACxE,WAAW,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC;IAQ3D;;;OAGG;IACG,WAAW,CACf,GAAG,EAAE,cAAc,EACnB,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,UAAU,CAAC;CAWvB"}
@@ -0,0 +1,38 @@
1
+ import { environmentPath } from './environments.js';
2
+ /**
3
+ * Storage — the read-only Storage surface for an environment. Lists the
4
+ * environment's buckets and the objects in one bucket via the control plane's
5
+ * server-side proxy to the per-env Storage admin API. Both reads degrade softly:
6
+ * an undeployed or unreachable Storage service yields an empty list plus a
7
+ * `notes` string explaining the empty state.
8
+ */
9
+ export class StorageResource {
10
+ #http;
11
+ constructor(http) {
12
+ this.#http = http;
13
+ }
14
+ /** `GET …/environments/{env}/storage/buckets` — the environment's buckets. */
15
+ async listBuckets(ref) {
16
+ const result = await this.#http.send({
17
+ method: 'GET',
18
+ path: `${environmentPath(ref)}/storage/buckets`,
19
+ });
20
+ return result.data;
21
+ }
22
+ /**
23
+ * `GET …/environments/{env}/storage/buckets/{bucket}/objects` — the objects in
24
+ * one bucket, optionally filtered by `prefix` and capped by `limit`.
25
+ */
26
+ async listObjects(ref, bucket, options) {
27
+ const result = await this.#http.send({
28
+ method: 'GET',
29
+ path: `${environmentPath(ref)}/storage/buckets/${encodeURIComponent(bucket)}/objects`,
30
+ query: {
31
+ ...(options?.prefix !== undefined ? { prefix: options.prefix } : {}),
32
+ ...(options?.limit !== undefined ? { limit: options.limit } : {}),
33
+ },
34
+ });
35
+ return result.data;
36
+ }
37
+ }
38
+ //# sourceMappingURL=storage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.js","sourceRoot":"","sources":["../../src/resources/storage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAmCpD;;;;;;GAMG;AACH,MAAM,OAAO,eAAe;IACjB,KAAK,CAAgB;IAE9B,YAAY,IAAmB;QAC7B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED,8EAA8E;IAC9E,KAAK,CAAC,WAAW,CAAC,GAAmB;QACnC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAa;YAC/C,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,GAAG,eAAe,CAAC,GAAG,CAAC,kBAAkB;SAChD,CAAC,CAAC;QACH,OAAO,MAAM,CAAC,IAAI,CAAC;IACrB,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,WAAW,CACf,GAAmB,EACnB,MAAc,EACd,OAA4B;QAE5B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAa;YAC/C,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,GAAG,eAAe,CAAC,GAAG,CAAC,oBAAoB,kBAAkB,CAAC,MAAM,CAAC,UAAU;YACrF,KAAK,EAAE;gBACL,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACpE,GAAG,CAAC,OAAO,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAClE;SACF,CAAC,CAAC;QACH,OAAO,MAAM,CAAC,IAAI,CAAC;IACrB,CAAC;CACF"}
@@ -0,0 +1,85 @@
1
+ import type { HttpTransport } from '../client.js';
2
+ import type { EnvironmentRef } from './environments.js';
3
+ import type { EnvironmentReference, PortableIdentifier } from '../types.gen.js';
4
+ /**
5
+ * One capped resource line of the envelope. The product rule is binding: we
6
+ * never bill a metered line item. Exceeding `cap` is enforced, not charged; the
7
+ * customer buys a {@link CapacityPack} to raise it.
8
+ */
9
+ export interface UsageLine {
10
+ /** Stable metric key, e.g. `database_bytes`. */
11
+ metric: string;
12
+ /** Human label for the console. */
13
+ label: string;
14
+ used: number;
15
+ /** Amount included in the flat price. */
16
+ included: number;
17
+ /** Hard ceiling (included plus any active packs). */
18
+ cap: number;
19
+ unit: string;
20
+ }
21
+ /** A discrete capacity increment attached to the environment's plan. */
22
+ export interface CapacityPack {
23
+ pack_id: PortableIdentifier;
24
+ metric: string;
25
+ label: string;
26
+ /** How much one pack adds to the metric's cap. */
27
+ amount: number;
28
+ unit: string;
29
+ active: boolean;
30
+ }
31
+ /**
32
+ * The flat-price usage envelope for one environment, exactly as
33
+ * `crates/control-api/src/adapters/usage.rs` renders it. There is deliberately
34
+ * no metered line item: a flat price, hard caps, and optional capacity packs.
35
+ */
36
+ export interface UsageEnvelope {
37
+ environment: EnvironmentReference;
38
+ plan: string;
39
+ /** Flat monthly price in US dollars (e.g. `25.99`). */
40
+ flat_price_usd: number;
41
+ period_start_epoch_seconds: number;
42
+ period_end_epoch_seconds: number;
43
+ lines: UsageLine[];
44
+ packs: CapacityPack[];
45
+ }
46
+ /** One invoice from the organization's billing provider. */
47
+ export interface Invoice {
48
+ invoice_id: string;
49
+ status: string;
50
+ amount_usd: number;
51
+ period_start_epoch_seconds: number;
52
+ period_end_epoch_seconds: number;
53
+ /** Provider-hosted invoice PDF, when the provider exposes one. */
54
+ download_url?: string;
55
+ }
56
+ /**
57
+ * `GET /v1/organizations/{org}/billing`. An external billing provider is
58
+ * optional; when none is connected `configured` is false and `notes` says so.
59
+ */
60
+ export interface BillingOverview {
61
+ organization_id: PortableIdentifier;
62
+ configured: boolean;
63
+ provider: string | null;
64
+ invoices: Invoice[];
65
+ /** Display form of the payment method on file, e.g. `visa ending 4242`. */
66
+ payment_method: string | null;
67
+ notes: string;
68
+ }
69
+ /** Usage (per environment) and billing (per organization). */
70
+ export declare class UsageResource {
71
+ #private;
72
+ constructor(http: HttpTransport);
73
+ /** `GET …/environments/{env}/usage` — the environment's flat-price envelope. */
74
+ get(ref: EnvironmentRef): Promise<UsageEnvelope>;
75
+ /**
76
+ * Lines at or above a utilization threshold (default 0.8) of their cap — the
77
+ * console's "approaching a cap, consider a pack" signal.
78
+ */
79
+ capsNearingLimit(ref: EnvironmentRef, threshold?: number): Promise<UsageLine[]>;
80
+ /** `GET /v1/organizations/{org}/billing` — provider status and invoices. */
81
+ billing(organizationId: PortableIdentifier): Promise<BillingOverview>;
82
+ }
83
+ /** Pure form of {@link UsageResource.capsNearingLimit} for an envelope in hand. */
84
+ export declare function linesNearingCap(envelope: UsageEnvelope, threshold?: number): UsageLine[];
85
+ //# sourceMappingURL=usage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../src/resources/usage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA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