@api-client/core 0.19.36 → 0.19.37
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/build/src/events/BaseEvents.d.ts +14 -4
- package/build/src/events/BaseEvents.d.ts.map +1 -1
- package/build/src/events/BaseEvents.js +14 -0
- package/build/src/events/BaseEvents.js.map +1 -1
- package/build/src/mocking/lib/Deployment.d.ts +3 -0
- package/build/src/mocking/lib/Deployment.d.ts.map +1 -1
- package/build/src/mocking/lib/Deployment.js +11 -0
- package/build/src/mocking/lib/Deployment.js.map +1 -1
- package/build/src/models/store/Deployment.d.ts +4 -4
- package/build/src/models/store/Deployment.d.ts.map +1 -1
- package/build/src/models/store/Deployment.js +4 -4
- package/build/src/models/store/Deployment.js.map +1 -1
- package/build/src/sdk/AiSdk.js +2 -2
- package/build/src/sdk/AiSdk.js.map +1 -1
- package/build/src/sdk/DeploymentsSdk.d.ts +50 -5
- package/build/src/sdk/DeploymentsSdk.d.ts.map +1 -1
- package/build/src/sdk/DeploymentsSdk.js +31 -11
- package/build/src/sdk/DeploymentsSdk.js.map +1 -1
- package/build/src/sdk/FilesSdk.js +4 -4
- package/build/src/sdk/FilesSdk.js.map +1 -1
- package/build/src/sdk/HistorySdk.js +3 -3
- package/build/src/sdk/HistorySdk.js.map +1 -1
- package/build/src/sdk/OrganizationsSdk.js +4 -4
- package/build/src/sdk/OrganizationsSdk.js.map +1 -1
- package/build/src/sdk/RevisionsSdk.js +1 -1
- package/build/src/sdk/RevisionsSdk.js.map +1 -1
- package/build/src/sdk/RouteBuilder.d.ts +2 -4
- package/build/src/sdk/RouteBuilder.d.ts.map +1 -1
- package/build/src/sdk/RouteBuilder.js +5 -8
- package/build/src/sdk/RouteBuilder.js.map +1 -1
- package/build/src/sdk/SdkBase.d.ts +2 -2
- package/build/src/sdk/SdkBase.d.ts.map +1 -1
- package/build/src/sdk/SdkBase.js +6 -5
- package/build/src/sdk/SdkBase.js.map +1 -1
- package/build/src/sdk/SdkMock.d.ts +17 -4
- package/build/src/sdk/SdkMock.d.ts.map +1 -1
- package/build/src/sdk/SdkMock.js +158 -145
- package/build/src/sdk/SdkMock.js.map +1 -1
- package/build/src/sdk/SharedSdk.js +1 -1
- package/build/src/sdk/SharedSdk.js.map +1 -1
- package/build/src/sdk/TrashSdk.js +1 -1
- package/build/src/sdk/TrashSdk.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/events/BaseEvents.ts +20 -4
- package/src/mocking/lib/Deployment.ts +14 -0
- package/src/models/store/Deployment.ts +4 -4
- package/src/sdk/AiSdk.ts +2 -2
- package/src/sdk/DeploymentsSdk.ts +66 -19
- package/src/sdk/FilesSdk.ts +4 -4
- package/src/sdk/HistorySdk.ts +3 -3
- package/src/sdk/OrganizationsSdk.ts +4 -4
- package/src/sdk/RevisionsSdk.ts +1 -1
- package/src/sdk/RouteBuilder.ts +6 -11
- package/src/sdk/SdkBase.ts +6 -6
- package/src/sdk/SdkMock.ts +177 -154
- package/src/sdk/SharedSdk.ts +1 -1
- package/src/sdk/TrashSdk.ts +1 -1
|
@@ -139,7 +139,7 @@ export interface IBulkOperationResult<T> {
|
|
|
139
139
|
* The batch operation does not return specific errors. Use the direct delete operation
|
|
140
140
|
* for the detailed error.
|
|
141
141
|
*/
|
|
142
|
-
|
|
142
|
+
data: (T | undefined | null)[];
|
|
143
143
|
}
|
|
144
144
|
/**
|
|
145
145
|
* An event to be used to delete a number of entities in the context provider.
|
|
@@ -221,7 +221,7 @@ export interface ContextUpdateBulkEventDetail<T = unknown> {
|
|
|
221
221
|
/**
|
|
222
222
|
* The list of context store objects to be updated by the context provider.
|
|
223
223
|
*/
|
|
224
|
-
|
|
224
|
+
data: T[];
|
|
225
225
|
/**
|
|
226
226
|
* The key of the parent object, if applicable.
|
|
227
227
|
*/
|
|
@@ -259,7 +259,7 @@ export interface ContextListResult<T> {
|
|
|
259
259
|
* The list of items in the response.
|
|
260
260
|
* May be empty array when there was no more results.
|
|
261
261
|
*/
|
|
262
|
-
|
|
262
|
+
data: T[];
|
|
263
263
|
}
|
|
264
264
|
/**
|
|
265
265
|
* Defines the type of comparison or operation to be performed on a field.
|
|
@@ -297,6 +297,16 @@ export interface FilterGroup {
|
|
|
297
297
|
* or a group of conditions. This is the type to be used in ContextListOptions.
|
|
298
298
|
*/
|
|
299
299
|
export type QueryFilter = AtomicFilter | FilterGroup;
|
|
300
|
+
/**
|
|
301
|
+
* Checks if the filter is an atomic filter.
|
|
302
|
+
* @param filter The filter to check.
|
|
303
|
+
*/
|
|
304
|
+
export declare function isAtomicFilter(filter?: QueryFilter): filter is AtomicFilter;
|
|
305
|
+
/**
|
|
306
|
+
* Checks if the filter is a group filter.
|
|
307
|
+
* @param filter The filter to check.
|
|
308
|
+
*/
|
|
309
|
+
export declare function isFilterGroup(filter?: QueryFilter): filter is FilterGroup;
|
|
300
310
|
/**
|
|
301
311
|
* Base query options for the data store.
|
|
302
312
|
*/
|
|
@@ -375,7 +385,7 @@ export interface IQueryResponse<T = unknown> {
|
|
|
375
385
|
/**
|
|
376
386
|
* An ordered list of results.
|
|
377
387
|
*/
|
|
378
|
-
|
|
388
|
+
data: IQueryResult<T>[];
|
|
379
389
|
}
|
|
380
390
|
export interface IQueryResult<T = unknown> {
|
|
381
391
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseEvents.d.ts","sourceRoot":"","sources":["../../../src/events/BaseEvents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAA;AAChE,OAAO,WAAW,MAAM,kBAAkB,CAAA;AAE1C;;;GAGG;AACH,MAAM,WAAW,4BAA4B,CAAC,CAAC;IAC7C;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,GAAG,SAAS,CAAA;CAC5C;AAED;;GAEG;AACH,qBAAa,YAAY,CAAC,CAAC,SAAS,MAAM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A;CAClB;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAW,SAAQ,UAAU;IAC5C;;OAEG;IACH,KAAK,EAAE,SAAS,EAAE,CAAA;CACnB;AAED;;;;;GAKG;AACH,MAAM,WAAW,cAAe,SAAQ,UAAU;IAChD;;OAEG;IACH,MAAM,EAAE,SAAS,EAAE,CAAA;CACpB"}
|
|
@@ -145,6 +145,20 @@ export class ContextUpdateEvent extends ContextEvent {
|
|
|
145
145
|
*/
|
|
146
146
|
export class ContextUpdateBulkEvent extends ContextEvent {
|
|
147
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* Checks if the filter is an atomic filter.
|
|
150
|
+
* @param filter The filter to check.
|
|
151
|
+
*/
|
|
152
|
+
export function isAtomicFilter(filter) {
|
|
153
|
+
return !!filter && 'field' in filter && 'operator' in filter;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Checks if the filter is a group filter.
|
|
157
|
+
* @param filter The filter to check.
|
|
158
|
+
*/
|
|
159
|
+
export function isFilterGroup(filter) {
|
|
160
|
+
return !!filter && 'op' in filter && 'filters' in filter;
|
|
161
|
+
}
|
|
148
162
|
export class ContextListEvent extends ContextEvent {
|
|
149
163
|
/**
|
|
150
164
|
* @param type The type of the event
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseEvents.js","sourceRoot":"","sources":["../../../src/events/BaseEvents.ts"],"names":[],"mappings":"AACA,OAAO,WAAW,MAAM,kBAAkB,CAAA;AAc1C;;GAEG;AACH,MAAM,OAAO,YAAkC,SAAQ,WAAgD;IACrG;;;OAGG;IACH,YAAY,IAAY,EAAE,MAAS;QACjC,KAAK,CAAC,IAAI,EAAE;YACV,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,UAAU,EAAE,IAAI;YAChB,MAAM,EAAE;gBACN,MAAM,EAAE,SAAS;gBACjB,GAAG,MAAM;aACV;SACF,CAAC,CAAA;IACJ,CAAC;CACF;AAaD;;GAEG;AACH,M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ACH,MAAM,OAAO,uBAA2B,SAAQ,WAAmC;IACjF;;;OAGG;IACH,YAAY,IAAY,EAAE,MAA8B;QACtD,KAAK,CAAC,IAAI,EAAE;YACV,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,UAAU,EAAE,KAAK;YACjB,MAAM,EAAE,MAAM;SACf,CAAC,CAAA;IACJ,CAAC;CACF;AAwBD;;;;;;GAMG;AACH,MAAM,OAAO,kBAA4C,SAAQ,YAGhE;CAWA;AAED;;;;;;;;GAQG;AACH,MAAM,OAAO,sBAAgD,SAAQ,YAGpE;CAWA;AAoHD,MAAM,OAAO,gBAAoB,SAAQ,YAAsD;IAC7F;;;OAGG;IACH,YAAY,IAAY,EAAE,OAA2B,EAAE;QACrD,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;IACnB,CAAC;CACF;AA6CD;;;;;;;;;GASG;AACH,MAAM,OAAO,iBAA+B,SAAQ,YAA6C;CAiBhG","sourcesContent":["import type { Operation } from '@api-client/json/patch/types.js'\nimport CustomEvent from './CustomEvent.js'\n\n/**\n * Base event detail definition for the events that returns a `result`\n * property on the `detail` object\n */\nexport interface ContextEventDetailWithResult<T> {\n /**\n * This property is set by the context provider, a promise resolved when the operation finish\n * with the corresponding result.\n */\n result?: Promise<T | undefined> | undefined\n}\n\n/**\n * A base class to use with context providers.\n */\nexport class ContextEvent<S extends object, R> extends CustomEvent<S & ContextEventDetailWithResult<R>> {\n /**\n * @param type The event type\n * @param detail The optional detail object. It adds object's properties to the `detail` with the `result` property.\n */\n constructor(type: string, detail: S) {\n super(type, {\n bubbles: true,\n composed: true,\n cancelable: true,\n detail: {\n result: undefined,\n ...detail,\n },\n })\n }\n}\n\nexport interface ContextReadEventDetail {\n /**\n * The key of the state object to read.\n */\n key: string\n /**\n * Optional parent, when needed.\n */\n parent?: string\n}\n\n/**\n * An event to be used to read a state from a context provider.\n */\nexport class ContextReadEvent<T> extends ContextEvent<ContextReadEventDetail, T | null | undefined> {\n /**\n * @param type The type of the event\n * @param key The domain key of the object to read\n * @param parent Optional parent, when needed.\n */\n constructor(type: string, key: string, parent?: string) {\n super(type, { key, parent })\n }\n}\n\nexport interface ContextReadBulkEventDetail {\n /**\n * The list of keys to read.\n */\n keys: string[]\n /**\n * Optional parent, when needed.\n */\n parent?: string\n}\n\n/**\n * An event to be used to read a list of object from the API store.\n */\nexport class ContextReadBulkEvent<T> extends ContextEvent<\n ContextReadBulkEventDetail,\n IBulkOperationResult<T | null | undefined>\n> {\n /**\n * @param type The type of the event\n * @param keys The list of domain keys to read. These must be of the same domain type.\n */\n constructor(type: string, keys: string[], parent?: string) {\n super(type, { keys, parent })\n }\n}\n\n/**\n * A general purpose change record.\n * Set on the `detail` object of the `CustomEvent` when a change occurs in the context store.\n */\nexport interface ContextChangeRecord<T> {\n /**\n * The data kind of the changed item.\n * May not be present when this is used with the old architecture.\n */\n kind?: string\n /**\n * The key of the changed context state object.\n */\n key: string\n /**\n * The updated context state object.\n */\n item?: T\n /**\n * Optionally, when relevant, the key of the parent of the changed object.\n */\n parent?: string\n /**\n * The parent organization.\n */\n organization?: string\n}\n\nexport interface ContextDeleteEventDetail {\n /**\n * The key of the domain object to remove.\n */\n key: string\n /**\n * The key of the parent object, if applicable.\n */\n parent?: string\n /**\n * The parent organization.\n */\n organization?: string\n}\n\nexport interface ContextDeleteBulkEventDetail {\n /**\n * The list of keys of the domain object to remove.\n */\n keys: string[]\n /**\n * The key of the parent object, if applicable.\n */\n parent?: string\n /**\n * The parent organization.\n */\n organization?: string\n}\n\n/**\n * An event to be used to delete a state in the context provider.\n */\nexport class ContextDeleteEvent extends ContextEvent<ContextDeleteEventDetail, ContextDeleteRecord> {\n /**\n * An event to be used to delete a state in the context provider.\n * @param type The type of the event to dispatch.\n * @param key The key of the object to delete\n * @param parent The key of the parent object, if applicable.\n */\n constructor(type: string, key: string, parent?: string) {\n super(type, { key, parent })\n }\n}\n\n/**\n * Describes a result of the batch delete operation.\n */\nexport interface IBulkOperationResult<T> {\n /**\n * The ordered list of delete result for each item.\n *\n * The batch operation does not return specific errors. Use the direct delete operation\n * for the detailed error.\n */\n items: (T | undefined | null)[]\n}\n\n/**\n * An event to be used to delete a number of entities in the context provider.\n */\nexport class ContextDeleteBulkEvent extends ContextEvent<\n ContextDeleteBulkEventDetail,\n IBulkOperationResult<ContextDeleteRecord>\n> {\n /**\n * An event to be used to delete a number of entities in the context provider.\n * @param type The type of the event to dispatch.\n * @param keys The list of ids of the domain object to remove.\n * @param parent The key of the parent object, if applicable.\n */\n constructor(type: string, keys: string[], parent?: string) {\n super(type, { keys, parent })\n }\n}\n\nexport interface ContextDeleteRecord {\n /**\n * The data kind of the deleted item.\n * May not be present when this is used with the old architecture.\n */\n kind?: string\n /**\n * The key of the removed object.\n */\n key: string\n /**\n * The key of the parent object, if applicable.\n */\n parent?: string\n}\n\n/**\n * An event dispatched to the context store to restore previously deleted items.\n */\nexport class ContextRestoreEvent<T> extends ContextEvent<\n { records: ContextDeleteRecord[] },\n IBulkOperationResult<ContextChangeRecord<T>>\n> {\n /**\n * An event dispatched to the context store to restore previously deleted items.\n *\n * The result of the event is the list of `ContextChangeRecord` for the restored items.\n *\n * @param type The type of the event.\n * @param records The records of previously deleted items.\n */\n constructor(type: string, records: ContextDeleteRecord[]) {\n super(type, { records })\n }\n}\n\n/**\n * An event dispatched when a context store object has been deleted.\n * In general a single context store uses the same event to dispatch the change record.\n * For example the `data-store` dispatches the `x` event and the change record has the\n * `kind` property that is used to recognize the type of the data object.\n */\nexport class ContextStateDeleteEvent extends CustomEvent<ContextDeleteRecord> {\n /**\n * @param type The type of the event to dispatch.\n * @param record The delete record.\n */\n constructor(type: string, record: ContextDeleteRecord) {\n super(type, {\n bubbles: true,\n composed: true,\n cancelable: false,\n detail: record,\n })\n }\n}\n\n/**\n * An event dispatched when a context store object has been updated.\n */\nexport class ContextStateUpdateEvent<T> extends CustomEvent<ContextChangeRecord<T>> {\n /**\n * @param type The type of the event to dispatch.\n * @param record The delete record.\n */\n constructor(type: string, record: ContextChangeRecord<T>) {\n super(type, {\n bubbles: true,\n composed: true,\n cancelable: false,\n detail: record,\n })\n }\n}\n\nexport interface ContextUpdateEventDetail<T> {\n /**\n * The context store object to be updated by the context provider.\n */\n item: T\n /**\n * The key of the parent object, if applicable.\n */\n parent?: string\n}\n\nexport interface ContextUpdateBulkEventDetail<T = unknown> {\n /**\n * The list of context store objects to be updated by the context provider.\n */\n items: T[]\n /**\n * The key of the parent object, if applicable.\n */\n parent?: string\n}\n\n/**\n * An event that is dispatched to update the entire object in the store.\n * This is equivalent to PUT operation in REST HTTP.\n *\n * @template T The object that is being updated.\n * @template U The object that is returned by the context store after updating. By default it is the `T`.\n */\nexport class ContextUpdateEvent<T extends object, U = T> extends ContextEvent<\n ContextUpdateEventDetail<T>,\n ContextChangeRecord<U>\n> {\n // /**\n // * An event that is dispatched to update the entire object in the store.\n // * This is equivalent to PUT operation in REST HTTP.\n // *\n // * @param type The type of the event to dispatch\n // * @param updateInfo The update information.\n // */\n // constructor(type: string, updateInfo: ContextUpdateEventDetail<T>) {\n // super(type, updateInfo)\n // }\n}\n\n/**\n * An event that is dispatched to update a list of objects in the store.\n * This is equivalent to PUT operation in REST HTTP.\n *\n * If there's a parent, this event only allows to update entities in bulk for the same parent.\n *\n * @template T The object that is being updated.\n * @template U The object that is returned by the context store after updating. By default it is the `T`.\n */\nexport class ContextUpdateBulkEvent<T extends object, U = T> extends ContextEvent<\n ContextUpdateBulkEventDetail<T>,\n IBulkOperationResult<ContextChangeRecord<U>>\n> {\n // /**\n // * An event that is dispatched to update the entire object in the store.\n // * This is equivalent to PUT operation in REST HTTP.\n // *\n // * @param type The type of the event to dispatch\n // * @param updateInfo The update information.\n // */\n // constructor(type: string, updateInfo: ContextUpdateBulkEventDetail<T>) {\n // super(type, updateInfo)\n // }\n}\n\n/**\n * Data store query result object.\n */\nexport interface ContextListResult<T> {\n /**\n * The cursor to use with the next query. It has the list state encoded in it.\n */\n cursor?: string\n /**\n * The list of items in the response.\n * May be empty array when there was no more results.\n */\n items: T[]\n}\n\n/**\n * Defines the type of comparison or operation to be performed on a field.\n * - eq: Equal\n * - neq: Not Equal\n * - gt: Greater Than\n * - lt: Less Than\n * - gte: Greater Than or Equal\n * - lte: Less Than or Equal\n * - con: String contains substring / Array contains element\n * - start: String starts with\n * - end: String ends with\n * - in: Value is one of the elements in the provided array\n * - nin: Value is not one of the elements in the provided array\n */\nexport type FilterOperator =\n | 'eq' // Equal\n | 'neq' // Not Equal\n | 'gt' // Greater Than\n | 'lt' // Less Than\n | 'gte' // Greater Than or Equal\n | 'lte' // Less Than or Equal\n | 'con' // String contains substring / Array contains element\n | 'start' // String starts with\n | 'end' // String ends with\n | 'in' // Value is one of the elements in the provided array\n | 'nin' // Value is not one of the elements in the provided array\n\n/**\n * Represents a single filter condition applied to a field.\n */\nexport interface AtomicFilter {\n field: string\n operator: FilterOperator\n value?: unknown // The value to compare against the field.\n // For 'in'/'nin', value should be an array.\n}\n\n/**\n * Represents a group of filters combined with a logical operator.\n * This allows for nesting and complex query construction.\n */\nexport interface FilterGroup {\n op: 'AND' | 'OR'\n filters: (AtomicFilter | FilterGroup)[]\n}\n\n/**\n * Represents a filter that can be either a single atomic condition\n * or a group of conditions. This is the type to be used in ContextListOptions.\n */\nexport type QueryFilter = AtomicFilter | FilterGroup\n\n/**\n * Base query options for the data store.\n */\nexport interface ContextListOptions {\n /**\n * The number of results per the page.\n */\n limit?: number\n /**\n * Page cursor to use with the query. This is returned by the API.\n */\n cursor?: string\n /**\n * The name of the field to order then results.\n */\n sort?: string\n /**\n * The order of the results. This is used when the `sort` property is set.\n * It can be `asc` or `desc`.\n */\n order?: 'asc' | 'desc'\n /**\n * Used when synchronizing data in the local store with the data stored in the net-store.\n * The timestamp when the last synchronization was performed. The resulting array will contain only items that\n * have been updated since that date.\n */\n since?: number\n /**\n * Optional parent identifier for hierarchical queries.\n * Some specific list operations might use this directly.\n */\n parent?: string\n /**\n * Optional organization identifier.\n * Some specific list operations might use this directly if not part of the main path.\n */\n oid?: string\n /**\n * Optional user id to filter results by the user\n */\n uid?: string\n /**\n * A structured filter object for advanced querying.\n */\n filter?: QueryFilter\n}\n\nexport class ContextListEvent<T> extends ContextEvent<ContextListOptions, ContextListResult<T>> {\n /**\n * @param type The type of the event\n * @param opts Query options.\n */\n constructor(type: string, opts: ContextListOptions = {}) {\n super(type, opts)\n }\n}\n\nexport interface IQueryDetail {\n /**\n * The query term. All values are always passed as string. Context store must parse value if it requires other types.\n */\n term: string\n\n /**\n * If the context store supports it, the tags to use with the query function to limit the results.\n */\n tags?: string[]\n\n /**\n * General purpose type to be defined by the context store.\n * Allows to specify the type of the query to perform.\n */\n type?: string\n\n /**\n * General purpose keyword to be defined by the context store.\n * The purpose is to instruct the context store to perform detailed search.\n * Usually this means longer search time but more accurate results.\n */\n detailed?: boolean\n}\n\nexport interface IQueryResponse<T = unknown> {\n /**\n * An ordered list of results.\n */\n items: IQueryResult<T>[]\n}\n\nexport interface IQueryResult<T = unknown> {\n /**\n * The document.\n */\n doc: T\n /**\n * The list of indexes where this document was found.\n */\n index: string[]\n}\n\n/**\n * An event dispatched to the context store to perform a query operation.\n * If the context store supports the query operation, it should use the definition\n * of `IQueryDetail` to perform the query.\n * The result is the list of objects ordered by the store from the most relevant items to the least.\n *\n * The implementation should not assume pagination and return enough results\n * for the user to find what they were looking for\n * or to redefine the query. Suggested limit is `50` which in many cases is equivalent of 2 pages of results.\n */\nexport class ContextQueryEvent<T = unknown> extends ContextEvent<IQueryDetail, IQueryResponse<T>> {\n /**\n * An event dispatched to the context store to perform a query operation.\n * If the context store supports the query operation, it should use the definition\n * of `IQueryDetail` to perform the query.\n * The result is the list of objects ordered by the store from the most relevant items to the least.\n *\n * The implementation should not assume pagination and return enough results\n * the user to find what they were looking for\n * or to redefine the query. Suggested limit is `50` which in many cases is equivalent of 2 pages of results.\n *\n * @param type The type of the event.\n * @param opts The query options.\n */\n // constructor(type: string, opts: IQueryDetail) {\n // super(type, opts)\n // }\n}\n\n/**\n * Query options to list history for a request in a project.\n * The user has to have access to the parent user organization to read / create / delete the history.\n */\nexport interface IHistoryRequestListOptions extends ContextListOptions {\n type: 'request'\n /**\n * The key of the parent organization.\n */\n organization: string\n /**\n * The id of the project that contains the request.\n */\n project: string\n /**\n * The id of the request.\n */\n id: string\n /**\n * Whether to limit the list of results to the history that belongs to the current user.\n */\n user?: boolean\n}\n\n/**\n * Listing options for the HTTP history.\n */\nexport type HistoryListOptions = IHistoryRequestListOptions\n\nexport interface IProjectExecutionListOptions extends ContextListOptions {\n /**\n * The key of the parent organization.\n */\n organization: string\n\n /**\n * The id of the parent project\n */\n project: string\n\n /**\n * The key of the application that made the records.\n * This is optional and will returns results for the project made in all apps.\n */\n app?: string\n\n /**\n * The key of the parent folder, if any.\n * Note, when this is not provided the endpoint only returns list of logs\n * created for the project.\n */\n parent?: string\n\n /**\n * The user id that made that project run. Optional.\n */\n user?: string\n}\n\n/**\n * @deprecated Use `PatchInfo` instead\n */\nexport interface IPatchBase {\n /**\n * Auto generated by the client sending the PATCH.\n */\n id: string\n /**\n * The application id that generated the patch.\n * This is a string that is assigned to each application in the suite.\n * External applications need to use a constant string for their apps.\n */\n app: string\n /**\n * The version of the application that generated the patch.\n * This can and will be used to handle potential differences between suite applications.\n */\n appVersion: string\n /**\n * The patch generated by the client.\n */\n patch: unknown\n /**\n * The current timestamp.\n */\n timestamp: number\n}\n\n/**\n * An interface describing a schema to be sent to the server\n * when making a patch of a file.\n * @deprecated Use `MediaPatchInfo` instead\n */\nexport interface IPatchInfo extends IPatchBase {\n /**\n * The patch generated by the client.\n */\n patch: Operation[]\n}\n\n/**\n * A schema sent by the store server in a response to the patch request.\n * It contains an information about the applied patch, the reverse operation associated with it,\n * application information, and the generated by the client patch id.\n * @deprecated Use `MediaPatchRevision` instead\n */\nexport interface IPatchRevision extends IPatchInfo {\n /**\n * The patch to apply to the object to revert the changes.\n */\n revert: Operation[]\n}\n"]}
|
|
1
|
+
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;IACnB,CAAC;CACF;AA6CD;;;;;;;;;GASG;AACH,MAAM,OAAO,iBAA+B,SAAQ,YAA6C;CAiBhG","sourcesContent":["import type { Operation } from '@api-client/json/patch/types.js'\nimport CustomEvent from './CustomEvent.js'\n\n/**\n * Base event detail definition for the events that returns a `result`\n * property on the `detail` object\n */\nexport interface ContextEventDetailWithResult<T> {\n /**\n * This property is set by the context provider, a promise resolved when the operation finish\n * with the corresponding result.\n */\n result?: Promise<T | undefined> | undefined\n}\n\n/**\n * A base class to use with context providers.\n */\nexport class ContextEvent<S extends object, R> extends CustomEvent<S & ContextEventDetailWithResult<R>> {\n /**\n * @param type The event type\n * @param detail The optional detail object. It adds object's properties to the `detail` with the `result` property.\n */\n constructor(type: string, detail: S) {\n super(type, {\n bubbles: true,\n composed: true,\n cancelable: true,\n detail: {\n result: undefined,\n ...detail,\n },\n })\n }\n}\n\nexport interface ContextReadEventDetail {\n /**\n * The key of the state object to read.\n */\n key: string\n /**\n * Optional parent, when needed.\n */\n parent?: string\n}\n\n/**\n * An event to be used to read a state from a context provider.\n */\nexport class ContextReadEvent<T> extends ContextEvent<ContextReadEventDetail, T | null | undefined> {\n /**\n * @param type The type of the event\n * @param key The domain key of the object to read\n * @param parent Optional parent, when needed.\n */\n constructor(type: string, key: string, parent?: string) {\n super(type, { key, parent })\n }\n}\n\nexport interface ContextReadBulkEventDetail {\n /**\n * The list of keys to read.\n */\n keys: string[]\n /**\n * Optional parent, when needed.\n */\n parent?: string\n}\n\n/**\n * An event to be used to read a list of object from the API store.\n */\nexport class ContextReadBulkEvent<T> extends ContextEvent<\n ContextReadBulkEventDetail,\n IBulkOperationResult<T | null | undefined>\n> {\n /**\n * @param type The type of the event\n * @param keys The list of domain keys to read. These must be of the same domain type.\n */\n constructor(type: string, keys: string[], parent?: string) {\n super(type, { keys, parent })\n }\n}\n\n/**\n * A general purpose change record.\n * Set on the `detail` object of the `CustomEvent` when a change occurs in the context store.\n */\nexport interface ContextChangeRecord<T> {\n /**\n * The data kind of the changed item.\n * May not be present when this is used with the old architecture.\n */\n kind?: string\n /**\n * The key of the changed context state object.\n */\n key: string\n /**\n * The updated context state object.\n */\n item?: T\n /**\n * Optionally, when relevant, the key of the parent of the changed object.\n */\n parent?: string\n /**\n * The parent organization.\n */\n organization?: string\n}\n\nexport interface ContextDeleteEventDetail {\n /**\n * The key of the domain object to remove.\n */\n key: string\n /**\n * The key of the parent object, if applicable.\n */\n parent?: string\n /**\n * The parent organization.\n */\n organization?: string\n}\n\nexport interface ContextDeleteBulkEventDetail {\n /**\n * The list of keys of the domain object to remove.\n */\n keys: string[]\n /**\n * The key of the parent object, if applicable.\n */\n parent?: string\n /**\n * The parent organization.\n */\n organization?: string\n}\n\n/**\n * An event to be used to delete a state in the context provider.\n */\nexport class ContextDeleteEvent extends ContextEvent<ContextDeleteEventDetail, ContextDeleteRecord> {\n /**\n * An event to be used to delete a state in the context provider.\n * @param type The type of the event to dispatch.\n * @param key The key of the object to delete\n * @param parent The key of the parent object, if applicable.\n */\n constructor(type: string, key: string, parent?: string) {\n super(type, { key, parent })\n }\n}\n\n/**\n * Describes a result of the batch delete operation.\n */\nexport interface IBulkOperationResult<T> {\n /**\n * The ordered list of delete result for each item.\n *\n * The batch operation does not return specific errors. Use the direct delete operation\n * for the detailed error.\n */\n data: (T | undefined | null)[]\n}\n\n/**\n * An event to be used to delete a number of entities in the context provider.\n */\nexport class ContextDeleteBulkEvent extends ContextEvent<\n ContextDeleteBulkEventDetail,\n IBulkOperationResult<ContextDeleteRecord>\n> {\n /**\n * An event to be used to delete a number of entities in the context provider.\n * @param type The type of the event to dispatch.\n * @param keys The list of ids of the domain object to remove.\n * @param parent The key of the parent object, if applicable.\n */\n constructor(type: string, keys: string[], parent?: string) {\n super(type, { keys, parent })\n }\n}\n\nexport interface ContextDeleteRecord {\n /**\n * The data kind of the deleted item.\n * May not be present when this is used with the old architecture.\n */\n kind?: string\n /**\n * The key of the removed object.\n */\n key: string\n /**\n * The key of the parent object, if applicable.\n */\n parent?: string\n}\n\n/**\n * An event dispatched to the context store to restore previously deleted items.\n */\nexport class ContextRestoreEvent<T> extends ContextEvent<\n { records: ContextDeleteRecord[] },\n IBulkOperationResult<ContextChangeRecord<T>>\n> {\n /**\n * An event dispatched to the context store to restore previously deleted items.\n *\n * The result of the event is the list of `ContextChangeRecord` for the restored items.\n *\n * @param type The type of the event.\n * @param records The records of previously deleted items.\n */\n constructor(type: string, records: ContextDeleteRecord[]) {\n super(type, { records })\n }\n}\n\n/**\n * An event dispatched when a context store object has been deleted.\n * In general a single context store uses the same event to dispatch the change record.\n * For example the `data-store` dispatches the `x` event and the change record has the\n * `kind` property that is used to recognize the type of the data object.\n */\nexport class ContextStateDeleteEvent extends CustomEvent<ContextDeleteRecord> {\n /**\n * @param type The type of the event to dispatch.\n * @param record The delete record.\n */\n constructor(type: string, record: ContextDeleteRecord) {\n super(type, {\n bubbles: true,\n composed: true,\n cancelable: false,\n detail: record,\n })\n }\n}\n\n/**\n * An event dispatched when a context store object has been updated.\n */\nexport class ContextStateUpdateEvent<T> extends CustomEvent<ContextChangeRecord<T>> {\n /**\n * @param type The type of the event to dispatch.\n * @param record The delete record.\n */\n constructor(type: string, record: ContextChangeRecord<T>) {\n super(type, {\n bubbles: true,\n composed: true,\n cancelable: false,\n detail: record,\n })\n }\n}\n\nexport interface ContextUpdateEventDetail<T> {\n /**\n * The context store object to be updated by the context provider.\n */\n item: T\n /**\n * The key of the parent object, if applicable.\n */\n parent?: string\n}\n\nexport interface ContextUpdateBulkEventDetail<T = unknown> {\n /**\n * The list of context store objects to be updated by the context provider.\n */\n data: T[]\n /**\n * The key of the parent object, if applicable.\n */\n parent?: string\n}\n\n/**\n * An event that is dispatched to update the entire object in the store.\n * This is equivalent to PUT operation in REST HTTP.\n *\n * @template T The object that is being updated.\n * @template U The object that is returned by the context store after updating. By default it is the `T`.\n */\nexport class ContextUpdateEvent<T extends object, U = T> extends ContextEvent<\n ContextUpdateEventDetail<T>,\n ContextChangeRecord<U>\n> {\n // /**\n // * An event that is dispatched to update the entire object in the store.\n // * This is equivalent to PUT operation in REST HTTP.\n // *\n // * @param type The type of the event to dispatch\n // * @param updateInfo The update information.\n // */\n // constructor(type: string, updateInfo: ContextUpdateEventDetail<T>) {\n // super(type, updateInfo)\n // }\n}\n\n/**\n * An event that is dispatched to update a list of objects in the store.\n * This is equivalent to PUT operation in REST HTTP.\n *\n * If there's a parent, this event only allows to update entities in bulk for the same parent.\n *\n * @template T The object that is being updated.\n * @template U The object that is returned by the context store after updating. By default it is the `T`.\n */\nexport class ContextUpdateBulkEvent<T extends object, U = T> extends ContextEvent<\n ContextUpdateBulkEventDetail<T>,\n IBulkOperationResult<ContextChangeRecord<U>>\n> {\n // /**\n // * An event that is dispatched to update the entire object in the store.\n // * This is equivalent to PUT operation in REST HTTP.\n // *\n // * @param type The type of the event to dispatch\n // * @param updateInfo The update information.\n // */\n // constructor(type: string, updateInfo: ContextUpdateBulkEventDetail<T>) {\n // super(type, updateInfo)\n // }\n}\n\n/**\n * Data store query result object.\n */\nexport interface ContextListResult<T> {\n /**\n * The cursor to use with the next query. It has the list state encoded in it.\n */\n cursor?: string\n /**\n * The list of items in the response.\n * May be empty array when there was no more results.\n */\n data: T[]\n}\n\n/**\n * Defines the type of comparison or operation to be performed on a field.\n * - eq: Equal\n * - neq: Not Equal\n * - gt: Greater Than\n * - lt: Less Than\n * - gte: Greater Than or Equal\n * - lte: Less Than or Equal\n * - con: String contains substring / Array contains element\n * - start: String starts with\n * - end: String ends with\n * - in: Value is one of the elements in the provided array\n * - nin: Value is not one of the elements in the provided array\n */\nexport type FilterOperator =\n | 'eq' // Equal\n | 'neq' // Not Equal\n | 'gt' // Greater Than\n | 'lt' // Less Than\n | 'gte' // Greater Than or Equal\n | 'lte' // Less Than or Equal\n | 'con' // String contains substring / Array contains element\n | 'start' // String starts with\n | 'end' // String ends with\n | 'in' // Value is one of the elements in the provided array\n | 'nin' // Value is not one of the elements in the provided array\n\n/**\n * Represents a single filter condition applied to a field.\n */\nexport interface AtomicFilter {\n field: string\n operator: FilterOperator\n value?: unknown // The value to compare against the field.\n // For 'in'/'nin', value should be an array.\n}\n\n/**\n * Represents a group of filters combined with a logical operator.\n * This allows for nesting and complex query construction.\n */\nexport interface FilterGroup {\n op: 'AND' | 'OR'\n filters: (AtomicFilter | FilterGroup)[]\n}\n\n/**\n * Represents a filter that can be either a single atomic condition\n * or a group of conditions. This is the type to be used in ContextListOptions.\n */\nexport type QueryFilter = AtomicFilter | FilterGroup\n\n/**\n * Checks if the filter is an atomic filter.\n * @param filter The filter to check.\n */\nexport function isAtomicFilter(filter?: QueryFilter): filter is AtomicFilter {\n return !!filter && 'field' in filter && 'operator' in filter\n}\n\n/**\n * Checks if the filter is a group filter.\n * @param filter The filter to check.\n */\nexport function isFilterGroup(filter?: QueryFilter): filter is FilterGroup {\n return !!filter && 'op' in filter && 'filters' in filter\n}\n\n/**\n * Base query options for the data store.\n */\nexport interface ContextListOptions {\n /**\n * The number of results per the page.\n */\n limit?: number\n /**\n * Page cursor to use with the query. This is returned by the API.\n */\n cursor?: string\n /**\n * The name of the field to order then results.\n */\n sort?: string\n /**\n * The order of the results. This is used when the `sort` property is set.\n * It can be `asc` or `desc`.\n */\n order?: 'asc' | 'desc'\n /**\n * Used when synchronizing data in the local store with the data stored in the net-store.\n * The timestamp when the last synchronization was performed. The resulting array will contain only items that\n * have been updated since that date.\n */\n since?: number\n /**\n * Optional parent identifier for hierarchical queries.\n * Some specific list operations might use this directly.\n */\n parent?: string\n /**\n * Optional organization identifier.\n * Some specific list operations might use this directly if not part of the main path.\n */\n oid?: string\n /**\n * Optional user id to filter results by the user\n */\n uid?: string\n /**\n * A structured filter object for advanced querying.\n */\n filter?: QueryFilter\n}\n\nexport class ContextListEvent<T> extends ContextEvent<ContextListOptions, ContextListResult<T>> {\n /**\n * @param type The type of the event\n * @param opts Query options.\n */\n constructor(type: string, opts: ContextListOptions = {}) {\n super(type, opts)\n }\n}\n\nexport interface IQueryDetail {\n /**\n * The query term. All values are always passed as string. Context store must parse value if it requires other types.\n */\n term: string\n\n /**\n * If the context store supports it, the tags to use with the query function to limit the results.\n */\n tags?: string[]\n\n /**\n * General purpose type to be defined by the context store.\n * Allows to specify the type of the query to perform.\n */\n type?: string\n\n /**\n * General purpose keyword to be defined by the context store.\n * The purpose is to instruct the context store to perform detailed search.\n * Usually this means longer search time but more accurate results.\n */\n detailed?: boolean\n}\n\nexport interface IQueryResponse<T = unknown> {\n /**\n * An ordered list of results.\n */\n data: IQueryResult<T>[]\n}\n\nexport interface IQueryResult<T = unknown> {\n /**\n * The document.\n */\n doc: T\n /**\n * The list of indexes where this document was found.\n */\n index: string[]\n}\n\n/**\n * An event dispatched to the context store to perform a query operation.\n * If the context store supports the query operation, it should use the definition\n * of `IQueryDetail` to perform the query.\n * The result is the list of objects ordered by the store from the most relevant items to the least.\n *\n * The implementation should not assume pagination and return enough results\n * for the user to find what they were looking for\n * or to redefine the query. Suggested limit is `50` which in many cases is equivalent of 2 pages of results.\n */\nexport class ContextQueryEvent<T = unknown> extends ContextEvent<IQueryDetail, IQueryResponse<T>> {\n /**\n * An event dispatched to the context store to perform a query operation.\n * If the context store supports the query operation, it should use the definition\n * of `IQueryDetail` to perform the query.\n * The result is the list of objects ordered by the store from the most relevant items to the least.\n *\n * The implementation should not assume pagination and return enough results\n * the user to find what they were looking for\n * or to redefine the query. Suggested limit is `50` which in many cases is equivalent of 2 pages of results.\n *\n * @param type The type of the event.\n * @param opts The query options.\n */\n // constructor(type: string, opts: IQueryDetail) {\n // super(type, opts)\n // }\n}\n\n/**\n * Query options to list history for a request in a project.\n * The user has to have access to the parent user organization to read / create / delete the history.\n */\nexport interface IHistoryRequestListOptions extends ContextListOptions {\n type: 'request'\n /**\n * The key of the parent organization.\n */\n organization: string\n /**\n * The id of the project that contains the request.\n */\n project: string\n /**\n * The id of the request.\n */\n id: string\n /**\n * Whether to limit the list of results to the history that belongs to the current user.\n */\n user?: boolean\n}\n\n/**\n * Listing options for the HTTP history.\n */\nexport type HistoryListOptions = IHistoryRequestListOptions\n\nexport interface IProjectExecutionListOptions extends ContextListOptions {\n /**\n * The key of the parent organization.\n */\n organization: string\n\n /**\n * The id of the parent project\n */\n project: string\n\n /**\n * The key of the application that made the records.\n * This is optional and will returns results for the project made in all apps.\n */\n app?: string\n\n /**\n * The key of the parent folder, if any.\n * Note, when this is not provided the endpoint only returns list of logs\n * created for the project.\n */\n parent?: string\n\n /**\n * The user id that made that project run. Optional.\n */\n user?: string\n}\n\n/**\n * @deprecated Use `PatchInfo` instead\n */\nexport interface IPatchBase {\n /**\n * Auto generated by the client sending the PATCH.\n */\n id: string\n /**\n * The application id that generated the patch.\n * This is a string that is assigned to each application in the suite.\n * External applications need to use a constant string for their apps.\n */\n app: string\n /**\n * The version of the application that generated the patch.\n * This can and will be used to handle potential differences between suite applications.\n */\n appVersion: string\n /**\n * The patch generated by the client.\n */\n patch: unknown\n /**\n * The current timestamp.\n */\n timestamp: number\n}\n\n/**\n * An interface describing a schema to be sent to the server\n * when making a patch of a file.\n * @deprecated Use `MediaPatchInfo` instead\n */\nexport interface IPatchInfo extends IPatchBase {\n /**\n * The patch generated by the client.\n */\n patch: Operation[]\n}\n\n/**\n * A schema sent by the store server in a response to the patch request.\n * It contains an information about the applied patch, the reverse operation associated with it,\n * application information, and the generated by the client patch id.\n * @deprecated Use `MediaPatchRevision` instead\n */\nexport interface IPatchRevision extends IPatchInfo {\n /**\n * The patch to apply to the object to revert the changes.\n */\n revert: Operation[]\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { DeploymentSchema } from '../../models/store/Deployment.js';
|
|
2
|
+
import type { DeploymentApi } from '../../sdk/DeploymentsSdk.js';
|
|
2
3
|
export declare class Deployment {
|
|
3
4
|
/**
|
|
4
5
|
* Generates a random deployment object.
|
|
@@ -12,5 +13,7 @@ export declare class Deployment {
|
|
|
12
13
|
* @returns List of random deployments
|
|
13
14
|
*/
|
|
14
15
|
deployments(size?: number, init?: Partial<DeploymentSchema>): DeploymentSchema[];
|
|
16
|
+
deploymentApi(init?: Partial<DeploymentApi>): DeploymentApi;
|
|
17
|
+
deploymentApis(size?: number, init?: Partial<DeploymentApi>): DeploymentApi[];
|
|
15
18
|
}
|
|
16
19
|
//# sourceMappingURL=Deployment.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Deployment.d.ts","sourceRoot":"","sources":["../../../../src/mocking/lib/Deployment.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;
|
|
1
|
+
{"version":3,"file":"Deployment.d.ts","sourceRoot":"","sources":["../../../../src/mocking/lib/Deployment.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAQhE,qBAAa,UAAU;IACrB;;;;OAIG;IACH,UAAU,CAAC,IAAI,GAAE,OAAO,CAAC,gBAAgB,CAAM,GAAG,gBAAgB;IA0DlE;;;;OAIG;IACH,WAAW,CAAC,IAAI,SAAK,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,gBAAgB,EAAE;IAQ5E,aAAa,CAAC,IAAI,GAAE,OAAO,CAAC,aAAa,CAAM,GAAG,aAAa;IAK/D,cAAc,CAAC,IAAI,SAAK,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,aAAa,EAAE;CAO1E"}
|
|
@@ -72,5 +72,16 @@ export class Deployment {
|
|
|
72
72
|
}
|
|
73
73
|
return result;
|
|
74
74
|
}
|
|
75
|
+
deploymentApi(init = {}) {
|
|
76
|
+
const { fileId = nanoid(), apiSlug = faker.internet.domainWord() } = init;
|
|
77
|
+
return { fileId, apiSlug };
|
|
78
|
+
}
|
|
79
|
+
deploymentApis(size = 25, init) {
|
|
80
|
+
const result = [];
|
|
81
|
+
for (let i = 0; i < size; i++) {
|
|
82
|
+
result.push(this.deploymentApi(init));
|
|
83
|
+
}
|
|
84
|
+
return result;
|
|
85
|
+
}
|
|
75
86
|
}
|
|
76
87
|
//# sourceMappingURL=Deployment.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Deployment.js","sourceRoot":"","sources":["../../../../src/mocking/lib/Deployment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;
|
|
1
|
+
{"version":3,"file":"Deployment.js","sourceRoot":"","sources":["../../../../src/mocking/lib/Deployment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;AAI1G,MAAM,sBAAsB,GAA4B;IACtD,qBAAqB,CAAC,IAAI;IAC1B,qBAAqB,CAAC,OAAO;IAC7B,qBAAqB,CAAC,GAAG;CACjB,CAAA;AAEV,MAAM,OAAO,UAAU;IACrB;;;;OAIG;IACH,UAAU,CAAC,OAAkC,EAAE;QAC7C,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,sBAAsB,CAAC,CAAA;QAC1E,IAAI,OAA2B,CAAA;QAC/B,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YAC/B,OAAO,GAAG,IAAI,CAAC,OAAO,CAAA;QACxB,CAAC;aAAM,IAAI,GAAG,KAAK,qBAAqB,CAAC,IAAI,EAAE,CAAC;YAC9C,OA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AAA;IACf,CAAC;CACF","sourcesContent":["import { faker } from '@faker-js/faker'\nimport { nanoid } from '../../nanoid.js'\nimport { DeploymentEnvironment, DeploymentKind, DeploymentStatus } from '../../models/store/Deployment.js'\nimport type { DeploymentSchema } from '../../models/store/Deployment.js'\nimport type { DeploymentApi } from '../../sdk/DeploymentsSdk.js'\n\nconst deploymentEnvironments: DeploymentEnvironment[] = [\n DeploymentEnvironment.PROD,\n DeploymentEnvironment.STAGING,\n DeploymentEnvironment.DEV,\n] as const\n\nexport class Deployment {\n /**\n * Generates a random deployment object.\n * @param init Optional values to be present in the object.\n * @returns Random deployment object.\n */\n deployment(init: Partial<DeploymentSchema> = {}): DeploymentSchema {\n const env = init.env ?? faker.helpers.arrayElement(deploymentEnvironments)\n let version: string | undefined\n if (init.version !== undefined) {\n version = init.version\n } else if (env === DeploymentEnvironment.PROD) {\n version = `v${faker.number.int({ min: 1, max: 5 })}`\n } else {\n version = undefined\n }\n\n const {\n key = nanoid(),\n orgId = nanoid(),\n apiId = nanoid(),\n orgSlug = faker.internet.domainWord(),\n apiSlug = faker.internet.domainWord(),\n modelVersion = faker.system.semver(),\n status = faker.helpers.arrayElement([\n DeploymentStatus.Pending,\n DeploymentStatus.Active,\n DeploymentStatus.Inactive,\n DeploymentStatus.Failed,\n ] as const),\n createdAt = faker.date.past().getTime(),\n updatedAt = faker.date.recent().getTime(),\n } = init\n\n const result: DeploymentSchema = {\n kind: DeploymentKind,\n key,\n orgId,\n apiId,\n orgSlug,\n apiSlug,\n env,\n modelVersion,\n status,\n createdAt,\n updatedAt,\n }\n if (version !== undefined && version !== '') {\n result.version = version\n }\n if (status === DeploymentStatus.Active) {\n result.baseUri = init.baseUri ?? faker.internet.url()\n result.portalUri = init.portalUri ?? faker.internet.url()\n } else {\n if (init.baseUri !== undefined) {\n result.baseUri = init.baseUri\n }\n if (init.portalUri !== undefined) {\n result.portalUri = init.portalUri\n }\n }\n return result\n }\n\n /**\n * Generates a list of random deployment objects.\n * @param size Number of deployments to generate. Default is 25.\n * @returns List of random deployments\n */\n deployments(size = 25, init?: Partial<DeploymentSchema>): DeploymentSchema[] {\n const result: DeploymentSchema[] = []\n for (let i = 0; i < size; i++) {\n result.push(this.deployment(init))\n }\n return result\n }\n\n deploymentApi(init: Partial<DeploymentApi> = {}): DeploymentApi {\n const { fileId = nanoid(), apiSlug = faker.internet.domainWord() } = init\n return { fileId, apiSlug }\n }\n\n deploymentApis(size = 25, init?: Partial<DeploymentApi>): DeploymentApi[] {\n const result: DeploymentApi[] = []\n for (let i = 0; i < size; i++) {\n result.push(this.deploymentApi(init))\n }\n return result\n }\n}\n"]}
|
|
@@ -8,19 +8,19 @@ export declare enum DeploymentStatus {
|
|
|
8
8
|
/**
|
|
9
9
|
* Deployment is pending
|
|
10
10
|
*/
|
|
11
|
-
Pending =
|
|
11
|
+
Pending = "pending",
|
|
12
12
|
/**
|
|
13
13
|
* Deployment is active
|
|
14
14
|
*/
|
|
15
|
-
Active =
|
|
15
|
+
Active = "active",
|
|
16
16
|
/**
|
|
17
17
|
* Deployment is inactive
|
|
18
18
|
*/
|
|
19
|
-
Inactive =
|
|
19
|
+
Inactive = "inactive",
|
|
20
20
|
/**
|
|
21
21
|
* Deployment has failed
|
|
22
22
|
*/
|
|
23
|
-
Failed =
|
|
23
|
+
Failed = "failed"
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* Environment tag for logical deployment grouping
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Deployment.d.ts","sourceRoot":"","sources":["../../../../src/models/store/Deployment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAA;AAElF,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5C,OAAO,EAAE,cAAc,EAAE,CAAA;AAEzB;;GAEG;AACH,oBAAY,gBAAgB;IAC1B;;OAEG;IACH,OAAO,
|
|
1
|
+
{"version":3,"file":"Deployment.d.ts","s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AAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,GAAG,EAAE,qBAAqB,CAAA;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,YAAY,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,gBAAgB,CAAA;IACxB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB,MAAM,CAAC,YAAY,CAAC,KAAK,GAAE,OAAO,CAAC,gBAAgB,CAAM,GAAG,gBAAgB;gBA2BhE,KAAK,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC;IAiB7C,MAAM,IAAI,gBAAgB;IA0B1B;;;OAGG;IACH,QAAQ,IAAI,sBAAsB,EAAE;CA4DrC"}
|
|
@@ -9,19 +9,19 @@ export var DeploymentStatus;
|
|
|
9
9
|
/**
|
|
10
10
|
* Deployment is pending
|
|
11
11
|
*/
|
|
12
|
-
DeploymentStatus[
|
|
12
|
+
DeploymentStatus["Pending"] = "pending";
|
|
13
13
|
/**
|
|
14
14
|
* Deployment is active
|
|
15
15
|
*/
|
|
16
|
-
DeploymentStatus[
|
|
16
|
+
DeploymentStatus["Active"] = "active";
|
|
17
17
|
/**
|
|
18
18
|
* Deployment is inactive
|
|
19
19
|
*/
|
|
20
|
-
DeploymentStatus[
|
|
20
|
+
DeploymentStatus["Inactive"] = "inactive";
|
|
21
21
|
/**
|
|
22
22
|
* Deployment has failed
|
|
23
23
|
*/
|
|
24
|
-
DeploymentStatus[
|
|
24
|
+
DeploymentStatus["Failed"] = "failed";
|
|
25
25
|
})(DeploymentStatus || (DeploymentStatus = {}));
|
|
26
26
|
/**
|
|
27
27
|
* Environment tag for logical deployment grouping
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Deployment.js","sourceRoot":"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AAU;aACjB,CAAC,CAAA;QACJ,CAAC;aAAM,IAAI,IAAI,CAAC,GAAG,KAAK,qBAAqB,CAAC,IAAI,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACnE,MAAM,CAAC,IAAI,CAAC;gBACV,KAAK,EAAE,SAAS;gBAChB,OAAO,EAAE,4DAA4D;gBACrE,IAAI,EAAE,UAAU;aACjB,CAAC,CAAA;QACJ,CAAC;QACD,OAAO,MAAM,CAAA;IACf,CAAC;CACF","sourcesContent":["import type { FieldValidationMessage } from '../../exceptions/validation_error.js'\nimport { nanoid } from '../../nanoid.js'\nimport { DeploymentKind } from '../kinds.js'\n\nexport { DeploymentKind }\n\n/**\n * Status of the deployment\n */\nexport enum DeploymentStatus {\n /**\n * Deployment is pending\n */\n Pending = 0,\n /**\n * Deployment is active\n */\n Active = 1,\n /**\n * Deployment is inactive\n */\n Inactive = 2,\n /**\n * Deployment has failed\n */\n Failed = 3,\n}\n\n/**\n * Environment tag for logical deployment grouping\n */\nexport enum DeploymentEnvironment {\n PROD = 'prod',\n STAGING = 'staging',\n DEV = 'dev',\n}\n\nexport interface DeploymentSchema {\n kind: typeof DeploymentKind\n /**\n * Primary key (nanoid)\n */\n key: string\n /**\n * ID of the organization\n */\n orgId: string\n /**\n * The file ID representing the API\n */\n apiId: string\n /**\n * Denormalized organization slug\n */\n orgSlug: string\n /**\n * Denormalized API slug\n */\n apiSlug: string\n /**\n * Environment tag\n */\n env: DeploymentEnvironment\n /**\n * The version of the deployment (e.g., 'v1', 'v2')\n * It must be set for production environments.\n * It cannot be set for non-production environments (e.g. 'dev').\n */\n version?: string\n /**\n * The semantic version of the deployed API model (e.g., '1.0.1').\n */\n modelVersion: string\n /**\n * Status of the deployment\n */\n status: DeploymentStatus\n /**\n * Timestamp of creation\n */\n createdAt: number\n /**\n * Timestamp of last update\n */\n updatedAt: number\n /**\n * The base URI to the API.\n * Note: This field is computed at runtime when the deployment status is active.\n * Note: This field is ignored when creating or updating a deployment.\n */\n baseUri?: string\n /**\n * The URI to the API portal.\n * Note: This field is computed at runtime when the deployment status is active.\n * Note: This field is ignored when creating or updating a deployment.\n */\n portalUri?: string\n}\n\nexport class Deployment implements DeploymentSchema {\n readonly kind: typeof DeploymentKind = DeploymentKind\n key: string\n orgId: string\n apiId: string\n orgSlug: string\n apiSlug: string\n env: DeploymentEnvironment\n version?: string\n modelVersion: string\n status: DeploymentStatus\n createdAt: number\n updatedAt: number\n baseUri?: string\n portalUri?: string\n\n static createSchema(input: Partial<DeploymentSchema> = {}): DeploymentSchema {\n const key = input.key ?? nanoid()\n const result: DeploymentSchema = {\n kind: DeploymentKind,\n key,\n orgId: input.orgId || '',\n apiId: input.apiId || '',\n orgSlug: input.orgSlug || '',\n apiSlug: input.apiSlug || '',\n env: input.env ?? DeploymentEnvironment.DEV,\n modelVersion: input.modelVersion || '0.0.0',\n status: input.status ?? DeploymentStatus.Pending,\n createdAt: input.createdAt ?? Date.now(),\n updatedAt: input.updatedAt ?? Date.now(),\n }\n if (input.baseUri) {\n result.baseUri = input.baseUri\n }\n if (input.portalUri) {\n result.portalUri = input.portalUri\n }\n if (input.version) {\n result.version = input.version\n }\n return result\n }\n\n constructor(state?: Partial<DeploymentSchema>) {\n const init = Deployment.createSchema(state)\n this.key = init.key\n this.orgId = init.orgId\n this.apiId = init.apiId\n this.orgSlug = init.orgSlug\n this.apiSlug = init.apiSlug\n this.env = init.env\n this.version = init.version\n this.status = init.status\n this.createdAt = init.createdAt\n this.updatedAt = init.updatedAt\n this.modelVersion = init.modelVersion\n this.baseUri = init.baseUri\n this.portalUri = init.portalUri\n }\n\n toJSON(): DeploymentSchema {\n const result: DeploymentSchema = {\n kind: DeploymentKind,\n key: this.key,\n orgId: this.orgId,\n apiId: this.apiId,\n orgSlug: this.orgSlug,\n apiSlug: this.apiSlug,\n env: this.env,\n modelVersion: this.modelVersion,\n status: this.status,\n createdAt: this.createdAt,\n updatedAt: this.updatedAt,\n }\n if (this.version) {\n result.version = this.version\n }\n if (this.baseUri) {\n result.baseUri = this.baseUri\n }\n if (this.portalUri) {\n result.portalUri = this.portalUri\n }\n return result\n }\n\n /**\n * Validates the deployment.\n * @returns An array of validation messages.\n */\n validate(): FieldValidationMessage[] {\n const result: FieldValidationMessage[] = []\n\n if (this.orgId === '') {\n result.push({\n field: 'orgId',\n message: 'Org ID must not be empty',\n rule: 'notEmpty',\n })\n }\n if (this.apiId === '') {\n result.push({\n field: 'apiId',\n message: 'API ID must not be empty',\n rule: 'notEmpty',\n })\n }\n if (this.orgSlug === '') {\n result.push({\n field: 'orgSlug',\n message: 'Org slug must not be empty',\n rule: 'notEmpty',\n })\n }\n if (this.apiSlug === '') {\n result.push({\n field: 'apiSlug',\n message: 'API slug must not be empty',\n rule: 'notEmpty',\n })\n }\n if (!this.env) {\n result.push({\n field: 'env',\n message: 'Environment tag must not be empty',\n rule: 'notEmpty',\n })\n }\n if (this.modelVersion === '') {\n result.push({\n field: 'modelVersion',\n message: 'API model version must not be empty',\n rule: 'notEmpty',\n })\n }\n if (this.env === DeploymentEnvironment.PROD && !this.version) {\n result.push({\n field: 'version',\n message: 'Version must not be empty for production environment',\n rule: 'notEmpty',\n })\n } else if (this.env !== DeploymentEnvironment.PROD && this.version) {\n result.push({\n field: 'version',\n message: 'Version must not be present for non-production environment',\n rule: 'notEmpty',\n })\n }\n return result\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Deployment.js","sourceRoot":"","sources":["../../../../src/models/store/Deployment.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5C,OAAO,EAAE,cAAc,EAAE,CAAA;AAEzB;;GAEG;AACH,MAAM,CAAN,IAAY,gBAiBX;AAjBD,WAAY,gBAAgB;IAC1B;;OAEG;IACH,uCAAmB,CAAA;IACnB;;OAEG;IACH,qCAAiB,CAAA;IACjB;;OAEG;IACH,yCAAqB,CAAA;IAC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/validation_error.js'\nimport { nanoid } from '../../nanoid.js'\nimport { DeploymentKind } from '../kinds.js'\n\nexport { DeploymentKind }\n\n/**\n * Status of the deployment\n */\nexport enum DeploymentStatus {\n /**\n * Deployment is pending\n */\n Pending = 'pending',\n /**\n * Deployment is active\n */\n Active = 'active',\n /**\n * Deployment is inactive\n */\n Inactive = 'inactive',\n /**\n * Deployment has failed\n */\n Failed = 'failed',\n}\n\n/**\n * Environment tag for logical deployment grouping\n */\nexport enum DeploymentEnvironment {\n PROD = 'prod',\n STAGING = 'staging',\n DEV = 'dev',\n}\n\nexport interface DeploymentSchema {\n kind: typeof DeploymentKind\n /**\n * Primary key (nanoid)\n */\n key: string\n /**\n * ID of the organization\n */\n orgId: string\n /**\n * The file ID representing the API\n */\n apiId: string\n /**\n * Denormalized organization slug\n */\n orgSlug: string\n /**\n * Denormalized API slug\n */\n apiSlug: string\n /**\n * Environment tag\n */\n env: DeploymentEnvironment\n /**\n * The version of the deployment (e.g., 'v1', 'v2')\n * It must be set for production environments.\n * It cannot be set for non-production environments (e.g. 'dev').\n */\n version?: string\n /**\n * The semantic version of the deployed API model (e.g., '1.0.1').\n */\n modelVersion: string\n /**\n * Status of the deployment\n */\n status: DeploymentStatus\n /**\n * Timestamp of creation\n */\n createdAt: number\n /**\n * Timestamp of last update\n */\n updatedAt: number\n /**\n * The base URI to the API.\n * Note: This field is computed at runtime when the deployment status is active.\n * Note: This field is ignored when creating or updating a deployment.\n */\n baseUri?: string\n /**\n * The URI to the API portal.\n * Note: This field is computed at runtime when the deployment status is active.\n * Note: This field is ignored when creating or updating a deployment.\n */\n portalUri?: string\n}\n\nexport class Deployment implements DeploymentSchema {\n readonly kind: typeof DeploymentKind = DeploymentKind\n key: string\n orgId: string\n apiId: string\n orgSlug: string\n apiSlug: string\n env: DeploymentEnvironment\n version?: string\n modelVersion: string\n status: DeploymentStatus\n createdAt: number\n updatedAt: number\n baseUri?: string\n portalUri?: string\n\n static createSchema(input: Partial<DeploymentSchema> = {}): DeploymentSchema {\n const key = input.key ?? nanoid()\n const result: DeploymentSchema = {\n kind: DeploymentKind,\n key,\n orgId: input.orgId || '',\n apiId: input.apiId || '',\n orgSlug: input.orgSlug || '',\n apiSlug: input.apiSlug || '',\n env: input.env ?? DeploymentEnvironment.DEV,\n modelVersion: input.modelVersion || '0.0.0',\n status: input.status ?? DeploymentStatus.Pending,\n createdAt: input.createdAt ?? Date.now(),\n updatedAt: input.updatedAt ?? Date.now(),\n }\n if (input.baseUri) {\n result.baseUri = input.baseUri\n }\n if (input.portalUri) {\n result.portalUri = input.portalUri\n }\n if (input.version) {\n result.version = input.version\n }\n return result\n }\n\n constructor(state?: Partial<DeploymentSchema>) {\n const init = Deployment.createSchema(state)\n this.key = init.key\n this.orgId = init.orgId\n this.apiId = init.apiId\n this.orgSlug = init.orgSlug\n this.apiSlug = init.apiSlug\n this.env = init.env\n this.version = init.version\n this.status = init.status\n this.createdAt = init.createdAt\n this.updatedAt = init.updatedAt\n this.modelVersion = init.modelVersion\n this.baseUri = init.baseUri\n this.portalUri = init.portalUri\n }\n\n toJSON(): DeploymentSchema {\n const result: DeploymentSchema = {\n kind: DeploymentKind,\n key: this.key,\n orgId: this.orgId,\n apiId: this.apiId,\n orgSlug: this.orgSlug,\n apiSlug: this.apiSlug,\n env: this.env,\n modelVersion: this.modelVersion,\n status: this.status,\n createdAt: this.createdAt,\n updatedAt: this.updatedAt,\n }\n if (this.version) {\n result.version = this.version\n }\n if (this.baseUri) {\n result.baseUri = this.baseUri\n }\n if (this.portalUri) {\n result.portalUri = this.portalUri\n }\n return result\n }\n\n /**\n * Validates the deployment.\n * @returns An array of validation messages.\n */\n validate(): FieldValidationMessage[] {\n const result: FieldValidationMessage[] = []\n\n if (this.orgId === '') {\n result.push({\n field: 'orgId',\n message: 'Org ID must not be empty',\n rule: 'notEmpty',\n })\n }\n if (this.apiId === '') {\n result.push({\n field: 'apiId',\n message: 'API ID must not be empty',\n rule: 'notEmpty',\n })\n }\n if (this.orgSlug === '') {\n result.push({\n field: 'orgSlug',\n message: 'Org slug must not be empty',\n rule: 'notEmpty',\n })\n }\n if (this.apiSlug === '') {\n result.push({\n field: 'apiSlug',\n message: 'API slug must not be empty',\n rule: 'notEmpty',\n })\n }\n if (!this.env) {\n result.push({\n field: 'env',\n message: 'Environment tag must not be empty',\n rule: 'notEmpty',\n })\n }\n if (this.modelVersion === '') {\n result.push({\n field: 'modelVersion',\n message: 'API model version must not be empty',\n rule: 'notEmpty',\n })\n }\n if (this.env === DeploymentEnvironment.PROD && !this.version) {\n result.push({\n field: 'version',\n message: 'Version must not be empty for production environment',\n rule: 'notEmpty',\n })\n } else if (this.env !== DeploymentEnvironment.PROD && this.version) {\n result.push({\n field: 'version',\n message: 'Version must not be present for non-production environment',\n rule: 'notEmpty',\n })\n }\n return result\n }\n}\n"]}
|
package/build/src/sdk/AiSdk.js
CHANGED
|
@@ -130,7 +130,7 @@ export class AiSdk extends SdkBase {
|
|
|
130
130
|
catch {
|
|
131
131
|
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status });
|
|
132
132
|
}
|
|
133
|
-
if (!Array.isArray(data.
|
|
133
|
+
if (!Array.isArray(data.data)) {
|
|
134
134
|
throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status });
|
|
135
135
|
}
|
|
136
136
|
return data;
|
|
@@ -286,7 +286,7 @@ export class AiSdk extends SdkBase {
|
|
|
286
286
|
catch {
|
|
287
287
|
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status });
|
|
288
288
|
}
|
|
289
|
-
if (!Array.isArray(data.
|
|
289
|
+
if (!Array.isArray(data.data)) {
|
|
290
290
|
throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status });
|
|
291
291
|
}
|
|
292
292
|
return data;
|
|
@@ -1 +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mBAAmB,EAAE,EAAE,EAAE,IAAI,EAAE,qBAAqB,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAA;YAClH,CAAC;YACD,IAAI,IAAqB,CAAA;YACzB,IAAI,CAAC;gBACH,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;YAChC,CAAC;YAAC,MAAM,CAAC;gBACP,MAAM,IAAI,SAAS,CAAC,GAAG,QAAQ,GAAG,cAAc,EAAE,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAA;YACxG,CAAC;YACD,IAAI,IAAI,CAAC,IAAI,KAAK,aAAa,EAAE,CAAC;gBAChC,MAAM,IAAI,SAAS,CAAC,GAAG,QAAQ,GAAG,kBAAkB,EAAE,EAAE,EAAE,IAAI,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAA;YAChH,CAAC;YACD,OAAO,IAAI,CAAA;QACb,CAAC;KACF,CAAA;CACF","sourcesContent":["import type { ContextListOptions, ContextListResult } from '../events/BaseEvents.js'\nimport { Exception } from '../exceptions/exception.js'\nimport type { AiStreamEvent } from '../modeling/ai/types.js'\nimport type { AiMessageSchema, AiModelMessageSchema, AiUserMessageSchema } from '../models/AiMessage.js'\nimport type { AiSessionApp, AiSessionSchema } from '../models/AiSession.js'\nimport { AiMessageKind, AiSessionKind } from '../models/kinds.js'\nimport { RouteBuilder } from './RouteBuilder.js'\nimport {\n E_INVALID_JSON,\n E_RESPONSE_NO_VALUE,\n E_RESPONSE_STATUS,\n E_RESPONSE_UNKNOWN,\n SdkBase,\n type SdkOptions,\n} from './SdkBase.js'\n\nexport class AiSdk extends SdkBase {\n /**\n * Modifies the domain of a file.\n * @param oid The organization id.\n * @param fid The domain file id.\n * @param goal The goal to modify the domain for.\n * @param sid The conversation session id, if any. When provided it will be used to continue the conversation.\n * @param request The request options.\n */\n async *modifyDomain(\n oid: string,\n fid: string,\n goal: string,\n sid?: string,\n request: SdkOptions = {}\n ): AsyncGenerator<AiStreamEvent> {\n const { token = this.sdk.token, signal } = request\n const url = this.sdk.getUrl(RouteBuilder.aiModifyDomain(oid, fid))\n const body = JSON.stringify({ goal, sid })\n const init: RequestInit = {\n method: 'POST',\n headers: {\n 'content-type': 'application/json',\n 'accept': 'text/event-stream',\n 'authorization': `Bearer ${token}`,\n },\n redirect: 'follow',\n credentials: 'include',\n body,\n signal,\n }\n const result = await fetch(url, init)\n if (!result.ok) {\n const errText = await result.text()\n throw new Exception(`Failed to modify domain: ${result.status} ${errText}`)\n }\n\n const reader = result.body?.getReader()\n if (!reader) {\n throw new Exception('Failed to get reader from response')\n }\n\n const decoder = new TextDecoder()\n let buffer = ''\n while (true) {\n const { done, value } = await reader.read()\n if (done) {\n return\n }\n buffer += decoder.decode(value, { stream: true })\n let newlineIndex: number\n while ((newlineIndex = buffer.indexOf('\\n\\n')) >= 0) {\n const messageChunk = buffer.slice(0, newlineIndex)\n buffer = buffer.slice(newlineIndex + 2)\n if (!messageChunk.trim()) continue\n\n const lines = messageChunk.split('\\n')\n let eventName = 'message'\n let eventDataStr = ''\n\n for (const line of lines) {\n if (line.startsWith('event:')) {\n eventName = line.substring(6).trim()\n } else if (line.startsWith('data:')) {\n eventDataStr += line.substring(5).trim()\n }\n }\n\n if (!eventDataStr) continue\n\n let eventData\n try {\n eventData = JSON.parse(eventDataStr)\n } catch {\n // eslint-disable-next-line no-console\n console.error('Failed to parse SSE JSON data:', eventDataStr)\n continue\n }\n\n switch (eventName) {\n case 'user-message':\n yield { event: eventName, data: eventData as AiUserMessageSchema }\n break\n case 'agent-message':\n yield { event: eventName, data: eventData as AiModelMessageSchema }\n break\n case 'thought-chunk':\n case 'text-chunk':\n // Assume the data is string diff chunks\n yield { event: eventName, data: eventData as string }\n break\n case 'done':\n yield { event: eventName, data: eventData as AiModelMessageSchema }\n return\n case 'error':\n yield { event: eventName, data: Exception.fromRawException(eventData, 'Failed to generate results') }\n break\n case 'session-updated':\n yield { event: eventName, data: eventData as AiSessionSchema }\n break\n default:\n // eslint-disable-next-line no-console\n console.warn(`Unknown SSE event: ${eventName}`)\n }\n }\n }\n }\n\n sessions = {\n /**\n * Lists the AI sessions for the given organization and application.\n * @param oid The organization id.\n * @param app The application id.\n * @param options The list options.\n * @param request The request options.\n * @returns The list of AI sessions.\n */\n list: async (\n oid: string,\n app: AiSessionApp,\n options: ContextListOptions = {},\n request: SdkOptions = {}\n ): Promise<ContextListResult<AiSessionSchema>> => {\n const { token = this.sdk.token } = request\n const url = this.sdk.getUrl(RouteBuilder.aiSessions(oid, app))\n this.sdk.appendListOptions(url, options)\n const result = await this.sdk.http.get(url.toString(), { token })\n this.inspectCommonStatusCodes(result)\n const E_PREFIX = 'Unable to list sessions. '\n if (result.status !== 200) {\n this.logInvalidResponse(result)\n throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)\n }\n if (!result.body) {\n throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })\n }\n let data: ContextListResult<AiSessionSchema>\n try {\n data = JSON.parse(result.body)\n } catch {\n throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })\n }\n if (!Array.isArray(data.items)) {\n throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })\n }\n return data\n },\n\n /**\n * Reads the AI session for the given organization, application and session id.\n * @param oid The organization id.\n * @param app The application id.\n * @param sid The session id.\n * @param request The request options.\n * @returns The AI session.\n */\n read: async (oid: string, app: AiSessionApp, sid: string, request: SdkOptions = {}): Promise<AiSessionSchema> => {\n const { token = this.sdk.token } = request\n const url = this.sdk.getUrl(RouteBuilder.aiSession(oid, app, sid))\n const result = await this.sdk.http.get(url.toString(), { token })\n this.inspectCommonStatusCodes(result)\n const E_PREFIX = 'Unable to read session. '\n if (result.status !== 200) {\n this.logInvalidResponse(result)\n throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)\n }\n if (!result.body) {\n throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })\n }\n let data: AiSessionSchema\n try {\n data = JSON.parse(result.body)\n } catch {\n throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })\n }\n if (data.kind !== AiSessionKind) {\n throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })\n }\n return data\n },\n\n /**\n * Creates the AI session for the given organization, application and session id.\n * @param oid The organization id.\n * @param app The application id.\n * @param session The AI session to create.\n * @param request The request options.\n * @returns The created AI session.\n */\n create: async (\n oid: string,\n app: AiSessionApp,\n session: Partial<AiSessionSchema>,\n request: SdkOptions = {}\n ): Promise<AiSessionSchema> => {\n const { token = this.sdk.token } = request\n const url = this.sdk.getUrl(RouteBuilder.aiSessions(oid, app))\n const body = JSON.stringify(session)\n const result = await this.sdk.http.post(url.toString(), { token, body })\n this.inspectCommonStatusCodes(result)\n const E_PREFIX = 'Unable to create session. '\n if (result.status !== 201) {\n this.logInvalidResponse(result)\n throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)\n }\n if (!result.body) {\n throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })\n }\n let data: AiSessionSchema\n try {\n data = JSON.parse(result.body)\n } catch {\n throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })\n }\n if (data.kind !== AiSessionKind) {\n throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })\n }\n return data\n },\n\n /**\n * Deletes the AI session for the given organization, application and session id.\n * The API performs a soft delete of the session.\n * @param oid The organization id.\n * @param app The application id.\n * @param sid The session id.\n * @param request The request options.\n */\n delete: async (oid: string, app: AiSessionApp, sid: string, request: SdkOptions = {}): Promise<void> => {\n const { token = this.sdk.token } = request\n const url = this.sdk.getUrl(RouteBuilder.aiSession(oid, app, sid))\n const result = await this.sdk.http.delete(url.toString(), { token })\n this.inspectCommonStatusCodes(result)\n const E_PREFIX = 'Unable to delete session. '\n if (result.status !== 204) {\n this.logInvalidResponse(result)\n throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)\n }\n },\n\n /**\n * Updates the AI session for the given organization, application and session id.\n * @param oid The organization id.\n * @param app The application id.\n * @param session The AI session to update.\n * @param request The request options.\n * @returns The updated AI session.\n */\n update: async (\n oid: string,\n app: AiSessionApp,\n session: AiSessionSchema,\n request: SdkOptions = {}\n ): Promise<AiSessionSchema> => {\n const { token = this.sdk.token } = request\n const url = this.sdk.getUrl(RouteBuilder.aiSession(oid, app, session.key))\n const body = JSON.stringify(session)\n const result = await this.sdk.http.put(url.toString(), { token, body })\n this.inspectCommonStatusCodes(result)\n const E_PREFIX = 'Unable to update session. '\n if (result.status !== 200) {\n this.logInvalidResponse(result)\n throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)\n }\n if (!result.body) {\n throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })\n }\n let data: AiSessionSchema\n try {\n data = JSON.parse(result.body)\n } catch {\n throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })\n }\n if (data.kind !== AiSessionKind) {\n throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })\n }\n return data\n },\n }\n\n messages = {\n /**\n * Lists the AI messages for the given organization and session id.\n * @param oid The organization id.\n * @param sid The session id.\n * @param options The list options.\n * @param request The request options.\n * @returns The list of AI messages.\n */\n list: async (\n oid: string,\n sid: string,\n options: ContextListOptions = {},\n request: SdkOptions = {}\n ): Promise<ContextListResult<AiMessageSchema>> => {\n const { token = this.sdk.token } = request\n const url = this.sdk.getUrl(RouteBuilder.aiMessages(oid, sid))\n this.sdk.appendListOptions(url, options)\n const result = await this.sdk.http.get(url.toString(), { token })\n this.inspectCommonStatusCodes(result)\n const E_PREFIX = 'Unable to list messages. '\n if (result.status !== 200) {\n this.logInvalidResponse(result)\n throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)\n }\n if (!result.body) {\n throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })\n }\n let data: ContextListResult<AiMessageSchema>\n try {\n data = JSON.parse(result.body)\n } catch {\n throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })\n }\n if (!Array.isArray(data.items)) {\n throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })\n }\n return data\n },\n\n /**\n * Deletes the AI message for the given organization, session and message id.\n * The API performs a soft delete of the message.\n * @param oid The organization id.\n * @param sid The session id.\n * @param mid The message id.\n * @param request The request options.\n */\n delete: async (oid: string, sid: string, mid: string, request: SdkOptions = {}): Promise<void> => {\n const { token = this.sdk.token } = request\n const url = this.sdk.getUrl(RouteBuilder.aiMessage(oid, sid, mid))\n const result = await this.sdk.http.delete(url.toString(), { token })\n this.inspectCommonStatusCodes(result)\n const E_PREFIX = 'Unable to delete message. '\n if (result.status !== 204) {\n this.logInvalidResponse(result)\n throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)\n }\n },\n\n /**\n * Updates the AI message for the given organization, session and message id.\n * @param oid The organization id.\n * @param sid The session id.\n * @param message The AI message to update.\n * @param request The request options.\n * @returns The updated AI message.\n */\n update: async (\n oid: string,\n sid: string,\n message: AiMessageSchema,\n request: SdkOptions = {}\n ): Promise<AiMessageSchema> => {\n const { token = this.sdk.token } = request\n const url = this.sdk.getUrl(RouteBuilder.aiMessage(oid, sid, message.key))\n const body = JSON.stringify(message)\n const result = await this.sdk.http.put(url.toString(), { token, body })\n this.inspectCommonStatusCodes(result)\n const E_PREFIX = 'Unable to update message. '\n if (result.status !== 200) {\n this.logInvalidResponse(result)\n throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)\n }\n if (!result.body) {\n throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })\n }\n let data: AiMessageSchema\n try {\n data = JSON.parse(result.body)\n } catch {\n throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })\n }\n if (data.kind !== AiMessageKind) {\n throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })\n }\n return data\n },\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"AiSdk.js","sourceRoot":"","sources":["../../../src/sdk/AiSdk.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AAItD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,OAAO,GAER,MAAM,cAAc,CAAA;AAErB,MAAM,OAAO,KAAM,SAAQ,OAAO;IAChC;;;;;;;OAOG;IACH,KAAK,CAAC,CAAC,YAAY,CACjB,GAAW,EACX,GAAW,EACX,IAAY,EACZ,GAAY,EACZ,UAAsB,EAAE;QAExB,MAAM,EAAE,KAAK,GAAG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EAAE,EAAE,IAAI,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAA;YAChH,CAAC;YACD,OAAO,IAAI,CAAA;QACb,CAAC;KACF,CAAA;CACF","sourcesContent":["import type { ContextListOptions, ContextListResult } from '../events/BaseEvents.js'\nimport { Exception } from '../exceptions/exception.js'\nimport type { AiStreamEvent } from '../modeling/ai/types.js'\nimport type { AiMessageSchema, AiModelMessageSchema, AiUserMessageSchema } from '../models/AiMessage.js'\nimport type { AiSessionApp, AiSessionSchema } from '../models/AiSession.js'\nimport { AiMessageKind, AiSessionKind } from '../models/kinds.js'\nimport { RouteBuilder } from './RouteBuilder.js'\nimport {\n E_INVALID_JSON,\n E_RESPONSE_NO_VALUE,\n E_RESPONSE_STATUS,\n E_RESPONSE_UNKNOWN,\n SdkBase,\n type SdkOptions,\n} from './SdkBase.js'\n\nexport class AiSdk extends SdkBase {\n /**\n * Modifies the domain of a file.\n * @param oid The organization id.\n * @param fid The domain file id.\n * @param goal The goal to modify the domain for.\n * @param sid The conversation session id, if any. When provided it will be used to continue the conversation.\n * @param request The request options.\n */\n async *modifyDomain(\n oid: string,\n fid: string,\n goal: string,\n sid?: string,\n request: SdkOptions = {}\n ): AsyncGenerator<AiStreamEvent> {\n const { token = this.sdk.token, signal } = request\n const url = this.sdk.getUrl(RouteBuilder.aiModifyDomain(oid, fid))\n const body = JSON.stringify({ goal, sid })\n const init: RequestInit = {\n method: 'POST',\n headers: {\n 'content-type': 'application/json',\n 'accept': 'text/event-stream',\n 'authorization': `Bearer ${token}`,\n },\n redirect: 'follow',\n credentials: 'include',\n body,\n signal,\n }\n const result = await fetch(url, init)\n if (!result.ok) {\n const errText = await result.text()\n throw new Exception(`Failed to modify domain: ${result.status} ${errText}`)\n }\n\n const reader = result.body?.getReader()\n if (!reader) {\n throw new Exception('Failed to get reader from response')\n }\n\n const decoder = new TextDecoder()\n let buffer = ''\n while (true) {\n const { done, value } = await reader.read()\n if (done) {\n return\n }\n buffer += decoder.decode(value, { stream: true })\n let newlineIndex: number\n while ((newlineIndex = buffer.indexOf('\\n\\n')) >= 0) {\n const messageChunk = buffer.slice(0, newlineIndex)\n buffer = buffer.slice(newlineIndex + 2)\n if (!messageChunk.trim()) continue\n\n const lines = messageChunk.split('\\n')\n let eventName = 'message'\n let eventDataStr = ''\n\n for (const line of lines) {\n if (line.startsWith('event:')) {\n eventName = line.substring(6).trim()\n } else if (line.startsWith('data:')) {\n eventDataStr += line.substring(5).trim()\n }\n }\n\n if (!eventDataStr) continue\n\n let eventData\n try {\n eventData = JSON.parse(eventDataStr)\n } catch {\n // eslint-disable-next-line no-console\n console.error('Failed to parse SSE JSON data:', eventDataStr)\n continue\n }\n\n switch (eventName) {\n case 'user-message':\n yield { event: eventName, data: eventData as AiUserMessageSchema }\n break\n case 'agent-message':\n yield { event: eventName, data: eventData as AiModelMessageSchema }\n break\n case 'thought-chunk':\n case 'text-chunk':\n // Assume the data is string diff chunks\n yield { event: eventName, data: eventData as string }\n break\n case 'done':\n yield { event: eventName, data: eventData as AiModelMessageSchema }\n return\n case 'error':\n yield { event: eventName, data: Exception.fromRawException(eventData, 'Failed to generate results') }\n break\n case 'session-updated':\n yield { event: eventName, data: eventData as AiSessionSchema }\n break\n default:\n // eslint-disable-next-line no-console\n console.warn(`Unknown SSE event: ${eventName}`)\n }\n }\n }\n }\n\n sessions = {\n /**\n * Lists the AI sessions for the given organization and application.\n * @param oid The organization id.\n * @param app The application id.\n * @param options The list options.\n * @param request The request options.\n * @returns The list of AI sessions.\n */\n list: async (\n oid: string,\n app: AiSessionApp,\n options: ContextListOptions = {},\n request: SdkOptions = {}\n ): Promise<ContextListResult<AiSessionSchema>> => {\n const { token = this.sdk.token } = request\n const url = this.sdk.getUrl(RouteBuilder.aiSessions(oid, app))\n this.sdk.appendListOptions(url, options)\n const result = await this.sdk.http.get(url.toString(), { token })\n this.inspectCommonStatusCodes(result)\n const E_PREFIX = 'Unable to list sessions. '\n if (result.status !== 200) {\n this.logInvalidResponse(result)\n throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)\n }\n if (!result.body) {\n throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })\n }\n let data: ContextListResult<AiSessionSchema>\n try {\n data = JSON.parse(result.body)\n } catch {\n throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })\n }\n if (!Array.isArray(data.data)) {\n throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })\n }\n return data\n },\n\n /**\n * Reads the AI session for the given organization, application and session id.\n * @param oid The organization id.\n * @param app The application id.\n * @param sid The session id.\n * @param request The request options.\n * @returns The AI session.\n */\n read: async (oid: string, app: AiSessionApp, sid: string, request: SdkOptions = {}): Promise<AiSessionSchema> => {\n const { token = this.sdk.token } = request\n const url = this.sdk.getUrl(RouteBuilder.aiSession(oid, app, sid))\n const result = await this.sdk.http.get(url.toString(), { token })\n this.inspectCommonStatusCodes(result)\n const E_PREFIX = 'Unable to read session. '\n if (result.status !== 200) {\n this.logInvalidResponse(result)\n throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)\n }\n if (!result.body) {\n throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })\n }\n let data: AiSessionSchema\n try {\n data = JSON.parse(result.body)\n } catch {\n throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })\n }\n if (data.kind !== AiSessionKind) {\n throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })\n }\n return data\n },\n\n /**\n * Creates the AI session for the given organization, application and session id.\n * @param oid The organization id.\n * @param app The application id.\n * @param session The AI session to create.\n * @param request The request options.\n * @returns The created AI session.\n */\n create: async (\n oid: string,\n app: AiSessionApp,\n session: Partial<AiSessionSchema>,\n request: SdkOptions = {}\n ): Promise<AiSessionSchema> => {\n const { token = this.sdk.token } = request\n const url = this.sdk.getUrl(RouteBuilder.aiSessions(oid, app))\n const body = JSON.stringify(session)\n const result = await this.sdk.http.post(url.toString(), { token, body })\n this.inspectCommonStatusCodes(result)\n const E_PREFIX = 'Unable to create session. '\n if (result.status !== 201) {\n this.logInvalidResponse(result)\n throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)\n }\n if (!result.body) {\n throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })\n }\n let data: AiSessionSchema\n try {\n data = JSON.parse(result.body)\n } catch {\n throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })\n }\n if (data.kind !== AiSessionKind) {\n throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })\n }\n return data\n },\n\n /**\n * Deletes the AI session for the given organization, application and session id.\n * The API performs a soft delete of the session.\n * @param oid The organization id.\n * @param app The application id.\n * @param sid The session id.\n * @param request The request options.\n */\n delete: async (oid: string, app: AiSessionApp, sid: string, request: SdkOptions = {}): Promise<void> => {\n const { token = this.sdk.token } = request\n const url = this.sdk.getUrl(RouteBuilder.aiSession(oid, app, sid))\n const result = await this.sdk.http.delete(url.toString(), { token })\n this.inspectCommonStatusCodes(result)\n const E_PREFIX = 'Unable to delete session. '\n if (result.status !== 204) {\n this.logInvalidResponse(result)\n throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)\n }\n },\n\n /**\n * Updates the AI session for the given organization, application and session id.\n * @param oid The organization id.\n * @param app The application id.\n * @param session The AI session to update.\n * @param request The request options.\n * @returns The updated AI session.\n */\n update: async (\n oid: string,\n app: AiSessionApp,\n session: AiSessionSchema,\n request: SdkOptions = {}\n ): Promise<AiSessionSchema> => {\n const { token = this.sdk.token } = request\n const url = this.sdk.getUrl(RouteBuilder.aiSession(oid, app, session.key))\n const body = JSON.stringify(session)\n const result = await this.sdk.http.put(url.toString(), { token, body })\n this.inspectCommonStatusCodes(result)\n const E_PREFIX = 'Unable to update session. '\n if (result.status !== 200) {\n this.logInvalidResponse(result)\n throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)\n }\n if (!result.body) {\n throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })\n }\n let data: AiSessionSchema\n try {\n data = JSON.parse(result.body)\n } catch {\n throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })\n }\n if (data.kind !== AiSessionKind) {\n throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })\n }\n return data\n },\n }\n\n messages = {\n /**\n * Lists the AI messages for the given organization and session id.\n * @param oid The organization id.\n * @param sid The session id.\n * @param options The list options.\n * @param request The request options.\n * @returns The list of AI messages.\n */\n list: async (\n oid: string,\n sid: string,\n options: ContextListOptions = {},\n request: SdkOptions = {}\n ): Promise<ContextListResult<AiMessageSchema>> => {\n const { token = this.sdk.token } = request\n const url = this.sdk.getUrl(RouteBuilder.aiMessages(oid, sid))\n this.sdk.appendListOptions(url, options)\n const result = await this.sdk.http.get(url.toString(), { token })\n this.inspectCommonStatusCodes(result)\n const E_PREFIX = 'Unable to list messages. '\n if (result.status !== 200) {\n this.logInvalidResponse(result)\n throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)\n }\n if (!result.body) {\n throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })\n }\n let data: ContextListResult<AiMessageSchema>\n try {\n data = JSON.parse(result.body)\n } catch {\n throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })\n }\n if (!Array.isArray(data.data)) {\n throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })\n }\n return data\n },\n\n /**\n * Deletes the AI message for the given organization, session and message id.\n * The API performs a soft delete of the message.\n * @param oid The organization id.\n * @param sid The session id.\n * @param mid The message id.\n * @param request The request options.\n */\n delete: async (oid: string, sid: string, mid: string, request: SdkOptions = {}): Promise<void> => {\n const { token = this.sdk.token } = request\n const url = this.sdk.getUrl(RouteBuilder.aiMessage(oid, sid, mid))\n const result = await this.sdk.http.delete(url.toString(), { token })\n this.inspectCommonStatusCodes(result)\n const E_PREFIX = 'Unable to delete message. '\n if (result.status !== 204) {\n this.logInvalidResponse(result)\n throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)\n }\n },\n\n /**\n * Updates the AI message for the given organization, session and message id.\n * @param oid The organization id.\n * @param sid The session id.\n * @param message The AI message to update.\n * @param request The request options.\n * @returns The updated AI message.\n */\n update: async (\n oid: string,\n sid: string,\n message: AiMessageSchema,\n request: SdkOptions = {}\n ): Promise<AiMessageSchema> => {\n const { token = this.sdk.token } = request\n const url = this.sdk.getUrl(RouteBuilder.aiMessage(oid, sid, message.key))\n const body = JSON.stringify(message)\n const result = await this.sdk.http.put(url.toString(), { token, body })\n this.inspectCommonStatusCodes(result)\n const E_PREFIX = 'Unable to update message. '\n if (result.status !== 200) {\n this.logInvalidResponse(result)\n throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)\n }\n if (!result.body) {\n throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })\n }\n let data: AiMessageSchema\n try {\n data = JSON.parse(result.body)\n } catch {\n throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })\n }\n if (data.kind !== AiMessageKind) {\n throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })\n }\n return data\n },\n }\n}\n"]}
|