@voiceflow/api-sdk 3.2.0 → 3.3.0

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.
Files changed (134) hide show
  1. package/build/{client.d.ts → common/client.d.ts} +0 -0
  2. package/build/{client.js → common/client.js} +0 -0
  3. package/build/common/client.js.map +1 -0
  4. package/build/{fetch.d.ts → common/fetch.d.ts} +0 -0
  5. package/build/{fetch.js → common/fetch.js} +0 -0
  6. package/build/common/fetch.js.map +1 -0
  7. package/build/{index.d.ts → common/index.d.ts} +0 -0
  8. package/build/{index.js → common/index.js} +0 -0
  9. package/build/common/index.js.map +1 -0
  10. package/build/{publicclient.d.ts → common/publicclient.d.ts} +0 -0
  11. package/build/{publicclient.js → common/publicclient.js} +0 -0
  12. package/build/common/publicclient.js.map +1 -0
  13. package/build/{resources → common/resources}/analytics.d.ts +0 -0
  14. package/build/{resources → common/resources}/analytics.js +0 -0
  15. package/build/common/resources/analytics.js.map +1 -0
  16. package/build/{resources → common/resources}/apiKey.d.ts +0 -0
  17. package/build/{resources → common/resources}/apiKey.js +0 -0
  18. package/build/common/resources/apiKey.js.map +1 -0
  19. package/build/{resources → common/resources}/base.d.ts +0 -0
  20. package/build/{resources → common/resources}/base.js +0 -0
  21. package/build/common/resources/base.js.map +1 -0
  22. package/build/{resources → common/resources}/crud.d.ts +0 -0
  23. package/build/{resources → common/resources}/crud.js +0 -0
  24. package/build/common/resources/crud.js.map +1 -0
  25. package/build/{resources → common/resources}/diagram.d.ts +0 -0
  26. package/build/{resources → common/resources}/diagram.js +0 -0
  27. package/build/common/resources/diagram.js.map +1 -0
  28. package/build/{resources → common/resources}/fetcher.d.ts +0 -0
  29. package/build/{resources → common/resources}/fetcher.js +0 -0
  30. package/build/common/resources/fetcher.js.map +1 -0
  31. package/build/{resources → common/resources}/index.d.ts +0 -0
  32. package/build/{resources → common/resources}/index.js +0 -0
  33. package/build/common/resources/index.js.map +1 -0
  34. package/build/{resources → common/resources}/program.d.ts +0 -0
  35. package/build/{resources → common/resources}/program.js +0 -0
  36. package/build/common/resources/program.js.map +1 -0
  37. package/build/{resources → common/resources}/project/constants.d.ts +0 -0
  38. package/build/{resources → common/resources}/project/constants.js +0 -0
  39. package/build/common/resources/project/constants.js.map +1 -0
  40. package/build/{resources → common/resources}/project/index.d.ts +0 -0
  41. package/build/{resources → common/resources}/project/index.js +0 -0
  42. package/build/common/resources/project/index.js.map +1 -0
  43. package/build/{resources → common/resources}/project/member.d.ts +0 -0
  44. package/build/{resources → common/resources}/project/member.js +0 -0
  45. package/build/common/resources/project/member.js.map +1 -0
  46. package/build/{resources → common/resources}/prototypeProgram.d.ts +0 -0
  47. package/build/{resources → common/resources}/prototypeProgram.js +0 -0
  48. package/build/common/resources/prototypeProgram.js.map +1 -0
  49. package/build/{resources → common/resources}/user.d.ts +0 -0
  50. package/build/{resources → common/resources}/user.js +0 -0
  51. package/build/common/resources/user.js.map +1 -0
  52. package/build/{resources → common/resources}/version.d.ts +0 -0
  53. package/build/{resources → common/resources}/version.js +0 -0
  54. package/build/common/resources/version.js.map +1 -0
  55. package/build/{types.d.ts → common/types.d.ts} +0 -0
  56. package/build/{types.js → common/types.js} +0 -0
  57. package/build/common/types.js.map +1 -0
  58. package/build/esm/client.d.ts +8 -0
  59. package/build/esm/client.js +9 -0
  60. package/build/esm/client.js.map +1 -0
  61. package/build/esm/fetch.d.ts +33 -0
  62. package/build/esm/fetch.js +68 -0
  63. package/build/esm/fetch.js.map +1 -0
  64. package/build/esm/index.d.ts +27 -0
  65. package/build/esm/index.js +26 -0
  66. package/build/esm/index.js.map +1 -0
  67. package/build/esm/publicclient.d.ts +21 -0
  68. package/build/esm/publicclient.js +15 -0
  69. package/build/esm/publicclient.js.map +1 -0
  70. package/build/esm/resources/analytics.d.ts +30 -0
  71. package/build/esm/resources/analytics.js +50 -0
  72. package/build/esm/resources/analytics.js.map +1 -0
  73. package/build/esm/resources/apiKey.d.ts +17 -0
  74. package/build/esm/resources/apiKey.js +26 -0
  75. package/build/esm/resources/apiKey.js.map +1 -0
  76. package/build/esm/resources/base.d.ts +8 -0
  77. package/build/esm/resources/base.js +12 -0
  78. package/build/esm/resources/base.js.map +1 -0
  79. package/build/esm/resources/crud.d.ts +14 -0
  80. package/build/esm/resources/crud.js +32 -0
  81. package/build/esm/resources/crud.js.map +1 -0
  82. package/build/esm/resources/diagram.d.ts +25 -0
  83. package/build/esm/resources/diagram.js +42 -0
  84. package/build/esm/resources/diagram.js.map +1 -0
  85. package/build/esm/resources/fetcher.d.ts +22 -0
  86. package/build/esm/resources/fetcher.js +17 -0
  87. package/build/esm/resources/fetcher.js.map +1 -0
  88. package/build/esm/resources/index.d.ts +8 -0
  89. package/build/esm/resources/index.js +9 -0
  90. package/build/esm/resources/index.js.map +1 -0
  91. package/build/esm/resources/program.d.ts +20 -0
  92. package/build/esm/resources/program.js +26 -0
  93. package/build/esm/resources/program.js.map +1 -0
  94. package/build/esm/resources/project/constants.d.ts +1 -0
  95. package/build/esm/resources/project/constants.js +2 -0
  96. package/build/esm/resources/project/constants.js.map +1 -0
  97. package/build/esm/resources/project/index.d.ts +32 -0
  98. package/build/esm/resources/project/index.js +49 -0
  99. package/build/esm/resources/project/index.js.map +1 -0
  100. package/build/esm/resources/project/member.d.ts +24 -0
  101. package/build/esm/resources/project/member.js +49 -0
  102. package/build/esm/resources/project/member.js.map +1 -0
  103. package/build/esm/resources/prototypeProgram.d.ts +6 -0
  104. package/build/esm/resources/prototypeProgram.js +9 -0
  105. package/build/esm/resources/prototypeProgram.js.map +1 -0
  106. package/build/esm/resources/user.d.ts +10 -0
  107. package/build/esm/resources/user.js +39 -0
  108. package/build/esm/resources/user.js.map +1 -0
  109. package/build/esm/resources/version.d.ts +61 -0
  110. package/build/esm/resources/version.js +82 -0
  111. package/build/esm/resources/version.js.map +1 -0
  112. package/build/esm/types.d.ts +19 -0
  113. package/build/esm/types.js +2 -0
  114. package/build/esm/types.js.map +1 -0
  115. package/package.json +10 -8
  116. package/build/client.js.map +0 -1
  117. package/build/fetch.js.map +0 -1
  118. package/build/index.js.map +0 -1
  119. package/build/publicclient.js.map +0 -1
  120. package/build/resources/analytics.js.map +0 -1
  121. package/build/resources/apiKey.js.map +0 -1
  122. package/build/resources/base.js.map +0 -1
  123. package/build/resources/crud.js.map +0 -1
  124. package/build/resources/diagram.js.map +0 -1
  125. package/build/resources/fetcher.js.map +0 -1
  126. package/build/resources/index.js.map +0 -1
  127. package/build/resources/program.js.map +0 -1
  128. package/build/resources/project/constants.js.map +0 -1
  129. package/build/resources/project/index.js.map +0 -1
  130. package/build/resources/project/member.js.map +0 -1
  131. package/build/resources/prototypeProgram.js.map +0 -1
  132. package/build/resources/user.js.map +0 -1
  133. package/build/resources/version.js.map +0 -1
  134. package/build/types.js.map +0 -1
@@ -0,0 +1,14 @@
1
+ import type { BaseSchema, PutPostType, SchemeType } from "../types";
2
+ import BaseResource, { Fields } from './base';
3
+ declare class CrudResource<S extends BaseSchema, K extends keyof SchemeType<S>, C extends Record<string, any>, E extends keyof SchemeType<S> = never> extends BaseResource<C> {
4
+ protected _getCRUDEndpoint(id?: SchemeType<S>[K]): string;
5
+ protected _get<T extends Partial<SchemeType<S>>>(fields: Fields): Promise<T[]>;
6
+ protected _get<T extends SchemeType<S>>(): Promise<T[]>;
7
+ protected _getByID<T extends Partial<SchemeType<S>>>(id: SchemeType<S>[K], fields: Fields): Promise<T>;
8
+ protected _getByID<T extends SchemeType<S>>(id: SchemeType<S>[K]): Promise<T>;
9
+ protected _post<T extends SchemeType<S>>(body: PutPostType<T, K, E>): Promise<T>;
10
+ protected _put<T extends SchemeType<S>>(id: SchemeType<S>[K], body: PutPostType<T, K, E>): Promise<T>;
11
+ protected _patch<T extends SchemeType<S>>(id: SchemeType<S>[K], body: Partial<T>): Promise<Partial<T>>;
12
+ protected _delete(id: SchemeType<S>[K]): Promise<SchemeType<S>[K]>;
13
+ }
14
+ export default CrudResource;
@@ -0,0 +1,32 @@
1
+ import BaseResource from './base';
2
+ class CrudResource extends BaseResource {
3
+ _getCRUDEndpoint(id) {
4
+ return id ? `${this._getEndpoint()}/${id}` : this._getEndpoint();
5
+ }
6
+ async _get(fields) {
7
+ const { data } = await this.fetch.get(`${this._getCRUDEndpoint()}${this._getFieldsQuery(fields)}`);
8
+ return data;
9
+ }
10
+ async _getByID(id, fields) {
11
+ const { data } = await this.fetch.get(`${this._getCRUDEndpoint(id)}${this._getFieldsQuery(fields)}`);
12
+ return data;
13
+ }
14
+ async _post(body) {
15
+ const { data } = await this.fetch.post(this._getCRUDEndpoint(), body);
16
+ return data;
17
+ }
18
+ async _put(id, body) {
19
+ const { data } = await this.fetch.put(this._getCRUDEndpoint(id), body);
20
+ return data;
21
+ }
22
+ async _patch(id, body) {
23
+ const { data } = await this.fetch.patch(this._getCRUDEndpoint(id), body);
24
+ return data;
25
+ }
26
+ async _delete(id) {
27
+ await this.fetch.delete(this._getCRUDEndpoint(id));
28
+ return id;
29
+ }
30
+ }
31
+ export default CrudResource;
32
+ //# sourceMappingURL=crud.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crud.js","sourceRoot":"","sources":["../../../src/resources/crud.ts"],"names":[],"mappings":"AAEA,OAAO,YAAwB,MAAM,QAAQ,CAAC;AAE9C,MAAM,YAKJ,SAAQ,YAAe;IACb,gBAAgB,CAAC,EAAqB;QAC9C,OAAO,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,YAAY,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;IACnE,CAAC;IAMS,KAAK,CAAC,IAAI,CAA0B,MAAe;QAC3D,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAM,GAAG,IAAI,CAAC,gBAAgB,EAAE,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAExG,OAAO,IAAI,CAAC;IACd,CAAC;IAMS,KAAK,CAAC,QAAQ,CAAC,EAAoB,EAAE,MAAe;QAC5D,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAErG,OAAO,IAAI,CAAC;IACd,CAAC;IAES,KAAK,CAAC,KAAK,CAA0B,IAA0B;QACvE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAI,IAAI,CAAC,gBAAgB,EAAE,EAAE,IAAI,CAAC,CAAC;QAEzE,OAAO,IAAI,CAAC;IACd,CAAC;IAES,KAAK,CAAC,IAAI,CAA0B,EAAoB,EAAE,IAA0B;QAC5F,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAI,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;QAE1E,OAAO,IAAI,CAAC;IACd,CAAC;IAES,KAAK,CAAC,MAAM,CAA0B,EAAoB,EAAE,IAAgB;QACpF,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,CAAa,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;QAErF,OAAO,IAAI,CAAC;IACd,CAAC;IAES,KAAK,CAAC,OAAO,CAAC,EAAoB;QAC1C,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,CAAC;QAEnD,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AAED,eAAe,YAAY,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { Models } from '@voiceflow/base-types';
2
+ import type Fetch from "../fetch";
3
+ import { Fields } from './base';
4
+ import CrudResource from './crud';
5
+ export declare const modelIDKey = "_id";
6
+ export declare type ModelIDKey = typeof modelIDKey;
7
+ declare class DiagramResource extends CrudResource<Models.Diagram, ModelIDKey, DiagramResource, 'modified'> {
8
+ constructor(fetch: Fetch);
9
+ get<T extends Partial<Models.Diagram>>(id: Models.DiagramID, fields: Fields): Promise<T>;
10
+ get<T extends Models.BaseDiagramNode = Models.BaseDiagramNode>(id: Models.DiagramID): Promise<Models.Diagram<T>>;
11
+ get<T extends Models.Diagram<any> = Models.Diagram>(id: Models.DiagramID): Promise<T>;
12
+ getRTC<T extends Models.Diagram<any> = Models.Diagram>(id: Models.DiagramID): Promise<{
13
+ diagram: T;
14
+ timestamp: number;
15
+ }>;
16
+ create<T extends Models.BaseDiagramNode = Models.BaseDiagramNode>(body: Omit<Models.Diagram<T>, '_id'> & Partial<Pick<Models.Diagram<T>, '_id'>>): Promise<Models.Diagram<T>>;
17
+ create<T extends Omit<Models.Diagram<any>, '_id'>>(body: T): Promise<T & Pick<Models.Diagram<any>, '_id'>>;
18
+ update<T extends Models.BaseDiagramNode = Models.BaseDiagramNode>(id: Models.DiagramID, body: Partial<Models.Diagram<T>>): Promise<Partial<Models.Diagram<T>>>;
19
+ update<T extends Partial<Models.Diagram<any>>>(id: Models.DiagramID, body: T): Promise<T>;
20
+ updateNode<T extends Omit<Models.BaseDiagramNode, 'nodeID'>>(id: Models.DiagramID, nodeID: Models.NodeID, body: T): Promise<T & Pick<Models.BaseDiagramNode, 'nodeID'>>;
21
+ patchNode<T extends Omit<Models.BaseDiagramNode, 'nodeID'>>(id: Models.DiagramID, nodeID: Models.NodeID, body: Partial<T>): Promise<T & Pick<Models.BaseDiagramNode, 'nodeID'>>;
22
+ deleteNode(id: Models.DiagramID, nodeID: Models.NodeID): Promise<string>;
23
+ delete(id: Models.DiagramID): Promise<Models.DiagramID>;
24
+ }
25
+ export default DiagramResource;
@@ -0,0 +1,42 @@
1
+ import CrudResource from './crud';
2
+ const ENDPOINT = 'diagrams';
3
+ export const modelIDKey = '_id';
4
+ class DiagramResource extends CrudResource {
5
+ constructor(fetch) {
6
+ super({
7
+ fetch,
8
+ clazz: DiagramResource,
9
+ endpoint: ENDPOINT,
10
+ });
11
+ }
12
+ async get(id, fields) {
13
+ return fields ? super._getByID(id, fields) : super._getByID(id);
14
+ }
15
+ async getRTC(id) {
16
+ const { data } = await this.fetch.get(`${this._getCRUDEndpoint(id)}/rtc`);
17
+ return data;
18
+ }
19
+ async create(body) {
20
+ return super._post(body);
21
+ }
22
+ async update(id, body) {
23
+ return super._patch(id, body);
24
+ }
25
+ async updateNode(id, nodeID, body) {
26
+ const { data } = await this.fetch.put(`${this._getCRUDEndpoint(id)}/nodes/${nodeID}`, body);
27
+ return data;
28
+ }
29
+ async patchNode(id, nodeID, body) {
30
+ const { data } = await this.fetch.patch(`${this._getCRUDEndpoint(id)}/nodes/${nodeID}`, body);
31
+ return data;
32
+ }
33
+ async deleteNode(id, nodeID) {
34
+ const { data } = await this.fetch.delete(`${this._getCRUDEndpoint(id)}/nodes/${nodeID}`);
35
+ return data;
36
+ }
37
+ async delete(id) {
38
+ return super._delete(id);
39
+ }
40
+ }
41
+ export default DiagramResource;
42
+ //# sourceMappingURL=diagram.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagram.js","sourceRoot":"","sources":["../../../src/resources/diagram.ts"],"names":[],"mappings":"AAKA,OAAO,YAAY,MAAM,QAAQ,CAAC;AAElC,MAAM,QAAQ,GAAG,UAAU,CAAC;AAE5B,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,CAAC;AAGhC,MAAM,eAAgB,SAAQ,YAAqE;IACjG,YAAY,KAAY;QACtB,KAAK,CAAC;YACJ,KAAK;YACL,KAAK,EAAE,eAAe;YACtB,QAAQ,EAAE,QAAQ;SACnB,CAAC,CAAC;IACL,CAAC;IAQM,KAAK,CAAC,GAAG,CAAC,EAAoB,EAAE,MAAe;QACpD,OAAO,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,E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,CAAC,EAAE,CAAC,UAAU,MAAM,EAAE,CAAC,CAAC;QAEjG,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,EAAoB;QACtC,OAAO,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC3B,CAAC;CACF;AAED,eAAe,eAAe,CAAC"}
@@ -0,0 +1,22 @@
1
+ import type Fetch from "../fetch";
2
+ declare type Clazz<Client, Options = undefined> = Options extends undefined ? new (fetch: Fetch) => Client : new (fetch: Fetch, options: Options) => Client;
3
+ interface BaseFetcherOptions<Client, Options = undefined> {
4
+ fetch: Fetch;
5
+ clazz: Clazz<Client, Options>;
6
+ endpoint: string;
7
+ }
8
+ export declare type FetcherOptions<Client, Options = undefined> = Options extends undefined ? BaseFetcherOptions<Client> & {
9
+ clazzOptions?: never;
10
+ } : BaseFetcherOptions<Client, Options> & {
11
+ clazzOptions: Options;
12
+ };
13
+ declare class Fetcher<Client, Options = undefined> {
14
+ private readonly clazz;
15
+ private endpoint;
16
+ private clazzOptions;
17
+ protected readonly fetch: Fetch;
18
+ constructor({ fetch, clazz, endpoint, clazzOptions }: FetcherOptions<Client, Options>);
19
+ protected _getEndpoint(): string;
20
+ options(options: Parameters<Fetch['initWithOptions']>[0]): Client;
21
+ }
22
+ export default Fetcher;
@@ -0,0 +1,17 @@
1
+ class Fetcher {
2
+ constructor({ fetch, clazz, endpoint, clazzOptions }) {
3
+ this.fetch = fetch;
4
+ this.clazz = clazz;
5
+ this.endpoint = endpoint;
6
+ this.clazzOptions = clazzOptions;
7
+ }
8
+ _getEndpoint() {
9
+ return this.endpoint;
10
+ }
11
+ options(options) {
12
+ const { clazz: Clazz } = this;
13
+ return new Clazz(this.fetch.initWithOptions(options), this.clazzOptions);
14
+ }
15
+ }
16
+ export default Fetcher;
17
+ //# sourceMappingURL=fetcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetcher.js","sourceRoot":"","sources":["../../../src/resources/fetcher.ts"],"names":[],"mappings":"AAcA,MAAM,OAAO;IASX,YAAY,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAmC;QACnF,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,YAAY,GAAG,YAAuB,CAAC;IAC9C,CAAC;IAES,YAAY;QACpB,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAEM,OAAO,CAAC,OAAgD;QAC7D,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;QAE9B,OAAO,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IAC3E,CAAC;CACF;AAED,eAAe,OAAO,CAAC"}
@@ -0,0 +1,8 @@
1
+ export { default as Analytics } from './analytics';
2
+ export { default as APIKey } from './apiKey';
3
+ export { default as Diagram } from './diagram';
4
+ export { default as Program } from './program';
5
+ export { default as Project } from './project';
6
+ export { default as PrototypeProgram } from './prototypeProgram';
7
+ export { default as User } from './user';
8
+ export { default as Version } from './version';
@@ -0,0 +1,9 @@
1
+ export { default as Analytics } from './analytics';
2
+ export { default as APIKey } from './apiKey';
3
+ export { default as Diagram } from './diagram';
4
+ export { default as Program } from './program';
5
+ export { default as Project } from './project';
6
+ export { default as PrototypeProgram } from './prototypeProgram';
7
+ export { default as User } from './user';
8
+ export { default as Version } from './version';
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/resources/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { Models } from '@voiceflow/base-types';
2
+ import type Fetch from "../fetch";
3
+ import { Fields } from './base';
4
+ import CrudResource from './crud';
5
+ export declare const modelIDKey = "id";
6
+ export declare type ModelIDKey = typeof modelIDKey;
7
+ declare class ProgramResource extends CrudResource<Models.Program, ModelIDKey, ProgramResource> {
8
+ constructor(fetch: Fetch, { resourceEndpoint }?: {
9
+ resourceEndpoint?: string;
10
+ });
11
+ get<T extends Partial<Models.Program>>(id: Models.ProgramID, fields: Fields): Promise<T>;
12
+ get<T extends Models.BaseNode, C extends Models.BaseCommand>(id: Models.ProgramID): Promise<Models.Program<T, C>>;
13
+ get<T extends Models.Program<any, any> = Models.Program>(id: Models.ProgramID): Promise<T>;
14
+ create<T extends Models.BaseNode, C extends Models.BaseCommand>(body: Omit<Models.Program<T, C>, ModelIDKey>): Promise<Models.Program<T, C>>;
15
+ create<T extends Omit<Models.Program<any, any>, ModelIDKey>>(body: T): Promise<T & Pick<Models.Program<any, any>, ModelIDKey>>;
16
+ update<T extends Models.BaseNode, C extends Models.BaseCommand>(id: Models.ProgramID, body: Omit<Models.Program<T, C>, ModelIDKey>): Promise<Omit<Models.Program<T, C>, ModelIDKey>>;
17
+ update<T extends Omit<Models.Program<any, any>, ModelIDKey>>(id: Models.ProgramID, body: T): Promise<T>;
18
+ delete(id: Models.ProgramID): Promise<Models.ProgramID>;
19
+ }
20
+ export default ProgramResource;
@@ -0,0 +1,26 @@
1
+ import CrudResource from './crud';
2
+ const ENDPOINT = 'programs';
3
+ export const modelIDKey = 'id';
4
+ class ProgramResource extends CrudResource {
5
+ constructor(fetch, { resourceEndpoint = ENDPOINT } = {}) {
6
+ super({
7
+ fetch,
8
+ clazz: ProgramResource,
9
+ endpoint: resourceEndpoint,
10
+ });
11
+ }
12
+ async get(id, fields) {
13
+ return fields ? super._getByID(id, fields) : super._getByID(id);
14
+ }
15
+ async create(body) {
16
+ return super._post(body);
17
+ }
18
+ async update(id, body) {
19
+ return super._put(id, body);
20
+ }
21
+ async delete(id) {
22
+ return super._delete(id);
23
+ }
24
+ }
25
+ export default ProgramResource;
26
+ //# sourceMappingURL=program.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"program.js","sourceRoot":"","sources":["../../../src/resources/program.ts"],"names":[],"mappings":"AAKA,OAAO,YAAY,MAAM,QAAQ,CAAC;AAElC,MAAM,QAAQ,GAAG,UAAU,CAAC;AAE5B,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC;AAG/B,MAAM,eAAgB,SAAQ,YAAyD;IACrF,YAAY,KAAY,EAAE,EAAE,gBAAgB,GAAG,QAAQ,KAAoC,EAAE;QAC3F,KAAK,CAAC;YACJ,KAAK;YACL,KAAK,EAAE,eAAe;YACtB,QAAQ,EAAE,gBAAgB;SAC3B,CAAC,CAAC;IACL,CAAC;IAQM,KAAK,CAAC,GAAG,CAAC,EAAoB,EAAE,MAAe;QACpD,OAAO,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAClE,CAAC;IAMM,KAAK,CAAC,MAAM,CAAC,IAAgD;QAClE,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IASM,KAAK,CAAC,MAAM,CAAC,EAAoB,EAAE,IAAgD;QACxF,OAAO,KAAK,CAAC,IAAI,CAA2B,EAAE,EAAE,IAAI,CAAC,CAAC;IACxD,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,EAAoB;QACtC,OAAO,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC3B,CAAC;CACF;AAED,eAAe,eAAe,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const ENDPOINT = "projects";
@@ -0,0 +1,2 @@
1
+ export const ENDPOINT = 'projects';
2
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/resources/project/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { Models } from '@voiceflow/base-types';
2
+ import type Fetch from "../../fetch";
3
+ import { Fields } from '../base';
4
+ import CrudResource from '../crud';
5
+ import MemberResource from './member';
6
+ export declare const modelIDKey = "_id";
7
+ export declare type ModelIDKey = typeof modelIDKey;
8
+ declare class ProjectResource extends CrudResource<Models.Project<Models.BasePlatformData, Models.BasePlatformData>, ModelIDKey, ProjectResource, 'creatorID'> {
9
+ member: MemberResource;
10
+ constructor(fetch: Fetch);
11
+ list<P extends Partial<Models.Project<Models.BasePlatformData, Models.BasePlatformData>>>(workspaceID: Models.WorkspaceID, fields: Fields): Promise<P[]>;
12
+ list<P extends Models.BasePlatformData, M extends Models.BasePlatformData>(workspaceID: Models.WorkspaceID): Promise<Models.Project<P, M>[]>;
13
+ list<P extends Models.Project<any, any> = Models.Project<Models.BasePlatformData, Models.BasePlatformData>>(workspaceID: Models.WorkspaceID): Promise<P[]>;
14
+ get<P extends Partial<Models.Project<Models.BasePlatformData, Models.BasePlatformData>>>(id: Models.ProjectID, fields: string[]): Promise<P>;
15
+ get<P extends Models.BasePlatformData, M extends Models.BasePlatformData>(id: Models.ProjectID): Promise<Models.Project<P, M>>;
16
+ get<P extends Models.Project<any, any> = Models.Project<Models.BasePlatformData, Models.BasePlatformData>>(id: Models.ProjectID): Promise<P>;
17
+ create<P extends Models.BasePlatformData, M extends Models.BasePlatformData>(body: Omit<Models.Project<P, M>, ModelIDKey | 'creatorID'>): Promise<Models.Project<P, M>>;
18
+ create<P extends Omit<Models.Project<any, any>, ModelIDKey | 'creatorID'>>(body: P): Promise<P & Pick<Models.Project<any, any>, ModelIDKey | 'creatorID'>>;
19
+ update<P extends Models.BasePlatformData, M extends Models.BasePlatformData>(id: Models.ProjectID, body: Partial<Models.Project<P, M>>): Promise<Partial<Models.Project<P, M>>>;
20
+ update<P extends Partial<Models.Project<any, any>>>(id: Models.ProjectID, body: P): Promise<P>;
21
+ delete(id: Models.ProjectID): Promise<Models.ProjectID>;
22
+ updatePlatformData<P extends Partial<Models.BasePlatformData>>(id: Models.ProjectID, body: P): Promise<P>;
23
+ getVersions<P extends Partial<Models.Version<Models.VersionPlatformData>>>(id: Models.ProjectID, fields: string[]): Promise<P[]>;
24
+ getVersions<P extends Models.Version<any> = Models.Version<Models.VersionPlatformData>>(id: Models.ProjectID): Promise<P[]>;
25
+ getVersions<P extends Models.VersionPlatformData>(id: Models.ProjectID): Promise<Models.Version<P>[]>;
26
+ getVersionsV2<P extends Models.VersionPlatformData>(id: Models.ProjectID, options?: {
27
+ offset?: number;
28
+ limit?: number;
29
+ }): Promise<Models.Version<P>[]>;
30
+ getPrototype<P extends Models.ProjectPrototype>(id: Models.ProjectID): Promise<P>;
31
+ }
32
+ export default ProjectResource;
@@ -0,0 +1,49 @@
1
+ import CrudResource from '../crud';
2
+ import { ENDPOINT } from './constants';
3
+ import MemberResource from './member';
4
+ export const modelIDKey = '_id';
5
+ class ProjectResource extends CrudResource {
6
+ constructor(fetch) {
7
+ super({
8
+ fetch,
9
+ clazz: ProjectResource,
10
+ endpoint: ENDPOINT,
11
+ });
12
+ this.member = new MemberResource(fetch);
13
+ }
14
+ async list(workspaceID, fields) {
15
+ const { data } = await this.fetch.get(`workspaces/${workspaceID}/projects${this._getFieldsQuery(fields)}`);
16
+ return data;
17
+ }
18
+ async get(id, fields) {
19
+ return fields ? super._getByID(id, fields) : super._getByID(id);
20
+ }
21
+ async create(body) {
22
+ return super._post(body);
23
+ }
24
+ async update(id, body) {
25
+ return super._patch(id, body);
26
+ }
27
+ async delete(id) {
28
+ return super._delete(id);
29
+ }
30
+ async updatePlatformData(id, body) {
31
+ const { data } = await this.fetch.patch(`${this._getCRUDEndpoint(id)}/platform`, body);
32
+ return data;
33
+ }
34
+ async getVersions(id, fields) {
35
+ const { data } = await this.fetch.get(`${this._getCRUDEndpoint(id)}/versions${this._getFieldsQuery(fields)}`);
36
+ return data;
37
+ }
38
+ async getVersionsV2(id, options = {}) {
39
+ const { offset = 0, limit = 10 } = options;
40
+ const { data } = await this.fetch.get(`${this._getCRUDEndpoint(id)}/projectVersions?offset=${offset}&limit=${limit}`);
41
+ return data;
42
+ }
43
+ async getPrototype(id) {
44
+ const { data } = await this.fetch.get(`${this._getCRUDEndpoint(id)}/prototype`);
45
+ return data;
46
+ }
47
+ }
48
+ export default ProjectResource;
49
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/resources/project/index.ts"],"names":[],"mappings":"AAKA,OAAO,YAAY,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,cAAc,MAAM,UAAU,CAAC;AAEtC,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,CAAC;AAGhC,MAAM,eAAgB,SAAQ,YAK7B;IAGC,YAAY,KAAY;QACtB,KAAK,CAAC;YACJ,KAAK;YACL,KAAK,EAAE,eAAe;YACtB,QAAQ,EAAE,QAAQ;SACnB,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,GAAG,IAAI,cAAc,CAAC,KAAK,CAAC,CAAC;IAC1C,CAAC;IAeM,KAAK,C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E,CAAC,CAAC;QAErI,OAAO,IAAI,CAAC;IACd,CAAC;IAOM,KAAK,CAAC,aAAa,CAAC,EAAoB,EAAE,UAA+C,EAAE;QAChG,MAAM,EAAE,MAAM,GAAG,CAAC,EAAE,KAAK,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC;QAC3C,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAwB,GAAG,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC,2BAA2B,MAAM,UAAU,KAAK,EAAE,CAAC,CAAC;QAE7I,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,YAAY,CAAoC,EAAoB;QAC/E,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAI,GAAG,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC;QAEnF,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED,eAAe,eAAe,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { Models } from '@voiceflow/base-types';
2
+ import Fetch, { PathVariables } from "../../fetch";
3
+ import BaseResource, { Fields } from '../base';
4
+ export declare const modelIDKey = "creatorID";
5
+ export declare type ModelIDKey = typeof modelIDKey;
6
+ declare class MemberResource extends BaseResource<MemberResource> {
7
+ constructor(fetch: Fetch);
8
+ protected _getCRUDEndpoint(id: Models.ProjectID): string;
9
+ list<P extends Partial<Models.Member<Models.BasePlatformData>>>(projectID: Models.ProjectID, fields: Fields): Promise<P[]>;
10
+ list<P extends Models.Member<any> = Models.Member<Models.BasePlatformData>>(projectID: Models.ProjectID): Promise<P[]>;
11
+ list<P extends Models.BasePlatformData>(projectID: Models.ProjectID): Promise<Models.Member<P>[]>;
12
+ get<P extends Partial<Models.Member<Models.BasePlatformData>>>(projectID: Models.ProjectID, fields: Fields): Promise<P>;
13
+ get<P extends Models.Member<any> = Models.Member<Models.BasePlatformData>>(projectID: Models.ProjectID, fields: Fields): Promise<P>;
14
+ get<P extends Models.BasePlatformData>(projectID: Models.ProjectID): Promise<Models.Member<P>>;
15
+ create<P extends Models.BasePlatformData>(projectID: Models.ProjectID, body: Omit<Models.Member<P>, ModelIDKey>): Promise<Models.Member<P>>;
16
+ create<P extends Omit<Models.Member<any>, ModelIDKey>>(projectID: Models.ProjectID, body: P): Promise<P & Pick<Models.Member<any>, ModelIDKey>>;
17
+ update<P extends Models.BasePlatformData>(projectID: Models.ProjectID, body: Omit<Models.Member<P>, ModelIDKey>): Promise<Models.Member<P>>;
18
+ update<P extends Omit<Models.Member<any>, ModelIDKey>>(projectID: Models.ProjectID, body: P): Promise<P & Pick<Models.Member<any>, ModelIDKey>>;
19
+ delete(projectID: Models.ProjectID): Promise<Models.CreatorID>;
20
+ platformDataAdd<P>(projectID: Models.ProjectID, path: string, value: P, pathVariables?: PathVariables): Promise<P>;
21
+ platformDataUpdate<P>(projectID: Models.ProjectID, path: string, value: P, pathVariables?: PathVariables): Promise<P>;
22
+ platformDataRemove<P>(projectID: Models.ProjectID, path: string, pathVariables?: PathVariables): Promise<P>;
23
+ }
24
+ export default MemberResource;
@@ -0,0 +1,49 @@
1
+ import BaseResource from '../base';
2
+ import { ENDPOINT } from './constants';
3
+ export const modelIDKey = 'creatorID';
4
+ class MemberResource extends BaseResource {
5
+ constructor(fetch) {
6
+ super({
7
+ fetch,
8
+ clazz: MemberResource,
9
+ endpoint: ENDPOINT,
10
+ });
11
+ }
12
+ _getCRUDEndpoint(id) {
13
+ return `${this._getEndpoint()}/${id}/members`;
14
+ }
15
+ async list(projectID, fields) {
16
+ const { data } = await this.fetch.get(`${this._getCRUDEndpoint(projectID)}${this._getFieldsQuery(fields)}`);
17
+ return data;
18
+ }
19
+ async get(projectID, fields) {
20
+ const { data } = await this.fetch.get(`${this._getEndpoint()}/${projectID}/member${this._getFieldsQuery(fields)}`);
21
+ return data;
22
+ }
23
+ async create(projectID, body) {
24
+ const { data } = await this.fetch.post(this._getCRUDEndpoint(projectID), body);
25
+ return data;
26
+ }
27
+ async update(projectID, body) {
28
+ const { data } = await this.fetch.put(this._getCRUDEndpoint(projectID), body);
29
+ return data;
30
+ }
31
+ async delete(projectID) {
32
+ const { data } = await this.fetch.delete(this._getCRUDEndpoint(projectID));
33
+ return data;
34
+ }
35
+ async platformDataAdd(projectID, path, value, pathVariables) {
36
+ const { data } = await this.fetch.granularPatch(`${this._getCRUDEndpoint(projectID)}/platform-data/add`, path, value, pathVariables);
37
+ return data;
38
+ }
39
+ async platformDataUpdate(projectID, path, value, pathVariables) {
40
+ const { data } = await this.fetch.granularPatch(`${this._getCRUDEndpoint(projectID)}/platform-data/update`, path, value, pathVariables);
41
+ return data;
42
+ }
43
+ async platformDataRemove(projectID, path, pathVariables) {
44
+ const { data } = await this.fetch.granularPatch(`${this._getCRUDEndpoint(projectID)}/platform-data/remove`, path, undefined, pathVariables);
45
+ return data;
46
+ }
47
+ }
48
+ export default MemberResource;
49
+ //# sourceMappingURL=member.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"member.js","sourceRoot":"","sources":["../../../../src/resources/project/member.ts"],"names":[],"mappings":"AAIA,OAAO,YAAwB,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,MAAM,CAAC,MAAM,UAAU,GAAG,WAAW,CAAC;AAGtC,MAAM,cAAe,SAAQ,YAA4B;IACvD,YAAY,KAAY;QACtB,KAAK,CAAC;YACJ,KAAK;YACL,KAAK,EAAE,cAAc;YACrB,QAAQ,EAAE,QAAQ;SACnB,CAAC,CAAC;IACL,CAAC;IAES,gBAAgB,CAAC,EAAoB;QAC7C,OAAO,GAAG,IAAI,CAAC,YAAY,EAAE,IAAI,EAAE,UAAU,CAAC;IAChD,CAAC;IAQM,KAAK,CAAC,IAAI,CAAC,SAA2B,EAAE,MAAe;QAC5D,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,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,CAAI,GAAG,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,oBAAoB,EAAE,IAAI,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC;QAExI,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,kBAAkB,CAAI,SAA2B,EAAE,IAAY,EAAE,KAAQ,EAAE,aAA6B;QACnH,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,aAAa,CAAI,GAAG,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,uBAAuB,EAAE,IAAI,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC;QAE3I,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,kBAAkB,CAAI,SAA2B,EAAE,IAAY,EAAE,aAA6B;QACzG,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,aAAa,CAAI,GAAG,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,uBAAuB,EAAE,IAAI,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;QAE/I,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED,eAAe,cAAc,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type Fetch from "../fetch";
2
+ import ProgramResource from './program';
3
+ declare class PrototypeProgramResource extends ProgramResource {
4
+ constructor(fetch: Fetch);
5
+ }
6
+ export default PrototypeProgramResource;
@@ -0,0 +1,9 @@
1
+ import ProgramResource from './program';
2
+ const ENDPOINT = 'prototype-programs';
3
+ class PrototypeProgramResource extends ProgramResource {
4
+ constructor(fetch) {
5
+ super(fetch, { resourceEndpoint: ENDPOINT });
6
+ }
7
+ }
8
+ export default PrototypeProgramResource;
9
+ //# sourceMappingURL=prototypeProgram.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prototypeProgram.js","sourceRoot":"","sources":["../../../src/resources/prototypeProgram.ts"],"names":[],"mappings":"AAEA,OAAO,eAAe,MAAM,WAAW,CAAC;AAExC,MAAM,QAAQ,GAAG,oBAAoB,CAAC;AAEtC,MAAM,wBAAyB,SAAQ,eAAe;IACpD,YAAY,KAAY;QACtB,KAAK,CAAC,KAAK,EAAE,EAAE,gBAAgB,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC/C,CAAC;CACF;AAED,eAAe,wBAAwB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { Models } from '@voiceflow/base-types';
2
+ export declare const parseJWT: <S>(token: string) => S;
3
+ declare class User {
4
+ creatorID: Models.CreatorID;
5
+ name: string;
6
+ email: string;
7
+ constructor(authorization: string);
8
+ isAPIKey(authorization: string): boolean;
9
+ }
10
+ export default User;
@@ -0,0 +1,39 @@
1
+ import jwtDecode from 'jwt-decode';
2
+ const decodeJWT = (token) => {
3
+ try {
4
+ return jwtDecode(token);
5
+ }
6
+ catch (_a) {
7
+ return null;
8
+ }
9
+ };
10
+ export const parseJWT = (token) => {
11
+ let user = decodeJWT(token.substring(16));
12
+ // try again without assuming the userHash is there
13
+ if (!user) {
14
+ user = decodeJWT(token);
15
+ }
16
+ if (!user) {
17
+ throw new RangeError('Invalid JWT');
18
+ }
19
+ return user;
20
+ };
21
+ class User {
22
+ constructor(authorization) {
23
+ this.creatorID = 0;
24
+ this.name = '';
25
+ this.email = '';
26
+ if (!this.isAPIKey(authorization)) {
27
+ const { id, name, email } = parseJWT(authorization);
28
+ this.creatorID = id;
29
+ this.name = name;
30
+ this.email = email;
31
+ }
32
+ }
33
+ // eslint-disable-next-line class-methods-use-this
34
+ isAPIKey(authorization) {
35
+ return authorization.startsWith('VF.');
36
+ }
37
+ }
38
+ export default User;
39
+ //# sourceMappingURL=user.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user.js","sourceRoot":"","sources":["../../../src/resources/user.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,MAAM,SAAS,GAAG,CAAI,KAAa,EAAY,EAAE;IAC/C,IAAI;QACF,OAAO,SAAS,CAAC,KAAK,CAAM,CAAC;KAC9B;IAAC,WAAM;QACN,OAAO,IAAI,CAAC;KACb;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAI,KAAa,EAAK,EAAE;IAC9C,IAAI,IAAI,GAAG,SAAS,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1C,mDAAmD;IACnD,IAAI,CAAC,IAAI,EAAE;QACT,IAAI,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;KACzB;IACD,IAAI,CAAC,IAAI,EAAE;QACT,MAAM,IAAI,UAAU,CAAC,aAAa,CAAC,CAAC;KACrC;IACD,OAAO,IAAoB,CAAC;AAC9B,CAAC,CAAC;AASF,MAAM,IAAI;IAOR,YAAY,aAAqB;QAN1B,cAAS,GAAqB,CAAC,CAAC;QAEhC,SAAI,GAAG,EAAE,CAAC;QAEV,UAAK,GAAG,EAAE,CAAC;QAGhB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE;YACjC,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,QAAQ,CAAY,aAAa,CAAC,CAAC;YAE/D,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;YACpB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;YACjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;SACpB;IACH,CAAC;IAED,kDAAkD;IAClD,QAAQ,CAAC,aAAqB;QAC5B,OAAO,aAAa,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC;CACF;AAED,eAAe,IAAI,CAAC"}
@@ -0,0 +1,61 @@
1
+ import { Models } from '@voiceflow/base-types';
2
+ import Fetch from "../fetch";
3
+ import { Fields } from './base';
4
+ import CrudResource from './crud';
5
+ export declare const ENDPOINT = "versions";
6
+ export declare type ModelKey = '_id';
7
+ declare class VersionResource extends CrudResource<Models.Version<Models.VersionPlatformData>, ModelKey, VersionResource, 'creatorID'> {
8
+ constructor(fetch: Fetch);
9
+ get<T extends Partial<Models.Version<Models.VersionPlatformData>>>(id: Models.VersionID, fields: Fields): Promise<T>;
10
+ get<P extends Models.VersionPlatformData>(id: Models.VersionID): Promise<Models.Version<P>>;
11
+ get<T extends Models.Version<any, any, string> = Models.Version<Models.VersionPlatformData>>(id: Models.VersionID): Promise<T>;
12
+ create<P extends Models.VersionPlatformData>(body: Omit<Models.Version<P>, ModelKey | 'creatorID'>): Promise<Models.Version<P>>;
13
+ create<P extends Omit<Models.Version<any, any, string>, ModelKey | 'creatorID'>>(body: P): Promise<P & Pick<Models.Version<any, any, string>, ModelKey | 'creatorID'>>;
14
+ update<P extends Models.VersionPlatformData>(id: Models.VersionID, body: Partial<Models.Version<P>>): Promise<Partial<Models.Version<P>>>;
15
+ update<P extends Partial<Models.Version<any, any, string>>>(id: Models.VersionID, body: P): Promise<P>;
16
+ delete(id: Models.VersionID): Promise<Models.VersionID>;
17
+ updatePlatformData<P extends Partial<Models.VersionPlatformData>>(id: Models.VersionID, body: P): Promise<P>;
18
+ updatePlatformDataSettings<P extends Partial<Models.VersionPlatformData['settings']>>(id: Models.VersionID, body: P): Promise<P>;
19
+ updatePlatformDataPublishing<P extends Partial<Models.VersionPlatformData['publishing']>>(id: Models.VersionID, body: P): Promise<P>;
20
+ getPrograms<T extends Partial<Models.Program>>(id: Models.VersionID, fields: Fields): Promise<T[]>;
21
+ getPrograms<T extends Models.Program<any> = Models.Program>(id: Models.VersionID): Promise<T[]>;
22
+ getPrototypePrograms<T extends Partial<Models.Program>>(id: Models.VersionID, fields: Fields): Promise<T[]>;
23
+ getPrototypePrograms<T extends Models.Program<any> = Models.Program>(id: Models.VersionID): Promise<T[]>;
24
+ getDiagrams<T extends Partial<Models.Diagram>>(id: Models.VersionID, fields: Fields): Promise<T[]>;
25
+ getDiagrams<T extends Models.Diagram<any> = Models.Diagram>(id: Models.VersionID): Promise<T[]>;
26
+ export<P extends Models.Project<any, any> = Models.Project<Models.BasePlatformData, Models.BasePlatformData>, V extends Models.Version<any> = Models.Version<Models.VersionPlatformData>, D extends Models.Diagram = Models.Diagram, PM extends Models.Program = Models.Program>(id: Models.VersionID, options: {
27
+ programs: true;
28
+ }): Promise<{
29
+ project: P;
30
+ version: V;
31
+ diagrams: Record<string, D>;
32
+ programs: Record<string, PM>;
33
+ }>;
34
+ export<P extends Models.Project<any, any> = Models.Project<Models.BasePlatformData, Models.BasePlatformData>, V extends Models.Version<any> = Models.Version<Models.VersionPlatformData>, D extends Models.Diagram = Models.Diagram>(id: Models.VersionID, options?: {
35
+ programs?: boolean;
36
+ }): Promise<{
37
+ project: P;
38
+ version: V;
39
+ diagrams: Record<string, D>;
40
+ }>;
41
+ exportResponses(id: Models.VersionID): Promise<Models.VersionDiagramResponce[]>;
42
+ import<P extends Models.Project<any, any> = Models.Project<Models.BasePlatformData, Models.BasePlatformData>>(workspaceID: string, data: {
43
+ project: P;
44
+ version: Models.Version<any>;
45
+ diagrams: Record<string, Models.Diagram<any>>;
46
+ }): Promise<P>;
47
+ getPrototype<T extends Models.VersionPrototype>(id: Models.VersionID, body?: {
48
+ isPublic?: boolean;
49
+ }): Promise<T>;
50
+ updatePrototype<P extends Partial<P>>(id: Models.VersionID, body: P): Promise<P>;
51
+ updatePrototypeSettings<P extends Partial<Models.VersionPrototype['settings']>>(id: Models.VersionID, body: P): Promise<P>;
52
+ checkPrototypeSharedLogin(id: Models.VersionID, body: {
53
+ password: string;
54
+ }): Promise<{
55
+ versionID: string;
56
+ }>;
57
+ getPrototypePlan(id: Models.VersionID): Promise<{
58
+ plan: string;
59
+ }>;
60
+ }
61
+ export default VersionResource;