@voiceflow/api-sdk 3.10.5 → 3.11.2

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.
@@ -1,5 +1,5 @@
1
- import { ClientOptions, PublicClient } from "./publicclient";
2
- import { User } from "./resources";
1
+ import { ClientOptions, PublicClient } from './publicClient';
2
+ import { User } from './resources';
3
3
  export declare class Client extends PublicClient {
4
4
  user: User;
5
5
  constructor(options: Omit<ClientOptions, 'authorization'> & {
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Client = void 0;
4
- const publicclient_1 = require("./publicclient");
4
+ const publicClient_1 = require("./publicClient");
5
5
  const resources_1 = require("./resources");
6
- class Client extends publicclient_1.PublicClient {
6
+ class Client extends publicClient_1.PublicClient {
7
7
  constructor(options) {
8
8
  super(options);
9
9
  this.user = new resources_1.User(options.authorization);
@@ -1,9 +1,9 @@
1
- import { Client } from "./client";
2
- import { ClientOptions, PublicClient } from "./publicclient";
3
1
  import * as s from 'superstruct';
4
- export { Client } from "./client";
5
- export { PublicClient } from "./publicclient";
6
- export { Flatten } from "./types";
2
+ import { Client } from './client';
3
+ import { ClientOptions, PublicClient } from './publicClient';
4
+ export type { Client } from './client';
5
+ export type { PublicClient } from './publicClient';
6
+ export type { Flatten } from './types';
7
7
  export declare const SParams: s.Struct<{
8
8
  clientKey: string;
9
9
  apiEndpoint: string;
@@ -20,9 +20,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
20
20
  };
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
22
  exports.SGenerateClientParams = exports.SParams = void 0;
23
- const client_1 = require("./client");
24
- const publicclient_1 = require("./publicclient");
25
23
  const s = __importStar(require("superstruct"));
24
+ const client_1 = require("./client");
25
+ const publicClient_1 = require("./publicClient");
26
26
  exports.SParams = s.object({
27
27
  clientKey: s.string(),
28
28
  apiEndpoint: s.string(),
@@ -37,7 +37,7 @@ class ApiSDK {
37
37
  this.apiEndpoint = apiEndpoint;
38
38
  }
39
39
  generatePublicClient(options = {}) {
40
- return new publicclient_1.PublicClient(Object.assign(Object.assign({}, options), { clientKey: this.clientKey, apiEndpoint: this.apiEndpoint }));
40
+ return new publicClient_1.PublicClient(Object.assign(Object.assign({}, options), { clientKey: this.clientKey, apiEndpoint: this.apiEndpoint }));
41
41
  }
42
42
  generateClient(options) {
43
43
  s.assert({ authorization: options.authorization }, exports.SGenerateClientParams);
@@ -1,6 +1,6 @@
1
- import Fetch, { FetchConfig } from "./fetch";
2
- import { Analytics, APIKey, Diagram, Program, Project, PrototypeProgram, VariableState, Version } from "./resources";
3
1
  import { Crypto } from '@voiceflow/common';
2
+ import Fetch, { FetchConfig } from './fetch';
3
+ import { Analytics, APIKey, Diagram, Note, Program, Project, PrototypeProgram, VariableState, Version } from './resources';
4
4
  export interface ClientOptions {
5
5
  options?: FetchConfig;
6
6
  clientKey: string;
@@ -9,14 +9,15 @@ export interface ClientOptions {
9
9
  analyticsEncryption?: Crypto.Synchronous;
10
10
  }
11
11
  export declare class PublicClient {
12
+ note: Note;
12
13
  fetch: Fetch;
14
+ apiKey: APIKey;
13
15
  project: Project;
14
16
  version: Version;
15
17
  program: Program;
16
18
  diagram: Diagram;
17
19
  analytics: Analytics;
18
- apiKey: APIKey;
19
- prototypeProgram: PrototypeProgram;
20
20
  variableState: VariableState;
21
+ prototypeProgram: PrototypeProgram;
21
22
  constructor({ clientKey, apiEndpoint, authorization, options, analyticsEncryption }: ClientOptions);
22
23
  }
@@ -9,14 +9,15 @@ const resources_1 = require("./resources");
9
9
  class PublicClient {
10
10
  constructor({ clientKey, apiEndpoint, authorization, options, analyticsEncryption }) {
11
11
  this.fetch = new fetch_1.default({ clientKey, apiEndpoint, authorization, options });
12
+ this.note = new resources_1.Note(this.fetch);
12
13
  this.apiKey = new resources_1.APIKey(this.fetch);
13
14
  this.project = new resources_1.Project(this.fetch);
14
15
  this.version = new resources_1.Version(this.fetch);
15
16
  this.program = new resources_1.Program(this.fetch);
16
17
  this.diagram = new resources_1.Diagram(this.fetch);
17
18
  this.analytics = new resources_1.Analytics(this.fetch, { encryption: analyticsEncryption });
18
- this.prototypeProgram = new resources_1.PrototypeProgram(this.fetch);
19
19
  this.variableState = new resources_1.VariableState(this.fetch);
20
+ this.prototypeProgram = new resources_1.PrototypeProgram(this.fetch);
20
21
  }
21
22
  }
22
23
  exports.PublicClient = PublicClient;
@@ -1,8 +1,8 @@
1
1
  import Fetcher, { FetcherOptions } from './fetcher';
2
2
  export declare type Fields = string[] | ReadonlyArray<string>;
3
- export declare type BaseResourceOptions<C extends Record<string, any>> = FetcherOptions<C>;
4
- declare class BaseResource<C extends Record<string, any>> extends Fetcher<C> {
5
- constructor(options: BaseResourceOptions<C>);
3
+ export declare type BaseResourceOptions<Client extends Record<string, any>> = FetcherOptions<Client>;
4
+ declare class BaseResource<Client extends Record<string, any>> extends Fetcher<Client> {
5
+ constructor(options: BaseResourceOptions<Client>);
6
6
  protected _getFieldsQuery(fields?: Fields): string;
7
7
  }
8
8
  export default BaseResource;
@@ -1,6 +1,7 @@
1
1
  export { default as Analytics } from './analytics';
2
2
  export { default as APIKey } from './apiKey';
3
3
  export { default as Diagram } from './diagram';
4
+ export { default as Note } from './note';
4
5
  export { default as Program } from './program';
5
6
  export { default as Project } from './project';
6
7
  export { default as PrototypeProgram } from './prototypeProgram';
@@ -3,13 +3,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Version = exports.VariableState = exports.User = exports.PrototypeProgram = exports.Project = exports.Program = exports.Diagram = exports.APIKey = exports.Analytics = void 0;
6
+ exports.Version = exports.VariableState = exports.User = exports.PrototypeProgram = exports.Project = exports.Program = exports.Note = exports.Diagram = exports.APIKey = exports.Analytics = void 0;
7
7
  var analytics_1 = require("./analytics");
8
8
  Object.defineProperty(exports, "Analytics", { enumerable: true, get: function () { return __importDefault(analytics_1).default; } });
9
9
  var apiKey_1 = require("./apiKey");
10
10
  Object.defineProperty(exports, "APIKey", { enumerable: true, get: function () { return __importDefault(apiKey_1).default; } });
11
11
  var diagram_1 = require("./diagram");
12
12
  Object.defineProperty(exports, "Diagram", { enumerable: true, get: function () { return __importDefault(diagram_1).default; } });
13
+ var note_1 = require("./note");
14
+ Object.defineProperty(exports, "Note", { enumerable: true, get: function () { return __importDefault(note_1).default; } });
13
15
  var program_1 = require("./program");
14
16
  Object.defineProperty(exports, "Program", { enumerable: true, get: function () { return __importDefault(program_1).default; } });
15
17
  var project_1 = require("./project");
@@ -0,0 +1,11 @@
1
+ import Fetch from "../fetch";
2
+ import { BaseModels } from '@voiceflow/base-types';
3
+ import BaseResource from './base';
4
+ export declare const ENDPOINT = "notes";
5
+ export declare type ModelKey = 'id';
6
+ declare class NoteResource extends BaseResource<NoteResource> {
7
+ constructor(fetch: Fetch);
8
+ upsert<T extends BaseModels.BaseNote = BaseModels.BaseNote>(versionID: string, note: T): Promise<T>;
9
+ delete(versionID: string, noteID: string): Promise<void>;
10
+ }
11
+ export default NoteResource;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ENDPOINT = void 0;
7
+ const base_1 = __importDefault(require("./base"));
8
+ exports.ENDPOINT = 'notes';
9
+ class NoteResource extends base_1.default {
10
+ constructor(fetch) {
11
+ super({ fetch, clazz: NoteResource, endpoint: exports.ENDPOINT });
12
+ }
13
+ async upsert(versionID, note) {
14
+ const { data } = await this.fetch.put(`${this._getEndpoint()}/${versionID}`, { note });
15
+ return data;
16
+ }
17
+ async delete(versionID, noteID) {
18
+ await this.fetch.delete(`${this._getEndpoint()}/${versionID}/${noteID}`);
19
+ }
20
+ }
21
+ exports.default = NoteResource;
@@ -1,5 +1,5 @@
1
- import { ClientOptions, PublicClient } from "./publicclient";
2
- import { User } from "./resources";
1
+ import { ClientOptions, PublicClient } from './publicClient';
2
+ import { User } from './resources';
3
3
  export declare class Client extends PublicClient {
4
4
  user: User;
5
5
  constructor(options: Omit<ClientOptions, 'authorization'> & {
@@ -1,5 +1,5 @@
1
- import { PublicClient } from "./publicclient";
2
- import { User } from "./resources";
1
+ import { PublicClient } from './publicClient';
2
+ import { User } from './resources';
3
3
  export class Client extends PublicClient {
4
4
  constructor(options) {
5
5
  super(options);
@@ -1,9 +1,9 @@
1
- import { Client } from "./client";
2
- import { ClientOptions, PublicClient } from "./publicclient";
3
1
  import * as s from 'superstruct';
4
- export { Client } from "./client";
5
- export { PublicClient } from "./publicclient";
6
- export { Flatten } from "./types";
2
+ import { Client } from './client';
3
+ import { ClientOptions, PublicClient } from './publicClient';
4
+ export type { Client } from './client';
5
+ export type { PublicClient } from './publicClient';
6
+ export type { Flatten } from './types';
7
7
  export declare const SParams: s.Struct<{
8
8
  clientKey: string;
9
9
  apiEndpoint: string;
@@ -1,6 +1,6 @@
1
- import { Client } from "./client";
2
- import { PublicClient } from "./publicclient";
3
1
  import * as s from 'superstruct';
2
+ import { Client } from './client';
3
+ import { PublicClient } from './publicClient';
4
4
  export const SParams = s.object({
5
5
  clientKey: s.string(),
6
6
  apiEndpoint: s.string(),
@@ -1,6 +1,6 @@
1
- import Fetch, { FetchConfig } from "./fetch";
2
- import { Analytics, APIKey, Diagram, Program, Project, PrototypeProgram, VariableState, Version } from "./resources";
3
1
  import { Crypto } from '@voiceflow/common';
2
+ import Fetch, { FetchConfig } from './fetch';
3
+ import { Analytics, APIKey, Diagram, Note, Program, Project, PrototypeProgram, VariableState, Version } from './resources';
4
4
  export interface ClientOptions {
5
5
  options?: FetchConfig;
6
6
  clientKey: string;
@@ -9,14 +9,15 @@ export interface ClientOptions {
9
9
  analyticsEncryption?: Crypto.Synchronous;
10
10
  }
11
11
  export declare class PublicClient {
12
+ note: Note;
12
13
  fetch: Fetch;
14
+ apiKey: APIKey;
13
15
  project: Project;
14
16
  version: Version;
15
17
  program: Program;
16
18
  diagram: Diagram;
17
19
  analytics: Analytics;
18
- apiKey: APIKey;
19
- prototypeProgram: PrototypeProgram;
20
20
  variableState: VariableState;
21
+ prototypeProgram: PrototypeProgram;
21
22
  constructor({ clientKey, apiEndpoint, authorization, options, analyticsEncryption }: ClientOptions);
22
23
  }
@@ -1,15 +1,16 @@
1
- import Fetch from "./fetch";
2
- import { Analytics, APIKey, Diagram, Program, Project, PrototypeProgram, VariableState, Version } from "./resources";
1
+ import Fetch from './fetch';
2
+ import { Analytics, APIKey, Diagram, Note, Program, Project, PrototypeProgram, VariableState, Version } from './resources';
3
3
  export class PublicClient {
4
4
  constructor({ clientKey, apiEndpoint, authorization, options, analyticsEncryption }) {
5
5
  this.fetch = new Fetch({ clientKey, apiEndpoint, authorization, options });
6
+ this.note = new Note(this.fetch);
6
7
  this.apiKey = new APIKey(this.fetch);
7
8
  this.project = new Project(this.fetch);
8
9
  this.version = new Version(this.fetch);
9
10
  this.program = new Program(this.fetch);
10
11
  this.diagram = new Diagram(this.fetch);
11
12
  this.analytics = new Analytics(this.fetch, { encryption: analyticsEncryption });
12
- this.prototypeProgram = new PrototypeProgram(this.fetch);
13
13
  this.variableState = new VariableState(this.fetch);
14
+ this.prototypeProgram = new PrototypeProgram(this.fetch);
14
15
  }
15
16
  }
@@ -1,8 +1,8 @@
1
1
  import Fetcher, { FetcherOptions } from './fetcher';
2
2
  export declare type Fields = string[] | ReadonlyArray<string>;
3
- export declare type BaseResourceOptions<C extends Record<string, any>> = FetcherOptions<C>;
4
- declare class BaseResource<C extends Record<string, any>> extends Fetcher<C> {
5
- constructor(options: BaseResourceOptions<C>);
3
+ export declare type BaseResourceOptions<Client extends Record<string, any>> = FetcherOptions<Client>;
4
+ declare class BaseResource<Client extends Record<string, any>> extends Fetcher<Client> {
5
+ constructor(options: BaseResourceOptions<Client>);
6
6
  protected _getFieldsQuery(fields?: Fields): string;
7
7
  }
8
8
  export default BaseResource;
@@ -1,6 +1,7 @@
1
1
  export { default as Analytics } from './analytics';
2
2
  export { default as APIKey } from './apiKey';
3
3
  export { default as Diagram } from './diagram';
4
+ export { default as Note } from './note';
4
5
  export { default as Program } from './program';
5
6
  export { default as Project } from './project';
6
7
  export { default as PrototypeProgram } from './prototypeProgram';
@@ -1,6 +1,7 @@
1
1
  export { default as Analytics } from './analytics';
2
2
  export { default as APIKey } from './apiKey';
3
3
  export { default as Diagram } from './diagram';
4
+ export { default as Note } from './note';
4
5
  export { default as Program } from './program';
5
6
  export { default as Project } from './project';
6
7
  export { default as PrototypeProgram } from './prototypeProgram';
@@ -0,0 +1,11 @@
1
+ import Fetch from "../fetch";
2
+ import { BaseModels } from '@voiceflow/base-types';
3
+ import BaseResource from './base';
4
+ export declare const ENDPOINT = "notes";
5
+ export declare type ModelKey = 'id';
6
+ declare class NoteResource extends BaseResource<NoteResource> {
7
+ constructor(fetch: Fetch);
8
+ upsert<T extends BaseModels.BaseNote = BaseModels.BaseNote>(versionID: string, note: T): Promise<T>;
9
+ delete(versionID: string, noteID: string): Promise<void>;
10
+ }
11
+ export default NoteResource;
@@ -0,0 +1,15 @@
1
+ import BaseResource from './base';
2
+ export const ENDPOINT = 'notes';
3
+ class NoteResource extends BaseResource {
4
+ constructor(fetch) {
5
+ super({ fetch, clazz: NoteResource, endpoint: ENDPOINT });
6
+ }
7
+ async upsert(versionID, note) {
8
+ const { data } = await this.fetch.put(`${this._getEndpoint()}/${versionID}`, { note });
9
+ return data;
10
+ }
11
+ async delete(versionID, noteID) {
12
+ await this.fetch.delete(`${this._getEndpoint()}/${versionID}/${noteID}`);
13
+ }
14
+ }
15
+ export default NoteResource;
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@voiceflow/api-sdk",
3
3
  "description": "wrapper for creator-api",
4
- "version": "3.10.5",
4
+ "version": "3.11.2",
5
5
  "author": "Voiceflow",
6
6
  "bugs": {
7
7
  "url": "https://github.com/voiceflow/libs/issues"
8
8
  },
9
9
  "dependencies": {
10
- "@voiceflow/base-types": "^2.18.0",
11
- "@voiceflow/common": "^7.24.0",
10
+ "@voiceflow/base-types": "^2.19.2",
11
+ "@voiceflow/common": "^7.25.1",
12
12
  "axios": "0.24.0",
13
13
  "jwt-decode": "^3.1.2",
14
14
  "superstruct": "^0.10.12"
@@ -62,5 +62,5 @@
62
62
  "test:single": "NODE_ENV=test ts-mocha --paths --config ./config/tests/.mocharc.json",
63
63
  "test:unit": "NODE_ENV=test nyc --report-dir=nyc_coverage_unit ts-mocha --paths --config ./config/tests/.mocharc.json 'tests/**/*.unit.ts'"
64
64
  },
65
- "gitHead": "8151c9f50f464c63f792373626d50079b0e605d1"
65
+ "gitHead": "cb46007be51b23d0852dbe4899c55bdc2afcf9bd"
66
66
  }