@rivetkit/engine-api-full 3.0.7 → 3.1.0-rc.1

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 (31) hide show
  1. package/dist/browser/cjs/index.js +190 -3
  2. package/dist/browser/cjs/serialization.js +47 -2
  3. package/dist/browser/esm/index.js +190 -3
  4. package/dist/browser/esm/serialization.js +47 -2
  5. package/dist/node/cjs/index.js +190 -3
  6. package/dist/node/cjs/serialization.js +53 -2
  7. package/dist/node/esm/index.js +190 -3
  8. package/dist/node/esm/serialization.js +47 -2
  9. package/package.json +1 -1
  10. package/types/Client.d.ts +14 -0
  11. package/types/api/client/requests/ActorsForkRequest.d.ts +14 -0
  12. package/types/api/client/requests/index.d.ts +1 -0
  13. package/types/api/resources/namespaces/client/Client.d.ts +12 -0
  14. package/types/api/types/Actor.d.ts +2 -0
  15. package/types/api/types/ActorsForkResponse.d.ts +4 -0
  16. package/types/api/types/Namespace.d.ts +11 -0
  17. package/types/api/types/NamespaceForkedFrom.d.ts +14 -0
  18. package/types/api/types/NamespaceSkippedActor.d.ts +14 -0
  19. package/types/api/types/NamespaceStatus.d.ts +18 -0
  20. package/types/api/types/NamespacesArchiveResponse.d.ts +7 -0
  21. package/types/api/types/index.d.ts +5 -0
  22. package/types/serialization/client/requests/ActorsForkRequest.d.ts +10 -0
  23. package/types/serialization/client/requests/index.d.ts +1 -0
  24. package/types/serialization/types/Actor.d.ts +1 -0
  25. package/types/serialization/types/ActorsForkResponse.d.ts +10 -0
  26. package/types/serialization/types/Namespace.d.ts +8 -0
  27. package/types/serialization/types/NamespaceForkedFrom.d.ts +14 -0
  28. package/types/serialization/types/NamespaceSkippedActor.d.ts +14 -0
  29. package/types/serialization/types/NamespaceStatus.d.ts +10 -0
  30. package/types/serialization/types/NamespacesArchiveResponse.d.ts +13 -0
  31. package/types/serialization/types/index.d.ts +5 -0
@@ -551,6 +551,7 @@ var init_NodePre18StreamWrapper = __esm({
551
551
  // src/api/index.ts
552
552
  var api_exports = {};
553
553
  __export(api_exports, {
554
+ NamespaceStatus: () => NamespaceStatus,
554
555
  authTokens: () => authTokens_exports,
555
556
  datacenters: () => datacenters_exports,
556
557
  metadata: () => metadata_exports,
@@ -558,6 +559,16 @@ __export(api_exports, {
558
559
  pools: () => pools_exports
559
560
  });
560
561
 
562
+ // src/api/types/NamespaceStatus.ts
563
+ var NamespaceStatus = {
564
+ Creating: "creating",
565
+ Forking: "forking",
566
+ Live: "live",
567
+ Archiving: "archiving",
568
+ Archived: "archived",
569
+ Failed: "failed"
570
+ };
571
+
561
572
  // src/api/resources/authTokens/index.ts
562
573
  var authTokens_exports = {};
563
574
  __export(authTokens_exports, {
@@ -2288,6 +2299,8 @@ __export(serialization_exports, {
2288
2299
  ActorsCreateRequest: () => ActorsCreateRequest,
2289
2300
  ActorsCreateResponse: () => ActorsCreateResponse,
2290
2301
  ActorsDeleteResponse: () => ActorsDeleteResponse,
2302
+ ActorsForkRequest: () => ActorsForkRequest,
2303
+ ActorsForkResponse: () => ActorsForkResponse,
2291
2304
  ActorsGetOrCreateRequest: () => ActorsGetOrCreateRequest,
2292
2305
  ActorsGetOrCreateResponse: () => ActorsGetOrCreateResponse,
2293
2306
  ActorsGetResponse: () => ActorsGetResponse,
@@ -2306,7 +2319,11 @@ __export(serialization_exports, {
2306
2319
  ErrorResponse: () => ErrorResponse,
2307
2320
  MetadataGetResponse: () => MetadataGetResponse,
2308
2321
  Namespace: () => Namespace,
2322
+ NamespaceForkedFrom: () => NamespaceForkedFrom,
2309
2323
  NamespaceListResponse: () => NamespaceListResponse,
2324
+ NamespaceSkippedActor: () => NamespaceSkippedActor,
2325
+ NamespaceStatus: () => NamespaceStatus2,
2326
+ NamespacesArchiveResponse: () => NamespacesArchiveResponse,
2310
2327
  NamespacesCreateRequest: () => NamespacesCreateRequest,
2311
2328
  NamespacesCreateResponse: () => NamespacesCreateResponse,
2312
2329
  Node: () => Node,
@@ -2336,7 +2353,8 @@ var Actor = schemas_exports.object({
2336
2353
  connectableTs: schemas_exports.property("connectable_ts", schemas_exports.number().nullable()),
2337
2354
  sleepTs: schemas_exports.property("sleep_ts", schemas_exports.number().nullable()),
2338
2355
  rescheduleTs: schemas_exports.property("reschedule_ts", schemas_exports.number().nullable()),
2339
- destroyTs: schemas_exports.property("destroy_ts", schemas_exports.number().nullable())
2356
+ destroyTs: schemas_exports.property("destroy_ts", schemas_exports.number().nullable()),
2357
+ forkedFrom: schemas_exports.property("forked_from", RivetId.nullable().optional())
2340
2358
  });
2341
2359
 
2342
2360
  // src/serialization/types/ActorName.ts
@@ -2353,6 +2371,11 @@ var ActorsCreateResponse = schemas_exports.object({
2353
2371
  // src/serialization/types/ActorsDeleteResponse.ts
2354
2372
  var ActorsDeleteResponse = schemas_exports.object({});
2355
2373
 
2374
+ // src/serialization/types/ActorsForkResponse.ts
2375
+ var ActorsForkResponse = schemas_exports.object({
2376
+ actor: Actor
2377
+ });
2378
+
2356
2379
  // src/serialization/types/ActorsGetOrCreateResponse.ts
2357
2380
  var ActorsGetOrCreateResponse = schemas_exports.object({
2358
2381
  actor: Actor,
@@ -2446,10 +2469,32 @@ var MetadataGetResponse = schemas_exports.object({
2446
2469
  actorNames: schemas_exports.record(schemas_exports.string(), ActorName).optional()
2447
2470
  });
2448
2471
 
2472
+ // src/serialization/types/NamespaceStatus.ts
2473
+ var NamespaceStatus2 = schemas_exports.enum_(["creating", "forking", "live", "archiving", "archived", "failed"]);
2474
+
2475
+ // src/serialization/types/NamespaceForkedFrom.ts
2476
+ var NamespaceForkedFrom = schemas_exports.object({
2477
+ namespace: schemas_exports.string(),
2478
+ forkNumber: schemas_exports.property("fork_number", schemas_exports.number()),
2479
+ forkedTs: schemas_exports.property("forked_ts", schemas_exports.number())
2480
+ });
2481
+
2482
+ // src/serialization/types/NamespaceSkippedActor.ts
2483
+ var NamespaceSkippedActor = schemas_exports.object({
2484
+ actorId: schemas_exports.property("actor_id", schemas_exports.string()),
2485
+ name: schemas_exports.string(),
2486
+ key: schemas_exports.string().nullable()
2487
+ });
2488
+
2449
2489
  // src/serialization/types/Namespace.ts
2450
2490
  var Namespace = schemas_exports.object({
2451
2491
  name: schemas_exports.string(),
2452
- createTs: schemas_exports.property("create_ts", schemas_exports.number())
2492
+ createTs: schemas_exports.property("create_ts", schemas_exports.number()),
2493
+ status: NamespaceStatus2,
2494
+ forkedFrom: schemas_exports.property("forked_from", NamespaceForkedFrom.nullable()),
2495
+ archivedTs: schemas_exports.property("archived_ts", schemas_exports.number().nullable()),
2496
+ skipped: schemas_exports.list(NamespaceSkippedActor).optional(),
2497
+ skippedCount: schemas_exports.property("skipped_count", schemas_exports.number().optional())
2453
2498
  });
2454
2499
 
2455
2500
  // src/serialization/types/NamespaceListResponse.ts
@@ -2463,6 +2508,11 @@ var NamespacesCreateResponse = schemas_exports.object({
2463
2508
  namespace: Namespace
2464
2509
  });
2465
2510
 
2511
+ // src/serialization/types/NamespacesArchiveResponse.ts
2512
+ var NamespacesArchiveResponse = schemas_exports.object({
2513
+ namespace: Namespace
2514
+ });
2515
+
2466
2516
  // src/serialization/types/Node.ts
2467
2517
  var Node = schemas_exports.object({
2468
2518
  key: schemas_exports.string(),
@@ -2522,6 +2572,12 @@ var ActorsGetOrCreateRequest = schemas_exports.object({
2522
2572
  pool: schemas_exports.string().optional()
2523
2573
  });
2524
2574
 
2575
+ // src/serialization/client/requests/ActorsForkRequest.ts
2576
+ var ActorsForkRequest = schemas_exports.object({
2577
+ key: schemas_exports.string().optional(),
2578
+ input: schemas_exports.string().optional()
2579
+ });
2580
+
2525
2581
  // src/serialization/resources/namespaces/index.ts
2526
2582
  var namespaces_exports = {};
2527
2583
  __export(namespaces_exports, {
@@ -2919,6 +2975,8 @@ var Namespaces = class {
2919
2975
  * })
2920
2976
  */
2921
2977
  async create(request, requestOptions) {
2978
+ const _body = request;
2979
+ const _queryParams = {};
2922
2980
  const _response = await (this._options.fetcher ?? fetcher)({
2923
2981
  url: urlJoin4(
2924
2982
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
@@ -2933,8 +2991,9 @@ var Namespaces = class {
2933
2991
  ...requestOptions == null ? void 0 : requestOptions.headers
2934
2992
  },
2935
2993
  contentType: "application/json",
2994
+ queryParameters: _queryParams,
2936
2995
  requestType: "json",
2937
- body: NamespacesCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
2996
+ body: NamespacesCreateRequest.jsonOrThrow(_body, { unrecognizedObjectKeys: "strip" }),
2938
2997
  timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 18e4,
2939
2998
  maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
2940
2999
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
@@ -2968,6 +3027,66 @@ var Namespaces = class {
2968
3027
  });
2969
3028
  }
2970
3029
  }
3030
+ /**
3031
+ * Archives a namespace: refuses new work for it, stops what its nodes host, then closes its
3032
+ * storage. Archiving is final. Answers at once with the namespace at status `archiving`, or
3033
+ * `archived` when it already is.
3034
+ *
3035
+ * @param {string} name - The namespace to archive.
3036
+ * @param {Namespaces.RequestOptions} requestOptions - Request-specific configuration.
3037
+ *
3038
+ * @example
3039
+ * await client.namespaces.archive("staging")
3040
+ */
3041
+ async archive(name, requestOptions) {
3042
+ const _response = await (this._options.fetcher ?? fetcher)({
3043
+ url: urlJoin4(
3044
+ await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
3045
+ `namespaces/${encodeURIComponent(name)}/archive`
3046
+ ),
3047
+ method: "POST",
3048
+ headers: {
3049
+ Authorization: await this._getAuthorizationHeader(),
3050
+ "X-Fern-Language": "JavaScript",
3051
+ "X-Fern-Runtime": RUNTIME.type,
3052
+ "X-Fern-Runtime-Version": RUNTIME.version,
3053
+ ...requestOptions == null ? void 0 : requestOptions.headers
3054
+ },
3055
+ contentType: "application/json",
3056
+ requestType: "json",
3057
+ timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 18e4,
3058
+ maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
3059
+ abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
3060
+ });
3061
+ if (_response.ok) {
3062
+ return NamespacesArchiveResponse.parseOrThrow(_response.body, {
3063
+ unrecognizedObjectKeys: "passthrough",
3064
+ allowUnrecognizedUnionMembers: true,
3065
+ allowUnrecognizedEnumValues: true,
3066
+ skipValidation: true,
3067
+ breadcrumbsPrefix: ["response"]
3068
+ });
3069
+ }
3070
+ if (_response.error.reason === "status-code") {
3071
+ throw new RivetError({
3072
+ statusCode: _response.error.statusCode,
3073
+ body: _response.error.body
3074
+ });
3075
+ }
3076
+ switch (_response.error.reason) {
3077
+ case "non-json":
3078
+ throw new RivetError({
3079
+ statusCode: _response.error.statusCode,
3080
+ body: _response.error.rawBody
3081
+ });
3082
+ case "timeout":
3083
+ throw new RivetTimeoutError("Timeout exceeded when calling POST /namespaces.");
3084
+ case "unknown":
3085
+ throw new RivetError({
3086
+ message: _response.error.errorMessage
3087
+ });
3088
+ }
3089
+ }
2971
3090
  async _getAuthorizationHeader() {
2972
3091
  return `Bearer ${await Supplier.get(this._options.token)}`;
2973
3092
  }
@@ -3920,6 +4039,74 @@ var RivetClient = class {
3920
4039
  });
3921
4040
  }
3922
4041
  }
4042
+ /**
4043
+ * Forks an actor: creates a new actor in the same namespace, with the source's name and pool,
4044
+ * whose database is a copy of the source's, and starts it.
4045
+ *
4046
+ * @param {Rivet.RivetId} actorId
4047
+ * @param {Rivet.ActorsForkRequest} request
4048
+ * @param {RivetClient.RequestOptions} requestOptions - Request-specific configuration.
4049
+ *
4050
+ * @example
4051
+ * await client.actorsFork("actor_id", {
4052
+ * namespace: "namespace",
4053
+ * })
4054
+ */
4055
+ async actorsFork(actorId, request, requestOptions) {
4056
+ const { namespace, ..._body } = request;
4057
+ const _queryParams = {};
4058
+ if (namespace != null)
4059
+ _queryParams["namespace"] = namespace;
4060
+ const _response = await (this._options.fetcher ?? fetcher)({
4061
+ url: urlJoin6(
4062
+ await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
4063
+ `actors/${encodeURIComponent(RivetId.jsonOrThrow(actorId))}/fork`
4064
+ ),
4065
+ method: "POST",
4066
+ headers: {
4067
+ Authorization: await this._getAuthorizationHeader(),
4068
+ "X-Fern-Language": "JavaScript",
4069
+ "X-Fern-Runtime": RUNTIME.type,
4070
+ "X-Fern-Runtime-Version": RUNTIME.version,
4071
+ ...requestOptions == null ? void 0 : requestOptions.headers
4072
+ },
4073
+ contentType: "application/json",
4074
+ queryParameters: _queryParams,
4075
+ requestType: "json",
4076
+ body: ActorsForkRequest.jsonOrThrow(_body, { unrecognizedObjectKeys: "strip" }),
4077
+ timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 18e4,
4078
+ maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
4079
+ abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
4080
+ });
4081
+ if (_response.ok) {
4082
+ return ActorsForkResponse.parseOrThrow(_response.body, {
4083
+ unrecognizedObjectKeys: "passthrough",
4084
+ allowUnrecognizedUnionMembers: true,
4085
+ allowUnrecognizedEnumValues: true,
4086
+ skipValidation: true,
4087
+ breadcrumbsPrefix: ["response"]
4088
+ });
4089
+ }
4090
+ if (_response.error.reason === "status-code") {
4091
+ throw new RivetError({
4092
+ statusCode: _response.error.statusCode,
4093
+ body: _response.error.body
4094
+ });
4095
+ }
4096
+ switch (_response.error.reason) {
4097
+ case "non-json":
4098
+ throw new RivetError({
4099
+ statusCode: _response.error.statusCode,
4100
+ body: _response.error.rawBody
4101
+ });
4102
+ case "timeout":
4103
+ throw new RivetTimeoutError("Timeout exceeded when calling POST /actors/{actor_id}/fork.");
4104
+ case "unknown":
4105
+ throw new RivetError({
4106
+ message: _response.error.errorMessage
4107
+ });
4108
+ }
4109
+ }
3923
4110
  async _getAuthorizationHeader() {
3924
4111
  return `Bearer ${await Supplier.get(this._options.token)}`;
3925
4112
  }
@@ -1483,7 +1483,8 @@ var Actor = schemas_exports.object({
1483
1483
  connectableTs: schemas_exports.property("connectable_ts", schemas_exports.number().nullable()),
1484
1484
  sleepTs: schemas_exports.property("sleep_ts", schemas_exports.number().nullable()),
1485
1485
  rescheduleTs: schemas_exports.property("reschedule_ts", schemas_exports.number().nullable()),
1486
- destroyTs: schemas_exports.property("destroy_ts", schemas_exports.number().nullable())
1486
+ destroyTs: schemas_exports.property("destroy_ts", schemas_exports.number().nullable()),
1487
+ forkedFrom: schemas_exports.property("forked_from", RivetId.nullable().optional())
1487
1488
  });
1488
1489
 
1489
1490
  // src/serialization/types/ActorName.ts
@@ -1500,6 +1501,11 @@ var ActorsCreateResponse = schemas_exports.object({
1500
1501
  // src/serialization/types/ActorsDeleteResponse.ts
1501
1502
  var ActorsDeleteResponse = schemas_exports.object({});
1502
1503
 
1504
+ // src/serialization/types/ActorsForkResponse.ts
1505
+ var ActorsForkResponse = schemas_exports.object({
1506
+ actor: Actor
1507
+ });
1508
+
1503
1509
  // src/serialization/types/ActorsGetOrCreateResponse.ts
1504
1510
  var ActorsGetOrCreateResponse = schemas_exports.object({
1505
1511
  actor: Actor,
@@ -1593,10 +1599,32 @@ var MetadataGetResponse = schemas_exports.object({
1593
1599
  actorNames: schemas_exports.record(schemas_exports.string(), ActorName).optional()
1594
1600
  });
1595
1601
 
1602
+ // src/serialization/types/NamespaceStatus.ts
1603
+ var NamespaceStatus = schemas_exports.enum_(["creating", "forking", "live", "archiving", "archived", "failed"]);
1604
+
1605
+ // src/serialization/types/NamespaceForkedFrom.ts
1606
+ var NamespaceForkedFrom = schemas_exports.object({
1607
+ namespace: schemas_exports.string(),
1608
+ forkNumber: schemas_exports.property("fork_number", schemas_exports.number()),
1609
+ forkedTs: schemas_exports.property("forked_ts", schemas_exports.number())
1610
+ });
1611
+
1612
+ // src/serialization/types/NamespaceSkippedActor.ts
1613
+ var NamespaceSkippedActor = schemas_exports.object({
1614
+ actorId: schemas_exports.property("actor_id", schemas_exports.string()),
1615
+ name: schemas_exports.string(),
1616
+ key: schemas_exports.string().nullable()
1617
+ });
1618
+
1596
1619
  // src/serialization/types/Namespace.ts
1597
1620
  var Namespace = schemas_exports.object({
1598
1621
  name: schemas_exports.string(),
1599
- createTs: schemas_exports.property("create_ts", schemas_exports.number())
1622
+ createTs: schemas_exports.property("create_ts", schemas_exports.number()),
1623
+ status: NamespaceStatus,
1624
+ forkedFrom: schemas_exports.property("forked_from", NamespaceForkedFrom.nullable()),
1625
+ archivedTs: schemas_exports.property("archived_ts", schemas_exports.number().nullable()),
1626
+ skipped: schemas_exports.list(NamespaceSkippedActor).optional(),
1627
+ skippedCount: schemas_exports.property("skipped_count", schemas_exports.number().optional())
1600
1628
  });
1601
1629
 
1602
1630
  // src/serialization/types/NamespaceListResponse.ts
@@ -1610,6 +1638,11 @@ var NamespacesCreateResponse = schemas_exports.object({
1610
1638
  namespace: Namespace
1611
1639
  });
1612
1640
 
1641
+ // src/serialization/types/NamespacesArchiveResponse.ts
1642
+ var NamespacesArchiveResponse = schemas_exports.object({
1643
+ namespace: Namespace
1644
+ });
1645
+
1613
1646
  // src/serialization/types/Node.ts
1614
1647
  var Node = schemas_exports.object({
1615
1648
  key: schemas_exports.string(),
@@ -1669,6 +1702,12 @@ var ActorsGetOrCreateRequest = schemas_exports.object({
1669
1702
  pool: schemas_exports.string().optional()
1670
1703
  });
1671
1704
 
1705
+ // src/serialization/client/requests/ActorsForkRequest.ts
1706
+ var ActorsForkRequest = schemas_exports.object({
1707
+ key: schemas_exports.string().optional(),
1708
+ input: schemas_exports.string().optional()
1709
+ });
1710
+
1672
1711
  // src/serialization/resources/namespaces/index.ts
1673
1712
  var namespaces_exports = {};
1674
1713
  __export(namespaces_exports, {
@@ -1685,6 +1724,8 @@ export {
1685
1724
  ActorsCreateRequest,
1686
1725
  ActorsCreateResponse,
1687
1726
  ActorsDeleteResponse,
1727
+ ActorsForkRequest,
1728
+ ActorsForkResponse,
1688
1729
  ActorsGetOrCreateRequest,
1689
1730
  ActorsGetOrCreateResponse,
1690
1731
  ActorsGetResponse,
@@ -1703,7 +1744,11 @@ export {
1703
1744
  ErrorResponse,
1704
1745
  MetadataGetResponse,
1705
1746
  Namespace,
1747
+ NamespaceForkedFrom,
1706
1748
  NamespaceListResponse,
1749
+ NamespaceSkippedActor,
1750
+ NamespaceStatus,
1751
+ NamespacesArchiveResponse,
1707
1752
  NamespacesCreateRequest,
1708
1753
  NamespacesCreateResponse,
1709
1754
  Node,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "license": "Apache-2.0",
3
3
  "name": "@rivetkit/engine-api-full",
4
- "version": "3.0.7",
4
+ "version": "3.1.0-rc.1",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/rivet-dev/rivet.git",
package/types/Client.d.ts CHANGED
@@ -196,5 +196,19 @@ export declare class RivetClient {
196
196
  * })
197
197
  */
198
198
  actorsSleep(actorId: Rivet.RivetId, request: Rivet.ActorsSleepRequest, requestOptions?: RivetClient.RequestOptions): Promise<Rivet.ActorsSleepResponse>;
199
+ /**
200
+ * Forks an actor: creates a new actor in the same namespace, with the source's name and pool,
201
+ * whose database is a copy of the source's, and starts it.
202
+ *
203
+ * @param {Rivet.RivetId} actorId
204
+ * @param {Rivet.ActorsForkRequest} request
205
+ * @param {RivetClient.RequestOptions} requestOptions - Request-specific configuration.
206
+ *
207
+ * @example
208
+ * await client.actorsFork("actor_id", {
209
+ * namespace: "namespace",
210
+ * })
211
+ */
212
+ actorsFork(actorId: Rivet.RivetId, request: Rivet.ActorsForkRequest, requestOptions?: RivetClient.RequestOptions): Promise<Rivet.ActorsForkResponse>;
199
213
  protected _getAuthorizationHeader(): Promise<string>;
200
214
  }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * namespace: "namespace",
5
+ * key: "key"
6
+ * }
7
+ */
8
+ export interface ActorsForkRequest {
9
+ namespace?: string;
10
+ /** Key of the new actor in canonical slash-separated form. Omit for an actor without a key. */
11
+ key?: string;
12
+ /** Fork input as standard base64, passed to the new actor's `onFork` hook. */
13
+ input?: string;
14
+ }
@@ -6,3 +6,4 @@ export { type ActorsGetRequest } from "./ActorsGetRequest";
6
6
  export { type ActorsDeleteRequest } from "./ActorsDeleteRequest";
7
7
  export { type ActorsRescheduleRequest } from "./ActorsRescheduleRequest";
8
8
  export { type ActorsSleepRequest } from "./ActorsSleepRequest";
9
+ export { type ActorsForkRequest } from "./ActorsForkRequest";
@@ -43,5 +43,17 @@ export declare class Namespaces {
43
43
  * })
44
44
  */
45
45
  create(request: Rivet.NamespacesCreateRequest, requestOptions?: Namespaces.RequestOptions): Promise<Rivet.NamespacesCreateResponse>;
46
+ /**
47
+ * Archives a namespace: refuses new work for it, stops what its nodes host, then closes its
48
+ * storage. Archiving is final. Answers at once with the namespace at status `archiving`, or
49
+ * `archived` when it already is.
50
+ *
51
+ * @param {string} name - The namespace to archive.
52
+ * @param {Namespaces.RequestOptions} requestOptions - Request-specific configuration.
53
+ *
54
+ * @example
55
+ * await client.namespaces.archive("staging")
56
+ */
57
+ archive(name: string, requestOptions?: Namespaces.RequestOptions): Promise<Rivet.NamespacesArchiveResponse>;
46
58
  protected _getAuthorizationHeader(): Promise<string>;
47
59
  }
@@ -23,4 +23,6 @@ export interface Actor {
23
23
  rescheduleTs: number | null;
24
24
  /** When the actor was destroyed, in Unix milliseconds. Only set in listings that include destroyed actors; otherwise `null`. */
25
25
  destroyTs: number | null;
26
+ /** ID of the source actor this actor's database was forked from, or `null` for an actor that was not made by a fork. Servers released before forks omit it. */
27
+ forkedFrom?: Rivet.RivetId | null;
26
28
  }
@@ -0,0 +1,4 @@
1
+ import * as Rivet from "../index";
2
+ export interface ActorsForkResponse {
3
+ actor: Rivet.Actor;
4
+ }
@@ -1,6 +1,17 @@
1
+ import * as Rivet from "../index";
1
2
  export interface Namespace {
2
3
  /** Namespace name. */
3
4
  name: string;
4
5
  /** When the namespace was created, in Unix milliseconds. */
5
6
  createTs: number;
7
+ /** `creating`, `forking`, `live`, `archiving`, `archived` or `failed`. */
8
+ status: Rivet.NamespaceStatus;
9
+ /** What the namespace was forked from; `null` for a namespace that is not a fork. */
10
+ forkedFrom: Rivet.NamespaceForkedFrom | null;
11
+ /** When the namespace was archived, in Unix milliseconds; `null` unless archived. */
12
+ archivedTs: number | null;
13
+ /** Legacy: the actors the move into the namespace's volume group could not move, at most 1,000; empty for every other namespace. Removed with the backfill in 3.1. */
14
+ skipped?: Rivet.NamespaceSkippedActor[];
15
+ /** Legacy: how many such actors are not destroyed yet, which can exceed the length of `skipped`. Removed with the backfill in 3.1. */
16
+ skippedCount?: number;
6
17
  }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * What a namespace was forked from.
6
+ */
7
+ export interface NamespaceForkedFrom {
8
+ /** The parent namespace. */
9
+ namespace: string;
10
+ /** The parent's fork number this namespace was made at. */
11
+ forkNumber: number;
12
+ /** When the fork finished, in Unix milliseconds. */
13
+ forkedTs: number;
14
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * An actor the move into the namespace's volume group could not move.
6
+ */
7
+ export interface NamespaceSkippedActor {
8
+ /** ID of the actor. */
9
+ actorId: string;
10
+ /** Actor name. */
11
+ name: string;
12
+ /** Actor key in the slash form, or `null` for an actor without one. */
13
+ key: string | null;
14
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * `creating` while a new namespace's volume group is created, `forking` while a fork's group
6
+ * writes run, `live` once the namespace serves, `archiving` while its nodes stop what they host,
7
+ * `archived` once its storage is closed, for good, and `failed` when a fork was refused after
8
+ * its record was written.
9
+ */
10
+ export type NamespaceStatus = "creating" | "forking" | "live" | "archiving" | "archived" | "failed";
11
+ export declare const NamespaceStatus: {
12
+ readonly Creating: "creating";
13
+ readonly Forking: "forking";
14
+ readonly Live: "live";
15
+ readonly Archiving: "archiving";
16
+ readonly Archived: "archived";
17
+ readonly Failed: "failed";
18
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Rivet from "../index";
5
+ export interface NamespacesArchiveResponse {
6
+ namespace: Rivet.Namespace;
7
+ }
@@ -2,6 +2,7 @@ export * from "./Actor";
2
2
  export * from "./ActorName";
3
3
  export * from "./ActorsCreateResponse";
4
4
  export * from "./ActorsDeleteResponse";
5
+ export * from "./ActorsForkResponse";
5
6
  export * from "./ActorsGetOrCreateResponse";
6
7
  export * from "./ActorsGetResponse";
7
8
  export * from "./ActorsListNamesResponse";
@@ -21,6 +22,10 @@ export * from "./MetadataGetResponse";
21
22
  export * from "./Namespace";
22
23
  export * from "./NamespaceListResponse";
23
24
  export * from "./NamespacesCreateResponse";
25
+ export * from "./NamespaceStatus";
26
+ export * from "./NamespaceForkedFrom";
27
+ export * from "./NamespaceSkippedActor";
28
+ export * from "./NamespacesArchiveResponse";
24
29
  export * from "./Node";
25
30
  export * from "./Pagination";
26
31
  export * from "./Pool";
@@ -0,0 +1,10 @@
1
+ import * as serializers from "../../index";
2
+ import * as Rivet from "../../../api/index";
3
+ import * as core from "../../../core";
4
+ export declare const ActorsForkRequest: core.serialization.Schema<serializers.ActorsForkRequest.Raw, Omit<Rivet.ActorsForkRequest, "namespace">>;
5
+ export declare namespace ActorsForkRequest {
6
+ interface Raw {
7
+ key?: string | null;
8
+ input?: string | null;
9
+ }
10
+ }
@@ -1,2 +1,3 @@
1
1
  export { ActorsCreateRequest } from "./ActorsCreateRequest";
2
2
  export { ActorsGetOrCreateRequest } from "./ActorsGetOrCreateRequest";
3
+ export { ActorsForkRequest } from "./ActorsForkRequest";
@@ -17,5 +17,6 @@ export declare namespace Actor {
17
17
  sleep_ts: number | null;
18
18
  reschedule_ts: number | null;
19
19
  destroy_ts: number | null;
20
+ forked_from?: RivetId.Raw | null;
20
21
  }
21
22
  }
@@ -0,0 +1,10 @@
1
+ import * as serializers from "../index";
2
+ import * as Rivet from "../../api/index";
3
+ import * as core from "../../core";
4
+ import { Actor } from "./Actor";
5
+ export declare const ActorsForkResponse: core.serialization.ObjectSchema<serializers.ActorsForkResponse.Raw, Rivet.ActorsForkResponse>;
6
+ export declare namespace ActorsForkResponse {
7
+ interface Raw {
8
+ actor: Actor.Raw;
9
+ }
10
+ }
@@ -1,10 +1,18 @@
1
1
  import * as serializers from "../index";
2
2
  import * as Rivet from "../../api/index";
3
3
  import * as core from "../../core";
4
+ import { NamespaceStatus } from "./NamespaceStatus";
5
+ import { NamespaceForkedFrom } from "./NamespaceForkedFrom";
6
+ import { NamespaceSkippedActor } from "./NamespaceSkippedActor";
4
7
  export declare const Namespace: core.serialization.ObjectSchema<serializers.Namespace.Raw, Rivet.Namespace>;
5
8
  export declare namespace Namespace {
6
9
  interface Raw {
7
10
  name: string;
8
11
  create_ts: number;
12
+ status: NamespaceStatus.Raw;
13
+ forked_from: NamespaceForkedFrom.Raw | null;
14
+ archived_ts: number | null;
15
+ skipped?: NamespaceSkippedActor.Raw[] | null;
16
+ skipped_count?: number | null;
9
17
  }
10
18
  }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as serializers from "../index";
5
+ import * as Rivet from "../../api/index";
6
+ import * as core from "../../core";
7
+ export declare const NamespaceForkedFrom: core.serialization.ObjectSchema<serializers.NamespaceForkedFrom.Raw, Rivet.NamespaceForkedFrom>;
8
+ export declare namespace NamespaceForkedFrom {
9
+ interface Raw {
10
+ namespace: string;
11
+ fork_number: number;
12
+ forked_ts: number;
13
+ }
14
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as serializers from "../index";
5
+ import * as Rivet from "../../api/index";
6
+ import * as core from "../../core";
7
+ export declare const NamespaceSkippedActor: core.serialization.ObjectSchema<serializers.NamespaceSkippedActor.Raw, Rivet.NamespaceSkippedActor>;
8
+ export declare namespace NamespaceSkippedActor {
9
+ interface Raw {
10
+ actor_id: string;
11
+ name: string;
12
+ key: string | null;
13
+ }
14
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as serializers from "../index";
5
+ import * as Rivet from "../../api/index";
6
+ import * as core from "../../core";
7
+ export declare const NamespaceStatus: core.serialization.Schema<serializers.NamespaceStatus.Raw, Rivet.NamespaceStatus>;
8
+ export declare namespace NamespaceStatus {
9
+ type Raw = "creating" | "forking" | "live" | "archiving" | "archived" | "failed";
10
+ }