Skip to content

Commit 2aca3c8

Browse files
committed
fix license keys
1 parent 12b9610 commit 2aca3c8

File tree

3 files changed

+14
-18
lines changed

3 files changed

+14
-18
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "polar-migrate",
3-
"version": "0.1.3",
3+
"version": "0.1.4",
44
"license": "Apache-2.0",
55
"bin": "bin/cli.js",
66
"type": "module",
@@ -17,7 +17,7 @@
1717
"dependencies": {
1818
"@inkjs/ui": "^2.0.0",
1919
"@lemonsqueezy/lemonsqueezy.js": "^4.0.0",
20-
"@polar-sh/sdk": "^0.22.2",
20+
"@polar-sh/sdk": "^0.24.0",
2121
"@types/cross-spawn": "^6.0.6",
2222
"cross-spawn": "^7.0.3",
2323
"ink": "^4.4.1",

pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/product.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
import type { Polar } from "@polar-sh/sdk";
1111
import type { Timeframe } from "@polar-sh/sdk/models/components/benefitlicensekeyexpirationproperties.js";
1212
import type { BenefitLicenseKeyExpirationProperties } from "@polar-sh/sdk/models/components/benefitlicensekeyexpirationproperties.js";
13-
import type { Interval } from "@polar-sh/sdk/models/components/interval.js";
1413
import type { FileRead } from "@polar-sh/sdk/models/components/listresourcefileread.js";
1514
import type { Organization } from "@polar-sh/sdk/models/components/organization.js";
1615
import type { Product } from "@polar-sh/sdk/models/components/product.js";
@@ -24,21 +23,18 @@ import type { ProductRecurringCreate } from "@polar-sh/sdk/models/components/pro
2423
import mime from "mime-types";
2524
import { uploadFailedMessage, uploadMessage } from "./ui/upload.js";
2625
import { Upload } from "./upload.js";
26+
import type { SubscriptionRecurringInterval } from "@polar-sh/sdk/models/components/subscriptionrecurringinterval.js";
2727

2828
const resolveInterval = (
2929
interval: ListVariants["data"][number]["attributes"]["interval"],
30-
): Interval => {
30+
): SubscriptionRecurringInterval => {
3131
switch (interval) {
32-
case "day":
33-
return "day";
34-
case "week":
35-
return "week";
3632
case "month":
3733
return "month";
3834
case "year":
3935
return "year";
4036
default:
41-
throw new Error(`Unknown interval: ${interval}`);
37+
return "month";
4238
}
4339
};
4440

@@ -161,12 +157,12 @@ export const createProduct = async (
161157
expires: variant.attributes.is_license_length_unlimited
162158
? undefined
163159
: resolveLicenseKeyExpiration(variant),
164-
activations: variant.attributes.license_activation_limit
165-
? {
160+
activations: variant.attributes.is_license_limit_unlimited
161+
? undefined
162+
: {
166163
limit: variant.attributes.license_activation_limit,
167164
enableCustomerAdmin: true,
168-
}
169-
: undefined,
165+
},
170166
},
171167
organizationId: organization.id,
172168
});

0 commit comments

Comments
 (0)