owosk 0.1.3 → 0.1.4
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 +17 -4
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -427,7 +427,8 @@ function generateConfig(plans, creditSystems = [], defaultProvider, format = "ts
|
|
|
427
427
|
featuresBySlug.set(f.slug, {
|
|
428
428
|
slug: f.slug,
|
|
429
429
|
name: f.name,
|
|
430
|
-
type: f.type || "metered"
|
|
430
|
+
type: f.type || "metered",
|
|
431
|
+
meterType: f.meterType
|
|
431
432
|
});
|
|
432
433
|
}
|
|
433
434
|
}
|
|
@@ -450,7 +451,9 @@ function generateConfig(plans, creditSystems = [], defaultProvider, format = "ts
|
|
|
450
451
|
const varName = slugToIdentifier(feature.slug, usedNames);
|
|
451
452
|
featureVars.set(feature.slug, varName);
|
|
452
453
|
const nameArg = feature.name ? `, { name: ${JSON.stringify(feature.name)} }` : "";
|
|
453
|
-
const
|
|
454
|
+
const isEntity = feature.meterType === "non_consumable";
|
|
455
|
+
const builder = feature.type === "boolean" ? "boolean" : isEntity ? "entity" : "metered";
|
|
456
|
+
const decl = `${builder}(${JSON.stringify(feature.slug)}${nameArg})`;
|
|
454
457
|
if (isCjs) {
|
|
455
458
|
featureLines.push(`const ${varName} = ${decl};`);
|
|
456
459
|
featureLines.push(`exports.${varName} = ${varName};`);
|
|
@@ -536,9 +539,13 @@ function generateConfig(plans, creditSystems = [], defaultProvider, format = "ts
|
|
|
536
539
|
featureEntries.push(`${varName}.config(${JSON.stringify(config2)})`);
|
|
537
540
|
continue;
|
|
538
541
|
}
|
|
542
|
+
const isEntityFeature = globalFeature?.meterType === "non_consumable";
|
|
539
543
|
const config = {};
|
|
540
544
|
if (pf.limit !== void 0) config.limit = pf.limit;
|
|
541
|
-
|
|
545
|
+
if (!isEntityFeature) {
|
|
546
|
+
const reset = pf.resetInterval || pf.reset || "monthly";
|
|
547
|
+
if (reset !== "none") config.reset = reset;
|
|
548
|
+
}
|
|
542
549
|
if (pf.overage) config.overage = pf.overage;
|
|
543
550
|
if (pf.overagePrice !== void 0) config.overagePrice = pf.overagePrice;
|
|
544
551
|
const configKeys = Object.keys(config);
|
|
@@ -564,9 +571,15 @@ function generateConfig(plans, creditSystems = [], defaultProvider, format = "ts
|
|
|
564
571
|
);
|
|
565
572
|
}
|
|
566
573
|
const hasCreditSystems = creditSystemLines.length > 0;
|
|
574
|
+
const hasEntities = Array.from(featuresBySlug.values()).some(
|
|
575
|
+
(f) => f.meterType === "non_consumable"
|
|
576
|
+
);
|
|
567
577
|
const providerLine = defaultProvider ? ` provider: ${JSON.stringify(defaultProvider)},
|
|
568
578
|
` : "";
|
|
569
|
-
const
|
|
579
|
+
const importParts = ["Owostack", "metered", "boolean"];
|
|
580
|
+
if (hasEntities) importParts.push("entity");
|
|
581
|
+
importParts.push("creditSystem", "plan");
|
|
582
|
+
const imports = isCjs ? `const { ${importParts.join(", ")} } = require("owostack");` : `import { ${importParts.join(", ")} } from "owostack";`;
|
|
570
583
|
const tsCheck = !isTs ? `// @ts-check` : "";
|
|
571
584
|
const jsDoc = !isTs ? `/** @type {import('owostack').Owostack} */` : "";
|
|
572
585
|
const owoDecl = isCjs ? "exports.owo =" : "export const owo =";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "owosk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "CLI for Owostack - sync catalog, manage billing infrastructure",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"commander": "^14.0.3",
|
|
25
25
|
"jiti": "^2.6.1",
|
|
26
26
|
"picocolors": "^1.1.1",
|
|
27
|
-
"@owostack/types": "0.1.
|
|
28
|
-
"owostack": "0.1.
|
|
27
|
+
"@owostack/types": "0.1.4",
|
|
28
|
+
"owostack": "0.1.4"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/node": "^22.19.10",
|