@remotion/licensing 4.0.531 → 4.0.533

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.
@@ -23,8 +23,10 @@ var internalRegisterUsageEvent = async ({
23
23
  event,
24
24
  isStill,
25
25
  isProduction,
26
- licenseKey
26
+ licenseKey,
27
+ idempotencyKey
27
28
  }) => {
29
+ const eventIdempotencyKey = idempotencyKey ?? globalThis.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random().toString(36).slice(2)}-${Math.random().toString(36).slice(2)}`;
28
30
  let lastError;
29
31
  const totalAttempts = DEFAULT_MAX_RETRIES + 1;
30
32
  for (let attempt = 1;attempt <= totalAttempts; attempt++) {
@@ -41,7 +43,8 @@ var internalRegisterUsageEvent = async ({
41
43
  host,
42
44
  succeeded,
43
45
  isStill,
44
- isProduction
46
+ isProduction,
47
+ idempotencyKey: eventIdempotencyKey
45
48
  }),
46
49
  headers: {
47
50
  "Content-Type": "application/json"
package/dist/index.d.ts CHANGED
@@ -1,14 +1,16 @@
1
1
  export { UsageEventClassification as Classification, registerUsageEvent, RegisterUsageEventResponse, } from './register-usage-event';
2
2
  export { EventCount, getUsage, GetUsageResponse } from './get-usage';
3
3
  export declare const LicensingInternals: {
4
- internalRegisterUsageEvent: ({ host, succeeded, event, isStill, isProduction, licenseKey, }: {
4
+ internalRegisterUsageEvent: ({ host, succeeded, event, isStill, isProduction, licenseKey, idempotencyKey, }: {
5
5
  host: string | null;
6
6
  succeeded: boolean;
7
7
  event: "cloud-render" | "web-render" | "webcodec-conversion";
8
- } & {
8
+ } & Omit<{
9
9
  isStill: boolean;
10
10
  isProduction: boolean;
11
- } & {
11
+ idempotencyKey: string;
12
+ }, "idempotencyKey"> & {
12
13
  licenseKey: string | null;
14
+ idempotencyKey?: string | null | undefined;
13
15
  }) => Promise<import("./register-usage-event").RegisterUsageEventResponse>;
14
16
  };
@@ -30,11 +30,14 @@ type RegisterUsageEventMandatoryOptions = {
30
30
  type OptionalRegisterUsageEventOptional = {
31
31
  isStill: boolean;
32
32
  isProduction: boolean;
33
+ /** Automatically generated when omitted and reused across request retries. */
34
+ idempotencyKey: string;
33
35
  };
34
- type InternalRegisterUsageEventOptions = RegisterUsageEventMandatoryOptions & OptionalRegisterUsageEventOptional & {
36
+ type InternalRegisterUsageEventOptions = RegisterUsageEventMandatoryOptions & Omit<OptionalRegisterUsageEventOptional, 'idempotencyKey'> & {
35
37
  licenseKey: string | null;
38
+ idempotencyKey?: string | null;
36
39
  };
37
40
  type RegisterUsageEventOptions = RegisterUsageEventMandatoryOptions & EitherApiKeyOrLicenseKey & Partial<OptionalRegisterUsageEventOptional>;
38
- export declare const internalRegisterUsageEvent: ({ host, succeeded, event, isStill, isProduction, licenseKey, }: InternalRegisterUsageEventOptions) => Promise<RegisterUsageEventResponse>;
41
+ export declare const internalRegisterUsageEvent: ({ host, succeeded, event, isStill, isProduction, licenseKey, idempotencyKey, }: InternalRegisterUsageEventOptions) => Promise<RegisterUsageEventResponse>;
39
42
  export declare const registerUsageEvent: (options: RegisterUsageEventOptions) => Promise<RegisterUsageEventResponse>;
40
43
  export {};
@@ -14,7 +14,13 @@ const sleep = (ms) => {
14
14
  });
15
15
  };
16
16
  exports.sleep = sleep;
17
- const internalRegisterUsageEvent = async ({ host, succeeded, event, isStill, isProduction, licenseKey, }) => {
17
+ const internalRegisterUsageEvent = async ({ host, succeeded, event, isStill, isProduction, licenseKey, idempotencyKey, }) => {
18
+ var _a, _b;
19
+ var _c;
20
+ // Reuse the same key for every retry, including requests whose response
21
+ // was lost after the server recorded the event. randomUUID is unavailable
22
+ // in browsers on insecure origins, so keep those environments working too.
23
+ const eventIdempotencyKey = (_c = idempotencyKey !== null && idempotencyKey !== void 0 ? idempotencyKey : (_b = (_a = globalThis.crypto) === null || _a === void 0 ? void 0 : _a.randomUUID) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : `${Date.now()}-${Math.random().toString(36).slice(2)}-${Math.random().toString(36).slice(2)}`;
18
24
  let lastError;
19
25
  const totalAttempts = DEFAULT_MAX_RETRIES + 1;
20
26
  for (let attempt = 1; attempt <= totalAttempts; attempt++) {
@@ -32,6 +38,7 @@ const internalRegisterUsageEvent = async ({ host, succeeded, event, isStill, isP
32
38
  succeeded,
33
39
  isStill,
34
40
  isProduction,
41
+ idempotencyKey: eventIdempotencyKey,
35
42
  }),
36
43
  headers: {
37
44
  'Content-Type': 'application/json',
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/licensing"
4
4
  },
5
5
  "name": "@remotion/licensing",
6
- "version": "4.0.531",
6
+ "version": "4.0.533",
7
7
  "description": "Manage your Remotion.pro license",
8
8
  "main": "dist",
9
9
  "scripts": {
@@ -24,10 +24,10 @@
24
24
  },
25
25
  "dependencies": {},
26
26
  "devDependencies": {
27
- "@remotion/eslint-config-internal": "4.0.531",
27
+ "@remotion/eslint-config-internal": "4.0.533",
28
28
  "eslint": "9.19.0",
29
29
  "msw": "2.12.7",
30
- "remotion": "4.0.531",
30
+ "remotion": "4.0.533",
31
31
  "@typescript/native-preview": "7.0.0-dev.20260217.1"
32
32
  },
33
33
  "homepage": "https://www.remotion.dev/docs/licensing",