@memori.ai/memori-api-client 2.6.0 → 2.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
 
2
2
 
3
+ ## [2.6.1](https://github.com/memori-ai/memori-api-client/compare/v2.6.0...v2.6.1) (2023-12-08)
4
+
5
+
6
+ ### Maintenance
7
+
8
+ * add endpoints as constants ([de513a2](https://github.com/memori-ai/memori-api-client/commit/de513a2662c163f3ad0181c1406d7f9da0dd72b7))
9
+
3
10
  ## [2.6.0](https://github.com/memori-ai/memori-api-client/compare/v2.5.0...v2.6.0) (2023-12-08)
4
11
 
5
12
 
package/README.md CHANGED
@@ -55,6 +55,14 @@ memori.constants.allowedMediaTypes; // list of allowed media types in asset uplo
55
55
  memori.constants.anonTag; // tag for anonymous users
56
56
  ```
57
57
 
58
+ Endpoint passed during initialization:
59
+
60
+ ```ts
61
+ memori.constants.HOSTNAME; // host name of the API, parameter of the constructor
62
+ memori.constants.BACKEND_URL;
63
+ memori.constants.ENGINE_URL;
64
+ ```
65
+
58
66
  ### Asset
59
67
 
60
68
  There is a helper method parsing media urls from the DB, handling different cases
package/dist/index.d.ts CHANGED
@@ -1,6 +1,11 @@
1
- import * as constants from './constants';
2
1
  declare const api: (hostname?: string) => {
3
- constants: typeof constants;
2
+ constants: {
3
+ HOSTNAME: string;
4
+ BACKEND_URL: string;
5
+ ENGINE_URL: string;
6
+ allowedMediaTypes: string[];
7
+ anonTag: "👤";
8
+ };
4
9
  asset: {
5
10
  getResourceUrl: ({ type, resourceURI, sessionID, baseURL, }: import("./helpers/asset").ResourceURLParams) => string;
6
11
  };
package/dist/index.js CHANGED
@@ -8,11 +8,18 @@ const constants = tslib_1.__importStar(require("./constants"));
8
8
  const asset_1 = tslib_1.__importDefault(require("./helpers/asset"));
9
9
  const api = (hostname) => {
10
10
  const apiUrl = (0, getApiUrl_1.getApiUrl)(hostname);
11
+ const engineUrl = `${apiUrl}/memori/v2`;
12
+ const backendUrl = `${apiUrl}/api/v2`;
11
13
  return {
12
- backend: (0, backend_1.default)(`${apiUrl}/api/v2`),
13
- ...(0, engine_1.default)(`${apiUrl}/memori/v2`),
14
- constants,
15
- asset: (0, asset_1.default)(`${apiUrl}/api/v2`),
14
+ backend: (0, backend_1.default)(backendUrl),
15
+ ...(0, engine_1.default)(engineUrl),
16
+ constants: {
17
+ ...constants,
18
+ HOSTNAME: apiUrl,
19
+ BACKEND_URL: backendUrl,
20
+ ENGINE_URL: engineUrl,
21
+ },
22
+ asset: (0, asset_1.default)(backendUrl),
16
23
  };
17
24
  };
18
25
  exports.default = api;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mDAAgD;AAChD,gEAAgC;AAChC,8DAA8B;AAC9B,+DAAyC;AACzC,oEAAoC;AAEpC,MAAM,GAAG,GAAG,CAAC,QAAiB,EAAE,EAAE;IAChC,MAAM,MAAM,GAAG,IAAA,qBAAS,EAAC,QAAQ,CAAC,CAAC;IAEnC,OAAO;QACL,OAAO,EAAE,IAAA,iBAAO,EAAC,GAAG,MAAM,SAAS,CAAC;QACpC,GAAG,IAAA,gBAAM,EAAC,GAAG,MAAM,YAAY,CAAC;QAChC,SAAS;QACT,KAAK,EAAE,IAAA,eAAK,EAAC,GAAG,MAAM,SAAS,CAAC;KACjC,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,GAAG,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mDAAgD;AAChD,gEAAgC;AAChC,8DAA8B;AAC9B,+DAAyC;AACzC,oEAAoC;AAEpC,MAAM,GAAG,GAAG,CAAC,QAAiB,EAAE,EAAE;IAChC,MAAM,MAAM,GAAG,IAAA,qBAAS,EAAC,QAAQ,CAAC,CAAC;IACnC,MAAM,SAAS,GAAG,GAAG,MAAM,YAAY,CAAC;IACxC,MAAM,UAAU,GAAG,GAAG,MAAM,SAAS,CAAC;IAEtC,OAAO;QACL,OAAO,EAAE,IAAA,iBAAO,EAAC,UAAU,CAAC;QAC5B,GAAG,IAAA,gBAAM,EAAC,SAAS,CAAC;QACpB,SAAS,EAAE;YACT,GAAG,SAAS;YACZ,QAAQ,EAAE,MAAM;YAChB,WAAW,EAAE,UAAU;YACvB,UAAU,EAAE,SAAS;SACtB;QACD,KAAK,EAAE,IAAA,eAAK,EAAC,UAAU,CAAC;KACzB,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,GAAG,CAAC"}
package/esm/index.d.ts CHANGED
@@ -1,6 +1,11 @@
1
- import * as constants from './constants';
2
1
  declare const api: (hostname?: string) => {
3
- constants: typeof constants;
2
+ constants: {
3
+ HOSTNAME: string;
4
+ BACKEND_URL: string;
5
+ ENGINE_URL: string;
6
+ allowedMediaTypes: string[];
7
+ anonTag: "👤";
8
+ };
4
9
  asset: {
5
10
  getResourceUrl: ({ type, resourceURI, sessionID, baseURL, }: import("./helpers/asset").ResourceURLParams) => string;
6
11
  };
package/esm/index.js CHANGED
@@ -5,11 +5,18 @@ import * as constants from './constants';
5
5
  import asset from './helpers/asset';
6
6
  const api = (hostname) => {
7
7
  const apiUrl = getApiUrl(hostname);
8
+ const engineUrl = `${apiUrl}/memori/v2`;
9
+ const backendUrl = `${apiUrl}/api/v2`;
8
10
  return {
9
- backend: backend(`${apiUrl}/api/v2`),
10
- ...engine(`${apiUrl}/memori/v2`),
11
- constants,
12
- asset: asset(`${apiUrl}/api/v2`),
11
+ backend: backend(backendUrl),
12
+ ...engine(engineUrl),
13
+ constants: {
14
+ ...constants,
15
+ HOSTNAME: apiUrl,
16
+ BACKEND_URL: backendUrl,
17
+ ENGINE_URL: engineUrl,
18
+ },
19
+ asset: asset(backendUrl),
13
20
  };
14
21
  };
15
22
  export default api;
package/esm/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,MAAM,iBAAiB,CAAC;AAEpC,MAAM,GAAG,GAAG,CAAC,QAAiB,EAAE,EAAE;IAChC,MAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;IAEnC,OAAO;QACL,OAAO,EAAE,OAAO,CAAC,GAAG,MAAM,SAAS,CAAC;QACpC,GAAG,MAAM,CAAC,GAAG,MAAM,YAAY,CAAC;QAChC,SAAS;QACT,KAAK,EAAE,KAAK,CAAC,GAAG,MAAM,SAAS,CAAC;KACjC,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,GAAG,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,MAAM,iBAAiB,CAAC;AAEpC,MAAM,GAAG,GAAG,CAAC,QAAiB,EAAE,EAAE;IAChC,MAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;IACnC,MAAM,SAAS,GAAG,GAAG,MAAM,YAAY,CAAC;IACxC,MAAM,UAAU,GAAG,GAAG,MAAM,SAAS,CAAC;IAEtC,OAAO;QACL,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC;QAC5B,GAAG,MAAM,CAAC,SAAS,CAAC;QACpB,SAAS,EAAE;YACT,GAAG,SAAS;YACZ,QAAQ,EAAE,MAAM;YAChB,WAAW,EAAE,UAAU;YACvB,UAAU,EAAE,SAAS;SACtB;QACD,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC;KACzB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,GAAG,CAAC"}
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.6.0",
2
+ "version": "2.6.1",
3
3
  "name": "@memori.ai/memori-api-client",
4
4
  "description": "React library to integrate a Memori in your app or website",
5
5
  "license": "Apache-2.0",
package/src/index.ts CHANGED
@@ -6,12 +6,19 @@ import asset from './helpers/asset';
6
6
 
7
7
  const api = (hostname?: string) => {
8
8
  const apiUrl = getApiUrl(hostname);
9
+ const engineUrl = `${apiUrl}/memori/v2`;
10
+ const backendUrl = `${apiUrl}/api/v2`;
9
11
 
10
12
  return {
11
- backend: backend(`${apiUrl}/api/v2`),
12
- ...engine(`${apiUrl}/memori/v2`),
13
- constants,
14
- asset: asset(`${apiUrl}/api/v2`),
13
+ backend: backend(backendUrl),
14
+ ...engine(engineUrl),
15
+ constants: {
16
+ ...constants,
17
+ HOSTNAME: apiUrl,
18
+ BACKEND_URL: backendUrl,
19
+ ENGINE_URL: engineUrl,
20
+ },
21
+ asset: asset(backendUrl),
15
22
  };
16
23
  };
17
24