@narrative.io/data-collaboration-sdk-ts 0.0.1

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 ADDED
@@ -0,0 +1,2 @@
1
+ var t=require("mande");function e(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,r(t,e)}function r(t,e){return r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},r(t,e)}var n,o=/*#__PURE__*/function(){function e(e){this.apiKey=void 0,this.environment=void 0,this.base_api=void 0,this.apiKey=e.apiKey,this.environment=e.environment||"prod",this.base_api=t.mande(""+this.getBaseUrl(),{headers:this.getHeaders()})}var r=e.prototype;return r.get=function(t){return this.base_api.get(t)},r.post=function(t,e){return this.base_api.post(t,e)},r.getBaseUrl=function(){switch(this.environment){case"prod":return"https://api.narrative.io/";case"dev":return"https://api-dev.narrative.io/";default:return this.environment}},r.getHeaders=function(){var t={"Content-type":"application/json"};return this.apiKey&&(t.Authorization="Bearer "+this.apiKey),t},e}(),i=/*#__PURE__*/function(t){function r(){return t.apply(this,arguments)||this}return e(r,t),r.prototype.getHealthCheck=function(){try{return Promise.resolve(this.get("health"))}catch(t){return Promise.reject(t)}},r}(o),p=/*#__PURE__*/function(t){function r(){return t.apply(this,arguments)||this}return e(r,t),r}(o);n=p,[i].forEach(function(t){Object.getOwnPropertyNames(t.prototype).forEach(function(e){Object.defineProperty(n.prototype,e,Object.getOwnPropertyDescriptor(t.prototype,e)||Object.create(null))})}),module.exports=p;
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/base-api.ts","../src/utils.ts","../src/health/index.ts","../src/index.ts"],"sourcesContent":["import { mande, MandeInstance } from 'mande'\n\ntype Environment = 'dev' | 'prod' | string\n\ntype Config = {\n apiKey?: string,\n environment?: Environment,\n}\n\nexport abstract class BaseApi {\n private apiKey?: string\n private environment: string\n private base_api: MandeInstance\n\n constructor(config: Config) {\n this.apiKey = config.apiKey\n this.environment = config.environment || 'prod'\n this.base_api = mande(`${this.getBaseUrl()}`, {\n headers: this.getHeaders(),\n })\n }\n\n protected get<T>(endpoint: string): Promise<T> {\n return this.base_api.get<T>(endpoint)\n }\n\n protected post<I, T>(endpoint: string, data: I): Promise<T> {\n return this.base_api.post<T>(endpoint, data)\n }\n\n private getBaseUrl(): string {\n switch (this.environment) {\n case 'prod': {\n return `https://api.narrative.io/`\n }\n case 'dev': {\n return `https://api-dev.narrative.io/`\n }\n default: {\n return this.environment\n }\n }\n }\n\n private getHeaders(): { [key: string]: string } {\n const headers: { [key: string]: string } = {\n 'Content-type': 'application/json'\n }\n\n if (this.apiKey) {\n headers['Authorization'] = `Bearer ${this.apiKey}`\n }\n\n return headers\n }\n}","export function applyMixins(derivedCtor: any, constructors: any[]) {\n constructors.forEach((baseCtor) => {\n Object.getOwnPropertyNames(baseCtor.prototype).forEach((name) => {\n Object.defineProperty(\n derivedCtor.prototype,\n name,\n Object.getOwnPropertyDescriptor(baseCtor.prototype, name) ||\n Object.create(null)\n );\n });\n });\n}","import { BaseApi } from \"../base-api\";\nimport { HealthCheckResponse } from \"./types\";\n\nconst resourceName = 'health';\n\nexport class HealthCheckApi extends BaseApi {\n public async getHealthCheck(): Promise<HealthCheckResponse> {\n return await this.get<HealthCheckResponse>(resourceName);\n }\n}","import { BaseApi } from './base-api';\nimport { HealthCheckApi } from './health'\nimport { applyMixins } from './utils'\n\nclass NarrativeApi extends BaseApi { }\ninterface NarrativeApi extends BaseApi, HealthCheckApi { }\napplyMixins(NarrativeApi, [HealthCheckApi]);\n\nexport default NarrativeApi"],"names":["derivedCtor","BaseApi","config","apiKey","this","environment","base_api","mande","getBaseUrl","headers","getHeaders","get","endpoint","post","data","_proto","HealthCheckApi","_BaseApi","apply","arguments","_inheritsLoose","prototype","getHealthCheck","Promise","resolve","e","reject","NarrativeApi","forEach","baseCtor","Object","getOwnPropertyNames","name","defineProperty","getOwnPropert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ACHjC,EAAYqB,UACZW,EACAF,OAAOI,yBAAyBL,EAASR,UAAWW,IACpDF,OAAOK,OAAO,MAEtB,EACJ"}
@@ -0,0 +1,2 @@
1
+ import{mande as t}from"mande";function e(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,r(t,e)}function r(t,e){return r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},r(t,e)}var n,o=/*#__PURE__*/function(){function e(e){this.apiKey=void 0,this.environment=void 0,this.base_api=void 0,this.apiKey=e.apiKey,this.environment=e.environment||"prod",this.base_api=t(""+this.getBaseUrl(),{headers:this.getHeaders()})}var r=e.prototype;return r.get=function(t){return this.base_api.get(t)},r.post=function(t,e){return this.base_api.post(t,e)},r.getBaseUrl=function(){switch(this.environment){case"prod":return"https://api.narrative.io/";case"dev":return"https://api-dev.narrative.io/";default:return this.environment}},r.getHeaders=function(){var t={"Content-type":"application/json"};return this.apiKey&&(t.Authorization="Bearer "+this.apiKey),t},e}(),i=/*#__PURE__*/function(t){function r(){return t.apply(this,arguments)||this}return e(r,t),r.prototype.getHealthCheck=function(){try{return Promise.resolve(this.get("health"))}catch(t){return Promise.reject(t)}},r}(o),p=/*#__PURE__*/function(t){function r(){return t.apply(this,arguments)||this}return e(r,t),r}(o);n=p,[i].forEach(function(t){Object.getOwnPropertyNames(t.prototype).forEach(function(e){Object.defineProperty(n.prototype,e,Object.getOwnPropertyDescriptor(t.prototype,e)||Object.create(null))})});export{p as default};
2
+ //# sourceMappingURL=index.m.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.m.js","sources":["../src/base-api.ts","../src/utils.ts","../src/health/index.ts","../src/index.ts"],"sourcesContent":["import { mande, MandeInstance } from 'mande'\n\ntype Environment = 'dev' | 'prod' | string\n\ntype Config = {\n apiKey?: string,\n environment?: Environment,\n}\n\nexport abstract class BaseApi {\n private apiKey?: string\n private environment: string\n private base_api: MandeInstance\n\n constructor(config: Config) {\n this.apiKey = config.apiKey\n this.environment = config.environment || 'prod'\n this.base_api = mande(`${this.getBaseUrl()}`, {\n headers: this.getHeaders(),\n })\n }\n\n protected get<T>(endpoint: string): Promise<T> {\n return this.base_api.get<T>(endpoint)\n }\n\n protected post<I, T>(endpoint: string, data: I): Promise<T> {\n return this.base_api.post<T>(endpoint, data)\n }\n\n private getBaseUrl(): string {\n switch (this.environment) {\n case 'prod': {\n return `https://api.narrative.io/`\n }\n case 'dev': {\n return `https://api-dev.narrative.io/`\n }\n default: {\n return this.environment\n }\n }\n }\n\n private getHeaders(): { [key: string]: string } {\n const headers: { [key: string]: string } = {\n 'Content-type': 'application/json'\n }\n\n if (this.apiKey) {\n headers['Authorization'] = `Bearer ${this.apiKey}`\n }\n\n return headers\n }\n}","export function applyMixins(derivedCtor: any, constructors: any[]) {\n constructors.forEach((baseCtor) => {\n Object.getOwnPropertyNames(baseCtor.prototype).forEach((name) => {\n Object.defineProperty(\n derivedCtor.prototype,\n name,\n Object.getOwnPropertyDescriptor(baseCtor.prototype, name) ||\n Object.create(null)\n );\n });\n });\n}","import { BaseApi } from \"../base-api\";\nimport { HealthCheckResponse } from \"./types\";\n\nconst resourceName = 'health';\n\nexport class HealthCheckApi extends BaseApi {\n public async getHealthCheck(): Promise<HealthCheckResponse> {\n return await this.get<HealthCheckResponse>(resourceName);\n }\n}","import { BaseApi } from './base-api';\nimport { HealthCheckApi } from './health'\nimport { applyMixins } from './utils'\n\nclass NarrativeApi extends BaseApi { }\ninterface NarrativeApi extends BaseApi, HealthCheckApi { }\napplyMixins(NarrativeApi, [HealthCheckApi]);\n\nexport default NarrativeApi"],"names":["derivedCtor","BaseApi","config","apiKey","this","environment","base_api","mande","getBaseUrl","headers","getHeaders","get","endpoint","post","data","_proto","HealthCheckApi","_BaseApi","apply","arguments","_inheritsLoose","prototype","getHealthCheck","Promise","resolve","e","reject","NarrativeApi","forEach","baseCtor","Object","getOwnPropertyNames","name","defineProperty","getOwnPropertyDescriptor","create"],"mappings":"+OASA,ICT4BA,i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EAASR,UAAWW,IACpDF,OAAOK,OAAO,MAEtB,EACJ"}
@@ -0,0 +1,2 @@
1
+ import{mande as e}from"mande";class t{constructor(t){this.apiKey=void 0,this.environment=void 0,this.base_api=void 0,this.apiKey=t.apiKey,this.environment=t.environment||"prod",this.base_api=e(`${this.getBaseUrl()}`,{headers:this.getHeaders()})}get(e){return this.base_api.get(e)}post(e,t){return this.base_api.post(e,t)}getBaseUrl(){switch(this.environment){case"prod":return"https://api.narrative.io/";case"dev":return"https://api-dev.narrative.io/";default:return this.environment}}getHeaders(){const e={"Content-type":"application/json"};return this.apiKey&&(e.Authorization=`Bearer ${this.apiKey}`),e}}class r extends t{}var a;a=r,[class extends t{async getHealthCheck(){return await this.get("health")}}].forEach(e=>{Object.getOwnPropertyNames(e.prototype).forEach(t=>{Object.defineProperty(a.prototype,t,Object.getOwnPropertyDescriptor(e.prototype,t)||Object.create(null))})});export{r as default};
2
+ //# sourceMappingURL=index.modern.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.modern.mjs","sources":["../src/base-api.ts","../src/index.ts","../src/utils.ts","../src/health/index.ts"],"sourcesContent":["import { mande, MandeInstance } from 'mande'\n\ntype Environment = 'dev' | 'prod' | string\n\ntype Config = {\n apiKey?: string,\n environment?: Environment,\n}\n\nexport abstract class BaseApi {\n private apiKey?: string\n private environment: string\n private base_api: MandeInstance\n\n constructor(config: Config) {\n this.apiKey = config.apiKey\n this.environment = config.environment || 'prod'\n this.base_api = mande(`${this.getBaseUrl()}`, {\n headers: this.getHeaders(),\n })\n }\n\n protected get<T>(endpoint: string): Promise<T> {\n return this.base_api.get<T>(endpoint)\n }\n\n protected post<I, T>(endpoint: string, data: I): Promise<T> {\n return this.base_api.post<T>(endpoint, data)\n }\n\n private getBaseUrl(): string {\n switch (this.environment) {\n case 'prod': {\n return `https://api.narrative.io/`\n }\n case 'dev': {\n return `https://api-dev.narrative.io/`\n }\n default: {\n return this.environment\n }\n }\n }\n\n private getHeaders(): { [key: string]: string } {\n const headers: { [key: string]: string } = {\n 'Content-type': 'application/json'\n }\n\n if (this.apiKey) {\n headers['Authorization'] = `Bearer ${this.apiKey}`\n }\n\n return headers\n }\n}","import { BaseApi } from './base-api';\nimport { HealthCheckApi } from './health'\nimport { applyMixins } from './utils'\n\nclass NarrativeApi extends BaseApi { }\ninterface NarrativeApi extends BaseApi, HealthCheckApi { }\napplyMixins(NarrativeApi, [HealthCheckApi]);\n\nexport default NarrativeApi","export function applyMixins(derivedCtor: any, constructors: any[]) {\n constructors.forEach((baseCtor) => {\n Object.getOwnPropertyNames(baseCtor.prototype).forEach((name) => {\n Object.defineProperty(\n derivedCtor.prototype,\n name,\n Object.getOwnPropertyDescriptor(baseCtor.prototype, name) ||\n Object.create(null)\n );\n });\n });\n}","import { BaseApi } from \"../base-api\";\nimport { HealthCheckResponse } from \"./types\";\n\nconst resourceName = 'health';\n\nexport class HealthCheckApi extends BaseApi {\n public async getHealthCheck(): Promise<HealthCheckResponse> {\n return await this.get<HealthCheckResponse>(resourceName);\n }\n}"],"names":["BaseApi","constructor","config","this","apiKey","environment","base_api","mande","getBaseUrl","headers","getHeaders","get","endpoint","post","data","NarrativeApi","applyMixins","derivedCtor","async","forEach","baseCtor","Object","getOwnPropertyNames","prototype","name","defineProperty","getOwnPropertyDescriptor","create"],"mappings":"oCAS6BA,EAKzBC,YAAYC,GAAcC,KAJlBC,YAAM,EAAAD,KACNE,iBACAC,EAAAA,KAAAA,cAGJ,EAAAH,KAAKC,OAASF,EAAOE,OACrBD,KAAKE,YAAcH,EAAOG,aAAe,OACzCF,KAAKG,SAAWC,EAAS,GAAAJ,KAAKK,eAAgB,CAC1CC,QAASN,KAAKO,cAEtB,CAEUC,IAAOC,GACb,OAAWT,KAACG,SAASK,IAAOC,EAChC,CAEUC,KAAWD,EAAkBE,GACnC,OAAWX,KAACG,SAASO,KAAQD,EAAUE,EAC3C,CAEQN,aACJ,OAAQL,KAAKE,aACT,IAAK,OACD,kCAEJ,IAAK,MACD,sCAEJ,QACI,OAAOF,KAAKE,YAGxB,CAEQK,aACJ,MAAMD,EAAqC,CACvC,eAAgB,oBAOpB,OAJIN,KAAKC,SACLK,EAAuB,wBAAcN,KAAKC,WAIlD,EClDJ,MAAMW,UAAqBf,GCJXgB,IAAYC,IDMhBF,EAAc,CEDpB,cAAqCf,EAChCkB,uBACH,aAAiBf,KAACQ,IAJL,SAKjB,IDPaQ,QAASC,IAClBC,OAAOC,oBAAoBF,EAASG,WAAWJ,QAASK,IACpDH,OAAOI,eACHR,EAAYM,UACZC,EACAH,OAAOK,yBAAyBN,EAASG,UAAWC,IACpDH,OAAOM,OAAO,MAEtB,EACJ"}
@@ -0,0 +1,2 @@
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("mande")):"function"==typeof define&&define.amd?define(["mande"],e):(t||self).dataCollaborationSdkTs=e(t.mande)}(this,function(t){function e(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,n(t,e)}function n(t,e){return n=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},n(t,e)}var r,o=/*#__PURE__*/function(){function e(e){this.apiKey=void 0,this.environment=void 0,this.base_api=void 0,this.apiKey=e.apiKey,this.environment=e.environment||"prod",this.base_api=t.mande(""+this.getBaseUrl(),{headers:this.getHeaders()})}var n=e.prototype;return n.get=function(t){return this.base_api.get(t)},n.post=function(t,e){return this.base_api.post(t,e)},n.getBaseUrl=function(){switch(this.environment){case"prod":return"https://api.narrative.io/";case"dev":return"https://api-dev.narrative.io/";default:return this.environment}},n.getHeaders=function(){var t={"Content-type":"application/json"};return this.apiKey&&(t.Authorization="Bearer "+this.apiKey),t},e}(),i=/*#__PURE__*/function(t){function n(){return t.apply(this,arguments)||this}return e(n,t),n.prototype.getHealthCheck=function(){try{return Promise.resolve(this.get("health"))}catch(t){return Promise.reject(t)}},n}(o),a=/*#__PURE__*/function(t){function n(){return t.apply(this,arguments)||this}return e(n,t),n}(o);return r=a,[i].forEach(function(t){Object.getOwnPropertyNames(t.prototype).forEach(function(e){Object.defineProperty(r.prototype,e,Object.getOwnPropertyDescriptor(t.prototype,e)||Object.create(null))})}),a});
2
+ //# sourceMappingURL=index.umd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.umd.js","sources":["../src/base-api.ts","../src/utils.ts","../src/health/index.ts","../src/index.ts"],"sourcesContent":["import { mande, MandeInstance } from 'mande'\n\ntype Environment = 'dev' | 'prod' | string\n\ntype Config = {\n apiKey?: string,\n environment?: Environment,\n}\n\nexport abstract class BaseApi {\n private apiKey?: string\n private environment: string\n private base_api: MandeInstance\n\n constructor(config: Config) {\n this.apiKey = config.apiKey\n this.environment = config.environment || 'prod'\n this.base_api = mande(`${this.getBaseUrl()}`, {\n headers: this.getHeaders(),\n })\n }\n\n protected get<T>(endpoint: string): Promise<T> {\n return this.base_api.get<T>(endpoint)\n }\n\n protected post<I, T>(endpoint: string, data: I): Promise<T> {\n return this.base_api.post<T>(endpoint, data)\n }\n\n private getBaseUrl(): string {\n switch (this.environment) {\n case 'prod': {\n return `https://api.narrative.io/`\n }\n case 'dev': {\n return `https://api-dev.narrative.io/`\n }\n default: {\n return this.environment\n }\n }\n }\n\n private getHeaders(): { [key: string]: string } {\n const headers: { [key: string]: string } = {\n 'Content-type': 'application/json'\n }\n\n if (this.apiKey) {\n headers['Authorization'] = `Bearer ${this.apiKey}`\n }\n\n return headers\n }\n}","export function applyMixins(derivedCtor: any, constructors: any[]) {\n constructors.forEach((baseCtor) => {\n Object.getOwnPropertyNames(baseCtor.prototype).forEach((name) => {\n Object.defineProperty(\n derivedCtor.prototype,\n name,\n Object.getOwnPropertyDescriptor(baseCtor.prototype, name) ||\n Object.create(null)\n );\n });\n });\n}","import { BaseApi } from \"../base-api\";\nimport { HealthCheckResponse } from \"./types\";\n\nconst resourceName = 'health';\n\nexport class HealthCheckApi extends BaseApi {\n public async getHealthCheck(): Promise<HealthCheckResponse> {\n return await this.get<HealthCheckResponse>(resourceName);\n }\n}","import { BaseApi } from './base-api';\nimport { HealthCheckApi } from './health'\nimport { applyMixins } from './utils'\n\nclass NarrativeApi extends BaseApi { }\ninterface NarrativeApi extends BaseApi, HealthCheckApi { }\napplyMixins(NarrativeApi, [HealthCheckApi]);\n\nexport default NarrativeApi"],"names":["derivedCtor","BaseApi","config","apiKey","this","environment","base_api","mande","getBaseUrl","headers","getHeaders","get","endpoint","post","data","_proto","HealthCheckApi","_BaseApi","apply","arguments","_inheritsLoose","prototype","getHealthCheck","Promise","resolve","e","reject","NarrativeApi","forEach","baseCtor","Object","getOwnPropertyNames","name","defineProperty","getOwnPropertyDescriptor","create"],"mappings":"4dASA,ICT4BA,iBDcxB,WAAA,SAAAC,EAAYC,QAJJC,YAAM,EAAAC,KACNC,iBAAW,EAAAD,KACXE,cAGJ,EAAAF,KAAKD,OAASD,EAAOC,OACrBC,KAAKC,YAAcH,EAAOG,aAAe,OACzCD,KAAKE,SAAWC,EAAKA,SAAIH,KAAKI,aAAgB,CAC1CC,QAASL,KAAKM,cAEtB,CAAC,IAESC,EAAAA,EAAAA,UAgCT,OAhCSA,EAAAA,IAAA,SAAOC,GACb,OAAOR,KAAKE,SAASK,IAAOC,EAChC,EAEUC,EAAAA,KAAA,SAAWD,EAAkBE,GACnC,OAAWV,KAACE,SAASO,KAAQD,EAAUE,EAC3C,EAACC,EAEOP,WAAA,WACJ,OAAQJ,KAAKC,aACT,IAAK,OACD,MACH,4BACD,IAAK,MACD,MAAA,gCAEJ,QACI,OAAOD,KAAKC,YAGxB,IAEQK,WAAA,WACJ,IAAaD,EAA8B,CACvC,eAAgB,oBAOpB,OAJIL,KAAKD,SACLM,EAAuB,cAAC,UAAaL,KAAKD,SAIlD,EAACF,CAAA,CAxCD,GETwBe,eAAA,SAAAC,GAAA,SAAAD,IAAA,OAAAC,EAAAC,MAAAd,KAAAe,YAAAf,IAAA,CAGvB,OAHuBgB,EAAAJ,EAAAC,GAAAD,EAAAK,UACXC,eAAc,WAAA,IACN,OAAAC,QAAAC,QAAJpB,KAAKO,IAJL,UAKhB,CAAA,MAAAc,GAAA,OAAAF,QAAAG,OAAAD,EAAA,CAAA,EAAAT,CAAA,CAHuB,CAAQf,GCD9B0B,eAAqB1B,SAAAA,GAAAA,SAAAA,IAAAA,OAAAA,EAAAA,MAAAA,KAAAA,YAAAA,IAAAA,CAAAA,OAAAA,EAAAA,EAAAA,GAAAA,CAAAA,CAAAA,CAAAA,UFJCD,EEMhB2B,EAAc,CAACX,GFLVY,QAAQ,SAACC,GAClBC,OAAOC,oBAAoBF,EAASR,WAAWO,QAAQ,SAACI,GACpDF,OAAOG,eACHjC,EAAYqB,UACZW,EACAF,OAAOI,yBAAyBL,EAASR,UAAWW,IACpDF,OAAOK,OAAO,MAEtB,EACJ"}
@@ -0,0 +1,16 @@
1
+ type Environment = 'dev' | 'prod' | string;
2
+ type Config = {
3
+ apiKey?: string;
4
+ environment?: Environment;
5
+ };
6
+ export declare abstract class BaseApi {
7
+ private apiKey?;
8
+ private environment;
9
+ private base_api;
10
+ constructor(config: Config);
11
+ protected get<T>(endpoint: string): Promise<T>;
12
+ protected post<I, T>(endpoint: string, data: I): Promise<T>;
13
+ private getBaseUrl;
14
+ private getHeaders;
15
+ }
16
+ export {};
@@ -0,0 +1,5 @@
1
+ import { BaseApi } from "../base-api";
2
+ import { HealthCheckResponse } from "./types";
3
+ export declare class HealthCheckApi extends BaseApi {
4
+ getHealthCheck(): Promise<HealthCheckResponse>;
5
+ }
@@ -0,0 +1,10 @@
1
+ export interface HealthCheck {
2
+ name: string;
3
+ type: string;
4
+ success: boolean;
5
+ error_message?: string | null;
6
+ }
7
+ export interface HealthCheckResponse {
8
+ success: boolean;
9
+ checks: HealthCheck[];
10
+ }
@@ -0,0 +1,7 @@
1
+ import { BaseApi } from './base-api';
2
+ import { HealthCheckApi } from './health';
3
+ declare class NarrativeApi extends BaseApi {
4
+ }
5
+ interface NarrativeApi extends BaseApi, HealthCheckApi {
6
+ }
7
+ export default NarrativeApi;
@@ -0,0 +1,5 @@
1
+ import { BaseApi } from "../base-api";
2
+ import { RosettaStoneResponse, SampleRecords } from "./types";
3
+ export declare class RosettaStoneApi extends BaseApi {
4
+ getLabelsFromSample(sample: SampleRecords): Promise<RosettaStoneResponse[]>;
5
+ }
@@ -0,0 +1,12 @@
1
+ export interface SampleRecords {
2
+ sample: SampleRecord;
3
+ }
4
+ export interface SampleRecord {
5
+ [key: string]: string | number | boolean;
6
+ }
7
+ export interface RosettaStoneResponse {
8
+ label: number;
9
+ key: string;
10
+ name: string;
11
+ score: number;
12
+ }
@@ -0,0 +1 @@
1
+ export declare function applyMixins(derivedCtor: any, constructors: any[]): void;
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@narrative.io/data-collaboration-sdk-ts",
3
+ "version": "0.0.1",
4
+ "main": "dist/index.js",
5
+ "module": "dist/index.m.js",
6
+ "umd:main": "dist/index.umd.js",
7
+ "repository": "github:narrative-io/data-collaboration-sdk-ts",
8
+ "source": "src/index.ts",
9
+ "description": "",
10
+ "scripts": {
11
+ "build": "rm -rf dist && microbundle --tsconfig tsconfig.json",
12
+ "dev": "microbundle watch --tsconfig tsconfig.json",
13
+ "test": "vitest run --coverage",
14
+ "publish": "npm run build && npm test && npm publish --access public"
15
+ },
16
+ "keywords": [],
17
+ "author": "",
18
+ "license": "ISC",
19
+ "devDependencies": {
20
+ "@typescript-eslint/eslint-plugin": "^5.51.0",
21
+ "@vitest/coverage-c8": "^0.28.4",
22
+ "eslint": "^8.33.0",
23
+ "eslint-config-standard-with-typescript": "^34.0.0",
24
+ "eslint-plugin-import": "^2.27.5",
25
+ "eslint-plugin-n": "^15.6.1",
26
+ "eslint-plugin-promise": "^6.1.1",
27
+ "microbundle": "^0.15.1",
28
+ "typescript": "^4.9.5",
29
+ "vitest": "^0.28.4"
30
+ },
31
+ "dependencies": {
32
+ "mande": "^2.0.3",
33
+ "msw": "^1.0.1"
34
+ },
35
+ "files": [
36
+ "dist"
37
+ ]
38
+ }