@jay-framework/compiler-shared 0.15.4 → 0.15.5

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.ts CHANGED
@@ -129,9 +129,10 @@ declare enum JayTypeKind {
129
129
  object = 8,
130
130
  array = 9,
131
131
  union = 10,
132
- promise = 11,
133
- recursive = 12,
134
- optional = 13
132
+ record = 11,
133
+ promise = 12,
134
+ recursive = 13,
135
+ optional = 14
135
136
  }
136
137
  interface JayType {
137
138
  name: string;
@@ -157,6 +158,7 @@ declare class JayEnumType implements JayType {
157
158
  readonly name: string;
158
159
  readonly values: Array<string>;
159
160
  constructor(name: string, values: Array<string>);
161
+ alias?: string;
160
162
  readonly kind = JayTypeKind.enum;
161
163
  }
162
164
  declare class JayHTMLType implements JayType {
@@ -209,6 +211,12 @@ declare class JayArrayType implements JayType {
209
211
  get name(): string;
210
212
  readonly kind = JayTypeKind.array;
211
213
  }
214
+ declare class JayRecordType implements JayType {
215
+ readonly itemType: JayType;
216
+ constructor(itemType: JayType);
217
+ get name(): string;
218
+ readonly kind = JayTypeKind.record;
219
+ }
212
220
  declare class JayUnionType implements JayType {
213
221
  readonly ofTypes: JayType[];
214
222
  constructor(ofTypes: JayType[]);
@@ -247,6 +255,7 @@ declare function isElementType(aType: JayType): aType is JayElementType;
247
255
  declare function isComponentType(aType: JayType): aType is JayComponentType;
248
256
  declare function isObjectType(aType: JayType): aType is JayObjectType;
249
257
  declare function isArrayType(aType: JayType): aType is JayArrayType;
258
+ declare function isRecordType(aType: JayType): aType is JayRecordType;
250
259
  declare function isUnionType(aType: JayType): aType is JayUnionType;
251
260
  declare function isPromiseType(aType: JayType): aType is JayPromiseType;
252
261
  declare function isRecursiveType(aType: JayType): aType is JayRecursiveType;
@@ -269,6 +278,7 @@ interface JsonSchemaProperty {
269
278
  description?: string;
270
279
  enum?: string[];
271
280
  items?: JsonSchemaProperty;
281
+ additionalProperties?: JsonSchemaProperty;
272
282
  properties?: Record<string, JsonSchemaProperty>;
273
283
  required?: string[];
274
284
  }
@@ -739,4 +749,4 @@ declare function compileForEachInstanceKeyExpr(coordinateSuffix: string, trackBy
739
749
  */
740
750
  declare function computeForEachInstanceKey(trackByValue: string, coordinateSuffix: string): string;
741
751
 
742
- export { type ActionManifestEntry, CSS_EXTENSION, type CompilerSourceFile, type DynamicContractConfig, GenerateTarget, type GenericTypescriptSourceFile, Import, type ImportName, type ImportedRefsTree, Imports, ImportsFor, JAY_4_REACT, JAY_ACTION_DTS_EXTENSION, JAY_ACTION_EXTENSION, JAY_COMPONENT, JAY_CONTRACT_DTS_EXTENSION, JAY_CONTRACT_EXTENSION, JAY_DTS_EXTENSION, JAY_EXTENSION, JAY_FULLSTACK_COMPONENTS, JAY_QUERY_CLIENT, JAY_QUERY_HYDRATE, JAY_QUERY_MAIN_SANDBOX, JAY_QUERY_MAIN_SANDBOX_TS, JAY_QUERY_PREFIX, JAY_QUERY_SERVER, JAY_QUERY_WORKER_SANDBOX, JAY_QUERY_WORKER_SANDBOX_TS, JAY_QUERY_WORKER_TRUSTED, JAY_QUERY_WORKER_TRUSTED_TS, JAY_RUNTIME, JAY_SECURE, JAY_SSR_RUNTIME, JAY_STACK_CLIENT_RUNTIME, JAY_TS_EXTENSION, JayArrayType, JayAtomicType, JayBoolean, JayBuildEnvironment, JayComponentApiMember, JayComponentType, JayDate, JayElementConstructorType, JayElementType, JayEnumType, type JayEnvironment, JayErrorType, JayHTMLType, type JayImportLink, type JayImportName, JayImportedType, JayNumber, JayObjectType, JayOptionalType, JayPromiseType, JayRecursiveType, JayString, type JayType, JayTypeAlias, JayTypeKind, JayUnionType, JayUnknown, type JayValidations, type JsonSchemaProperty, LOCAL_PLUGIN_PATH, MAKE_JAY_4_REACT_COMPONENT, MAKE_JAY_COMPONENT, MAKE_JAY_TSX_COMPONENT, type MainRuntimeModes, type ParsedJayModuleSpecifier, type PluginComponentResolution, type PluginInitConfig, type PluginManifest, REACT, type RecursiveRegion, type Ref, type RefsTree, RenderFragment, RuntimeMode, SourceFileFormat, TSX_EXTENSION, TS_EXTENSION, WithValidations, addBuildEnvironment, checkValidationErrors, compileCoordinateExpr, compileForEachInstanceKeyExpr, computeForEachInstanceKey, computeInstanceKey, equalJayTypes, findDynamicContract, getBasePath, getBuildEnvironment, getJayTsFileSourcePath, getMode, getModeFileExtension, getModeFromExtension, hasBuildEnvironment, hasExtension, hasJayExtension, hasJayModeExtension, hasRefs, isArrayType, isAtomicType, isComponentType, isCurrencyType, isDateWithTimezoneType, isElementConstructorType, isElementType, isEnumType, isHTMLType, isImportedType, isLocalModule, isObjectType, isOptionalType, isPromiseType, isRecursiveType, isStaticCoordinate, isTypeAliasType, isUnionType, jayTypeToJsonSchema, loadPluginManifest, mergeRefsTrees, mkRef, mkRefsTree, nestRefs, normalizeActionEntry, parseJayModuleSpecifier, prettify, prettifyHtml, removeComments, resolvePluginComponent, resolvePluginManifest, resolvePrimitiveType, withOriginalTrace, withoutExtension };
752
+ export { type ActionManifestEntry, CSS_EXTENSION, type CompilerSourceFile, type DynamicContractConfig, GenerateTarget, type GenericTypescriptSourceFile, Import, type ImportName, type ImportedRefsTree, Imports, ImportsFor, JAY_4_REACT, JAY_ACTION_DTS_EXTENSION, JAY_ACTION_EXTENSION, JAY_COMPONENT, JAY_CONTRACT_DTS_EXTENSION, JAY_CONTRACT_EXTENSION, JAY_DTS_EXTENSION, JAY_EXTENSION, JAY_FULLSTACK_COMPONENTS, JAY_QUERY_CLIENT, JAY_QUERY_HYDRATE, JAY_QUERY_MAIN_SANDBOX, JAY_QUERY_MAIN_SANDBOX_TS, JAY_QUERY_PREFIX, JAY_QUERY_SERVER, JAY_QUERY_WORKER_SANDBOX, JAY_QUERY_WORKER_SANDBOX_TS, JAY_QUERY_WORKER_TRUSTED, JAY_QUERY_WORKER_TRUSTED_TS, JAY_RUNTIME, JAY_SECURE, JAY_SSR_RUNTIME, JAY_STACK_CLIENT_RUNTIME, JAY_TS_EXTENSION, JayArrayType, JayAtomicType, JayBoolean, JayBuildEnvironment, JayComponentApiMember, JayComponentType, JayDate, JayElementConstructorType, JayElementType, JayEnumType, type JayEnvironment, JayErrorType, JayHTMLType, type JayImportLink, type JayImportName, JayImportedType, JayNumber, JayObjectType, JayOptionalType, JayPromiseType, JayRecordType, JayRecursiveType, JayString, type JayType, JayTypeAlias, JayTypeKind, JayUnionType, JayUnknown, type JayValidations, type JsonSchemaProperty, LOCAL_PLUGIN_PATH, MAKE_JAY_4_REACT_COMPONENT, MAKE_JAY_COMPONENT, MAKE_JAY_TSX_COMPONENT, type MainRuntimeModes, type ParsedJayModuleSpecifier, type PluginComponentResolution, type PluginInitConfig, type PluginManifest, REACT, type RecursiveRegion, type Ref, type RefsTree, RenderFragment, RuntimeMode, SourceFileFormat, TSX_EXTENSION, TS_EXTENSION, WithValidations, addBuildEnvironment, checkValidationErrors, compileCoordinateExpr, compileForEachInstanceKeyExpr, computeForEachInstanceKey, computeInstanceKey, equalJayTypes, findDynamicContract, getBasePath, getBuildEnvironment, getJayTsFileSourcePath, getMode, getModeFileExtension, getModeFromExtension, hasBuildEnvironment, hasExtension, hasJayExtension, hasJayModeExtension, hasRefs, isArrayType, isAtomicType, isComponentType, isCurrencyType, isDateWithTimezoneType, isElementConstructorType, isElementType, isEnumType, isHTMLType, isImportedType, isLocalModule, isObjectType, isOptionalType, isPromiseType, isRecordType, isRecursiveType, isStaticCoordinate, isTypeAliasType, isUnionType, jayTypeToJsonSchema, loadPluginManifest, mergeRefsTrees, mkRef, mkRefsTree, nestRefs, normalizeActionEntry, parseJayModuleSpecifier, prettify, prettifyHtml, removeComments, resolvePluginComponent, resolvePluginManifest, resolvePrimitiveType, withOriginalTrace, withoutExtension };
package/dist/index.js CHANGED
@@ -572,9 +572,10 @@ var JayTypeKind = /* @__PURE__ */ ((JayTypeKind2) => {
572
572
  JayTypeKind2[JayTypeKind2["object"] = 8] = "object";
573
573
  JayTypeKind2[JayTypeKind2["array"] = 9] = "array";
574
574
  JayTypeKind2[JayTypeKind2["union"] = 10] = "union";
575
- JayTypeKind2[JayTypeKind2["promise"] = 11] = "promise";
576
- JayTypeKind2[JayTypeKind2["recursive"] = 12] = "recursive";
577
- JayTypeKind2[JayTypeKind2["optional"] = 13] = "optional";
575
+ JayTypeKind2[JayTypeKind2["record"] = 11] = "record";
576
+ JayTypeKind2[JayTypeKind2["promise"] = 12] = "promise";
577
+ JayTypeKind2[JayTypeKind2["recursive"] = 13] = "recursive";
578
+ JayTypeKind2[JayTypeKind2["optional"] = 14] = "optional";
578
579
  return JayTypeKind2;
579
580
  })(JayTypeKind || {});
580
581
  class JayAtomicType {
@@ -605,6 +606,7 @@ class JayTypeAlias {
605
606
  }
606
607
  class JayEnumType {
607
608
  constructor(name, values) {
609
+ __publicField(this, "alias");
608
610
  __publicField(this, "kind", 2);
609
611
  this.name = name;
610
612
  this.values = values;
@@ -666,6 +668,15 @@ class JayArrayType {
666
668
  return `Array<${this.itemType.name}>`;
667
669
  }
668
670
  }
671
+ class JayRecordType {
672
+ constructor(itemType) {
673
+ __publicField(this, "kind", 11);
674
+ this.itemType = itemType;
675
+ }
676
+ get name() {
677
+ return `Record<string, ${this.itemType.name}>`;
678
+ }
679
+ }
669
680
  class JayUnionType {
670
681
  constructor(ofTypes) {
671
682
  __publicField(this, "kind", 10);
@@ -680,7 +691,7 @@ class JayUnionType {
680
691
  }
681
692
  class JayPromiseType {
682
693
  constructor(itemType) {
683
- __publicField(this, "kind", 11);
694
+ __publicField(this, "kind", 12);
684
695
  this.itemType = itemType;
685
696
  }
686
697
  get name() {
@@ -689,7 +700,7 @@ class JayPromiseType {
689
700
  }
690
701
  class JayRecursiveType {
691
702
  constructor(referencePath, resolvedType) {
692
- __publicField(this, "kind", 12);
703
+ __publicField(this, "kind", 13);
693
704
  this.referencePath = referencePath;
694
705
  this.resolvedType = resolvedType;
695
706
  }
@@ -699,7 +710,7 @@ class JayRecursiveType {
699
710
  }
700
711
  class JayOptionalType {
701
712
  constructor(innerType) {
702
- __publicField(this, "kind", 13);
713
+ __publicField(this, "kind", 14);
703
714
  this.innerType = innerType;
704
715
  }
705
716
  get name() {
@@ -712,7 +723,7 @@ const JayErrorType = new JayObjectType("Error", {
712
723
  stack: new JayAtomicType("string")
713
724
  });
714
725
  function isOptionalType(aType) {
715
- return aType.kind === 13;
726
+ return aType.kind === 14;
716
727
  }
717
728
  function isAtomicType(aType) {
718
729
  return aType.kind === 0;
@@ -744,14 +755,17 @@ function isObjectType(aType) {
744
755
  function isArrayType(aType) {
745
756
  return aType.kind === 9;
746
757
  }
758
+ function isRecordType(aType) {
759
+ return aType.kind === 11;
760
+ }
747
761
  function isUnionType(aType) {
748
762
  return aType.kind === 10;
749
763
  }
750
764
  function isPromiseType(aType) {
751
- return aType.kind === 11;
765
+ return aType.kind === 12;
752
766
  }
753
767
  function isRecursiveType(aType) {
754
- return aType.kind === 12;
768
+ return aType.kind === 13;
755
769
  }
756
770
  function isCurrencyType(aType) {
757
771
  return aType.kind === 0 && aType.name === "Currency";
@@ -771,6 +785,8 @@ function equalJayTypes(a, b) {
771
785
  );
772
786
  else if (a instanceof JayArrayType && b instanceof JayArrayType)
773
787
  return equalJayTypes(a.itemType, b.itemType);
788
+ else if (a instanceof JayRecordType && b instanceof JayRecordType)
789
+ return equalJayTypes(a.itemType, b.itemType);
774
790
  else if (a instanceof JayTypeAlias && b instanceof JayTypeAlias)
775
791
  return true;
776
792
  else if (a instanceof JayHTMLType && b instanceof JayHTMLType)
@@ -825,6 +841,13 @@ function jayTypeToJsonSchema(type) {
825
841
  }
826
842
  return { type: "array" };
827
843
  }
844
+ if (isRecordType(type)) {
845
+ const valueSchema = jayTypeToJsonSchema(type.itemType);
846
+ if (valueSchema) {
847
+ return { type: "object", additionalProperties: valueSchema };
848
+ }
849
+ return { type: "object" };
850
+ }
828
851
  if (isObjectType(type)) {
829
852
  const properties = {};
830
853
  const required = [];
@@ -1650,6 +1673,7 @@ export {
1650
1673
  JayObjectType,
1651
1674
  JayOptionalType,
1652
1675
  JayPromiseType,
1676
+ JayRecordType,
1653
1677
  JayRecursiveType,
1654
1678
  JayString,
1655
1679
  JayTypeAlias,
@@ -1701,6 +1725,7 @@ export {
1701
1725
  isObjectType,
1702
1726
  isOptionalType,
1703
1727
  isPromiseType,
1728
+ isRecordType,
1704
1729
  isRecursiveType,
1705
1730
  isStaticCoordinate,
1706
1731
  isTypeAliasType,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jay-framework/compiler-shared",
3
- "version": "0.15.4",
3
+ "version": "0.15.5",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "license": "Apache-2.0",
@@ -25,10 +25,10 @@
25
25
  },
26
26
  "author": "",
27
27
  "dependencies": {
28
- "@jay-framework/component": "^0.15.4",
29
- "@jay-framework/runtime": "^0.15.4",
30
- "@jay-framework/secure": "^0.15.4",
31
- "@jay-framework/typescript-bridge": "^0.15.4",
28
+ "@jay-framework/component": "^0.15.5",
29
+ "@jay-framework/runtime": "^0.15.5",
30
+ "@jay-framework/secure": "^0.15.5",
31
+ "@jay-framework/typescript-bridge": "^0.15.5",
32
32
  "@types/js-yaml": "^4.0.9",
33
33
  "change-case": "^4.1.2",
34
34
  "js-beautify": "^1.14.11",
@@ -41,7 +41,7 @@
41
41
  },
42
42
  "devDependencies": {
43
43
  "@caiogondim/strip-margin": "^1.0.0",
44
- "@jay-framework/dev-environment": "^0.15.4",
44
+ "@jay-framework/dev-environment": "^0.15.5",
45
45
  "@testing-library/jest-dom": "^6.2.0",
46
46
  "@types/js-beautify": "^1",
47
47
  "@types/node": "^20.11.5",