@prisme.ai/sdk 1.0.1 → 2.0.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/README.md +250 -0
- package/dist/index.d.mts +1129 -0
- package/dist/index.d.ts +1129 -7
- package/dist/index.js +1326 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1287 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +50 -11
- package/Readme.md +0 -28
- package/dist/_virtual/_tslib.js +0 -107
- package/dist/lib/ApiError.d.ts +0 -8
- package/dist/lib/ApiError.test.d.ts +0 -1
- package/dist/lib/HTTPError.d.ts +0 -6
- package/dist/lib/HTTPError.test.d.ts +0 -1
- package/dist/lib/api.d.ts +0 -140
- package/dist/lib/api.test.d.ts +0 -1
- package/dist/lib/endpoints/users.d.ts +0 -9
- package/dist/lib/endpoints/workspaces.d.ts +0 -9
- package/dist/lib/endpoints/workspacesVersions.d.ts +0 -10
- package/dist/lib/events.d.ts +0 -38
- package/dist/lib/events.test.d.ts +0 -1
- package/dist/lib/fetcher.d.ts +0 -23
- package/dist/lib/fetcher.test.d.ts +0 -1
- package/dist/lib/types.d.ts +0 -17
- package/dist/lib/utils.d.ts +0 -1
- package/dist/lib/utils.test.d.ts +0 -1
- package/dist/sdk/index.js +0 -19
- package/dist/sdk/lib/ApiError.js +0 -24
- package/dist/sdk/lib/HTTPError.js +0 -21
- package/dist/sdk/lib/api.js +0 -956
- package/dist/sdk/lib/endpoints/users.js +0 -43
- package/dist/sdk/lib/endpoints/workspaces.js +0 -23
- package/dist/sdk/lib/endpoints/workspacesVersions.js +0 -40
- package/dist/sdk/lib/events.js +0 -142
- package/dist/sdk/lib/fetcher.js +0 -175
- package/dist/sdk/lib/utils.js +0 -18
- package/index.ts +0 -7
- package/lib/ApiError.test.ts +0 -13
- package/lib/ApiError.ts +0 -21
- package/lib/HTTPError.test.ts +0 -8
- package/lib/HTTPError.ts +0 -13
- package/lib/api.test.ts +0 -772
- package/lib/api.ts +0 -871
- package/lib/endpoints/users.ts +0 -22
- package/lib/endpoints/workspaces.ts +0 -18
- package/lib/endpoints/workspacesVersions.ts +0 -34
- package/lib/events.test.ts +0 -89
- package/lib/events.ts +0 -180
- package/lib/fetcher.test.ts +0 -246
- package/lib/fetcher.ts +0 -163
- package/lib/types.ts +0 -21
- package/lib/utils.test.ts +0 -38
- package/lib/utils.ts +0 -12
- package/tsconfig.json +0 -21
package/dist/lib/events.d.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { Socket } from 'socket.io-client';
|
|
2
|
-
import { Api } from './api';
|
|
3
|
-
export type PayloadQuery = Record<string, string | string[]>;
|
|
4
|
-
export type OrQuery = PayloadQuery[];
|
|
5
|
-
export type SearchOptions = Omit<PrismeaiAPI.EventsLongpolling.QueryParameters, 'query' | 'types'> & {
|
|
6
|
-
payloadQuery?: PayloadQuery | OrQuery;
|
|
7
|
-
types?: string[];
|
|
8
|
-
};
|
|
9
|
-
export declare class Events {
|
|
10
|
-
protected client: Socket;
|
|
11
|
-
workspaceId: string;
|
|
12
|
-
private filters;
|
|
13
|
-
private listenedUserTopics;
|
|
14
|
-
private listeners;
|
|
15
|
-
private lastReceivedEventDate;
|
|
16
|
-
constructor({ workspaceId, token, legacyToken, apiKey, apiHost, filters, api, }: {
|
|
17
|
-
workspaceId: string;
|
|
18
|
-
token: string;
|
|
19
|
-
legacyToken?: string;
|
|
20
|
-
apiKey?: string;
|
|
21
|
-
apiHost?: string;
|
|
22
|
-
filters?: Record<string, any>;
|
|
23
|
-
api: Api;
|
|
24
|
-
});
|
|
25
|
-
get socket(): Socket<import("@socket.io/component-emitter").DefaultEventsMap, import("@socket.io/component-emitter").DefaultEventsMap>;
|
|
26
|
-
destroy(): void;
|
|
27
|
-
all(listener: (eventName: string, eventData: Prismeai.PrismeEvent) => void): () => Socket<import("@socket.io/component-emitter").DefaultEventsMap, import("@socket.io/component-emitter").DefaultEventsMap>;
|
|
28
|
-
on(ev: string, listener: (eventData: Prismeai.PrismeEvent) => void): () => void;
|
|
29
|
-
emit(event: string, payload?: any, options?: any): void;
|
|
30
|
-
listenTopics({ event, topics, }: {
|
|
31
|
-
event: string;
|
|
32
|
-
topics: string | string[];
|
|
33
|
-
}): void;
|
|
34
|
-
updateFilters(filters: SearchOptions): void;
|
|
35
|
-
once(ev: string, listener: (eventName: string, eventData: Prismeai.PrismeEvent) => void): () => void;
|
|
36
|
-
close(): void;
|
|
37
|
-
}
|
|
38
|
-
export default Events;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/lib/fetcher.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export type Fetched<T> = T & {
|
|
2
|
-
headers?: Record<string, any>;
|
|
3
|
-
};
|
|
4
|
-
export declare class Fetcher {
|
|
5
|
-
host: string;
|
|
6
|
-
token: string | null;
|
|
7
|
-
legacyToken: string | null;
|
|
8
|
-
overwriteClientId?: string;
|
|
9
|
-
private clientIdHeader?;
|
|
10
|
-
protected _apiKey: string | null;
|
|
11
|
-
language: string | undefined;
|
|
12
|
-
lastReceivedHeaders?: Record<string, any>;
|
|
13
|
-
constructor(host: string, clientIdHeader?: string);
|
|
14
|
-
set apiKey(apiKey: string);
|
|
15
|
-
prepareRequest(url: string, options?: RequestInit): Promise<Response>;
|
|
16
|
-
protected _fetch<T>(url: string, options?: RequestInit): Promise<T>;
|
|
17
|
-
get<T = any>(url: string): Promise<T>;
|
|
18
|
-
post<T>(url: string, body?: Record<string, any>, opts?: RequestInit): Promise<T>;
|
|
19
|
-
put<T>(url: string, body: Record<string, any>): Promise<T>;
|
|
20
|
-
patch<T>(url: string, body: Record<string, any>): Promise<T>;
|
|
21
|
-
delete<T>(url: string): Promise<T>;
|
|
22
|
-
}
|
|
23
|
-
export default Fetcher;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/lib/types.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import '@prisme.ai/types';
|
|
2
|
-
export interface Workspace extends Prismeai.Workspace {
|
|
3
|
-
id: string;
|
|
4
|
-
updatedAt: Date;
|
|
5
|
-
updatedBy: string;
|
|
6
|
-
createdAt: Date;
|
|
7
|
-
createdBy: string;
|
|
8
|
-
}
|
|
9
|
-
export interface Event<DateType extends Date | string> extends Omit<Prismeai.PrismeEvent, 'createdAt'> {
|
|
10
|
-
createdAt: DateType;
|
|
11
|
-
}
|
|
12
|
-
export type EventsFilters = Record<string, string> & {
|
|
13
|
-
afterDate?: PrismeaiAPI.EventsLongpolling.Parameters.AfterDate;
|
|
14
|
-
beforeDate?: PrismeaiAPI.EventsLongpolling.Parameters.BeforeDate;
|
|
15
|
-
text?: PrismeaiAPI.EventsLongpolling.Parameters.Text;
|
|
16
|
-
query?: PrismeaiAPI.EventsLongpolling.Parameters.Query;
|
|
17
|
-
};
|
package/dist/lib/utils.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const removedUndefinedProperties: (obj: any, removeEmptyStrings?: boolean) => any;
|
package/dist/lib/utils.test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/sdk/index.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var api = require('./lib/api.js');
|
|
6
|
-
var ApiError = require('./lib/ApiError.js');
|
|
7
|
-
var events = require('./lib/events.js');
|
|
8
|
-
var fetcher = require('./lib/fetcher.js');
|
|
9
|
-
var HTTPError = require('./lib/HTTPError.js');
|
|
10
|
-
require('@prisme.ai/types');
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
exports.Api = api.Api;
|
|
15
|
-
exports["default"] = api["default"];
|
|
16
|
-
exports.ApiError = ApiError.ApiError;
|
|
17
|
-
exports.Events = events.Events;
|
|
18
|
-
exports.Fetcher = fetcher.Fetcher;
|
|
19
|
-
exports.HTTPError = HTTPError.HTTPError;
|
package/dist/sdk/lib/ApiError.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var _tslib = require('../../_virtual/_tslib.js');
|
|
6
|
-
|
|
7
|
-
var ApiError = /** @class */ (function (_super) {
|
|
8
|
-
_tslib.__extends(ApiError, _super);
|
|
9
|
-
function ApiError(_a, code) {
|
|
10
|
-
var error = _a.error, message = _a.message, details = _a.details;
|
|
11
|
-
var _this = _super.call(this, message) || this;
|
|
12
|
-
_this.code = code;
|
|
13
|
-
_this.error = error;
|
|
14
|
-
_this.details = details;
|
|
15
|
-
return _this;
|
|
16
|
-
}
|
|
17
|
-
ApiError.prototype.toString = function () {
|
|
18
|
-
return this.error;
|
|
19
|
-
};
|
|
20
|
-
return ApiError;
|
|
21
|
-
}(Error));
|
|
22
|
-
|
|
23
|
-
exports.ApiError = ApiError;
|
|
24
|
-
exports["default"] = ApiError;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var _tslib = require('../../_virtual/_tslib.js');
|
|
6
|
-
|
|
7
|
-
var HTTPError = /** @class */ (function (_super) {
|
|
8
|
-
_tslib.__extends(HTTPError, _super);
|
|
9
|
-
function HTTPError(status, code) {
|
|
10
|
-
var _this = _super.call(this, status) || this;
|
|
11
|
-
_this.code = code;
|
|
12
|
-
return _this;
|
|
13
|
-
}
|
|
14
|
-
HTTPError.prototype.toString = function () {
|
|
15
|
-
return "".concat(this.code, " ").concat(this.message);
|
|
16
|
-
};
|
|
17
|
-
return HTTPError;
|
|
18
|
-
}(Error));
|
|
19
|
-
|
|
20
|
-
exports.HTTPError = HTTPError;
|
|
21
|
-
exports["default"] = HTTPError;
|