@anvil-works/anvil-cli 0.8.0-canary.3 → 0.8.0-canary.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/cli.js +6 -20
- package/dist/componentTypeSpec.d.ts +1 -1
- package/dist/componentTypeSpec.d.ts.map +1 -1
- package/dist/index.js +6 -20
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -15863,7 +15863,8 @@ Promise.resolve(executeGitCredentialOperation(process.argv[2] || "get", {
|
|
|
15863
15863
|
if (PYTHON_KEYWORDS.has(value)) pushIssue(issues, path, "must be a valid Python identifier (not a keyword)");
|
|
15864
15864
|
}
|
|
15865
15865
|
const componentTypeSpec_IDENTIFIER_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
15866
|
-
const
|
|
15866
|
+
const LEGACY_CUSTOM_COMPONENT_SPEC_RE = /^form:(?:([^:]+):)?(.+)$/;
|
|
15867
|
+
const PACKAGE_QUALIFIED_FORM_NAME_RE = /^([^.]+)\.(.+)$/;
|
|
15867
15868
|
const componentTypeSpec_PYTHON_KEYWORDS = new Set([
|
|
15868
15869
|
"False",
|
|
15869
15870
|
"None",
|
|
@@ -15903,32 +15904,17 @@ Promise.resolve(executeGitCredentialOperation(process.argv[2] || "get", {
|
|
|
15903
15904
|
"match",
|
|
15904
15905
|
"case"
|
|
15905
15906
|
]);
|
|
15906
|
-
const LEGACY_FORM_TYPE_REFERENCE_MESSAGE = "must be a valid form: reference (form:Module.Form, form:dep_xxx:Package.Form)";
|
|
15907
|
+
const LEGACY_FORM_TYPE_REFERENCE_MESSAGE = "must be a valid form: reference (form:Module.Form, form:dep_xxx:Package.Form, form:APP_ID:Package.Form)";
|
|
15907
15908
|
const COMPONENT_TYPE_REFERENCE_MESSAGE = "must be a known Anvil component type (see componentIcons.ts), a form: reference, or a package-qualified form reference (Package.Form)";
|
|
15908
15909
|
function isValidIdentifierSegment(value) {
|
|
15909
15910
|
return value.length > 0 && componentTypeSpec_IDENTIFIER_RE.test(value) && !componentTypeSpec_PYTHON_KEYWORDS.has(value);
|
|
15910
15911
|
}
|
|
15911
15912
|
function isValidLegacyFormTypeReference(typeName) {
|
|
15912
|
-
|
|
15913
|
-
const rest = typeName.slice(5);
|
|
15914
|
-
if (0 === rest.length) return false;
|
|
15915
|
-
let classPath = rest;
|
|
15916
|
-
if (rest.startsWith("dep_")) {
|
|
15917
|
-
const splitIndex = rest.indexOf(":");
|
|
15918
|
-
if (splitIndex <= 0) return false;
|
|
15919
|
-
const depId = rest.slice(0, splitIndex);
|
|
15920
|
-
if (!DEP_ID_RE.test(depId)) return false;
|
|
15921
|
-
classPath = rest.slice(splitIndex + 1);
|
|
15922
|
-
}
|
|
15923
|
-
if (0 === classPath.length) return false;
|
|
15924
|
-
return classPath.split(".").every((part)=>isValidIdentifierSegment(part));
|
|
15913
|
+
return LEGACY_CUSTOM_COMPONENT_SPEC_RE.test(typeName);
|
|
15925
15914
|
}
|
|
15926
15915
|
function isValidPackageQualifiedComponentType(typeName) {
|
|
15927
15916
|
if (typeName.startsWith("anvil.")) return false;
|
|
15928
|
-
|
|
15929
|
-
const parts = typeName.split(".");
|
|
15930
|
-
if (parts.length < 2) return false;
|
|
15931
|
-
return parts.every((part)=>isValidIdentifierSegment(part));
|
|
15917
|
+
return PACKAGE_QUALIFIED_FORM_NAME_RE.test(typeName);
|
|
15932
15918
|
}
|
|
15933
15919
|
function componentTypeSpec_pushIssue(issues, path, message) {
|
|
15934
15920
|
issues.push({
|
|
@@ -16037,7 +16023,7 @@ Promise.resolve(executeGitCredentialOperation(process.argv[2] || "get", {
|
|
|
16037
16023
|
const bindingPath = `${path}[${index}]`;
|
|
16038
16024
|
if (!isPlainObject(binding)) return void formTemplateValidation_pushIssue(issues, bindingPath, "must be an object");
|
|
16039
16025
|
if ("string" != typeof binding.property || 0 === binding.property.length) formTemplateValidation_pushIssue(issues, `${bindingPath}.property`, "must be a non-empty string");
|
|
16040
|
-
if ("string" != typeof binding.code
|
|
16026
|
+
if ("string" != typeof binding.code) formTemplateValidation_pushIssue(issues, `${bindingPath}.code`, "must be a string");
|
|
16041
16027
|
if (void 0 !== binding.writeback && "boolean" != typeof binding.writeback) formTemplateValidation_pushIssue(issues, `${bindingPath}.writeback`, "must be a boolean");
|
|
16042
16028
|
});
|
|
16043
16029
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ValidationIssue } from "./validators";
|
|
2
|
-
export declare const LEGACY_FORM_TYPE_REFERENCE_MESSAGE = "must be a valid form: reference (form:Module.Form, form:dep_xxx:Package.Form)";
|
|
2
|
+
export declare const LEGACY_FORM_TYPE_REFERENCE_MESSAGE = "must be a valid form: reference (form:Module.Form, form:dep_xxx:Package.Form, form:APP_ID:Package.Form)";
|
|
3
3
|
export declare const COMPONENT_TYPE_REFERENCE_MESSAGE = "must be a known Anvil component type (see componentIcons.ts), a form: reference, or a package-qualified form reference (Package.Form)";
|
|
4
4
|
export declare function isValidLegacyFormTypeReference(typeName: string): boolean;
|
|
5
5
|
export declare function isValidPackageQualifiedComponentType(typeName: string): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"componentTypeSpec.d.ts","sourceRoot":"","sources":["../src/componentTypeSpec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"componentTypeSpec.d.ts","sourceRoot":"","sources":["../src/componentTypeSpec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AA8CpD,eAAO,MAAM,kCAAkC,4GAC8D,CAAC;AAE9G,eAAO,MAAM,gCAAgC,0IAC8F,CAAC;AAM5I,wBAAgB,8BAA8B,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAExE;AAED,wBAAgB,oCAAoC,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAK9E;AAED,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,EAAE,yBAAyB,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,OAAO,CAWlH;AAMD,wBAAgB,yBAAyB,CACrC,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,eAAe,EAAE,EACzB,yBAAyB,EAAE,WAAW,CAAC,MAAM,CAAC,QAwBjD"}
|
package/dist/index.js
CHANGED
|
@@ -15892,7 +15892,8 @@ Promise.resolve(executeGitCredentialOperation(process.argv[2] || "get", {
|
|
|
15892
15892
|
if (PYTHON_KEYWORDS.has(value)) pushIssue(issues, path, "must be a valid Python identifier (not a keyword)");
|
|
15893
15893
|
}
|
|
15894
15894
|
const componentTypeSpec_IDENTIFIER_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
15895
|
-
const
|
|
15895
|
+
const LEGACY_CUSTOM_COMPONENT_SPEC_RE = /^form:(?:([^:]+):)?(.+)$/;
|
|
15896
|
+
const PACKAGE_QUALIFIED_FORM_NAME_RE = /^([^.]+)\.(.+)$/;
|
|
15896
15897
|
const componentTypeSpec_PYTHON_KEYWORDS = new Set([
|
|
15897
15898
|
"False",
|
|
15898
15899
|
"None",
|
|
@@ -15932,32 +15933,17 @@ Promise.resolve(executeGitCredentialOperation(process.argv[2] || "get", {
|
|
|
15932
15933
|
"match",
|
|
15933
15934
|
"case"
|
|
15934
15935
|
]);
|
|
15935
|
-
const LEGACY_FORM_TYPE_REFERENCE_MESSAGE = "must be a valid form: reference (form:Module.Form, form:dep_xxx:Package.Form)";
|
|
15936
|
+
const LEGACY_FORM_TYPE_REFERENCE_MESSAGE = "must be a valid form: reference (form:Module.Form, form:dep_xxx:Package.Form, form:APP_ID:Package.Form)";
|
|
15936
15937
|
const COMPONENT_TYPE_REFERENCE_MESSAGE = "must be a known Anvil component type (see componentIcons.ts), a form: reference, or a package-qualified form reference (Package.Form)";
|
|
15937
15938
|
function isValidIdentifierSegment(value) {
|
|
15938
15939
|
return value.length > 0 && componentTypeSpec_IDENTIFIER_RE.test(value) && !componentTypeSpec_PYTHON_KEYWORDS.has(value);
|
|
15939
15940
|
}
|
|
15940
15941
|
function isValidLegacyFormTypeReference(typeName) {
|
|
15941
|
-
|
|
15942
|
-
const rest = typeName.slice(5);
|
|
15943
|
-
if (0 === rest.length) return false;
|
|
15944
|
-
let classPath = rest;
|
|
15945
|
-
if (rest.startsWith("dep_")) {
|
|
15946
|
-
const splitIndex = rest.indexOf(":");
|
|
15947
|
-
if (splitIndex <= 0) return false;
|
|
15948
|
-
const depId = rest.slice(0, splitIndex);
|
|
15949
|
-
if (!DEP_ID_RE.test(depId)) return false;
|
|
15950
|
-
classPath = rest.slice(splitIndex + 1);
|
|
15951
|
-
}
|
|
15952
|
-
if (0 === classPath.length) return false;
|
|
15953
|
-
return classPath.split(".").every((part)=>isValidIdentifierSegment(part));
|
|
15942
|
+
return LEGACY_CUSTOM_COMPONENT_SPEC_RE.test(typeName);
|
|
15954
15943
|
}
|
|
15955
15944
|
function isValidPackageQualifiedComponentType(typeName) {
|
|
15956
15945
|
if (typeName.startsWith("anvil.")) return false;
|
|
15957
|
-
|
|
15958
|
-
const parts = typeName.split(".");
|
|
15959
|
-
if (parts.length < 2) return false;
|
|
15960
|
-
return parts.every((part)=>isValidIdentifierSegment(part));
|
|
15946
|
+
return PACKAGE_QUALIFIED_FORM_NAME_RE.test(typeName);
|
|
15961
15947
|
}
|
|
15962
15948
|
function componentTypeSpec_pushIssue(issues, path, message) {
|
|
15963
15949
|
issues.push({
|
|
@@ -16066,7 +16052,7 @@ Promise.resolve(executeGitCredentialOperation(process.argv[2] || "get", {
|
|
|
16066
16052
|
const bindingPath = `${path}[${index}]`;
|
|
16067
16053
|
if (!isPlainObject(binding)) return void formTemplateValidation_pushIssue(issues, bindingPath, "must be an object");
|
|
16068
16054
|
if ("string" != typeof binding.property || 0 === binding.property.length) formTemplateValidation_pushIssue(issues, `${bindingPath}.property`, "must be a non-empty string");
|
|
16069
|
-
if ("string" != typeof binding.code
|
|
16055
|
+
if ("string" != typeof binding.code) formTemplateValidation_pushIssue(issues, `${bindingPath}.code`, "must be a string");
|
|
16070
16056
|
if (void 0 !== binding.writeback && "boolean" != typeof binding.writeback) formTemplateValidation_pushIssue(issues, `${bindingPath}.writeback`, "must be a boolean");
|
|
16071
16057
|
});
|
|
16072
16058
|
}
|