Skip to content

Commit

Permalink
fix: Add root namespace construct to fix invalid imports of root name…
Browse files Browse the repository at this point in the history
…space into other namespace files

commit bd6a314
Author: Kevin Greene <[email protected]>
Date:   Fri Apr 26 11:39:33 2019 -0700

    chore: update package-lock

commit 17dac1c
Author: Kevin Greene <[email protected]>
Date:   Thu Apr 25 16:16:38 2019 -0700

    fix: Add root namespace construct to fix invalid imports of root namespace into other namespace files
  • Loading branch information
kevin-greene-ck committed Apr 26, 2019
1 parent 508f85e commit 011a35b
Show file tree
Hide file tree
Showing 34 changed files with 121 additions and 168 deletions.
128 changes: 42 additions & 86 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/main/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export function emptyNamespace(): INamespacePath {
return {
type: 'NamespacePath',
scope: '',
name: '',
name: '__ROOT_NAMESPACE__',
path: createPathForNamespace(''),
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/tests/integration/apache/calculator-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {

import { AddService } from './codegen/com/test/add-service'

import { SharedStruct, SharedUnion } from './codegen/com/test/shared'
import { SharedStruct, SharedUnion } from './codegen'

import { Server } from 'net'

Expand Down
2 changes: 1 addition & 1 deletion src/tests/integration/apache/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
Work,
} from './codegen/com/test/calculator'

import { SharedStruct, SharedUnion } from './codegen/com/test/shared'
import { SharedStruct, SharedUnion } from './codegen'

import { createAddServer } from './add-service'
import { createCalculatorServer } from './calculator-service'
Expand Down
3 changes: 0 additions & 3 deletions src/tests/integration/thrift/shared.thrift
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
namespace java com.test.shared
namespace js com.test.shared

const i32 SHARED_INT = 45

struct SharedStruct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
import Int64 = require("node-int64");
import * as thrift from "test-lib";
import * as com_test_shared from "./../shared";
import * as __ROOT_NAMESPACE__ from "./../../..";
import * as com_test_operation from "./../operation";
import * as com_test_common from "./../common";
import * as __NAMESPACE__ from "./.";
Expand Down Expand Up @@ -1686,7 +1686,7 @@ export class ZipResult {
return new ZipResult(_args);
}
}
export class Client extends com_test_shared.SharedService.Client {
export class Client extends __ROOT_NAMESPACE__.SharedService.Client {
public _seqid: number;
public _reqs: {
[name: number]: (err: Error | object | undefined, val?: any) => void;
Expand Down Expand Up @@ -2339,8 +2339,8 @@ export interface ILocalHandler {
fetchThing(): com_test_common.CommonStruct | Promise<com_test_common.CommonStruct>;
zip(): void | Promise<void>;
}
export type IHandler = ILocalHandler & com_test_shared.SharedService.IHandler;
export class Processor extends com_test_shared.SharedService.Processor {
export type IHandler = ILocalHandler & __ROOT_NAMESPACE__.SharedService.IHandler;
export class Processor extends __ROOT_NAMESPACE__.SharedService.Processor {
public _handler: IHandler;
constructor(handler: IHandler) {
super({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
* Autogenerated by @creditkarma/thrift-typescript v{{VERSION}}
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
*/
import * as com_test_shared from "./../shared";
import * as __ROOT_NAMESPACE__ from "./../../..";
import * as __NAMESPACE__ from "./.";
export import CommonStruct = com_test_shared.SharedStruct;
export import CommonUnion = com_test_shared.SharedUnion;
export import CommonEnum = com_test_shared.SharedEnum;
export import COMMON_INT = com_test_shared.SHARED_INT;
export import CommonStruct = __ROOT_NAMESPACE__.SharedStruct;
export import CommonUnion = __ROOT_NAMESPACE__.SharedUnion;
export import CommonEnum = __ROOT_NAMESPACE__.SharedEnum;
export import COMMON_INT = __ROOT_NAMESPACE__.SHARED_INT;
export import NotAllowed = __NAMESPACE__.AuthException;
export import MoreOptions = __NAMESPACE__.OtherCommonUnion;
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
*/
import * as thrift from "test-lib";
import * as com_test_shared from "./../shared";
import * as __ROOT_NAMESPACE__ from "./../../..";
export interface IInvalidResultArgs {
message?: string;
code?: com_test_shared.Code;
code?: __ROOT_NAMESPACE__.Code;
}
export class InvalidResult {
public message?: string;
public code?: com_test_shared.Code;
public code?: __ROOT_NAMESPACE__.Code;
constructor(args?: IInvalidResultArgs) {
if (args != null && args.message != null) {
this.message = args.message;
Expand Down Expand Up @@ -58,7 +58,7 @@ export class InvalidResult {
break;
case 2:
if (fieldType === thrift.Thrift.Type.STRUCT) {
const value_2: com_test_shared.Code = com_test_shared.Code.read(input);
const value_2: __ROOT_NAMESPACE__.Code = __ROOT_NAMESPACE__.Code.read(input);
_args.code = value_2;
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
*/
import * as thrift from "test-lib";
import * as com_test_shared from "./../shared";
import * as __ROOT_NAMESPACE__ from "./../../..";
import * as com_test_operation from "./../operation";
import * as com_test_common from "./../common";
import * as __NAMESPACE__ from "./.";
Expand Down Expand Up @@ -2547,7 +2547,7 @@ export class Zip__Result extends thrift.StructLike implements IZip__Result {
return Zip__ResultCodec.encode(this, output);
}
}
export class Client<Context = any> extends com_test_shared.SharedService.Client<Context> {
export class Client<Context = any> extends __ROOT_NAMESPACE__.SharedService.Client<Context> {
public static readonly serviceName: string = serviceName;
public static readonly annotations: thrift.IThriftAnnotations = annotations;
public static readonly methodAnnotations: thrift.IMethodAnnotations = methodAnnotations;
Expand Down Expand Up @@ -3107,8 +3107,8 @@ export interface ILocalHandler<Context = any> {
fetchThing(context?: Context): com_test_common.ICommonStructArgs | Promise<com_test_common.ICommonStructArgs>;
zip(context?: Context): void | Promise<void>;
}
export type IHandler<Context = any> = ILocalHandler<Context> & com_test_shared.SharedService.IHandler<Context>;
export class Processor<Context = any> extends com_test_shared.SharedService.Processor<Context> {
export type IHandler<Context = any> = ILocalHandler<Context> & __ROOT_NAMESPACE__.SharedService.IHandler<Context>;
export class Processor<Context = any> extends __ROOT_NAMESPACE__.SharedService.Processor<Context> {
protected readonly _handler: IHandler<Context>;
public static readonly serviceName: string = serviceName;
public static readonly annotations: thrift.IThriftAnnotations = annotations;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@
* Autogenerated by @creditkarma/thrift-typescript v{{VERSION}}
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
*/
import * as com_test_shared from "./../shared";
import * as __ROOT_NAMESPACE__ from "./../../..";
import * as __NAMESPACE__ from "./.";
export type ICommonStruct = com_test_shared.ISharedStruct;
export type ICommonStructArgs = com_test_shared.ISharedStructArgs;
export const CommonStruct = com_test_shared.SharedStruct;
export const CommonStructCodec = com_test_shared.SharedStructCodec;
export type CommonUnionType = com_test_shared.SharedUnionType;
export type CommonUnion = com_test_shared.SharedUnion;
export type ICommonUnionWithOption1 = com_test_shared.ISharedUnionWithOption1;
export type ICommonUnionWithOption2 = com_test_shared.ISharedUnionWithOption2;
export type CommonUnionArgs = com_test_shared.SharedUnionArgs;
export type ICommonUnionWithOption1Args = com_test_shared.ISharedUnionWithOption1Args;
export type ICommonUnionWithOption2Args = com_test_shared.ISharedUnionWithOption2Args;
export const CommonUnionCodec = com_test_shared.SharedUnionCodec;
export const CommonEnum = com_test_shared.SharedEnum;
export type CommonEnum = com_test_shared.SharedEnum;
export const COMMON_INT = com_test_shared.SHARED_INT;
export type ICommonStruct = __ROOT_NAMESPACE__.ISharedStruct;
export type ICommonStructArgs = __ROOT_NAMESPACE__.ISharedStructArgs;
export const CommonStruct = __ROOT_NAMESPACE__.SharedStruct;
export const CommonStructCodec = __ROOT_NAMESPACE__.SharedStructCodec;
export type CommonUnionType = __ROOT_NAMESPACE__.SharedUnionType;
export type CommonUnion = __ROOT_NAMESPACE__.SharedUnion;
export type ICommonUnionWithOption1 = __ROOT_NAMESPACE__.ISharedUnionWithOption1;
export type ICommonUnionWithOption2 = __ROOT_NAMESPACE__.ISharedUnionWithOption2;
export type CommonUnionArgs = __ROOT_NAMESPACE__.SharedUnionArgs;
export type ICommonUnionWithOption1Args = __ROOT_NAMESPACE__.ISharedUnionWithOption1Args;
export type ICommonUnionWithOption2Args = __ROOT_NAMESPACE__.ISharedUnionWithOption2Args;
export const CommonUnionCodec = __ROOT_NAMESPACE__.SharedUnionCodec;
export const CommonEnum = __ROOT_NAMESPACE__.SharedEnum;
export type CommonEnum = __ROOT_NAMESPACE__.SharedEnum;
export const COMMON_INT = __ROOT_NAMESPACE__.SHARED_INT;
export type INotAllowed = __NAMESPACE__.IAuthException;
export type INotAllowedArgs = __NAMESPACE__.IAuthExceptionArgs;
export const NotAllowed = __NAMESPACE__.AuthException;
Expand Down
Loading

0 comments on commit 011a35b

Please sign in to comment.