@30nama/sdk 1.0.7 → 1.1.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.
@@ -2,15 +2,7 @@ import BaseEntity from './BaseEntity';
2
2
  import { IAttachment } from './IAttachment';
3
3
  import { IGenre } from './ICollector';
4
4
  import { IRating } from './IRating';
5
- export type ISOLocales = 'en' | 'fa';
6
- export type VideoContentInfoData = {
7
- title: string;
8
- description?: string;
9
- };
10
- export type VideoContentInfo = {
11
- [key in ISOLocales]: VideoContentInfoData;
12
- };
13
- export type VideoContentOption = 'featured' | 'persian-subtitle' | 'streams';
5
+ import { VideoContentInfo, VideoContentOption } from './IVideoContent';
14
6
  type SeriesMeta = {
15
7
  air_status: string;
16
8
  air_days: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"IBoxOffice.js","sourceRoot":"","sources":["../../src/entities/IBoxOffice.ts"],"names":[],"mappings":";;;AAAA,6CAAqC;AAkBrC,MAAa,UAAW,SAAQ,oBAAU;IAmBtC,YAAY,OAA4B;QACpC,KAAK,EAAE,CAAA;QACP,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IAChC,CAAC;CACJ;AAvBD,gCAuBC"}
1
+ {"version":3,"file":"IBoxOffice.js","sourceRoot":"","sources":["../../src/entities/IBoxOffice.ts"],"names":[],"mappings":";;;AAAA,6CAAqC;AAcrC,MAAa,UAAW,SAAQ,oBAAU;IAmBtC,YAAY,OAA4B;QACpC,KAAK,EAAE,CAAA;QACP,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IAChC,CAAC;CACJ;AAvBD,gCAuBC"}
@@ -2,22 +2,7 @@ import BaseEntity from './BaseEntity';
2
2
  import { IAttachment } from './IAttachment';
3
3
  import { IGenre } from './ICollector';
4
4
  import { IRating } from './IRating';
5
- export type ISOLocales = 'en' | 'fa';
6
- export type VideoContentInfoData = {
7
- title: string;
8
- description?: string;
9
- };
10
- export type VideoContentInfo = {
11
- [key in ISOLocales]: VideoContentInfoData;
12
- };
13
- export type VideoContentOption = 'featured' | 'persian-subtitle' | 'streams';
14
- type SeriesMeta = {
15
- air_status: string;
16
- air_days: string[];
17
- last_episode_date?: string;
18
- last_episode: string;
19
- next_episode_date?: string;
20
- };
5
+ import { SeriesMeta, VideoContentInfo, VideoContentOption } from './IVideoContent';
21
6
  export declare class ITitle extends BaseEntity {
22
7
  id: string;
23
8
  info: VideoContentInfo;
@@ -50,4 +35,3 @@ export declare class IHeroTitle extends BaseEntity {
50
35
  download_id?: string;
51
36
  constructor(partial: Partial<ITitle>);
52
37
  }
53
- export {};
@@ -1 +1 @@
1
- {"version":3,"file":"ITitle.js","sourceRoot":"","sources":["../../src/entities/ITitle.ts"],"names":[],"mappings":";;;AAAA,6CAAqC;AAkBrC,MAAa,MAAO,SAAQ,oBAAU;IAclC,YAAY,OAAwB;QAChC,KAAK,EAAE,CAAA;QACP,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IAChC,CAAC;CACJ;AAlBD,wBAkBC;AAED,MAAa,UAAW,SAAQ,oBAAU;IActC,YAAY,OAAwB;QAChC,KAAK,EAAE,CAAA;QACP,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IAChC,CAAC;CACJ;AAlBD,gCAkBC"}
1
+ {"version":3,"file":"ITitle.js","sourceRoot":"","sources":["../../src/entities/ITitle.ts"],"names":[],"mappings":";;;AAAA,6CAAqC;AAMrC,MAAa,MAAO,SAAQ,oBAAU;IAelC,YAAY,OAAwB;QAChC,KAAK,EAAE,CAAA;QACP,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IAChC,CAAC;CACJ;AAnBD,wBAmBC;AAED,MAAa,UAAW,SAAQ,oBAAU;IActC,YAAY,OAAwB;QAChC,KAAK,EAAE,CAAA;QACP,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IAChC,CAAC;CACJ;AAlBD,gCAkBC"}
@@ -13,7 +13,7 @@ export type VideoContentInfo = {
13
13
  [key in ISOLocales]: VideoContentInfoData;
14
14
  };
15
15
  export type VideoContentOption = 'featured' | 'persian-subtitle' | 'streams';
16
- type SeriesMeta = {
16
+ export type SeriesMeta = {
17
17
  air_status: string;
18
18
  air_days: string[];
19
19
  last_episode_date?: string;
@@ -58,4 +58,3 @@ export declare class IVideoContent extends BaseEntity {
58
58
  }[];
59
59
  constructor(partial: Partial<IVideoContent>);
60
60
  }
61
- export {};
@@ -2,3 +2,7 @@ export * from './IVideoContent';
2
2
  export * from './IRating';
3
3
  export * from './IAttachment';
4
4
  export * from './ICollector';
5
+ export * from './ICollection';
6
+ export * from './IBoxOffice';
7
+ export * from './IPerson';
8
+ export * from './ITitle';
@@ -18,4 +18,8 @@ __exportStar(require("./IVideoContent"), exports);
18
18
  __exportStar(require("./IRating"), exports);
19
19
  __exportStar(require("./IAttachment"), exports);
20
20
  __exportStar(require("./ICollector"), exports);
21
+ __exportStar(require("./ICollection"), exports);
22
+ __exportStar(require("./IBoxOffice"), exports);
23
+ __exportStar(require("./IPerson"), exports);
24
+ __exportStar(require("./ITitle"), exports);
21
25
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/entities/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAA+B;AAC/B,4CAAyB;AACzB,gDAA6B;AAC7B,+CAA4B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/entities/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAA+B;AAC/B,4CAAyB;AACzB,gDAA6B;AAC7B,+CAA4B;AAC5B,gDAA6B;AAC7B,+CAA4B;AAC5B,4CAAyB;AACzB,2CAAwB"}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export { API } from './api';
2
2
  export * as core from './core';
3
3
  export * as entities from './entities';
4
+ export * as pattern from './pattern';
package/dist/index.js CHANGED
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.entities = exports.core = exports.API = void 0;
3
+ exports.pattern = exports.entities = exports.core = exports.API = void 0;
4
4
  var api_1 = require("./api");
5
5
  Object.defineProperty(exports, "API", { enumerable: true, get: function () { return api_1.API; } });
6
6
  exports.core = require("./core");
7
7
  exports.entities = require("./entities");
8
+ exports.pattern = require("./pattern");
8
9
  // export * as party from './party'
9
10
  // export * as watchTogether from './watchTogether'
10
11
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,6BAA2B;AAAlB,0FAAA,GAAG,OAAA;AACZ,iCAA8B;AAC9B,yCAAsC;AACtC,mCAAmC;AACnC,mDAAmD"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,6BAA2B;AAAlB,0FAAA,GAAG,OAAA;AACZ,iCAA8B;AAC9B,yCAAsC;AACtC,uCAAoC;AACpC,mCAAmC;AACnC,mDAAmD"}
@@ -0,0 +1,17 @@
1
+ import { BaseResponse } from '../api/types';
2
+ export declare class Result<T = BaseResponse<any>> {
3
+ private _value?;
4
+ private notification?;
5
+ private status?;
6
+ private constructor();
7
+ static ok<U>(value?: U, status?: boolean): Result<U>;
8
+ static fail<U>(notification: string, status?: boolean): Result<U>;
9
+ isSuccess(): boolean;
10
+ isFailure(): boolean;
11
+ clean(): Result<T>;
12
+ get value(): T | undefined;
13
+ getFlatValue(): T | undefined;
14
+ getError(): string | undefined;
15
+ getStatus(): boolean;
16
+ }
17
+ export declare function isolate(data: any): any;
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isolate = exports.Result = void 0;
4
+ class Result {
5
+ constructor(_value, notification, status) {
6
+ this._value = _value;
7
+ this.notification = notification;
8
+ this.status = status;
9
+ }
10
+ static ok(value, status) {
11
+ return new Result(value, undefined, status);
12
+ }
13
+ static fail(notification, status) {
14
+ return new Result(undefined, notification, status);
15
+ }
16
+ isSuccess() {
17
+ return this.notification === undefined && !!this._value;
18
+ }
19
+ isFailure() {
20
+ return this.notification !== undefined || !this._value;
21
+ }
22
+ clean() {
23
+ this.notification = undefined;
24
+ return this;
25
+ }
26
+ get value() {
27
+ if (this.isFailure()) {
28
+ throw new Error('Cannot get value from a failed result.');
29
+ }
30
+ return this._value;
31
+ }
32
+ getFlatValue() {
33
+ if (this.isFailure())
34
+ throw new Error('Cannot get value from a failed result.');
35
+ if (!this._value)
36
+ return undefined;
37
+ return JSON.parse(JSON.stringify(this._value));
38
+ }
39
+ getError() {
40
+ if (this.isSuccess()) {
41
+ throw new Error('Cannot get error from a successful result.');
42
+ }
43
+ return this.notification;
44
+ }
45
+ getStatus() {
46
+ return this.status || false;
47
+ }
48
+ }
49
+ exports.Result = Result;
50
+ function isolate(data) {
51
+ return Object.assign(Object.assign({}, data), { toFlat: () => JSON.parse(JSON.stringify(data)) });
52
+ }
53
+ exports.isolate = isolate;
54
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/pattern/index.ts"],"names":[],"mappings":";;;AAEA,MAAa,MAAM;IACf,YACY,MAAU,EACV,YAAqB,EACrB,MAAgB;QAFhB,WAAM,GAAN,MAAM,CAAI;QACV,iBAAY,GAAZ,YAAY,CAAS;QACrB,WAAM,GAAN,MAAM,CAAU;IACzB,CAAC;IACG,MAAM,CAAC,EAAE,CAAI,KAAS,EAAE,MAAgB;QAC3C,OAAO,IAAI,MAAM,CAAI,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC,CAAA;IAClD,CAAC;IACM,MAAM,CAAC,IAAI,CAAI,YAAoB,EAAE,MAAgB;QACxD,OAAO,IA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ACjD;AACL,CAAC;AALD,0BAKC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@30nama/sdk",
3
3
  "description": "30nama SDK for Node.js",
4
- "version": "1.0.7",
4
+ "version": "1.1.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "files": [