shred-api-client 1.14.2 → 1.14.4-rc.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.
Files changed (115) hide show
  1. package/dist/api/AppConfig.api.d.ts +2 -2
  2. package/dist/api/AppConfig.api.js +25 -2
  3. package/dist/api/Email.api.d.ts +3 -3
  4. package/dist/api/Email.api.js +25 -2
  5. package/dist/api/Goal.api.d.ts +10 -0
  6. package/dist/api/Goal.api.js +42 -0
  7. package/dist/api/Note.api.d.ts +0 -0
  8. package/dist/api/Note.api.js +1 -0
  9. package/dist/api/Notification.api.d.ts +8 -8
  10. package/dist/api/Notification.api.js +32 -9
  11. package/dist/api/Project.api.d.ts +8 -8
  12. package/dist/api/Project.api.js +38 -18
  13. package/dist/api/Prompt.api.d.ts +6 -6
  14. package/dist/api/Prompt.api.js +6 -6
  15. package/dist/api/Subscription.api.d.ts +6 -6
  16. package/dist/api/Subscription.api.js +12 -12
  17. package/dist/api/Tenant.api.d.ts +7 -7
  18. package/dist/api/Tenant.api.js +7 -7
  19. package/dist/api/Track.api.d.ts +3 -3
  20. package/dist/api/Track.api.js +2 -2
  21. package/dist/api/User.api.d.ts +6 -6
  22. package/dist/api/User.api.js +15 -15
  23. package/dist/index.d.ts +12 -5
  24. package/dist/index.js +25 -16
  25. package/dist/model/Api.d.ts +20 -24
  26. package/dist/model/Api.js +3 -1
  27. package/dist/model/app-config/AppConfig.api.d.ts +9 -0
  28. package/dist/model/{AppConfig.schema.js → app-config/AppConfig.api.js} +2 -3
  29. package/dist/model/app-config/index.d.ts +1 -0
  30. package/dist/model/app-config/index.js +17 -0
  31. package/dist/model/asset/Asset.schema.d.ts +43 -0
  32. package/dist/model/asset/Asset.schema.js +19 -0
  33. package/dist/model/asset/index.d.ts +2 -0
  34. package/dist/model/asset/index.js +5 -0
  35. package/dist/model/core/APIResponse.d.ts +6 -0
  36. package/dist/model/core/Query.d.ts +15 -0
  37. package/dist/model/core/Query.js +2 -0
  38. package/dist/model/core/index.d.ts +2 -0
  39. package/dist/model/core/index.js +18 -0
  40. package/dist/model/email/Email.api.d.ts +11 -0
  41. package/dist/model/{Email.schema.js → email/Email.api.js} +2 -3
  42. package/dist/model/email/Email.schema.d.ts +15 -0
  43. package/dist/model/email/Email.schema.js +9 -0
  44. package/dist/model/email/index.d.ts +3 -0
  45. package/dist/model/email/index.js +20 -0
  46. package/dist/model/exceptions/index.d.ts +3 -2
  47. package/dist/model/exceptions/index.js +2 -1
  48. package/dist/model/goal/Goal.api.d.ts +11 -0
  49. package/dist/model/goal/Goal.api.js +6 -0
  50. package/dist/model/goal/Goal.schema.d.ts +154 -0
  51. package/dist/model/goal/Goal.schema.js +26 -0
  52. package/dist/model/goal/index.d.ts +3 -0
  53. package/dist/model/goal/index.js +22 -0
  54. package/dist/model/note/Note.api.d.ts +26 -0
  55. package/dist/model/note/Note.api.js +21 -0
  56. package/dist/model/note/Note.schema.d.ts +141 -0
  57. package/dist/model/note/Note.schema.js +30 -0
  58. package/dist/model/note/index.d.ts +2 -0
  59. package/dist/model/note/index.js +6 -0
  60. package/dist/model/notification/Notification.api.d.ts +47 -0
  61. package/dist/model/notification/Notification.api.js +13 -0
  62. package/dist/model/notification/Notification.schema.d.ts +454 -0
  63. package/dist/model/notification/Notification.schema.js +111 -0
  64. package/dist/model/notification/index.d.ts +3 -0
  65. package/dist/model/notification/index.js +30 -0
  66. package/dist/model/project/Project.api.d.ts +66 -0
  67. package/dist/model/project/Project.api.js +20 -0
  68. package/dist/model/project/Project.schema.d.ts +206 -0
  69. package/dist/model/{Project.schema.js → project/Project.schema.js} +31 -52
  70. package/dist/model/project/index.d.ts +3 -0
  71. package/dist/model/project/index.js +24 -0
  72. package/dist/model/{Prompt.schema.d.ts → prompt/Prompt.api.d.ts} +4 -24
  73. package/dist/model/{Prompt.schema.js → prompt/Prompt.api.js} +2 -3
  74. package/dist/model/prompt/Prompt.schema.d.ts +165 -0
  75. package/dist/model/prompt/Prompt.schema.js +24 -0
  76. package/dist/model/prompt/index.d.ts +3 -0
  77. package/dist/model/prompt/index.js +22 -0
  78. package/dist/model/{Subscription.schema.d.ts → subscription/Subscription.api.d.ts} +4 -51
  79. package/dist/model/{Subscription.schema.js → subscription/Subscription.api.js} +2 -8
  80. package/dist/model/subscription/Subscription.schema.d.ts +314 -0
  81. package/dist/model/subscription/Subscription.schema.js +53 -0
  82. package/dist/model/subscription/index.d.ts +3 -0
  83. package/dist/model/subscription/index.js +25 -0
  84. package/dist/model/{Tenant.schema.d.ts → tenant/Tenant.api.d.ts} +4 -29
  85. package/dist/model/{Tenant.schema.js → tenant/Tenant.api.js} +2 -3
  86. package/dist/model/tenant/Tenant.schema.d.ts +342 -0
  87. package/dist/model/tenant/Tenant.schema.js +29 -0
  88. package/dist/model/tenant/index.d.ts +3 -0
  89. package/dist/model/tenant/index.js +21 -0
  90. package/dist/model/track/Track.api.d.ts +10 -0
  91. package/dist/model/{Track.schema.js → track/Track.api.js} +2 -3
  92. package/dist/model/track/Track.schema.d.ts +44 -0
  93. package/dist/model/track/Track.schema.js +14 -0
  94. package/dist/model/track/index.d.ts +3 -0
  95. package/dist/model/track/index.js +21 -0
  96. package/dist/model/{User.schema.d.ts → user/User.api.d.ts} +4 -41
  97. package/dist/model/user/User.api.js +20 -0
  98. package/dist/model/user/User.schema.d.ts +117 -0
  99. package/dist/model/user/User.schema.js +42 -0
  100. package/dist/model/user/index.d.ts +3 -0
  101. package/dist/model/user/index.js +23 -0
  102. package/dist/util/parseQuery.d.ts +2 -0
  103. package/dist/util/parseQuery.js +25 -0
  104. package/package.json +4 -3
  105. package/dist/model/AppConfig.schema.d.ts +0 -10
  106. package/dist/model/Asset.schema.d.ts +0 -13
  107. package/dist/model/Email.schema.d.ts +0 -17
  108. package/dist/model/Notification.schema.d.ts +0 -112
  109. package/dist/model/Notification.schema.js +0 -38
  110. package/dist/model/Project.schema.d.ts +0 -152
  111. package/dist/model/Track.schema.d.ts +0 -20
  112. package/dist/model/User.schema.js +0 -81
  113. package/dist/namespace.d.ts +0 -82
  114. package/dist/namespace.js +0 -45
  115. /package/dist/model/{Asset.schema.js → core/APIResponse.js} +0 -0
@@ -3,7 +3,7 @@ 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
- const Tenant_schema_1 = require("../model/Tenant.schema");
6
+ const __1 = require("../");
7
7
  const HTTPClient_1 = __importDefault(require("../util/HTTPClient"));
8
8
  class TenantAPI {
9
9
  constructor(env) {
@@ -11,16 +11,16 @@ class TenantAPI {
11
11
  this.clientHTTP = new HTTPClient_1.default();
12
12
  }
13
13
  async getByInviteCode(inviteCode, context) {
14
- const endpointInfo = Tenant_schema_1.TenantEndpoints.GetByInviteCode;
14
+ const endpointInfo = __1.Tenant.Endpoints.GetByInviteCode;
15
15
  const data = await this.clientHTTP.makeRequest(this.env, `${endpointInfo.uri}/${inviteCode}`, endpointInfo.method, null, context);
16
16
  return data;
17
17
  }
18
18
  async getTenant(context, tenantId) {
19
- const endpointInfo = Tenant_schema_1.TenantEndpoints.GetTenant;
19
+ const endpointInfo = __1.Tenant.Endpoints.GetTenant;
20
20
  let uri = endpointInfo.uri;
21
21
  let method = endpointInfo.method;
22
22
  if (tenantId) {
23
- const endpointData = Tenant_schema_1.TenantEndpoints.GetTenantById;
23
+ const endpointData = __1.Tenant.Endpoints.GetTenantById;
24
24
  const endpoint = endpointData.uri.replace(":tenantId", tenantId);
25
25
  uri = endpoint;
26
26
  method = endpointData.method;
@@ -29,17 +29,17 @@ class TenantAPI {
29
29
  return data;
30
30
  }
31
31
  async create(t, context) {
32
- const endpointInfo = Tenant_schema_1.TenantEndpoints.CreateTenant;
32
+ const endpointInfo = __1.Tenant.Endpoints.CreateTenant;
33
33
  const data = await this.clientHTTP.makeRequest(this.env, `${endpointInfo.uri}`, endpointInfo.method, Object.assign({}, t), context);
34
34
  return data;
35
35
  }
36
36
  async list(context) {
37
- const endpointInfo = Tenant_schema_1.TenantEndpoints.ListAll;
37
+ const endpointInfo = __1.Tenant.Endpoints.ListAll;
38
38
  const data = await this.clientHTTP.makeRequest(this.env, `${endpointInfo.uri}`, endpointInfo.method, null, context);
39
39
  return data;
40
40
  }
41
41
  async update(tenantId, updateData, context) {
42
- const endpointInfo = Tenant_schema_1.TenantEndpoints.UpdateTenant;
42
+ const endpointInfo = __1.Tenant.Endpoints.UpdateTenant;
43
43
  const data = await this.clientHTTP.makeRequest(this.env, `${endpointInfo.uri}`, endpointInfo.method, { tenantId, data: updateData }, context);
44
44
  return data;
45
45
  }
@@ -1,9 +1,9 @@
1
1
  import Environment from "../model/Env";
2
- import { Track, TrackAPISchema } from "../model/Track.schema";
3
- declare class TrackAPI implements TrackAPISchema {
2
+ import { Track } from "../";
3
+ declare class TrackAPI implements Track.IAPI {
4
4
  private env;
5
5
  private clientHTTP;
6
6
  constructor(env: Environment);
7
- send(t: Track): Promise<boolean>;
7
+ send(t: Track.Entity): Promise<boolean>;
8
8
  }
9
9
  export default TrackAPI;
@@ -4,14 +4,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const HTTPClient_1 = __importDefault(require("../util/HTTPClient"));
7
- const Track_schema_1 = require("../model/Track.schema");
7
+ const __1 = require("../");
8
8
  class TrackAPI {
9
9
  constructor(env) {
10
10
  this.env = env;
11
11
  this.clientHTTP = new HTTPClient_1.default();
12
12
  }
13
13
  async send(t) {
14
- const endpointInfo = Track_schema_1.TrackEndpoints.Track;
14
+ const endpointInfo = __1.Track.Endpoints.Track;
15
15
  const data = await this.clientHTTP.makeRequest(this.env, `${endpointInfo.uri}`, endpointInfo.method, t);
16
16
  return data;
17
17
  }
@@ -1,7 +1,7 @@
1
1
  import Context from "../model/Context";
2
- import { System, Update, User, UserAPISchema } from "../model/User.schema";
2
+ import { User } from "../";
3
3
  import Environment from "../model/Env";
4
- declare class UserAPI implements UserAPISchema {
4
+ declare class UserAPI implements User.IAPI {
5
5
  private env;
6
6
  private clientHTTP;
7
7
  constructor(env: Environment);
@@ -13,11 +13,11 @@ declare class UserAPI implements UserAPISchema {
13
13
  changeEmail(ctx: Context, email: string, code: number): Promise<boolean>;
14
14
  confirmCode(email: string, code: number, keepCode?: boolean): Promise<boolean>;
15
15
  isEmailAvaliable(email: string): Promise<boolean>;
16
- update(context: Context, update: Partial<Update>): Promise<boolean>;
17
- getBindedUsers(context: Context): Promise<User[]>;
16
+ update(context: Context, update: Partial<User.Update>): Promise<boolean>;
17
+ getBindedUsers(context: Context): Promise<User.Entity[]>;
18
18
  setup(context: Context): Promise<boolean>;
19
- authenticate(email: string, password: string, system: System): Promise<string>;
19
+ authenticate(email: string, password: string, system: User.System): Promise<string>;
20
20
  createUser(email: string, name: string, password: string, passwordConfirmation: string, profession: string | null, invitationCode: string | null): Promise<any>;
21
- getUserInfo(context: Context): Promise<User>;
21
+ getUserInfo(context: Context): Promise<User.Entity>;
22
22
  }
23
23
  export default UserAPI;
@@ -3,7 +3,7 @@ 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
- const User_schema_1 = require("../model/User.schema");
6
+ const __1 = require("../");
7
7
  const HTTPClient_1 = __importDefault(require("../util/HTTPClient"));
8
8
  class UserAPI {
9
9
  constructor(env) {
@@ -11,67 +11,67 @@ class UserAPI {
11
11
  this.clientHTTP = new HTTPClient_1.default();
12
12
  }
13
13
  async deleteAccount(ctx) {
14
- const endpointData = User_schema_1.UserEndpoints.DeleteAccount;
14
+ const endpointData = __1.User.Endpoints.DeleteAccount;
15
15
  const data = await this.clientHTTP.makeRequest(this.env, endpointData.uri, endpointData.method, null, ctx);
16
16
  return data.success;
17
17
  }
18
18
  async createIntegrationToken(ctx) {
19
- const endpointData = User_schema_1.UserEndpoints.CreateToken;
19
+ const endpointData = __1.User.Endpoints.CreateToken;
20
20
  const data = await this.clientHTTP.makeRequest(this.env, `${endpointData.uri}`, endpointData.method, null, ctx);
21
21
  return data.token;
22
22
  }
23
23
  async getIntegrationToken(ctx) {
24
- const endpointData = User_schema_1.UserEndpoints.GetIntegrationToken;
24
+ const endpointData = __1.User.Endpoints.GetIntegrationToken;
25
25
  const data = await this.clientHTTP.makeRequest(this.env, `${endpointData.uri}`, endpointData.method, null, ctx);
26
26
  return data.token;
27
27
  }
28
28
  async sendValidationCode(email) {
29
- const endpointData = User_schema_1.UserEndpoints.SendValidationCode;
29
+ const endpointData = __1.User.Endpoints.SendValidationCode;
30
30
  const data = await this.clientHTTP.makeRequest(this.env, `${endpointData.uri}?email=${email}`, endpointData.method);
31
31
  return data.success;
32
32
  }
33
33
  async changePassword(email, pass, passConfirm, code) {
34
- const endpointData = User_schema_1.UserEndpoints.ChangePassword;
34
+ const endpointData = __1.User.Endpoints.ChangePassword;
35
35
  const data = await this.clientHTTP.makeRequest(this.env, endpointData.uri, endpointData.method, { email, pass, passConfirm, code });
36
36
  return data.success;
37
37
  }
38
38
  async changeEmail(ctx, email, code) {
39
- const endpointData = User_schema_1.UserEndpoints.ChangeEmail;
39
+ const endpointData = __1.User.Endpoints.ChangeEmail;
40
40
  const data = await this.clientHTTP.makeRequest(this.env, endpointData.uri, endpointData.method, { email, code }, ctx);
41
41
  return data.success;
42
42
  }
43
43
  async confirmCode(email, code, keepCode) {
44
- const endpointData = User_schema_1.UserEndpoints.ConfirmCode;
44
+ const endpointData = __1.User.Endpoints.ConfirmCode;
45
45
  const data = await this.clientHTTP.makeRequest(this.env, `${endpointData.uri}?email=${email}&code=${code}&keepCode=${keepCode}`, endpointData.method);
46
46
  return data.success;
47
47
  }
48
48
  async isEmailAvaliable(email) {
49
- const endpointData = User_schema_1.UserEndpoints.IsEmailAvaliable;
49
+ const endpointData = __1.User.Endpoints.IsEmailAvaliable;
50
50
  const data = await this.clientHTTP.makeRequest(this.env, `${endpointData.uri}?email=${email}`, endpointData.method);
51
51
  return data.isValid;
52
52
  }
53
53
  async update(context, update) {
54
- const endpointData = User_schema_1.UserEndpoints.UpdateUser;
54
+ const endpointData = __1.User.Endpoints.UpdateUser;
55
55
  const data = await this.clientHTTP.makeRequest(this.env, `${endpointData.uri}`, endpointData.method, Object.assign({}, update), context);
56
56
  return data.isValid;
57
57
  }
58
58
  async getBindedUsers(context) {
59
- const endpointData = User_schema_1.UserEndpoints.GetBindedUsers;
59
+ const endpointData = __1.User.Endpoints.GetBindedUsers;
60
60
  const data = await this.clientHTTP.makeRequest(this.env, `${endpointData.uri}`, endpointData.method, null, context);
61
61
  return data;
62
62
  }
63
63
  async setup(context) {
64
- const endpointData = User_schema_1.UserEndpoints.Setup;
64
+ const endpointData = __1.User.Endpoints.Setup;
65
65
  const data = await this.clientHTTP.makeRequest(this.env, `${endpointData.uri}`, endpointData.method, null, context);
66
66
  return data.success;
67
67
  }
68
68
  async authenticate(email, password, system) {
69
- const endpointData = User_schema_1.UserEndpoints.Authenticate;
69
+ const endpointData = __1.User.Endpoints.Authenticate;
70
70
  const data = await this.clientHTTP.makeRequest(this.env, `${endpointData.uri}`, endpointData.method, { system, email, password });
71
71
  return data.token;
72
72
  }
73
73
  async createUser(email, name, password, passwordConfirmation, profession, invitationCode) {
74
- const endpointData = User_schema_1.UserEndpoints.CreateUser;
74
+ const endpointData = __1.User.Endpoints.CreateUser;
75
75
  const data = await this.clientHTTP.makeRequest(this.env, endpointData.uri, endpointData.method, {
76
76
  email,
77
77
  name,
@@ -83,7 +83,7 @@ class UserAPI {
83
83
  return data;
84
84
  }
85
85
  async getUserInfo(context) {
86
- const endpointData = User_schema_1.UserEndpoints.GetUserInfo;
86
+ const endpointData = __1.User.Endpoints.GetUserInfo;
87
87
  const data = await this.clientHTTP.makeRequest(this.env, endpointData.uri, endpointData.method, null, context);
88
88
  return data;
89
89
  }
package/dist/index.d.ts CHANGED
@@ -1,7 +1,14 @@
1
1
  import { ShredAPI } from "./model/Api";
2
- import { Role, System } from "./model/User.schema";
3
- import { Status as ProjectStatus, Styles, CaptionStyle } from "./model/Project.schema";
4
- import Exceptions from "./model/exceptions/";
5
- export { Role, System, Exceptions, ProjectStatus, Styles, CaptionStyle };
2
+ export * as Exceptions from "./model/exceptions";
3
+ export * as Prompt from "./model/prompt";
4
+ export * as Asset from "./model/asset";
5
+ export * as Tenant from "./model/tenant";
6
+ export * as User from "./model/user";
7
+ export * as Subscription from "./model/subscription";
8
+ export * as Track from "./model/track";
9
+ export * as Email from "./model/email";
10
+ export * as Core from "./model/core";
11
+ export * as Project from "./model/project";
12
+ export * as Goal from "./model/goal";
13
+ export * as Notification from "./model/notification";
6
14
  export default ShredAPI;
7
- export * from "./namespace";
package/dist/index.js CHANGED
@@ -10,23 +10,32 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
10
10
  if (k2 === undefined) k2 = k;
11
11
  o[k2] = m[k];
12
12
  }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- var __importDefault = (this && this.__importDefault) || function (mod) {
17
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
18
24
  };
19
25
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.CaptionStyle = exports.Styles = exports.ProjectStatus = exports.Exceptions = exports.System = exports.Role = void 0;
26
+ exports.Notification = exports.Goal = exports.Project = exports.Core = exports.Email = exports.Track = exports.Subscription = exports.User = exports.Tenant = exports.Asset = exports.Prompt = exports.Exceptions = void 0;
21
27
  const Api_1 = require("./model/Api");
22
- const User_schema_1 = require("./model/User.schema");
23
- Object.defineProperty(exports, "Role", { enumerable: true, get: function () { return User_schema_1.Role; } });
24
- Object.defineProperty(exports, "System", { enumerable: true, get: function () { return User_schema_1.System; } });
25
- const Project_schema_1 = require("./model/Project.schema");
26
- Object.defineProperty(exports, "ProjectStatus", { enumerable: true, get: function () { return Project_schema_1.Status; } });
27
- Object.defineProperty(exports, "Styles", { enumerable: true, get: function () { return Project_schema_1.Styles; } });
28
- Object.defineProperty(exports, "CaptionStyle", { enumerable: true, get: function () { return Project_schema_1.CaptionStyle; } });
29
- const exceptions_1 = __importDefault(require("./model/exceptions/"));
30
- exports.Exceptions = exceptions_1.default;
28
+ //V2
29
+ exports.Exceptions = __importStar(require("./model/exceptions"));
30
+ exports.Prompt = __importStar(require("./model/prompt"));
31
+ exports.Asset = __importStar(require("./model/asset"));
32
+ exports.Tenant = __importStar(require("./model/tenant"));
33
+ exports.User = __importStar(require("./model/user"));
34
+ exports.Subscription = __importStar(require("./model/subscription"));
35
+ exports.Track = __importStar(require("./model/track"));
36
+ exports.Email = __importStar(require("./model/email"));
37
+ exports.Core = __importStar(require("./model/core"));
38
+ exports.Project = __importStar(require("./model/project"));
39
+ exports.Goal = __importStar(require("./model/goal"));
40
+ exports.Notification = __importStar(require("./model/notification"));
31
41
  exports.default = Api_1.ShredAPI;
32
- __exportStar(require("./namespace"), exports);
@@ -1,28 +1,24 @@
1
1
  import Environment from "./Env";
2
- import { PromptAPISchema } from "./Prompt.schema";
3
- import { NotificationSchema } from "./Notification.schema";
4
- import { SubscriptionAPISchema } from "./Subscription.schema";
5
- import { UserAPISchema } from "./User.schema";
6
- import { EmailAPISchema } from "./Email.schema";
7
- import { TenantAPISchema } from "./Tenant.schema";
8
- import { ProjectAPISchema } from "./Project.schema";
9
- import { APPConfigSchema } from "./AppConfig.schema";
10
- import { TrackAPISchema } from "./Track.schema";
11
- export type APIResponse<T> = {
12
- perPage: number;
13
- last?: T;
14
- data: T[];
15
- count: number;
16
- };
2
+ import * as Prompt from "./../model/prompt";
3
+ import * as Subscription from "./../model/subscription";
4
+ import * as User from "./../model/user";
5
+ import * as Tenant from "./../model/tenant";
6
+ import * as Track from "./../model/track";
7
+ import * as Email from "./../model/email";
8
+ import * as Project from "./../model/project";
9
+ import * as Goal from "./../model/goal";
10
+ import * as Notification from "./../model/notification";
11
+ import * as AppConfig from "./../model/app-config";
17
12
  export declare class ShredAPI {
18
- user: UserAPISchema;
19
- subscription: SubscriptionAPISchema;
20
- prompt: PromptAPISchema;
21
- pushNotification: NotificationSchema;
22
- email: EmailAPISchema;
23
- tenant: TenantAPISchema;
24
- app: APPConfigSchema;
25
- project: ProjectAPISchema;
26
- track: TrackAPISchema;
13
+ user: User.IAPI;
14
+ goal: Goal.IAPI;
15
+ subscription: Subscription.IAPI;
16
+ prompt: Prompt.IAPI;
17
+ pushNotification: Notification.IAPI;
18
+ email: Email.IAPI;
19
+ tenant: Tenant.IAPI;
20
+ app: AppConfig.IAPI;
21
+ project: Project.IAPI;
22
+ track: Track.IAPI;
27
23
  constructor(env: Environment);
28
24
  }
package/dist/model/Api.js CHANGED
@@ -9,13 +9,15 @@ const Prompt_api_1 = __importDefault(require("../api/Prompt.api"));
9
9
  const Subscription_api_1 = __importDefault(require("../api/Subscription.api"));
10
10
  const Tenant_api_1 = __importDefault(require("../api/Tenant.api"));
11
11
  const User_api_1 = __importDefault(require("../api/User.api"));
12
+ const Track_api_1 = __importDefault(require("../api/Track.api"));
12
13
  const Email_api_1 = __importDefault(require("../api/Email.api"));
13
14
  const Project_api_1 = __importDefault(require("../api/Project.api"));
15
+ const Goal_api_1 = __importDefault(require("../api/Goal.api"));
14
16
  const AppConfig_api_1 = __importDefault(require("../api/AppConfig.api"));
15
- const Track_api_1 = __importDefault(require("../api/Track.api"));
16
17
  class ShredAPI {
17
18
  constructor(env) {
18
19
  this.user = new User_api_1.default(env);
20
+ this.goal = new Goal_api_1.default(env);
19
21
  this.prompt = new Prompt_api_1.default(env);
20
22
  this.subscription = new Subscription_api_1.default(env);
21
23
  this.pushNotification = new Notification_api_1.default(env);
@@ -0,0 +1,9 @@
1
+ export interface IAPI {
2
+ version: () => Promise<string>;
3
+ }
4
+ export declare const Endpoints: {
5
+ Version: {
6
+ uri: string;
7
+ method: string;
8
+ };
9
+ };
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AppConfigEndpoints = void 0;
4
- const AppConfigEndpoints = {
3
+ exports.Endpoints = void 0;
4
+ exports.Endpoints = {
5
5
  Version: {
6
6
  uri: "/app-config/public/version/latest",
7
7
  method: "GET",
8
8
  },
9
9
  };
10
- exports.AppConfigEndpoints = AppConfigEndpoints;
@@ -0,0 +1 @@
1
+ export * from "./AppConfig.api";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./AppConfig.api"), exports);
@@ -0,0 +1,43 @@
1
+ import { z } from "zod";
2
+ declare const AssetSchema: z.ZodObject<{
3
+ assetId: z.ZodString;
4
+ fileName: z.ZodString;
5
+ extension: z.ZodString;
6
+ fileSize: z.ZodNumber;
7
+ assetUrl: z.ZodString;
8
+ thumbnailUrl: z.ZodString;
9
+ type: z.ZodString;
10
+ duration: z.ZodOptional<z.ZodNumber>;
11
+ progress: z.ZodOptional<z.ZodNumber>;
12
+ error: z.ZodOptional<z.ZodString>;
13
+ authorId: z.ZodString;
14
+ uploadedAt: z.ZodNumber;
15
+ }, "strip", z.ZodTypeAny, {
16
+ type: string;
17
+ assetId: string;
18
+ fileName: string;
19
+ extension: string;
20
+ fileSize: number;
21
+ assetUrl: string;
22
+ thumbnailUrl: string;
23
+ authorId: string;
24
+ uploadedAt: number;
25
+ error?: string | undefined;
26
+ duration?: number | undefined;
27
+ progress?: number | undefined;
28
+ }, {
29
+ type: string;
30
+ assetId: string;
31
+ fileName: string;
32
+ extension: string;
33
+ fileSize: number;
34
+ assetUrl: string;
35
+ thumbnailUrl: string;
36
+ authorId: string;
37
+ uploadedAt: number;
38
+ error?: string | undefined;
39
+ duration?: number | undefined;
40
+ progress?: number | undefined;
41
+ }>;
42
+ type Asset = z.infer<typeof AssetSchema>;
43
+ export { Asset, AssetSchema };
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AssetSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const AssetSchema = zod_1.z.object({
6
+ assetId: zod_1.z.string(),
7
+ fileName: zod_1.z.string(),
8
+ extension: zod_1.z.string(),
9
+ fileSize: zod_1.z.number(),
10
+ assetUrl: zod_1.z.string().url(),
11
+ thumbnailUrl: zod_1.z.string().url(),
12
+ type: zod_1.z.string(),
13
+ duration: zod_1.z.number().optional(),
14
+ progress: zod_1.z.number().optional(),
15
+ error: zod_1.z.string().optional(),
16
+ authorId: zod_1.z.string(),
17
+ uploadedAt: zod_1.z.number(),
18
+ });
19
+ exports.AssetSchema = AssetSchema;
@@ -0,0 +1,2 @@
1
+ export { AssetSchema } from "./Asset.schema";
2
+ export type { Asset as Entity } from "./Asset.schema";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AssetSchema = void 0;
4
+ var Asset_schema_1 = require("./Asset.schema");
5
+ Object.defineProperty(exports, "AssetSchema", { enumerable: true, get: function () { return Asset_schema_1.AssetSchema; } });
@@ -0,0 +1,6 @@
1
+ export type APIResponse<T> = {
2
+ data: T[];
3
+ count: number;
4
+ cursor?: string | number | null;
5
+ perPage?: number;
6
+ };
@@ -0,0 +1,15 @@
1
+ export type QueryOrderBy<T> = {
2
+ field: keyof T | "modified";
3
+ direction: "asc" | "desc";
4
+ };
5
+ export type QueryWhere<T> = {
6
+ field: keyof T | "modified";
7
+ operation: "==" | "!=" | ">" | "<" | ">=" | "<=" | "in" | "array-contains";
8
+ value: T[keyof T] | T[keyof T][];
9
+ };
10
+ export type QueryOptions<T> = {
11
+ perPage?: number;
12
+ cursor?: string | number | null;
13
+ orderBy?: QueryOrderBy<T>;
14
+ wheres?: QueryWhere<T>[];
15
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export * from "./Query";
2
+ export * from "./APIResponse";
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./Query"), exports);
18
+ __exportStar(require("./APIResponse"), exports);
@@ -0,0 +1,11 @@
1
+ import Context from "../Context";
2
+ import { Email } from "./Email.schema";
3
+ export interface IAPI {
4
+ send: (email: Email, ctx?: Context) => Promise<boolean>;
5
+ }
6
+ export declare const Endpoints: {
7
+ SendEmail: {
8
+ uri: string;
9
+ method: string;
10
+ };
11
+ };
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EmailEndpoints = void 0;
4
- const EmailEndpoints = {
3
+ exports.Endpoints = void 0;
4
+ exports.Endpoints = {
5
5
  SendEmail: {
6
6
  uri: "/emails/public/send",
7
7
  method: "POST",
8
8
  },
9
9
  };
10
- exports.EmailEndpoints = EmailEndpoints;
@@ -0,0 +1,15 @@
1
+ import { z } from "zod";
2
+ export declare const EmailSchema: z.ZodObject<{
3
+ to: z.ZodOptional<z.ZodString>;
4
+ subject: z.ZodString;
5
+ body: z.ZodString;
6
+ }, "strip", z.ZodTypeAny, {
7
+ body: string;
8
+ subject: string;
9
+ to?: string | undefined;
10
+ }, {
11
+ body: string;
12
+ subject: string;
13
+ to?: string | undefined;
14
+ }>;
15
+ export type Email = z.infer<typeof EmailSchema>;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EmailSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.EmailSchema = zod_1.z.object({
6
+ to: zod_1.z.string().email().optional(),
7
+ subject: zod_1.z.string(),
8
+ body: zod_1.z.string(),
9
+ });
@@ -0,0 +1,3 @@
1
+ export type { Email as Entity } from "./Email.schema";
2
+ export { EmailSchema } from "./Email.schema";
3
+ export * from "./Email.api";
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.EmailSchema = void 0;
18
+ var Email_schema_1 = require("./Email.schema");
19
+ Object.defineProperty(exports, "EmailSchema", { enumerable: true, get: function () { return Email_schema_1.EmailSchema; } });
20
+ __exportStar(require("./Email.api"), exports);
@@ -4,7 +4,7 @@ import ResourceNotFoundException from "./ResourceNotFoundException";
4
4
  import ShredException from "./ShredException";
5
5
  import UnauthorizedException from "./UnauthorizedException";
6
6
  import ForbiddenException from "./ForbiddenException";
7
- declare const _default: {
7
+ declare const Exceptions: {
8
8
  ConflictException: typeof ConflictException;
9
9
  InvalidArgumentException: typeof InvalidArgumentException;
10
10
  ResourceNotFoundException: typeof ResourceNotFoundException;
@@ -12,4 +12,5 @@ declare const _default: {
12
12
  UnauthorizedException: typeof UnauthorizedException;
13
13
  ForbiddenException: typeof ForbiddenException;
14
14
  };
15
- export default _default;
15
+ export default Exceptions;
16
+ export type { ConflictException, InvalidArgumentException, ResourceNotFoundException, ShredException, UnauthorizedException, ForbiddenException, };
@@ -9,7 +9,7 @@ const ResourceNotFoundException_1 = __importDefault(require("./ResourceNotFoundE
9
9
  const ShredException_1 = __importDefault(require("./ShredException"));
10
10
  const UnauthorizedException_1 = __importDefault(require("./UnauthorizedException"));
11
11
  const ForbiddenException_1 = __importDefault(require("./ForbiddenException"));
12
- exports.default = {
12
+ const Exceptions = {
13
13
  ConflictException: ConflictException_1.default,
14
14
  InvalidArgumentException: InvalidArgumentException_1.default,
15
15
  ResourceNotFoundException: ResourceNotFoundException_1.default,
@@ -17,3 +17,4 @@ exports.default = {
17
17
  UnauthorizedException: UnauthorizedException_1.default,
18
18
  ForbiddenException: ForbiddenException_1.default,
19
19
  };
20
+ exports.default = Exceptions;