@lunora/codegen 1.0.0-alpha.33 → 1.0.0-alpha.35
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.d.mts
CHANGED
|
@@ -1434,14 +1434,15 @@ interface IdentityClaimReadIR {
|
|
|
1434
1434
|
}
|
|
1435
1435
|
/**
|
|
1436
1436
|
* One payment webhook-adapter construction in `lunora/` (`createStripeAdapter` /
|
|
1437
|
-
* `createPolarAdapter`
|
|
1438
|
-
* `
|
|
1439
|
-
*
|
|
1440
|
-
* ceiling. Structurally
|
|
1437
|
+
* `createPolarAdapter` / `createAutumnAdapter` / `createDodoPaymentsAdapter`).
|
|
1438
|
+
* `toleranceSeconds` carries the statically-known `webhookToleranceSeconds`
|
|
1439
|
+
* replay window when it is a plain numeric literal; the payment-webhook
|
|
1440
|
+
* wide-tolerance lint fires when it exceeds a conservative ceiling. Structurally
|
|
1441
|
+
* identical to `AdvisorPaymentWebhook`.
|
|
1441
1442
|
*/
|
|
1442
1443
|
interface PaymentWebhookIR {
|
|
1443
1444
|
/** The adapter factory invoked. */
|
|
1444
|
-
callee: "createPolarAdapter" | "createStripeAdapter";
|
|
1445
|
+
callee: "createAutumnAdapter" | "createDodoPaymentsAdapter" | "createPolarAdapter" | "createStripeAdapter";
|
|
1445
1446
|
/** Export binding name of the enclosing declaration (`<module>` at file scope). */
|
|
1446
1447
|
exportName: string;
|
|
1447
1448
|
/** Source file relative to `<projectRoot>/lunora/`, without extension. */
|
package/dist/index.d.ts
CHANGED
|
@@ -1434,14 +1434,15 @@ interface IdentityClaimReadIR {
|
|
|
1434
1434
|
}
|
|
1435
1435
|
/**
|
|
1436
1436
|
* One payment webhook-adapter construction in `lunora/` (`createStripeAdapter` /
|
|
1437
|
-
* `createPolarAdapter`
|
|
1438
|
-
* `
|
|
1439
|
-
*
|
|
1440
|
-
* ceiling. Structurally
|
|
1437
|
+
* `createPolarAdapter` / `createAutumnAdapter` / `createDodoPaymentsAdapter`).
|
|
1438
|
+
* `toleranceSeconds` carries the statically-known `webhookToleranceSeconds`
|
|
1439
|
+
* replay window when it is a plain numeric literal; the payment-webhook
|
|
1440
|
+
* wide-tolerance lint fires when it exceeds a conservative ceiling. Structurally
|
|
1441
|
+
* identical to `AdvisorPaymentWebhook`.
|
|
1441
1442
|
*/
|
|
1442
1443
|
interface PaymentWebhookIR {
|
|
1443
1444
|
/** The adapter factory invoked. */
|
|
1444
|
-
callee: "createPolarAdapter" | "createStripeAdapter";
|
|
1445
|
+
callee: "createAutumnAdapter" | "createDodoPaymentsAdapter" | "createPolarAdapter" | "createStripeAdapter";
|
|
1445
1446
|
/** Export binding name of the enclosing declaration (`<module>` at file scope). */
|
|
1446
1447
|
exportName: string;
|
|
1447
1448
|
/** Source file relative to `<projectRoot>/lunora/`, without extension. */
|
package/dist/index.mjs
CHANGED
|
@@ -23,7 +23,7 @@ export { G as GENERATED_HEADER, e as emitApi, a as emitCollections, b as emitCon
|
|
|
23
23
|
export { emitApp } from './packem_shared/emitApp-nQ2oC-8G.mjs';
|
|
24
24
|
export { buildOpenApiDocument, emitOpenApi, emitOpenApiModule } from './packem_shared/buildOpenApiDocument-bp1pYSV6.mjs';
|
|
25
25
|
export { OPENRPC_VERSION, buildOpenRpcDocument, emitOpenRpc, emitOpenRpcModule } from './packem_shared/OPENRPC_VERSION-4YIeMkOI.mjs';
|
|
26
|
-
export { SCHEMA_SNAPSHOT_FILENAME, createCodegenProject, refreshCodegenProject, runCodegen } from './packem_shared/SCHEMA_SNAPSHOT_FILENAME-
|
|
26
|
+
export { SCHEMA_SNAPSHOT_FILENAME, createCodegenProject, refreshCodegenProject, runCodegen } from './packem_shared/SCHEMA_SNAPSHOT_FILENAME-C6Q0h0O5.mjs';
|
|
27
27
|
export { SCHEMA_SNAPSHOT_VERSION, SchemaSnapshotParseError, buildSchemaSnapshot, diffSchemaSnapshots, evaluateSchemaDrift, parseSchemaSnapshot, serializeSchemaSnapshot } from './packem_shared/SCHEMA_SNAPSHOT_VERSION-D0ARY6rL.mjs';
|
|
28
28
|
export { schemaFromIr } from './packem_shared/schemaFromIr-DTYsLBaA.mjs';
|
|
29
29
|
export { LUNORA_ERROR_CODES, validatorIrToJsonSchema } from './packem_shared/LUNORA_ERROR_CODES-CySpQPD3.mjs';
|
|
@@ -644,47 +644,53 @@ const discoverAuthConfig = (project, lunoraDirectory) => {
|
|
|
644
644
|
return rows;
|
|
645
645
|
};
|
|
646
646
|
|
|
647
|
-
const
|
|
648
|
-
const browserUrlMethod = (node) => {
|
|
647
|
+
const sinkMethod = (node, config) => {
|
|
649
648
|
if (!Node.isPropertyAccessExpression(node)) {
|
|
650
649
|
return void 0;
|
|
651
650
|
}
|
|
652
651
|
const method = node.getName();
|
|
653
|
-
if (!
|
|
652
|
+
if (!config.methods.has(method)) {
|
|
654
653
|
return void 0;
|
|
655
654
|
}
|
|
656
|
-
return method;
|
|
655
|
+
return config.matchReceiver(node.getExpression().getText()) ? method : void 0;
|
|
657
656
|
};
|
|
658
|
-
const
|
|
659
|
-
const method =
|
|
657
|
+
const accessInCall = (call, relativePath, config) => {
|
|
658
|
+
const method = sinkMethod(call.getExpression(), config);
|
|
660
659
|
if (method === void 0) {
|
|
661
660
|
return void 0;
|
|
662
661
|
}
|
|
663
|
-
const
|
|
664
|
-
if (!
|
|
662
|
+
const key = call.getArguments()[config.argIndex];
|
|
663
|
+
if (!key || !isArgumentDerived(key) || isScopedByContext(key)) {
|
|
665
664
|
return void 0;
|
|
666
665
|
}
|
|
667
666
|
return { exportName: enclosingExportName$1(call), file: relativePath, line: call.getStartLineNumber(), method };
|
|
668
667
|
};
|
|
669
|
-
const
|
|
668
|
+
const accessesInSourceFile = (sourceFile, relativePath, config) => {
|
|
670
669
|
const found = [];
|
|
671
670
|
for (const call of sourceFile.getDescendantsOfKind(SyntaxKind.CallExpression)) {
|
|
672
|
-
const
|
|
673
|
-
if (
|
|
674
|
-
found.push(
|
|
671
|
+
const access = accessInCall(call, relativePath, config);
|
|
672
|
+
if (access) {
|
|
673
|
+
found.push(access);
|
|
675
674
|
}
|
|
676
675
|
}
|
|
677
676
|
return found;
|
|
678
677
|
};
|
|
679
|
-
const
|
|
680
|
-
const
|
|
678
|
+
const discoverArgumentDerivedAccesses = (project, lunoraDirectory, config) => {
|
|
679
|
+
const accesses = [];
|
|
681
680
|
for (const filePath of listLunoraSourceFiles(lunoraDirectory)) {
|
|
682
681
|
const sourceFile = project.getSourceFile(filePath) ?? project.addSourceFileAtPath(filePath);
|
|
683
|
-
|
|
682
|
+
accesses.push(...accessesInSourceFile(sourceFile, lunoraRelativePath(lunoraDirectory, filePath), config));
|
|
684
683
|
}
|
|
685
|
-
return
|
|
684
|
+
return accesses;
|
|
686
685
|
};
|
|
687
686
|
|
|
687
|
+
const BROWSER_URL_METHODS = /* @__PURE__ */ new Set(["content", "pdf", "scrape", "screenshot"]);
|
|
688
|
+
const discoverBrowserUrlAccesses = (project, lunoraDirectory) => discoverArgumentDerivedAccesses(project, lunoraDirectory, {
|
|
689
|
+
argIndex: 0,
|
|
690
|
+
matchReceiver: (receiver) => receiver === "ctx.browser",
|
|
691
|
+
methods: BROWSER_URL_METHODS
|
|
692
|
+
});
|
|
693
|
+
|
|
688
694
|
const FUNCTION_CALLEES = /* @__PURE__ */ new Set(["createBrowser", "createInboundEmailHandler", "createPayment"]);
|
|
689
695
|
const CONSTRUCTOR_CALLEES = /* @__PURE__ */ new Set(["RateLimiter"]);
|
|
690
696
|
const CALLBACK_CALLEES = /* @__PURE__ */ new Set(["extend"]);
|
|
@@ -774,50 +780,18 @@ const discoverConfigCalls = (project, lunoraDirectory) => {
|
|
|
774
780
|
};
|
|
775
781
|
|
|
776
782
|
const CONTAINER_ACCESSOR_PREFIX = "ctx.containers.";
|
|
777
|
-
const
|
|
778
|
-
if (!Node.isPropertyAccessExpression(node)) {
|
|
779
|
-
return void 0;
|
|
780
|
-
}
|
|
781
|
-
const method = node.getName();
|
|
782
|
-
if (method !== "get") {
|
|
783
|
-
return void 0;
|
|
784
|
-
}
|
|
785
|
-
const receiver = node.getExpression().getText();
|
|
783
|
+
const isContainerInstanceReceiver = (receiver) => {
|
|
786
784
|
if (!receiver.startsWith(CONTAINER_ACCESSOR_PREFIX)) {
|
|
787
|
-
return
|
|
785
|
+
return false;
|
|
788
786
|
}
|
|
789
787
|
const remainder = receiver.slice(CONTAINER_ACCESSOR_PREFIX.length);
|
|
790
|
-
return remainder.length > 0 && !remainder.includes(".")
|
|
791
|
-
};
|
|
792
|
-
const containerAccessInCall = (call, relativePath) => {
|
|
793
|
-
const method = containerGetMethod(call.getExpression());
|
|
794
|
-
if (method === void 0) {
|
|
795
|
-
return void 0;
|
|
796
|
-
}
|
|
797
|
-
const key = call.getArguments()[0];
|
|
798
|
-
if (!key || !isArgumentDerived(key) || isScopedByContext(key)) {
|
|
799
|
-
return void 0;
|
|
800
|
-
}
|
|
801
|
-
return { exportName: enclosingExportName$1(call), file: relativePath, line: call.getStartLineNumber(), method };
|
|
802
|
-
};
|
|
803
|
-
const containerAccessesInSourceFile = (sourceFile, relativePath) => {
|
|
804
|
-
const found = [];
|
|
805
|
-
for (const call of sourceFile.getDescendantsOfKind(SyntaxKind.CallExpression)) {
|
|
806
|
-
const access = containerAccessInCall(call, relativePath);
|
|
807
|
-
if (access) {
|
|
808
|
-
found.push(access);
|
|
809
|
-
}
|
|
810
|
-
}
|
|
811
|
-
return found;
|
|
812
|
-
};
|
|
813
|
-
const discoverContainerKeyAccesses = (project, lunoraDirectory) => {
|
|
814
|
-
const accesses = [];
|
|
815
|
-
for (const filePath of listLunoraSourceFiles(lunoraDirectory)) {
|
|
816
|
-
const sourceFile = project.getSourceFile(filePath) ?? project.addSourceFileAtPath(filePath);
|
|
817
|
-
accesses.push(...containerAccessesInSourceFile(sourceFile, lunoraRelativePath(lunoraDirectory, filePath)));
|
|
818
|
-
}
|
|
819
|
-
return accesses;
|
|
788
|
+
return remainder.length > 0 && !remainder.includes(".");
|
|
820
789
|
};
|
|
790
|
+
const discoverContainerKeyAccesses = (project, lunoraDirectory) => discoverArgumentDerivedAccesses(project, lunoraDirectory, {
|
|
791
|
+
argIndex: 0,
|
|
792
|
+
matchReceiver: isContainerInstanceReceiver,
|
|
793
|
+
methods: /* @__PURE__ */ new Set(["get"])
|
|
794
|
+
});
|
|
821
795
|
|
|
822
796
|
const EGRESS_MUTATING_METHODS = /* @__PURE__ */ new Set(["allow", "deny", "setAllowed"]);
|
|
823
797
|
const hasEnableInternetTrue = (call) => {
|
|
@@ -1646,46 +1620,11 @@ const discoverImageDeliveryUrlAccesses = (project, lunoraDirectory) => {
|
|
|
1646
1620
|
};
|
|
1647
1621
|
|
|
1648
1622
|
const KV_KEY_METHODS = /* @__PURE__ */ new Set(["delete", "get", "getRaw", "getWithMetadata", "put"]);
|
|
1649
|
-
const
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
if (!KV_KEY_METHODS.has(method)) {
|
|
1655
|
-
return void 0;
|
|
1656
|
-
}
|
|
1657
|
-
const receiver = node.getExpression().getText();
|
|
1658
|
-
return receiver === "ctx.kv" || receiver.startsWith("ctx.kv.") ? method : void 0;
|
|
1659
|
-
};
|
|
1660
|
-
const kvAccessInCall = (call, relativePath) => {
|
|
1661
|
-
const method = kvKeyMethod(call.getExpression());
|
|
1662
|
-
if (method === void 0) {
|
|
1663
|
-
return void 0;
|
|
1664
|
-
}
|
|
1665
|
-
const key = call.getArguments()[0];
|
|
1666
|
-
if (!key || !isArgumentDerived(key) || isScopedByContext(key)) {
|
|
1667
|
-
return void 0;
|
|
1668
|
-
}
|
|
1669
|
-
return { exportName: enclosingExportName$1(call), file: relativePath, line: call.getStartLineNumber(), method };
|
|
1670
|
-
};
|
|
1671
|
-
const kvAccessesInSourceFile = (sourceFile, relativePath) => {
|
|
1672
|
-
const found = [];
|
|
1673
|
-
for (const call of sourceFile.getDescendantsOfKind(SyntaxKind.CallExpression)) {
|
|
1674
|
-
const access = kvAccessInCall(call, relativePath);
|
|
1675
|
-
if (access) {
|
|
1676
|
-
found.push(access);
|
|
1677
|
-
}
|
|
1678
|
-
}
|
|
1679
|
-
return found;
|
|
1680
|
-
};
|
|
1681
|
-
const discoverKvKeyAccesses = (project, lunoraDirectory) => {
|
|
1682
|
-
const accesses = [];
|
|
1683
|
-
for (const filePath of listLunoraSourceFiles(lunoraDirectory)) {
|
|
1684
|
-
const sourceFile = project.getSourceFile(filePath) ?? project.addSourceFileAtPath(filePath);
|
|
1685
|
-
accesses.push(...kvAccessesInSourceFile(sourceFile, lunoraRelativePath(lunoraDirectory, filePath)));
|
|
1686
|
-
}
|
|
1687
|
-
return accesses;
|
|
1688
|
-
};
|
|
1623
|
+
const discoverKvKeyAccesses = (project, lunoraDirectory) => discoverArgumentDerivedAccesses(project, lunoraDirectory, {
|
|
1624
|
+
argIndex: 0,
|
|
1625
|
+
matchReceiver: (receiver) => receiver === "ctx.kv" || receiver.startsWith("ctx.kv."),
|
|
1626
|
+
methods: KV_KEY_METHODS
|
|
1627
|
+
});
|
|
1689
1628
|
|
|
1690
1629
|
const MAIL_METHODS = /* @__PURE__ */ new Set(["queue", "send"]);
|
|
1691
1630
|
const RECIPIENT_FIELDS = /* @__PURE__ */ new Set(["bcc", "cc", "to"]);
|
|
@@ -2081,7 +2020,7 @@ const discoverPackageDependencies = (projectRoot) => {
|
|
|
2081
2020
|
}
|
|
2082
2021
|
};
|
|
2083
2022
|
|
|
2084
|
-
const WEBHOOK_ADAPTER_CALLEES = /* @__PURE__ */ new Set(["createPolarAdapter", "createStripeAdapter"]);
|
|
2023
|
+
const WEBHOOK_ADAPTER_CALLEES = /* @__PURE__ */ new Set(["createAutumnAdapter", "createDodoPaymentsAdapter", "createPolarAdapter", "createStripeAdapter"]);
|
|
2085
2024
|
const numericLiteralValue$1 = (node) => node && Node.isNumericLiteral(node) ? Number(node.getText()) : void 0;
|
|
2086
2025
|
const toleranceFromOptions = (objectLiteral) => {
|
|
2087
2026
|
const property = objectLiteral.getProperty("webhookToleranceSeconds");
|
|
@@ -2949,46 +2888,11 @@ const KEY_TAKING_METHODS = /* @__PURE__ */ new Set([
|
|
|
2949
2888
|
"store",
|
|
2950
2889
|
"upload"
|
|
2951
2890
|
]);
|
|
2952
|
-
const
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
if (!KEY_TAKING_METHODS.has(method)) {
|
|
2958
|
-
return void 0;
|
|
2959
|
-
}
|
|
2960
|
-
const receiver = node.getExpression().getText();
|
|
2961
|
-
return receiver === "ctx.storage" || receiver.startsWith("ctx.storage.") ? method : void 0;
|
|
2962
|
-
};
|
|
2963
|
-
const storageKeyInCall = (call, relativePath) => {
|
|
2964
|
-
const method = storageKeyMethod(call.getExpression());
|
|
2965
|
-
if (method === void 0) {
|
|
2966
|
-
return void 0;
|
|
2967
|
-
}
|
|
2968
|
-
const key = call.getArguments()[0];
|
|
2969
|
-
if (!key || !isArgumentDerived(key) || isScopedByContext(key)) {
|
|
2970
|
-
return void 0;
|
|
2971
|
-
}
|
|
2972
|
-
return { exportName: enclosingExportName$1(call), file: relativePath, line: call.getStartLineNumber(), method };
|
|
2973
|
-
};
|
|
2974
|
-
const storageKeyAccessesInSourceFile = (sourceFile, relativePath) => {
|
|
2975
|
-
const found = [];
|
|
2976
|
-
for (const call of sourceFile.getDescendantsOfKind(SyntaxKind.CallExpression)) {
|
|
2977
|
-
const access = storageKeyInCall(call, relativePath);
|
|
2978
|
-
if (access) {
|
|
2979
|
-
found.push(access);
|
|
2980
|
-
}
|
|
2981
|
-
}
|
|
2982
|
-
return found;
|
|
2983
|
-
};
|
|
2984
|
-
const discoverStorageKeyAccesses = (project, lunoraDirectory) => {
|
|
2985
|
-
const accesses = [];
|
|
2986
|
-
for (const filePath of listLunoraSourceFiles(lunoraDirectory)) {
|
|
2987
|
-
const sourceFile = project.getSourceFile(filePath) ?? project.addSourceFileAtPath(filePath);
|
|
2988
|
-
accesses.push(...storageKeyAccessesInSourceFile(sourceFile, lunoraRelativePath(lunoraDirectory, filePath)));
|
|
2989
|
-
}
|
|
2990
|
-
return accesses;
|
|
2991
|
-
};
|
|
2891
|
+
const discoverStorageKeyAccesses = (project, lunoraDirectory) => discoverArgumentDerivedAccesses(project, lunoraDirectory, {
|
|
2892
|
+
argIndex: 0,
|
|
2893
|
+
matchReceiver: (receiver) => receiver === "ctx.storage" || receiver.startsWith("ctx.storage."),
|
|
2894
|
+
methods: KEY_TAKING_METHODS
|
|
2895
|
+
});
|
|
2992
2896
|
|
|
2993
2897
|
const OPTIONS_ARGUMENT_INDEX = /* @__PURE__ */ new Map([
|
|
2994
2898
|
["generateUploadUrl", 1],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/codegen",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.35",
|
|
4
4
|
"description": "Code generator for Lunora: emits _generated/{api,server,dataModel}.ts from your schema",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -46,13 +46,13 @@
|
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@lunora/advisor": "1.0.0-alpha.
|
|
50
|
-
"@lunora/container": "1.0.0-alpha.
|
|
51
|
-
"@lunora/errors": "1.0.0-alpha.
|
|
52
|
-
"@lunora/queue": "1.0.0-alpha.
|
|
53
|
-
"@lunora/scheduler": "1.0.0-alpha.
|
|
54
|
-
"@lunora/values": "1.0.0-alpha.
|
|
55
|
-
"@lunora/workflow": "1.0.0-alpha.
|
|
49
|
+
"@lunora/advisor": "1.0.0-alpha.21",
|
|
50
|
+
"@lunora/container": "1.0.0-alpha.7",
|
|
51
|
+
"@lunora/errors": "1.0.0-alpha.2",
|
|
52
|
+
"@lunora/queue": "1.0.0-alpha.5",
|
|
53
|
+
"@lunora/scheduler": "1.0.0-alpha.6",
|
|
54
|
+
"@lunora/values": "1.0.0-alpha.5",
|
|
55
|
+
"@lunora/workflow": "1.0.0-alpha.7",
|
|
56
56
|
"ts-morph": "^28.0.0"
|
|
57
57
|
},
|
|
58
58
|
"engines": {
|