owostack 0.3.2 → 0.3.3
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.
- package/dist/index.js +38 -3
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -411,6 +411,40 @@ function buildSyncPayload(catalog, defaultProvider) {
|
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
413
|
}
|
|
414
|
+
for (const entry of catalog) {
|
|
415
|
+
if (entry._type !== "credit_system") continue;
|
|
416
|
+
for (const csFeature of entry.features) {
|
|
417
|
+
const featureSlug = csFeature.feature;
|
|
418
|
+
if (!featureMap.has(featureSlug)) {
|
|
419
|
+
const handle = _featureRegistry.get(featureSlug);
|
|
420
|
+
featureMap.set(featureSlug, {
|
|
421
|
+
slug: featureSlug,
|
|
422
|
+
type: "metered",
|
|
423
|
+
name: handle?.featureName || slugToName(featureSlug)
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
for (const entry of catalog) {
|
|
429
|
+
if (entry._type !== "plan") continue;
|
|
430
|
+
for (const f of entry.features) {
|
|
431
|
+
const csHandle = _creditSystemRegistry.get(f.slug);
|
|
432
|
+
if (csHandle) {
|
|
433
|
+
const def = csHandle._buildDefinition();
|
|
434
|
+
for (const csFeature of def.features) {
|
|
435
|
+
const featureSlug = csFeature.feature;
|
|
436
|
+
if (!featureMap.has(featureSlug)) {
|
|
437
|
+
const handle = _featureRegistry.get(featureSlug);
|
|
438
|
+
featureMap.set(featureSlug, {
|
|
439
|
+
slug: featureSlug,
|
|
440
|
+
type: "metered",
|
|
441
|
+
name: handle?.featureName || slugToName(featureSlug)
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
}
|
|
414
448
|
const creditSystems = catalog.filter((e) => e._type === "credit_system").map((cs) => ({
|
|
415
449
|
slug: cs.slug,
|
|
416
450
|
name: cs.name,
|
|
@@ -455,6 +489,7 @@ function buildSyncPayload(catalog, defaultProvider) {
|
|
|
455
489
|
enabled: f.enabled,
|
|
456
490
|
// Boolean features have no limit concept (null), metered features use limit from config
|
|
457
491
|
limit: f.featureType === "boolean" ? null : f.config?.limit ?? null,
|
|
492
|
+
trialLimit: f.featureType === "boolean" ? null : f.config?.trialLimit ?? null,
|
|
458
493
|
// Boolean features have no reset interval
|
|
459
494
|
...f.featureType !== "boolean" && {
|
|
460
495
|
reset: f.config?.reset || "monthly"
|
|
@@ -554,12 +589,12 @@ var Owostack = class {
|
|
|
554
589
|
return config.apiUrl;
|
|
555
590
|
}
|
|
556
591
|
if (config.mode === "sandbox") {
|
|
557
|
-
return "https://sandbox.owostack.com";
|
|
592
|
+
return "https://sandbox.owostack.com/v1";
|
|
558
593
|
}
|
|
559
594
|
if (config.mode === "live") {
|
|
560
|
-
return "https://api.owostack.com";
|
|
595
|
+
return "https://api.owostack.com/v1";
|
|
561
596
|
}
|
|
562
|
-
return "https://api.owostack.com";
|
|
597
|
+
return "https://api.owostack.com/v1";
|
|
563
598
|
}
|
|
564
599
|
/**
|
|
565
600
|
* Override the API key at runtime (used by CLI).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "owostack",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "Core SDK for Owostack billing infrastructure",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"payments"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@owostack/types": "0.3.
|
|
33
|
+
"@owostack/types": "0.3.3"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"tsup": "^8.3.6",
|