@farthershore/product 0.4.0 → 0.5.0
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/bin.js +12 -6
- package/dist/index.js +8 -5
- package/dist/types/errors.d.ts +3 -3
- package/dist/types/ir-types.d.ts +1 -1
- package/dist/types/product.d.ts +2 -5
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -2423,10 +2423,13 @@ function hashIr(ir) {
|
|
|
2423
2423
|
}
|
|
2424
2424
|
|
|
2425
2425
|
// src/version.ts
|
|
2426
|
-
var SDK_VERSION = true ? "0.
|
|
2426
|
+
var SDK_VERSION = true ? "0.5.0" : "0.0.0-dev";
|
|
2427
2427
|
|
|
2428
2428
|
// src/product.ts
|
|
2429
2429
|
var PRODUCT_BRAND = Symbol.for("farthershore.product.product");
|
|
2430
|
+
var PRODUCT_MANIFEST_COMPILER = Symbol.for(
|
|
2431
|
+
"farthershore.product.manifestCompiler"
|
|
2432
|
+
);
|
|
2430
2433
|
function isCapabilityGrant(value) {
|
|
2431
2434
|
return typeof value === "object" && value !== null && value.kind === "capability_grant";
|
|
2432
2435
|
}
|
|
@@ -2484,7 +2487,7 @@ var Product = class {
|
|
|
2484
2487
|
frontend;
|
|
2485
2488
|
lifecycle;
|
|
2486
2489
|
offering;
|
|
2487
|
-
/** Escape hatches — raw platform-schema JSON, validated
|
|
2490
|
+
/** Escape hatches — raw platform-schema JSON, validated by the compiler. */
|
|
2488
2491
|
raw;
|
|
2489
2492
|
constructor(name, options) {
|
|
2490
2493
|
if (!name || typeof name !== "string") {
|
|
@@ -2887,9 +2890,9 @@ var Product = class {
|
|
|
2887
2890
|
resourceGraph() {
|
|
2888
2891
|
return this.graph.snapshot();
|
|
2889
2892
|
}
|
|
2890
|
-
/**
|
|
2891
|
-
*
|
|
2892
|
-
|
|
2893
|
+
/** @internal Internal platform compiler entrypoint. Builder code exports the
|
|
2894
|
+
* Product; the bot/CLI/build-runner decide when to compile and apply it. */
|
|
2895
|
+
[PRODUCT_MANIFEST_COMPILER]() {
|
|
2893
2896
|
const routes = this.materializeFeatureFiles();
|
|
2894
2897
|
this.assertRouteMeteringValid(routes);
|
|
2895
2898
|
this.assertGraphDependenciesSatisfied();
|
|
@@ -3358,6 +3361,9 @@ var Product = class {
|
|
|
3358
3361
|
function isProduct(value) {
|
|
3359
3362
|
return typeof value === "object" && value !== null && value[PRODUCT_BRAND] === true;
|
|
3360
3363
|
}
|
|
3364
|
+
function compileProductToManifest(product) {
|
|
3365
|
+
return product[PRODUCT_MANIFEST_COMPILER]();
|
|
3366
|
+
}
|
|
3361
3367
|
function isPlainObject(value) {
|
|
3362
3368
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3363
3369
|
}
|
|
@@ -3487,7 +3493,7 @@ async function main() {
|
|
|
3487
3493
|
process.exit(1);
|
|
3488
3494
|
}
|
|
3489
3495
|
try {
|
|
3490
|
-
const { ir, irHash } = candidate
|
|
3496
|
+
const { ir, irHash } = compileProductToManifest(candidate);
|
|
3491
3497
|
await writeFile(
|
|
3492
3498
|
resolve(process.cwd(), args.out),
|
|
3493
3499
|
`${JSON.stringify({ ir, irHash }, null, 2)}
|
package/dist/index.js
CHANGED
|
@@ -2418,10 +2418,13 @@ function canonicalIrJson(ir) {
|
|
|
2418
2418
|
}
|
|
2419
2419
|
|
|
2420
2420
|
// src/version.ts
|
|
2421
|
-
var SDK_VERSION = true ? "0.
|
|
2421
|
+
var SDK_VERSION = true ? "0.5.0" : "0.0.0-dev";
|
|
2422
2422
|
|
|
2423
2423
|
// src/product.ts
|
|
2424
2424
|
var PRODUCT_BRAND = Symbol.for("farthershore.product.product");
|
|
2425
|
+
var PRODUCT_MANIFEST_COMPILER = Symbol.for(
|
|
2426
|
+
"farthershore.product.manifestCompiler"
|
|
2427
|
+
);
|
|
2425
2428
|
function isCapabilityGrant(value) {
|
|
2426
2429
|
return typeof value === "object" && value !== null && value.kind === "capability_grant";
|
|
2427
2430
|
}
|
|
@@ -2479,7 +2482,7 @@ var Product = class {
|
|
|
2479
2482
|
frontend;
|
|
2480
2483
|
lifecycle;
|
|
2481
2484
|
offering;
|
|
2482
|
-
/** Escape hatches — raw platform-schema JSON, validated
|
|
2485
|
+
/** Escape hatches — raw platform-schema JSON, validated by the compiler. */
|
|
2483
2486
|
raw;
|
|
2484
2487
|
constructor(name, options) {
|
|
2485
2488
|
if (!name || typeof name !== "string") {
|
|
@@ -2882,9 +2885,9 @@ var Product = class {
|
|
|
2882
2885
|
resourceGraph() {
|
|
2883
2886
|
return this.graph.snapshot();
|
|
2884
2887
|
}
|
|
2885
|
-
/**
|
|
2886
|
-
*
|
|
2887
|
-
|
|
2888
|
+
/** @internal Internal platform compiler entrypoint. Builder code exports the
|
|
2889
|
+
* Product; the bot/CLI/build-runner decide when to compile and apply it. */
|
|
2890
|
+
[PRODUCT_MANIFEST_COMPILER]() {
|
|
2888
2891
|
const routes = this.materializeFeatureFiles();
|
|
2889
2892
|
this.assertRouteMeteringValid(routes);
|
|
2890
2893
|
this.assertGraphDependenciesSatisfied();
|
package/dist/types/errors.d.ts
CHANGED
|
@@ -5,9 +5,9 @@ export type ManifestIssue = {
|
|
|
5
5
|
message: string;
|
|
6
6
|
};
|
|
7
7
|
/**
|
|
8
|
-
* Thrown by
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* Thrown by the platform manifest compiler when the assembled manifest fails
|
|
9
|
+
* schema validation. Plain-data `issues` so the error survives serialization
|
|
10
|
+
* across the runner callback boundary.
|
|
11
11
|
*/
|
|
12
12
|
export declare class ManifestValidationError extends Error {
|
|
13
13
|
readonly issues: ManifestIssue[];
|
package/dist/types/ir-types.d.ts
CHANGED
|
@@ -321,7 +321,7 @@ export type ManifestIrDocument = {
|
|
|
321
321
|
migrations: null;
|
|
322
322
|
};
|
|
323
323
|
};
|
|
324
|
-
/**
|
|
324
|
+
/** Platform compiler result: the validated envelope plus its canonical hash. */
|
|
325
325
|
export type ManifestBuildResult = {
|
|
326
326
|
ir: ManifestIrDocument;
|
|
327
327
|
irHash: string;
|
package/dist/types/product.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CacheProfile, ActionSpecJson, CapabilityFileJson, FrontendComponentId, FrontendGateMode, FrontendManifestJson, GrantJson,
|
|
1
|
+
import type { CacheProfile, ActionSpecJson, CapabilityFileJson, FrontendComponentId, FrontendGateMode, FrontendManifestJson, GrantJson, MeterDefinitionJson, MigrationDeclJson, MigrationPinJson, MutationClass, CountedResourceJson, PlanLimitJson, PlanMeterJson, PlanSpecJson, PolicyFileJson, ProductPoliciesJson, ProductCustomerContextJson, ProductWorkflowKindJson, ProductWorkflowTriggerJson, ProductSurfaceTypeJson, RoutesFileJson } from "./ir-types.js";
|
|
2
2
|
import type { PriceSpec } from "./price.js";
|
|
3
3
|
import { type ManifestResourceGraphSnapshot } from "./resource-graph.js";
|
|
4
4
|
/** Brand symbol so the bin can recognize a Product across SDK copies
|
|
@@ -282,7 +282,7 @@ export declare class Product {
|
|
|
282
282
|
readonly offering: {
|
|
283
283
|
plan: (key: string, options: PlanOptions) => PlanRef;
|
|
284
284
|
};
|
|
285
|
-
/** Escape hatches — raw platform-schema JSON, validated
|
|
285
|
+
/** Escape hatches — raw platform-schema JSON, validated by the compiler. */
|
|
286
286
|
readonly raw: {
|
|
287
287
|
/** Deep-merged onto the emitted product spec (usage, webhooks,
|
|
288
288
|
* environments, add_ons, lifecycle, billing overrides, …). */
|
|
@@ -308,9 +308,6 @@ export declare class Product {
|
|
|
308
308
|
use(...modules: ProductModule[]): Product;
|
|
309
309
|
/** Inspect the SDK-local declaration graph used to emit the Manifest IR. */
|
|
310
310
|
resourceGraph(): ManifestResourceGraphSnapshot;
|
|
311
|
-
/** Assemble + validate the Manifest IR. Throws ManifestValidationError
|
|
312
|
-
* with structured issues when the declared state is invalid. */
|
|
313
|
-
toIR(): ManifestBuildResult;
|
|
314
311
|
private buildProductSpec;
|
|
315
312
|
private buildMeterDefinitions;
|
|
316
313
|
private routeValueMeterKeys;
|