From 4efbe114e3d1d431e5d003d28eda3105afe46569 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 13 Nov 2026 19:35:59 +0000 Subject: [PATCH] feat(api): update SDKs to meteroid 0.1.0 BEGIN_NESTED_COMMIT feat(api): update `GET /api/v1/licenses`, `GET /api/v1/licenses/{license_id}`, `POST /api/v1/licenses`, `POST /api/v1/licenses/{license_id}/revoke` END_NESTED_COMMIT --- src/api/licenses.ts | 2 +- src/models/issueLicenseRequest.ts | 13 +++++++++++++ src/models/issueLicenseResponse.ts | 5 ++++- src/models/license.ts | 9 +++++++++ tests/api/licenses.test.ts | 8 ++++---- 5 files changed, 31 insertions(+), 6 deletions(-) diff --git a/src/api/licenses.ts b/src/api/licenses.ts index 5307bbb..15a5417 100644 --- a/src/api/licenses.ts +++ b/src/api/licenses.ts @@ -106,7 +106,7 @@ export class Licenses { /** * Get a license's activation code * - * Available until the license is activated or revoked. + * Available until the license is activated or revoked; for an ephemeral license, until revoked. */ public retrieveActivationCode( licenseId: string, diff --git a/src/models/issueLicenseRequest.ts b/src/models/issueLicenseRequest.ts index 6f728db..05353e2 100644 --- a/src/models/issueLicenseRequest.ts +++ b/src/models/issueLicenseRequest.ts @@ -5,6 +5,12 @@ import { decodeBoolean, decodeInteger, decodeObject, decodeString } from "../dec export interface IssueLicenseRequest { /** Customer ID or alias */ customerId: string; + /** + * Ephemeral, for CI and other short-lived installations: the activation code can be used + * any number of times, each activation gets a license of this many hours (1 to 24) for the + * installation activating, and nothing is refreshed. Not with `offline` or `validity_days`. + */ + ephemeralHours?: number | null | undefined; /** * Offline only. The installation's id as it reports it, up to 255 characters without * spaces: the license names it (`aud`) and stays bound to it. Without one, the license is @@ -35,12 +41,17 @@ export const IssueLicenseRequestSerializer = { return { ...extraProperties(json, [ "customer_id", + "ephemeral_hours", "instance_id", "offline", "subscription_id", "validity_days", ]), customerId: decodeString(json["customer_id"], path, "customer_id"), + ephemeralHours: + json["ephemeral_hours"] != null + ? decodeInteger(json["ephemeral_hours"], path, "ephemeral_hours") + : json["ephemeral_hours"], instanceId: json["instance_id"] != null ? decodeString(json["instance_id"], path, "instance_id") @@ -64,12 +75,14 @@ export const IssueLicenseRequestSerializer = { return { ...extraProperties(value, [ "customerId", + "ephemeralHours", "instanceId", "offline", "subscriptionId", "validityDays", ]), customer_id: value.customerId, + ephemeral_hours: value.ephemeralHours, instance_id: value.instanceId, offline: value.offline, subscription_id: value.subscriptionId, diff --git a/src/models/issueLicenseResponse.ts b/src/models/issueLicenseResponse.ts index eac7627..a44ee65 100644 --- a/src/models/issueLicenseResponse.ts +++ b/src/models/issueLicenseResponse.ts @@ -4,7 +4,10 @@ import { decodeObject, decodePath, decodeString } from "../decode.js"; import { type License, LicenseSerializer } from "./license.js"; export interface IssueLicenseResponse { - /** Online: one-time code the customer enters in their installation to activate the license. */ + /** + * Online: one-time code the customer enters in their installation to activate the license. + * Ephemeral: the reusable code, e.g. a CI secret. + */ activationCode?: string | null | undefined; license: License; /** Offline: the signed license (a JWT) to install in the installation. */ diff --git a/src/models/license.ts b/src/models/license.ts index 36be134..4179f5d 100644 --- a/src/models/license.ts +++ b/src/models/license.ts @@ -19,6 +19,8 @@ export interface License { createdAt: Date; customerId: CustomerId; customerName: string; + /** Ephemeral: each activation of the reusable code gets a license of this many hours. */ + ephemeralHours?: number | null | undefined; /** Whether the activation code can still be retrieved: only until activation or revocation. */ hasActivationCode: boolean; id: LicenseId; @@ -53,6 +55,7 @@ export const LicenseSerializer = { "created_at", "customer_id", "customer_name", + "ephemeral_hours", "has_activation_code", "id", "instance_id", @@ -72,6 +75,10 @@ export const LicenseSerializer = { decodePath(path, "customer_id") ), customerName: decodeString(json["customer_name"], path, "customer_name"), + ephemeralHours: + json["ephemeral_hours"] != null + ? decodeInteger(json["ephemeral_hours"], path, "ephemeral_hours") + : json["ephemeral_hours"], hasActivationCode: decodeBoolean( json["has_activation_code"], path, @@ -119,6 +126,7 @@ export const LicenseSerializer = { "createdAt", "customerId", "customerName", + "ephemeralHours", "hasActivationCode", "id", "instanceId", @@ -135,6 +143,7 @@ export const LicenseSerializer = { created_at: value.createdAt, customer_id: CustomerIdSerializer.serialize(value.customerId), customer_name: value.customerName, + ephemeral_hours: value.ephemeralHours, has_activation_code: value.hasActivationCode, id: LicenseIdSerializer.serialize(value.id), instance_id: value.instanceId, diff --git a/tests/api/licenses.test.ts b/tests/api/licenses.test.ts index 9ada686..2763d07 100644 --- a/tests/api/licenses.test.ts +++ b/tests/api/licenses.test.ts @@ -13,7 +13,7 @@ test("licenses.list", async () => { const { client, requests } = mock({ status: 200, contentType: "application/json", - body: '{"data":[{"auto_issued":false,"created_at":"2023-12-31T23:59:59.999-05:30","customer_id":"customer_id_2","customer_name":"sample","has_activation_code":false,"id":"license_id_0","offline":false,"revoked_immediately":false,"status":"REVOKED","validity_days":-123456789}]}', + body: '{"data":[{"auto_issued":false,"created_at":"2023-12-31T23:59:59.999-05:30","customer_id":"customer_id_2","customer_name":"sample","has_activation_code":true,"id":"license_id_78","offline":false,"revoked_immediately":false,"status":"PENDING","validity_days":2147483647}]}', }); await client.licenses.list(); assert.deepEqual(requests, ["GET /api/v1/licenses"]); @@ -23,7 +23,7 @@ test("licenses.create", async () => { const { client, requests } = mock({ status: 200, contentType: "application/json", - body: '{"license":{"auto_issued":false,"created_at":"2023-12-31T23:59:59.999-05:30","customer_id":"customer_id_37","customer_name":"sample","has_activation_code":true,"id":"license_id_40","offline":true,"revoked_immediately":true,"status":"PENDING","validity_days":123456789}}', + body: '{"license":{"auto_issued":false,"created_at":"2023-12-31T23:59:59.999-05:30","customer_id":"customer_id_37","customer_name":"sample","has_activation_code":true,"id":"license_id_32","offline":true,"revoked_immediately":false,"status":"REVOKED","validity_days":2147483647}}', }); await client.licenses.create( IssueLicenseRequestSerializer.parse(parseJson('{"customer_id":"sample"}')) @@ -35,7 +35,7 @@ test("licenses.retrieve", async () => { const { client, requests } = mock({ status: 200, contentType: "application/json", - body: '{"auto_issued":false,"created_at":"2024-03-15T10:30:45.123+02:00","customer_id":"customer_id_79","customer_name":"sample","has_activation_code":false,"id":"license_id_90","offline":false,"revoked_immediately":true,"status":"PENDING","validity_days":-123456789}', + body: '{"auto_issued":false,"created_at":"2024-03-15T10:30:45.123+02:00","customer_id":"customer_id_79","customer_name":"sample","has_activation_code":true,"id":"license_id_13","offline":true,"revoked_immediately":false,"status":"PENDING","validity_days":-2147483648}', }); await client.licenses.retrieve("license_id"); assert.deepEqual(requests, ["GET /api/v1/licenses/license_id"]); @@ -68,7 +68,7 @@ test("licenses.revoke", async () => { const { client, requests } = mock({ status: 200, contentType: "application/json", - body: '{"auto_issued":false,"created_at":"2024-03-15T10:30:45.123+02:00","customer_id":"customer_id_79","customer_name":"sample","has_activation_code":false,"id":"license_id_90","offline":false,"revoked_immediately":true,"status":"PENDING","validity_days":-123456789}', + body: '{"auto_issued":false,"created_at":"2024-03-15T10:30:45.123+02:00","customer_id":"customer_id_79","customer_name":"sample","has_activation_code":true,"id":"license_id_13","offline":true,"revoked_immediately":false,"status":"PENDING","validity_days":-2147483648}', }); await client.licenses.revoke( "license_id",