@atomic-ehr/codegen 0.0.2-canary.20251119121046.dd3a241 → 0.0.2-canary.20251119131907.723c8fd

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 CHANGED
@@ -3538,7 +3538,7 @@ var treeShake = (tsIndex, treeShake2, logger) => {
3538
3538
  return mkTypeSchemaIndex(shaked, logger);
3539
3539
  };
3540
3540
  var resourceRelatives = (schemas) => {
3541
- const regularSchemas = schemas.filter(isResourceTypeSchema);
3541
+ const regularSchemas = schemas.filter((e) => isResourceTypeSchema(e) || isLogicalTypeSchema(e));
3542
3542
  const directPairs = [];
3543
3543
  for (const schema of regularSchemas) {
3544
3544
  if (schema.base) {
@@ -5818,8 +5818,8 @@ var TypeScript = class extends Writer {
5818
5818
  identifier: schema.identifier,
5819
5819
  tsPackageName: tsModuleName(schema.identifier),
5820
5820
  resourceName: tsResourceName(schema.identifier),
5821
- nestedTypes: isResourceTypeSchema(schema) && schema.nested ? schema.nested.map((n) => tsResourceName(n.identifier)) : [],
5822
- helpers: isResourceTypeSchema(schema) ? [`is${tsResourceName(schema.identifier)}`] : []
5821
+ nestedTypes: isResourceTypeSchema(schema) && schema.nested || isLogicalTypeSchema(schema) && schema.nested ? schema.nested.map((n) => tsResourceName(n.identifier)) : [],
5822
+ helpers: isResourceTypeSchema(schema) || isLogicalTypeSchema(schema) ? [`is${tsResourceName(schema.identifier)}`] : []
5823
5823
  }
5824
5824
  ]).sort((a, b) => a.resourceName.localeCompare(b.resourceName));
5825
5825
  exports = Array.from(new Map(exports.map((exp) => [exp.resourceName.toLowerCase(), exp])).values()).sort(
@@ -5902,7 +5902,7 @@ var TypeScript = class extends Writer {
5902
5902
  return;
5903
5903
  }
5904
5904
  this.curlyBlock(["export", "interface", name, extendsClause], () => {
5905
- if (isResourceTypeSchema(schema)) {
5905
+ if (isResourceTypeSchema(schema) || isLogicalTypeSchema(schema)) {
5906
5906
  const possibleResourceTypes = [schema.identifier];
5907
5907
  possibleResourceTypes.push(...tsIndex.resourceChildren(schema.identifier));
5908
5908
  const openSetSuffix = this.opts.openResourceTypeSet && possibleResourceTypes.length > 1 ? " | string" : "";
@@ -5942,7 +5942,7 @@ var TypeScript = class extends Writer {
5942
5942
  });
5943
5943
  }
5944
5944
  generateResourceTypePredicate(schema) {
5945
- if (!isResourceTypeSchema(schema)) return;
5945
+ if (!isResourceTypeSchema(schema) && !isLogicalTypeSchema(schema)) return;
5946
5946
  const name = tsResourceName(schema.identifier);
5947
5947
  this.curlyBlock(["export", "const", `is${name}`, "=", `(resource: unknown): resource is ${name}`, "=>"], () => {
5948
5948
  this.lineSM(
@@ -6133,7 +6133,6 @@ var TypeScript = class extends Writer {
6133
6133
  ...tsIndex.collectComplexTypes(),
6134
6134
  ...tsIndex.collectResources(),
6135
6135
  ...tsIndex.collectLogicalModels(),
6136
- // ...tsIndex.collectLogicalModels(),
6137
6136
  ...this.opts.generateProfile ? tsIndex.collectProfiles().filter((p) => tsIndex.isWithMetaField(p)) : []
6138
6137
  ];
6139
6138
  const grouped = groupByPackages(typesToGenerate);