@@ -29,6 +29,10 @@ import {
2929 EnumRef ,
3030 EnvDefinition ,
3131 ImportedEnvDefinition ,
32+ MapDefinition ,
33+ ArrayDefinition ,
34+ PropertyDefinition ,
35+ MethodDefinition ,
3236} from "@polywrap/wrap-manifest-types-js" ;
3337import {
3438 parseSchema ,
@@ -56,6 +60,8 @@ import {
5660 createImportedEnvDefinition ,
5761 visitImportedEnvDefinition ,
5862 isImportedEnvType ,
63+ mapUtils ,
64+ ScalarType ,
5965} from "@polywrap/schema-parse" ;
6066
6167type ImplementationWithInterfaces = {
@@ -441,6 +447,95 @@ const extractObjectImportDependencies = (
441447
442448const namespaceTypes = ( namespace : string ) : AbiTransforms => ( {
443449 enter : {
450+ PropertyDefinition : ( def : PropertyDefinition & Namespaced ) => {
451+ if ( def . __namespaced ) {
452+ return def ;
453+ }
454+
455+ return {
456+ ...def ,
457+ type : mapUtils . appendNamespace ( namespace , def . type ) ,
458+ __namespaced : true ,
459+ } ;
460+ } ,
461+ MethodDefinition : ( def : MethodDefinition & Namespaced ) => {
462+ if ( def . __namespaced ) {
463+ return def ;
464+ }
465+
466+ return {
467+ ...def ,
468+ type : mapUtils . appendNamespace ( namespace , def . type ) ,
469+ __namespaced : true ,
470+ } ;
471+ } ,
472+ MapDefinition : ( def : MapDefinition & Namespaced ) => {
473+ if ( def . __namespaced ) {
474+ return def ;
475+ }
476+
477+ return {
478+ ...def ,
479+ type : mapUtils . appendNamespace ( namespace , def . type ) ,
480+ __namespaced : true ,
481+ } ;
482+ } ,
483+ ArrayDefinition : ( def : ArrayDefinition & Namespaced ) => {
484+ if ( def . __namespaced ) {
485+ return def ;
486+ }
487+
488+ const _item = def . item && {
489+ ...def . item ,
490+ type : mapUtils . appendNamespace ( namespace , def . item . type ) ,
491+ __namespaced : true ,
492+ } ;
493+
494+ const _array = def . array && {
495+ ...def . array ,
496+ type : mapUtils . appendNamespace ( namespace , def . array . type ) ,
497+ __namespaced : true ,
498+ } ;
499+
500+ const _object = def . object && {
501+ ...def . object ,
502+ type : mapUtils . appendNamespace ( namespace , def . object . type ) ,
503+ __namespaced : true ,
504+ } ;
505+
506+ const _enum = def . enum && {
507+ ...def . enum ,
508+ type : mapUtils . appendNamespace ( namespace , def . enum . type ) ,
509+ __namespaced : true ,
510+ } ;
511+
512+ const _map = def . map && {
513+ ...def . map ,
514+ type : mapUtils . appendNamespace ( namespace , def . map . type ) ,
515+ __namespaced : true ,
516+ } ;
517+
518+ const _scalar = def . scalar && {
519+ ...def . scalar ,
520+ type : mapUtils . appendNamespace (
521+ namespace ,
522+ def . scalar . type
523+ ) as ScalarType ,
524+ __namespaced : true ,
525+ } ;
526+
527+ return {
528+ ...def ,
529+ item : _item ,
530+ array : _array ,
531+ object : _object ,
532+ enum : _enum ,
533+ map : _map ,
534+ scalar : _scalar ,
535+ type : mapUtils . appendNamespace ( namespace , def . type ) ,
536+ __namespaced : true ,
537+ } ;
538+ } ,
444539 ObjectRef : ( def : ObjectRef & Namespaced ) => {
445540 if ( def . __namespaced ) {
446541 return def ;
0 commit comments