first commit
This commit is contained in:
+362
@@ -0,0 +1,362 @@
|
||||
import type { JsonValue } from "./types.js";
|
||||
export type EntityId = string;
|
||||
export type Operator = "Equal" | "NotEqual" | "LessThan" | "GreaterThan" | "LessThanOrEqual" | "GreaterThanOrEqual" | "BeginsWith" | "EndsWith" | "Contains" | "DoesNotContain" | "In" | "Like" | "InRange" | "NotInRange" | "NotIn";
|
||||
export type Order = "Ascending" | "Descending";
|
||||
export type DatePeriod = "ThisWeek" | "ThisMonth" | "ThisQuarter" | "ThisYear" | "NextWeek" | "NextMonth" | "NextQuarter" | "NextYear" | "LastWeek" | "LastMonth" | "LastQuarter" | "LastYear";
|
||||
export type FunctionType = "Count" | "Max" | "Min" | "Sum" | "Avg";
|
||||
export type LicenseType = "Full" | "Limited" | "Email" | "None" | "TeamMember" | "Social" | "ExternalCollaborator";
|
||||
export type NewsFeedMode = "Following" | "All";
|
||||
export type TimesheetState = "UnSubmitted" | "PendingApproval" | "Approved" | "All";
|
||||
export type ErrorCode = "EntityNotFound" | "InvalidArgument" | "MissingArgument" | "InvalidOperation" | "DuplicateKey" | "InvalidField" | "InvalidType" | "FileNotFound" | "VirusCheckFailed" | "Unauthorized" | "UnsupportedClient" | "General" | "Internal" | "ValidationRuleError" | "LoginFailure" | "SessionTimeout" | "Redirect" | "InvalidQuery" | "ExecutionThresholdExceeded" | "TooManyRequests";
|
||||
export type FieldType = "Boolean" | "String" | "Integer" | "Long" | "Double" | "DateTime" | "Date" | "Entity" | "Duration" | "Money";
|
||||
export type PresentationType = "Text" | "Numeric" | "Date" | "Time" | "Checkbox" | "TextArea" | "Currency" | "Duration" | "ReferenceToObject" | "PickList" | "Url" | "Percent" | "Other";
|
||||
export type RecipientType = "To" | "CC";
|
||||
export type AccessType = "Public" | "Private";
|
||||
export type TriggerType = "Create" | "CreateOrEdit" | "Delete" | "CreateOrEditWithPreviousValueNotEqual";
|
||||
export type HttpMethod = "DELETE" | "GET" | "POST" | "PUT";
|
||||
export interface AndCondition {
|
||||
and: Condition[];
|
||||
}
|
||||
export interface OrCondition {
|
||||
or: Condition[];
|
||||
}
|
||||
export interface NotCondition {
|
||||
not: Condition;
|
||||
}
|
||||
export interface CompareCondition {
|
||||
_type?: "Compare";
|
||||
leftExpression: Expression;
|
||||
operator: ComparisonOperator;
|
||||
rightExpression: Expression;
|
||||
}
|
||||
export interface CzqlCondition {
|
||||
text: string;
|
||||
parameters?: Parameters;
|
||||
}
|
||||
export type Condition = AndCondition | OrCondition | NotCondition | CompareCondition | CzqlCondition;
|
||||
export interface FieldExpression {
|
||||
fieldName: string;
|
||||
}
|
||||
export interface ConstantExpression {
|
||||
value: JsonValue;
|
||||
}
|
||||
export interface ConstantListExpression {
|
||||
values: JsonValue[];
|
||||
}
|
||||
export interface QueryExpression {
|
||||
query: Query;
|
||||
}
|
||||
export interface PredefinedDateRangeExpression {
|
||||
value?: DatePeriod;
|
||||
dateRangeValue?: DatePeriod;
|
||||
}
|
||||
export type Expression = FieldExpression | ConstantExpression | ConstantListExpression | QueryExpression | PredefinedDateRangeExpression;
|
||||
export type ApplyOnMembersResult = string;
|
||||
export type IFormat = Record<string, JsonValue>;
|
||||
export type RoleType = string;
|
||||
export interface Action {
|
||||
url: string;
|
||||
method: HttpMethod;
|
||||
headers?: string;
|
||||
body?: string;
|
||||
}
|
||||
export interface ApplyOnMembersResultItemStatus {
|
||||
userGroupId?: EntityId;
|
||||
userGroupName?: string;
|
||||
status?: ApplyOnMembersResult;
|
||||
failureStatusMessage?: FailureStatusMessage;
|
||||
}
|
||||
export interface CalendarException {
|
||||
id?: EntityId;
|
||||
name?: string;
|
||||
isWorkingDay?: boolean;
|
||||
isAllDay?: boolean;
|
||||
startHour?: number;
|
||||
endHour?: number;
|
||||
exceptionType?: EntityId;
|
||||
startDate?: DateTime;
|
||||
endDate?: DateTime;
|
||||
repeat?: Repeat;
|
||||
}
|
||||
export interface CreateResult {
|
||||
id?: EntityId;
|
||||
}
|
||||
export interface DateTime {
|
||||
}
|
||||
export interface DayInformation {
|
||||
isWorkingDay?: boolean;
|
||||
totalWorkingHours?: number;
|
||||
startHour?: number;
|
||||
endHour?: number;
|
||||
}
|
||||
export interface Entity {
|
||||
id?: EntityId;
|
||||
objectFields?: Record<string, JsonValue>;
|
||||
}
|
||||
export interface EntityDescription {
|
||||
typeName?: string;
|
||||
fields?: FieldDescription[];
|
||||
validStates?: string[];
|
||||
label?: string;
|
||||
labelPlural?: string;
|
||||
parentEntity?: string;
|
||||
displayField?: string;
|
||||
disabled?: boolean;
|
||||
relations?: RelationDescription[];
|
||||
}
|
||||
export interface EntityRelationsDescription {
|
||||
typeName?: string;
|
||||
relations?: RelationDescription[];
|
||||
}
|
||||
export interface Error {
|
||||
errorCode?: ErrorCode;
|
||||
message?: string;
|
||||
referenceId?: string;
|
||||
}
|
||||
export interface Every {
|
||||
recurrenceType?: string;
|
||||
period?: number;
|
||||
}
|
||||
export interface ExceptionDate {
|
||||
date?: DateTime;
|
||||
calendarExceptionId?: EntityId;
|
||||
}
|
||||
export interface FailureStatusMessage {
|
||||
failureMessage?: string;
|
||||
}
|
||||
export interface FieldAggregation {
|
||||
function?: FunctionType;
|
||||
fieldName?: string;
|
||||
alias?: string;
|
||||
}
|
||||
export interface FieldDescription {
|
||||
name?: string;
|
||||
type?: FieldType;
|
||||
presentationType?: PresentationType;
|
||||
label?: string;
|
||||
defaultValue?: JsonValue;
|
||||
system?: boolean;
|
||||
calculated?: boolean;
|
||||
nullable?: boolean;
|
||||
createOnly?: boolean;
|
||||
updateable?: boolean;
|
||||
internal?: boolean;
|
||||
custom?: boolean;
|
||||
visible?: boolean;
|
||||
decimalPlaces?: number;
|
||||
filterable?: boolean;
|
||||
sortable?: boolean;
|
||||
format?: IFormat;
|
||||
maxLength?: number;
|
||||
flags?: string[];
|
||||
restrictedFieldSetName?: string;
|
||||
manuallySetName?: string;
|
||||
}
|
||||
export interface FieldValue {
|
||||
fieldName?: string;
|
||||
value?: JsonValue;
|
||||
}
|
||||
export interface FileInformation {
|
||||
storage?: Storage;
|
||||
url?: string;
|
||||
fileName?: string;
|
||||
subType?: string;
|
||||
extendedInfo?: string;
|
||||
}
|
||||
export interface IdentifierMap {
|
||||
oid?: string;
|
||||
id?: string;
|
||||
}
|
||||
export interface LicenseConsumption {
|
||||
licenseTypeLabel?: string;
|
||||
licenseType?: LicenseType;
|
||||
assignedLicenses?: number;
|
||||
activeUsers?: number;
|
||||
allocatedLicenses?: number;
|
||||
}
|
||||
export interface LoginOptions {
|
||||
partnerId?: string;
|
||||
applicationId?: string;
|
||||
}
|
||||
export interface MissingTimesheets {
|
||||
date?: DateTime;
|
||||
workingHours?: number;
|
||||
reportedHours?: number;
|
||||
missingHours?: number;
|
||||
}
|
||||
export interface OrderBy {
|
||||
fieldName?: string;
|
||||
order?: Order;
|
||||
}
|
||||
export interface OrganizationLicenseConsumption {
|
||||
id?: EntityId;
|
||||
licenseConsumption?: LicenseConsumption;
|
||||
}
|
||||
export interface Paging {
|
||||
from?: number;
|
||||
limit?: number;
|
||||
hasMore?: boolean;
|
||||
}
|
||||
export interface Parameters {
|
||||
objectFields?: Record<string, JsonValue>;
|
||||
}
|
||||
export interface PostFeedItem {
|
||||
latestReplies?: ReplyFeedItem;
|
||||
pinned?: boolean;
|
||||
message?: Entity;
|
||||
likedByMe?: boolean;
|
||||
relatedEntities?: Entity;
|
||||
notify?: Entity;
|
||||
topics?: Entity;
|
||||
bodyMarkup?: string;
|
||||
summary?: string;
|
||||
}
|
||||
export interface Recipient {
|
||||
recipientType?: RecipientType;
|
||||
user?: EntityId;
|
||||
eMail?: string;
|
||||
}
|
||||
export interface Relation {
|
||||
name?: string;
|
||||
fields?: string[];
|
||||
where?: Condition;
|
||||
orders?: OrderBy[];
|
||||
fromLink?: boolean;
|
||||
}
|
||||
export interface RelationDescription {
|
||||
name?: string;
|
||||
label?: string;
|
||||
roleLabel?: string;
|
||||
readOnly?: boolean;
|
||||
linkTypeName?: string;
|
||||
relatedTypeName?: string;
|
||||
sourceFieldName?: string;
|
||||
}
|
||||
export interface Repeat {
|
||||
every?: Every;
|
||||
occurrences?: number;
|
||||
endBy?: DateTime;
|
||||
}
|
||||
export interface ReplyFeedItem {
|
||||
message?: Entity;
|
||||
likedByMe?: boolean;
|
||||
relatedEntities?: Entity;
|
||||
notify?: Entity;
|
||||
topics?: Entity;
|
||||
bodyMarkup?: string;
|
||||
summary?: string;
|
||||
}
|
||||
export interface Request {
|
||||
url?: string;
|
||||
method?: string;
|
||||
body?: JsonValue;
|
||||
}
|
||||
export interface Response {
|
||||
statusCode?: number;
|
||||
body?: JsonValue;
|
||||
}
|
||||
export interface RetrieveResult {
|
||||
entity?: Entity;
|
||||
}
|
||||
export interface RoleForResource {
|
||||
role: RoleType;
|
||||
resource: EntityId;
|
||||
}
|
||||
export interface EntityFeedQuery {
|
||||
entityId: EntityId;
|
||||
fields?: string[];
|
||||
feedItemOptions?: string[];
|
||||
paging?: Paging;
|
||||
}
|
||||
export interface GroupsQuery {
|
||||
fields?: string[];
|
||||
paging?: Paging;
|
||||
}
|
||||
export interface NewsFeedQuery {
|
||||
mode?: NewsFeedMode;
|
||||
fields?: string[];
|
||||
feedItemOptions?: string[];
|
||||
paging?: Paging;
|
||||
}
|
||||
export interface RepliesQuery {
|
||||
postId: EntityId;
|
||||
fields?: string[];
|
||||
feedItemOptions?: string[];
|
||||
paging?: Paging;
|
||||
}
|
||||
export interface AggregateQuery {
|
||||
typeName: string;
|
||||
groupBy?: string[];
|
||||
orders?: OrderBy[];
|
||||
where?: Condition;
|
||||
aggregations: FieldAggregation[];
|
||||
paging?: Paging;
|
||||
}
|
||||
export interface CzqlQuery {
|
||||
q?: string;
|
||||
parameters?: Parameters;
|
||||
paging?: Paging;
|
||||
}
|
||||
export interface EntityQuery {
|
||||
typeName: string;
|
||||
fields?: string[];
|
||||
orders?: OrderBy[];
|
||||
where?: Condition;
|
||||
relations?: Relation[];
|
||||
deleted?: boolean;
|
||||
originalExternalID?: boolean;
|
||||
paging?: Paging;
|
||||
}
|
||||
export interface RelationQuery {
|
||||
entityId: EntityId;
|
||||
relationName: string;
|
||||
fields?: string[];
|
||||
orders?: OrderBy[];
|
||||
where?: Condition;
|
||||
relations?: Relation[];
|
||||
fromLink?: boolean;
|
||||
paging?: Paging;
|
||||
}
|
||||
export interface ExpenseQuery {
|
||||
projectId?: EntityId;
|
||||
customerId?: EntityId;
|
||||
typeName: string;
|
||||
fields?: string[];
|
||||
orders?: OrderBy[];
|
||||
where?: Condition;
|
||||
relations?: Relation[];
|
||||
deleted?: boolean;
|
||||
originalExternalID?: boolean;
|
||||
paging?: Paging;
|
||||
}
|
||||
export interface TimesheetQuery {
|
||||
projectId?: EntityId;
|
||||
customerId?: EntityId;
|
||||
iAmTheApprover?: boolean;
|
||||
workItems?: EntityId[];
|
||||
timesheetState?: TimesheetState;
|
||||
typeName: string;
|
||||
fields?: string[];
|
||||
orders?: OrderBy[];
|
||||
where?: Condition;
|
||||
relations?: Relation[];
|
||||
deleted?: boolean;
|
||||
originalExternalID?: boolean;
|
||||
paging?: Paging;
|
||||
}
|
||||
export interface FindUserQuery {
|
||||
firstName?: string;
|
||||
lastName?: string;
|
||||
eMail?: string;
|
||||
fuzzySearchUserName?: boolean;
|
||||
includeSuspendedUsers?: boolean;
|
||||
fields?: string[];
|
||||
orders?: OrderBy[];
|
||||
paging?: Paging;
|
||||
}
|
||||
export type Query = EntityFeedQuery | GroupsQuery | NewsFeedQuery | RepliesQuery | AggregateQuery | CzqlQuery | EntityQuery | RelationQuery | ExpenseQuery | TimesheetQuery | FindUserQuery;
|
||||
export type EntityQueryBody = EntityQuery;
|
||||
export type ComparisonOperator = Operator;
|
||||
export type SortOrder = Order;
|
||||
export type ConditionParameters = Parameters;
|
||||
//# sourceMappingURL=clarizen-api-types.d.ts.map
|
||||
+1
File diff suppressed because one or more lines are too long
+2
@@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=clarizen-api-types.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"clarizen-api-types.js","sourceRoot":"","sources":["../src/clarizen-api-types.ts"],"names":[],"mappings":""}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
import { type ClarizenNamespace } from "./endpoints.js";
|
||||
import { EntityObjectsService } from "./objects.js";
|
||||
import { type MetadataService } from "./metadata/service.js";
|
||||
import { type NamespaceService, type OperationCall } from "./service.js";
|
||||
import type { QueryParamValue } from "./http.js";
|
||||
import type { EntityQueryParams, EntityQueryResult, JsonObject, LoginParams, LoginResult, ServerDefinition, SessionInfo } from "./types.js";
|
||||
export interface ClarizenOptions {
|
||||
baseUrl?: string;
|
||||
apiToken?: string;
|
||||
sessionId?: string;
|
||||
}
|
||||
export interface AuthenticationService {
|
||||
getServerDefinition: (body?: JsonObject) => Promise<ServerDefinition>;
|
||||
getSessionInfo: () => Promise<SessionInfo>;
|
||||
login: (params: LoginParams) => Promise<LoginResult>;
|
||||
logout: OperationCall;
|
||||
}
|
||||
export interface DataService {
|
||||
entityQuery: (params: EntityQueryParams) => Promise<EntityQueryResult>;
|
||||
[operation: string]: OperationCall | ((params: EntityQueryParams) => Promise<EntityQueryResult>);
|
||||
}
|
||||
export type { MetadataService } from "./metadata/service.js";
|
||||
export declare class Clarizen {
|
||||
private readonly http;
|
||||
readonly authentication: AuthenticationService;
|
||||
readonly applications: NamespaceService;
|
||||
readonly bulk: NamespaceService;
|
||||
readonly data: DataService;
|
||||
readonly files: NamespaceService;
|
||||
readonly metadata: MetadataService;
|
||||
readonly utils: NamespaceService;
|
||||
readonly objects: EntityObjectsService;
|
||||
constructor(baseUrl: string, apiToken?: string);
|
||||
constructor(options: ClarizenOptions);
|
||||
get baseUrl(): string;
|
||||
loginWithDiscovery(params: LoginParams): Promise<LoginResult>;
|
||||
useSession(sessionId: string): void;
|
||||
useApiKey(apiToken: string): void;
|
||||
get sessionId(): string | undefined;
|
||||
call<T = unknown>(namespace: ClarizenNamespace, operation: string, body?: Record<string, unknown>, query?: Record<string, QueryParamValue>): Promise<T>;
|
||||
static createForLogin(baseUrl?: string): Clarizen;
|
||||
static readonly namespaces: readonly ["applications", "authentication", "bulk", "data", "files", "metadata", "utils"];
|
||||
}
|
||||
//# sourceMappingURL=clarizen.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"clarizen.d.ts","sourceRoot":"","sources":["../src/clarizen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACpF,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,aAAa,EACnB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAEV,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EACV,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,WAAW,EACZ,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB;IACpC,mBAAmB,EAAE,CAAC,IAAI,CAAC,EAAE,UAAU,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACtE,cAAc,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC;IAC3C,KAAK,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;IACrD,MAAM,EAAE,aAAa,CAAC;CACvB;AAED,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACvE,CAAC,SAAS,EAAE,MAAM,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,QAAQ,CAAC,UAAU,4FAAc;CACzC"}
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
import { NAMESPACES } from "./endpoints.js";
|
||||
import { HttpClient } from "./http.js";
|
||||
import { EntityObjectsService } from "./objects.js";
|
||||
import { createMetadataService } from "./metadata/service.js";
|
||||
import { createNamespaceService, } from "./service.js";
|
||||
export class Clarizen {
|
||||
http;
|
||||
authentication;
|
||||
applications;
|
||||
bulk;
|
||||
data;
|
||||
files;
|
||||
metadata;
|
||||
utils;
|
||||
objects;
|
||||
constructor(baseUrlOrOptions, apiToken) {
|
||||
const options = typeof baseUrlOrOptions === "string"
|
||||
? { baseUrl: baseUrlOrOptions, apiToken }
|
||||
: baseUrlOrOptions;
|
||||
const baseUrl = (options.baseUrl ?? "https://api.clarizen.com").replace(/\/$/, "");
|
||||
let auth;
|
||||
if (options.sessionId) {
|
||||
auth = { type: "session", sessionId: options.sessionId };
|
||||
}
|
||||
else if (options.apiToken) {
|
||||
auth = { type: "apiKey", token: options.apiToken };
|
||||
}
|
||||
else {
|
||||
auth = { type: "none" };
|
||||
}
|
||||
this.http = new HttpClient(baseUrl, auth);
|
||||
const authBase = createNamespaceService(this.http, "authentication");
|
||||
this.authentication = {
|
||||
getServerDefinition: (body) => authBase.getServerDefinition(body),
|
||||
getSessionInfo: () => authBase.getSessionInfo(),
|
||||
logout: authBase.logout,
|
||||
login: async (params) => {
|
||||
const result = (await authBase.login(params));
|
||||
this.useSession(result.sessionId);
|
||||
return result;
|
||||
},
|
||||
};
|
||||
this.applications = createNamespaceService(this.http, "applications");
|
||||
this.bulk = createNamespaceService(this.http, "bulk");
|
||||
this.files = createNamespaceService(this.http, "files");
|
||||
this.metadata = createMetadataService(this.http);
|
||||
this.utils = createNamespaceService(this.http, "utils");
|
||||
this.objects = new EntityObjectsService(this.http);
|
||||
this.data = createNamespaceService(this.http, "data");
|
||||
}
|
||||
get baseUrl() {
|
||||
return this.http.getBaseUrl();
|
||||
}
|
||||
async loginWithDiscovery(params) {
|
||||
const definition = await this.authentication.getServerDefinition(params);
|
||||
this.http.setBaseUrl(definition.serverLocation);
|
||||
return this.authentication.login(params);
|
||||
}
|
||||
useSession(sessionId) {
|
||||
this.http.setAuth({ type: "session", sessionId });
|
||||
}
|
||||
useApiKey(apiToken) {
|
||||
this.http.setAuth({ type: "apiKey", token: apiToken });
|
||||
}
|
||||
get sessionId() {
|
||||
const auth = this.http.getAuth();
|
||||
return auth.type === "session" ? auth.sessionId : undefined;
|
||||
}
|
||||
call(namespace, operation, body, query) {
|
||||
const service = this[namespace];
|
||||
return service(operation, body, query);
|
||||
}
|
||||
static createForLogin(baseUrl = "https://api.clarizen.com") {
|
||||
return new Clarizen({ baseUrl });
|
||||
}
|
||||
static namespaces = NAMESPACES;
|
||||
}
|
||||
//# sourceMappingURL=clarizen.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"clarizen.js","sourceRoot":"","sources":["../src/clarizen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA0B,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAwB,MAAM,uBAAuB,CAAC;AACpF,OAAO,EACL,sBAAsB,GAGvB,MAAM,cAAc,CAAC;AAiCtB,MAAM,OAAO,QAAQ;IACF,IAAI,CAAa;IAEzB,cAAc,CAAwB;IACtC,YAAY,CAAmB;IAC/B,IAAI,CAAmB;IACvB,IAAI,CAAc;IAClB,KAAK,CAAmB;IACxB,QAAQ,CAAkB;IAC1B,KAAK,CAAmB;IACxB,OAAO,CAAuB;IAIvC,YACE,gBAA0C,EAC1C,QAAiB;QAEjB,MAAM,OAAO,GACX,OAAO,gBAAgB,KAAK,QAAQ;YAClC,CAAC,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE;YACzC,CAAC,CAAC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AAC,OAAO,EAAE,CAAC;QACjC,OAAO,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;IAC9D,CAAC;IAED,IAAI,CACF,SAA4B,EAC5B,SAAiB,EACjB,IAA8B,EAC9B,KAAuC;QAEvC,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAqB,CAAC;QACpD,OAAO,OAAO,CAAC,SAAS,EAAE,IAAkB,EAAE,KAAK,CAAe,CAAC;IACrE,CAAC;IAED,MAAM,CAAC,cAAc,CAAC,OAAO,GAAG,0BAA0B;QACxD,OAAO,IAAI,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;IACnC,CAAC;IAED,MAAM,CAAU,UAAU,GAAG,UAAU,CAAC"}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
import type { EndpointDefinition } from "./types.js";
|
||||
export declare const ENDPOINTS: EndpointDefinition[];
|
||||
export declare const NAMESPACES: readonly ["applications", "authentication", "bulk", "data", "files", "metadata", "utils"];
|
||||
export type ClarizenNamespace = (typeof NAMESPACES)[number];
|
||||
//# sourceMappingURL=endpoints.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"endpoints.d.ts","sourceRoot":"","sources":["../src/endpoints.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD,eAAO,MAAM,SAAS,EAAE,kBAAkB,EAqDzC,CAAC;AAEF,eAAO,MAAM,UAAU,2FAQb,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC"}
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
export const ENDPOINTS = [
|
||||
{ namespace: "applications", operation: "GetApplicationStatus", path: "/V2.0/services/applications/getApplicationStatus", httpMethods: ["GET"], description: "Get application status" },
|
||||
{ namespace: "applications", operation: "InstallApplication", path: "/V2.0/services/applications/installApplication", httpMethods: ["POST"], description: "Install application" },
|
||||
{ namespace: "authentication", operation: "GetServerDefinition", path: "/V2.0/services/authentication/getServerDefinition", httpMethods: ["POST"], description: "Returns the URL where your organization API is located" },
|
||||
{ namespace: "authentication", operation: "GetSessionInfo", path: "/V2.0/services/authentication/getSessionInfo", httpMethods: ["GET", "POST"], description: "Returns information about the current session" },
|
||||
{ namespace: "authentication", operation: "Login", path: "/V2.0/services/authentication/login", httpMethods: ["POST"], description: "Login to the API" },
|
||||
{ namespace: "authentication", operation: "Logout", path: "/V2.0/services/authentication/logout", httpMethods: ["GET"], description: "Terminate the current API session" },
|
||||
{ namespace: "bulk", operation: "Execute", path: "/V2.0/services/bulk/execute", httpMethods: ["POST"], description: "Execute several API calls in a single round trip" },
|
||||
{ namespace: "data", operation: "AggregateQuery", path: "/V2.0/services/data/aggregateQuery", httpMethods: ["GET", "POST"], description: "Query and aggregate results" },
|
||||
{ namespace: "data", operation: "ApplyOnMembers", path: "/V2.0/services/data/applyOnMembers", httpMethods: ["POST"], description: "Apply settings from User Group to members" },
|
||||
{ namespace: "data", operation: "ChangeState", path: "/V2.0/services/data/changeState", httpMethods: ["POST"], description: "Change the state of an object" },
|
||||
{ namespace: "data", operation: "CloseFiscalMonth", path: "/V2.0/services/data/closeFiscalMonth", httpMethods: ["POST"], description: "Close the fiscal month" },
|
||||
{ namespace: "data", operation: "CountQuery", path: "/V2.0/services/data/countQuery", httpMethods: ["GET", "POST"], description: "Query and return result count" },
|
||||
{ namespace: "data", operation: "CreateAndRetrieve", path: "/V2.0/services/data/createAndRetrieve", httpMethods: ["POST"], description: "Create and immediately retrieve an entity" },
|
||||
{ namespace: "data", operation: "CreateDiscussion", path: "/V2.0/services/data/createDiscussion", httpMethods: ["POST"], description: "Create a discussion message" },
|
||||
{ namespace: "data", operation: "CreateFromTemplate", path: "/V2.0/services/data/createFromTemplate", httpMethods: ["POST"], description: "Create an entity from a template" },
|
||||
{ namespace: "data", operation: "CreateMultiply", path: "/V2.0/services/data/createMultiply", httpMethods: ["PUT"], description: "Create multiple entities" },
|
||||
{ namespace: "data", operation: "DeletePermissions", path: "/V2.0/services/data/deletePermissions", httpMethods: ["POST"], description: "Delete permission on entity" },
|
||||
{ namespace: "data", operation: "EntityFeedQuery", path: "/V2.0/services/data/entityFeedQuery", httpMethods: ["GET", "POST"], description: "Return the social feed of an object" },
|
||||
{ namespace: "data", operation: "EntityQuery", path: "/V2.0/services/data/entityQuery", httpMethods: ["GET", "POST"], description: "Retrieve entities by criteria" },
|
||||
{ namespace: "data", operation: "ExecuteCustomAction", path: "/V2.0/services/data/executeCustomAction", httpMethods: ["GET", "POST"], description: "Execute custom action" },
|
||||
{ namespace: "data", operation: "ExpenseQuery", path: "/V2.0/services/data/expenseQuery", httpMethods: ["POST"], description: "Retrieve expenses for a project or customer" },
|
||||
{ namespace: "data", operation: "FindUserQuery", path: "/V2.0/services/data/findUserQuery", httpMethods: ["POST"], description: "Find a user by criteria" },
|
||||
{ namespace: "data", operation: "GetCalendarExceptions", path: "/V2.0/services/data/getCalendarExceptions", httpMethods: ["GET"], description: "Retrieve calendar exceptions" },
|
||||
{ namespace: "data", operation: "GetCalendarInfo", path: "/V2.0/services/data/getCalendarInfo", httpMethods: ["GET"], description: "Calendar definitions info" },
|
||||
{ namespace: "data", operation: "GetTemplateDescriptions", path: "/V2.0/services/data/getTemplateDescriptions", httpMethods: ["GET"], description: "List templates for an entity type" },
|
||||
{ namespace: "data", operation: "GroupsQuery", path: "/V2.0/services/data/groupsQuery", httpMethods: ["GET", "POST"], description: "List groups the current user belongs to" },
|
||||
{ namespace: "data", operation: "LicenseConsumption", path: "/V2.0/services/data/licenseConsumption", httpMethods: ["GET", "POST"], description: "License consumption per organization" },
|
||||
{ namespace: "data", operation: "Lifecycle", path: "/V2.0/services/data/lifecycle", httpMethods: ["POST"], description: "Lifecycle operations (Activate, Cancel, etc.)" },
|
||||
{ namespace: "data", operation: "MissingTimesheets", path: "/V2.0/services/data/missingTimesheets", httpMethods: ["GET"], description: "Missing timesheets information" },
|
||||
{ namespace: "data", operation: "NewsFeedQuery", path: "/V2.0/services/data/newsFeedQuery", httpMethods: ["GET", "POST"], description: "Current user news feed" },
|
||||
{ namespace: "data", operation: "ObjectIds", path: "/V2.0/services/data/objectIds", httpMethods: ["POST"], description: "Resolve object IDs" },
|
||||
{ namespace: "data", operation: "Query", path: "/V2.0/services/data/query", httpMethods: ["GET", "POST"], description: "Execute a CZQL query" },
|
||||
{ namespace: "data", operation: "RelationQuery", path: "/V2.0/services/data/relationQuery", httpMethods: ["GET", "POST"], description: "Related entities from a relation" },
|
||||
{ namespace: "data", operation: "ReopenFiscalMonth", path: "/V2.0/services/data/reopenFiscalMonth", httpMethods: ["POST"], description: "Reopen fiscal month" },
|
||||
{ namespace: "data", operation: "RepliesQuery", path: "/V2.0/services/data/repliesQuery", httpMethods: ["GET", "POST"], description: "Reply feed of a discussion" },
|
||||
{ namespace: "data", operation: "RetrieveMultiple", path: "/V2.0/services/data/retrieveMultiple", httpMethods: ["POST"], description: "Retrieve multiple entities of the same type" },
|
||||
{ namespace: "data", operation: "Search", path: "/V2.0/services/data/search", httpMethods: ["GET"], description: "Text search in entity types" },
|
||||
{ namespace: "data", operation: "SetPermissions", path: "/V2.0/services/data/setPermissions", httpMethods: ["POST"], description: "Create or update permission on entity" },
|
||||
{ namespace: "data", operation: "TimesheetQuery", path: "/V2.0/services/data/timesheetQuery", httpMethods: ["GET", "POST"], description: "Retrieve timesheets" },
|
||||
{ namespace: "data", operation: "Upsert", path: "/V2.0/services/data/upsert", httpMethods: ["POST"], description: "Create or update an entity" },
|
||||
{ namespace: "files", operation: "Download", path: "/V2.0/services/files/download", httpMethods: ["GET"], description: "Download file attached to a document" },
|
||||
{ namespace: "files", operation: "GetUploadUrl", path: "/V2.0/services/files/getUploadUrl", httpMethods: ["GET"], description: "Get URL for uploading files" },
|
||||
{ namespace: "files", operation: "UpdateImage", path: "/V2.0/services/files/updateImage", httpMethods: ["POST"], description: "Set or reset object image" },
|
||||
{ namespace: "files", operation: "Upload", path: "/V2.0/services/files/upload", httpMethods: ["POST"], description: "Upload file to a document" },
|
||||
{ namespace: "metadata", operation: "DescribeEntities", path: "/V2.0/services/metadata/describeEntities", httpMethods: ["GET"], description: "Entity type fields, relations and states" },
|
||||
{ namespace: "metadata", operation: "DescribeEntityRelations", path: "/V2.0/services/metadata/describeEntityRelations", httpMethods: ["POST"], description: "Describe relation between entities" },
|
||||
{ namespace: "metadata", operation: "DescribeMetadata", path: "/V2.0/services/metadata/describeMetadata", httpMethods: ["GET"], description: "Entity types in your organization" },
|
||||
{ namespace: "metadata", operation: "GetSystemSettingsValues", path: "/V2.0/services/metadata/getSystemSettingsValues", httpMethods: ["GET"], description: "Retrieve system settings values" },
|
||||
{ namespace: "metadata", operation: "ListEntities", path: "/V2.0/services/metadata/listEntities", httpMethods: ["GET"], description: "List entity types for your organization" },
|
||||
{ namespace: "metadata", operation: "SetSystemSettingsValues", path: "/V2.0/services/metadata/setSystemSettingsValues", httpMethods: ["POST"], description: "Save system settings values" },
|
||||
{ namespace: "utils", operation: "AppLogin", path: "/V2.0/services/utils/appLogin", httpMethods: ["GET"], description: "Convert API session to web application session" },
|
||||
{ namespace: "utils", operation: "SendEMail", path: "/V2.0/services/utils/sendEMail", httpMethods: ["POST"], description: "Send email attached to an object" },
|
||||
];
|
||||
export const NAMESPACES = [
|
||||
"applications",
|
||||
"authentication",
|
||||
"bulk",
|
||||
"data",
|
||||
"files",
|
||||
"metadata",
|
||||
"utils",
|
||||
];
|
||||
//# sourceMappingURL=endpoints.js.map
|
||||
+1
File diff suppressed because one or more lines are too long
+9
@@ -0,0 +1,9 @@
|
||||
import type { ClarizenErrorBody } from "./types.js";
|
||||
export declare class ClarizenApiError extends Error {
|
||||
readonly errorCode: string;
|
||||
readonly referenceId?: string;
|
||||
readonly status: number;
|
||||
constructor(status: number, body: ClarizenErrorBody);
|
||||
isSessionTimeout(): boolean;
|
||||
}
|
||||
//# sourceMappingURL=errors.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB;IAQnD,gBAAgB,IAAI,OAAO;CAG5B"}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
export class ClarizenApiError extends Error {
|
||||
errorCode;
|
||||
referenceId;
|
||||
status;
|
||||
constructor(status, body) {
|
||||
super(body.message);
|
||||
this.name = "ClarizenApiError";
|
||||
this.status = status;
|
||||
this.errorCode = body.errorCode;
|
||||
this.referenceId = body.referenceId;
|
||||
}
|
||||
isSessionTimeout() {
|
||||
return this.errorCode === "SessionTimeout";
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=errors.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IAChC,SAAS,CAAS;IAClB,WAAW,CAAU;IACrB,MAAM,CAAS;IAExB,YAAY,MAAc,EAAE,IAAuB;QACjD,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACpB,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAC/B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAChC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;IACtC,CAAC;IAED,gBAAgB;QACd,OAAO,IAAI,CAAC,SAAS,KAAK,gBAAgB,CAAC;IAC7C,CAAC;CACF"}
|
||||
+6275
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
+1206
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
+20
@@ -0,0 +1,20 @@
|
||||
import type { AuthMode, HttpMethod, JsonObject } from "./types.js";
|
||||
export type QueryParamValue = string | number | boolean | readonly (string | number | boolean)[] | undefined;
|
||||
export interface RequestOptions {
|
||||
method?: HttpMethod;
|
||||
query?: Record<string, QueryParamValue>;
|
||||
body?: JsonObject;
|
||||
}
|
||||
export declare class HttpClient {
|
||||
private baseUrl;
|
||||
private auth;
|
||||
constructor(baseUrl: string, auth: AuthMode);
|
||||
getBaseUrl(): string;
|
||||
setBaseUrl(baseUrl: string): void;
|
||||
setAuth(auth: AuthMode): void;
|
||||
getAuth(): AuthMode;
|
||||
private authorizationHeader;
|
||||
request<T>(path: string, options?: RequestOptions): Promise<T>;
|
||||
private executeOnce;
|
||||
}
|
||||
//# sourceMappingURL=http.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAqB,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAEtF,MAAM,MAAM,eAAe,GACvB,MAAM,GACN,MAAM,GACN,OAAO,GACP,SAAS,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,EAAE,GACtC,SAAS,CAAC;AAEd,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IACxC,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AAmBD,qBAAa,UAAU;IAEnB,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,IAAI;gBADJ,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,QAAQ;IAGxB,UAAU,IAAI,MAAM;IAIpB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIjC,OAAO,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI;IAI7B,OAAO,IAAI,QAAQ;IAInB,OAAO,CAAC,mBAAmB;IAUrB,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,CAAC,CAAC;YAe1D,WAAW;CAqD1B"}
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
import { ClarizenApiError } from "./errors.js";
|
||||
function appendQueryParam(params, key, value) {
|
||||
if (value === undefined)
|
||||
return;
|
||||
if (Array.isArray(value)) {
|
||||
for (const item of value) {
|
||||
params.append(key, String(item));
|
||||
}
|
||||
return;
|
||||
}
|
||||
params.set(key, String(value));
|
||||
}
|
||||
const MAX_ATTEMPTS = 3;
|
||||
export class HttpClient {
|
||||
baseUrl;
|
||||
auth;
|
||||
constructor(baseUrl, auth) {
|
||||
this.baseUrl = baseUrl;
|
||||
this.auth = auth;
|
||||
}
|
||||
getBaseUrl() {
|
||||
return this.baseUrl;
|
||||
}
|
||||
setBaseUrl(baseUrl) {
|
||||
this.baseUrl = baseUrl.replace(/\/$/, "");
|
||||
}
|
||||
setAuth(auth) {
|
||||
this.auth = auth;
|
||||
}
|
||||
getAuth() {
|
||||
return this.auth;
|
||||
}
|
||||
authorizationHeader() {
|
||||
if (this.auth.type === "apiKey") {
|
||||
return `ApiKey ${this.auth.token}`;
|
||||
}
|
||||
if (this.auth.type === "session") {
|
||||
return `Session ${this.auth.sessionId}`;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
async request(path, options = {}) {
|
||||
for (let attempt = 1;; attempt++) {
|
||||
try {
|
||||
return await this.executeOnce(path, options);
|
||||
}
|
||||
catch (error) {
|
||||
if ((error instanceof ClarizenApiError && error.isSessionTimeout()) ||
|
||||
attempt >= MAX_ATTEMPTS) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
async executeOnce(path, options) {
|
||||
const method = options.method ?? "POST";
|
||||
const url = new URL(path, this.baseUrl);
|
||||
if (options.query) {
|
||||
for (const [key, value] of Object.entries(options.query)) {
|
||||
appendQueryParam(url.searchParams, key, value);
|
||||
}
|
||||
}
|
||||
const headers = {
|
||||
Accept: "application/json",
|
||||
"Accept-Encoding": "gzip",
|
||||
};
|
||||
const authHeader = this.authorizationHeader();
|
||||
if (authHeader) {
|
||||
headers.Authorization = authHeader;
|
||||
}
|
||||
const init = { method, headers };
|
||||
if (method !== "GET" && options.body !== undefined) {
|
||||
headers["Content-Type"] = "application/json";
|
||||
init.body = JSON.stringify(options.body);
|
||||
}
|
||||
const response = await fetch(url, init);
|
||||
const text = await response.text();
|
||||
if (!text) {
|
||||
if (!response.ok) {
|
||||
throw new ClarizenApiError(response.status, {
|
||||
errorCode: "HttpError",
|
||||
message: response.statusText,
|
||||
});
|
||||
}
|
||||
return {};
|
||||
}
|
||||
const data = JSON.parse(text);
|
||||
if (!response.ok || (data && typeof data === "object" && "errorCode" in data)) {
|
||||
const err = data;
|
||||
if (err.errorCode) {
|
||||
throw new ClarizenApiError(response.status || 400, err);
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=http.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAgB/C,SAAS,gBAAgB,CACvB,MAAuB,EACvB,GAAW,EACX,KAAsB;IAEtB,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO;IAChC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YAC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,EAAE,IAAI,CAAC,CAAC;QACxC,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QAEnC,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;gBACjB,MAAM,IAAI,gBAAgB,CAAC,QAAQ,CAAC,MAAM,EAAE;oBAC1C,SAAS,EAAE,WAAW;oBACtB,OAAO,EAAE,QAAQ,CAAC,UAAU;iBAC7B,CAAC,CAAC;YACL,CAAC;YACD,OAAO,EAAO,CAAC;QACjB,CAAC;QAED,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAA0B,CAAC;QAEvD,IAAI,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,WAAW,IAAI,IAAI,CAAC,EAAE,CAAC;YAC9E,MAAM,GAAG,GAAG,IAAyB,CAAC;YACtC,IAAI,GAAG,CAAC,SAAS,EAAE,CAAC;gBAClB,MAAM,IAAI,gBAAgB,CAAC,QAAQ,CAAC,MAAM,IAAI,GAAG,EAAE,GAAG,CAAC,CAAC;YAC1D,CAAC;QACH,CAAC;QAED,OAAO,IAAS,CAAC;IACnB,CAAC;CACF"}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
export { Clarizen, type ClarizenOptions } from "./clarizen.js";
|
||||
export type { AuthenticationService, DataService, MetadataService, } from "./clarizen.js";
|
||||
export { ClarizenApiError } from "./errors.js";
|
||||
export { ENDPOINTS, NAMESPACES, type ClarizenNamespace } from "./endpoints.js";
|
||||
export { EntityObjectsService, entityObjectPath } from "./objects.js";
|
||||
export type { EntityGetOptions } from "./objects.js";
|
||||
export type { AuthMode, EntityQueryParams, EntityQueryResult, LoginParams, LoginResult, ServerDefinition, SessionInfo, EndpointDefinition, JsonObject, JsonValue, } from "./types.js";
|
||||
export * from "./clarizen-api-types.js";
|
||||
export { fetchMetadataCatalog, filterStandardTypeNames, isStandardMetadataName, sanitizeEntityDescription, } from "./metadata/index.js";
|
||||
export type { DescribeMetadataParams, DescribeMetadataResult, EntityMetadataEntry, FetchMetadataCatalogOptions, ListEntitiesResult, MetadataCatalog, MetadataFlag, } from "./metadata/index.js";
|
||||
export * from "./generated/metadata-types.js";
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAC/D,YAAY,EACV,qBAAqB,EACrB,WAAW,EACX,eAAe,GAChB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACtE,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,YAAY,EACV,QAAQ,EACR,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,kBAAkB,EAClB,UAAU,EACV,SAAS,GACV,MAAM,YAAY,CAAC;AACpB,cAAc,yBAAyB,CAAC;AACxC,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,sBAAsB,EACtB,sBAAsB,EACtB,mBAAmB,EACnB,2BAA2B,EAC3B,kBAAkB,EAClB,eAAe,EACf,YAAY,GACb,MAAM,qBAAqB,CAAC;AAC7B,cAAc,+BAA+B,CAAC"}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
export { Clarizen } from "./clarizen.js";
|
||||
export { ClarizenApiError } from "./errors.js";
|
||||
export { ENDPOINTS, NAMESPACES } from "./endpoints.js";
|
||||
export { EntityObjectsService, entityObjectPath } from "./objects.js";
|
||||
export * from "./clarizen-api-types.js";
|
||||
export { fetchMetadataCatalog, filterStandardTypeNames, isStandardMetadataName, sanitizeEntityDescription, } from "./metadata/index.js";
|
||||
export * from "./generated/metadata-types.js";
|
||||
//# sourceMappingURL=index.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAwB,MAAM,eAAe,CAAC;AAM/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,UAAU,EAA0B,MAAM,gBAAgB,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AActE,cAAc,yBAAyB,CAAC;AACxC,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,qBAAqB,CAAC;AAU7B,cAAc,+BAA+B,CAAC"}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
import type { HttpClient } from "../http.js";
|
||||
import type { FetchMetadataCatalogOptions, MetadataCatalog } from "./types.js";
|
||||
export declare function fetchMetadataCatalog(http: HttpClient, options?: FetchMetadataCatalogOptions): Promise<MetadataCatalog>;
|
||||
//# sourceMappingURL=catalog.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/metadata/catalog.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAK7C,OAAO,KAAK,EAGV,2BAA2B,EAE3B,eAAe,EAEhB,MAAM,YAAY,CAAC;AAqHpB,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,UAAU,EAChB,OAAO,GAAE,2BAAgC,GACxC,OAAO,CAAC,eAAe,CAAC,CAyB1B"}
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
import { ClarizenApiError } from "../errors.js";
|
||||
import { ENDPOINTS } from "../endpoints.js";
|
||||
import { filterStandardTypeNames, sanitizeEntityDescription, } from "./filter.js";
|
||||
const DEFAULT_FLAGS = ["fields", "relations"];
|
||||
const DEFAULT_BATCH_SIZE = 20;
|
||||
const DESCRIBE_METADATA_PATH = ENDPOINTS.find((e) => e.namespace === "metadata" && e.operation === "DescribeMetadata")?.path ?? "/V2.0/services/metadata/describeMetadata";
|
||||
const LIST_ENTITIES_PATH = ENDPOINTS.find((e) => e.namespace === "metadata" && e.operation === "ListEntities")?.path ?? "/V2.0/services/metadata/listEntities";
|
||||
function describeMetadataQuery(typeNames, flags) {
|
||||
const query = {
|
||||
flags,
|
||||
};
|
||||
if (typeNames !== undefined && typeNames.length > 0) {
|
||||
query.typeNames = typeNames;
|
||||
}
|
||||
return query;
|
||||
}
|
||||
async function listEntities(http) {
|
||||
const result = await http.request(LIST_ENTITIES_PATH, {
|
||||
method: "GET",
|
||||
});
|
||||
return result.typeNames ?? [];
|
||||
}
|
||||
async function describeMetadata(http, typeNames, flags) {
|
||||
const result = await http.request(DESCRIBE_METADATA_PATH, {
|
||||
method: "GET",
|
||||
query: describeMetadataQuery(typeNames, flags),
|
||||
});
|
||||
const entries = [];
|
||||
for (const desc of result.entityDescriptions ?? []) {
|
||||
const entry = sanitizeEntityDescription(desc);
|
||||
if (entry) {
|
||||
entries.push(entry);
|
||||
}
|
||||
}
|
||||
return entries;
|
||||
}
|
||||
function chunk(items, size) {
|
||||
const chunks = [];
|
||||
for (let i = 0; i < items.length; i += size) {
|
||||
chunks.push(items.slice(i, i + size));
|
||||
}
|
||||
return chunks;
|
||||
}
|
||||
function mergeEntries(batches) {
|
||||
const byType = new Map();
|
||||
for (const batch of batches) {
|
||||
for (const entry of batch) {
|
||||
byType.set(entry.typeName, entry);
|
||||
}
|
||||
}
|
||||
return [...byType.values()].sort((a, b) => a.typeName.localeCompare(b.typeName));
|
||||
}
|
||||
function needsBatchedFetch(error) {
|
||||
if (error instanceof ClarizenApiError) {
|
||||
return (error.errorCode === "MissingArgument" ||
|
||||
error.errorCode === "InvalidArgument");
|
||||
}
|
||||
if (error instanceof Error) {
|
||||
const msg = error.message.toLowerCase();
|
||||
return msg.includes("missing") || msg.includes("typenames");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
async function fetchBatched(http, flags, batchSize, log) {
|
||||
log("listEntities + batched describeMetadata...");
|
||||
const rawNames = await listEntities(http);
|
||||
const typeNames = filterStandardTypeNames(rawNames);
|
||||
log(` ${typeNames.length} standard entities (${rawNames.length} total)`);
|
||||
const batches = chunk(typeNames, batchSize);
|
||||
const batchResults = [];
|
||||
for (let i = 0; i < batches.length; i++) {
|
||||
const batch = batches[i];
|
||||
log(` batch ${i + 1}/${batches.length} (${batch.length} types)...`);
|
||||
batchResults.push(await describeMetadata(http, batch, flags));
|
||||
}
|
||||
return mergeEntries(batchResults);
|
||||
}
|
||||
export async function fetchMetadataCatalog(http, options = {}) {
|
||||
const flags = options.flags ?? DEFAULT_FLAGS;
|
||||
const batchSize = options.batchSize ?? DEFAULT_BATCH_SIZE;
|
||||
const log = options.onProgress ?? (() => { });
|
||||
let entries;
|
||||
try {
|
||||
log("describeMetadata (all entities)...");
|
||||
entries = await describeMetadata(http, undefined, flags);
|
||||
if (entries.length === 0) {
|
||||
entries = await fetchBatched(http, flags, batchSize, log);
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
if (needsBatchedFetch(error)) {
|
||||
entries = await fetchBatched(http, flags, batchSize, log);
|
||||
}
|
||||
else {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return {
|
||||
fetchedAt: new Date().toISOString(),
|
||||
entities: entries,
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=catalog.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"catalog.js","sourceRoot":"","sources":["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EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;IAChE,CAAC;IAED,OAAO,YAAY,CAAC,YAAY,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,IAAgB,EAChB,UAAuC,EAAE;IAEzC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,aAAa,CAAC;IAC7C,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,kBAAkB,CAAC;IAC1D,MAAM,GAAG,GAAG,OAAO,CAAC,UAAU,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IAE7C,IAAI,OAA8B,CAAC;IAEnC,IAAI,CAAC;QACH,GAAG,CAAC,oCAAoC,CAAC,CAAC;QAC1C,OAAO,GAAG,MAAM,gBAAgB,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QACzD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzB,OAAO,GAAG,MAAM,YAAY,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;QAC5D,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,iBAAiB,CAAC,KAAK,CAAC,EAAE,CAAC;YAC7B,OAAO,GAAG,MAAM,YAAY,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;QAC5D,CAAC;aAAM,CAAC;YACN,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAED,OAAO;QACL,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACnC,QAAQ,EAAE,OAAO;KAClB,CAAC;AACJ,CAAC"}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import type { EntityDescription } from "../clarizen-api-types.js";
|
||||
import type { EntityMetadataEntry } from "./types.js";
|
||||
/** Standard (non-custom) metadata names exclude C_ and R_ segments. */
|
||||
export declare function isStandardMetadataName(name: string): boolean;
|
||||
export declare function filterStandardTypeNames(typeNames: string[]): string[];
|
||||
export declare function sanitizeEntityDescription(desc: EntityDescription): EntityMetadataEntry | null;
|
||||
//# sourceMappingURL=filter.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../src/metadata/filter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtD,uEAAuE;AACvE,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE5D;AAED,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAErE;AAED,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,iBAAiB,GACtB,mBAAmB,GAAG,IAAI,CAuB5B"}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/** Standard (non-custom) metadata names exclude C_ and R_ segments. */
|
||||
export function isStandardMetadataName(name) {
|
||||
return !name.includes("C_") && !name.includes("R_");
|
||||
}
|
||||
export function filterStandardTypeNames(typeNames) {
|
||||
return typeNames.filter(isStandardMetadataName);
|
||||
}
|
||||
export function sanitizeEntityDescription(desc) {
|
||||
const typeName = desc.typeName;
|
||||
if (!typeName || !isStandardMetadataName(typeName)) {
|
||||
return null;
|
||||
}
|
||||
const fields = (desc.fields ?? []).filter((f) => f.name && isStandardMetadataName(f.name));
|
||||
const relations = (desc.relations ?? []).filter((r) => r.name &&
|
||||
isStandardMetadataName(r.name) &&
|
||||
(!r.relatedTypeName || isStandardMetadataName(r.relatedTypeName)));
|
||||
return {
|
||||
typeName,
|
||||
label: desc.label,
|
||||
fields,
|
||||
relations,
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=filter.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"filter.js","sourceRoot":"","sources":["../../src/metadata/filter.ts"],"names":[],"mappings":"AAGA,uEAAuE;AACvE,MAAM,UAAU,sBAAsB,CAAC,IAAY;IACjD,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACtD,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,SAAmB;IACzD,OAAO,SAAS,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,yBAAyB,CACvC,IAAuB;IAEvB,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;IAC/B,IAAI,CAAC,QAAQ,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC,EAAE,CAAC;QACnD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,MAAM,GAAG,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,MAAM,CACvC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,sBAAsB,CAAC,CAAC,CAAC,IAAI,CAAC,CAChD,CAAC;IAEF,MAAM,SAAS,GAAG,CAAC,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,MAAM,CAC7C,CAAC,CAAC,EAAE,EAAE,CACJ,CAAC,CAAC,IAAI;QACN,sBAAsB,CAAC,CAAC,CAAC,IAAI,CAAC;QAC9B,CAAC,CAAC,CAAC,CAAC,eAAe,IAAI,sBAAsB,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CACpE,CAAC;IAEF,OAAO;QACL,QAAQ;QACR,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,MAAM;QACN,SAAS;KACV,CAAC;AACJ,CAAC"}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
import type { MetadataCatalog } from "./types.js";
|
||||
export declare function generateMetadataTypesFile(catalog: MetadataCatalog): string;
|
||||
//# sourceMappingURL=generate-types.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"generate-types.d.ts","sourceRoot":"","sources":["../../src/metadata/generate-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAUlD,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,CA2D1E"}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
function escapeString(value) {
|
||||
return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
||||
}
|
||||
function objectKey(name) {
|
||||
return /^[A-Za-z_][A-Za-z0-9_]*$/.test(name) ? name : JSON.stringify(name);
|
||||
}
|
||||
export function generateMetadataTypesFile(catalog) {
|
||||
const entityTypes = catalog.entities.map((e) => e.typeName);
|
||||
const fieldsLines = catalog.entities.map((e) => {
|
||||
const names = e.fields
|
||||
.map((f) => f.name)
|
||||
.filter((n) => Boolean(n));
|
||||
const literals = names.map((n) => `"${escapeString(n)}"`).join(", ");
|
||||
return ` ${objectKey(e.typeName)}: [${literals}] as const`;
|
||||
});
|
||||
const relationsLines = catalog.entities.map((e) => {
|
||||
const rels = e.relations
|
||||
.filter((r) => r.name && r.relatedTypeName)
|
||||
.map((r) => `{ name: "${escapeString(r.name)}", relatedTypeName: "${escapeString(r.relatedTypeName)}" }`);
|
||||
return ` ${objectKey(e.typeName)}: [${rels.join(", ")}] as const`;
|
||||
});
|
||||
return `// Auto-generated by npm run scrape:metadata. Do not edit manually.
|
||||
/* eslint-disable */
|
||||
|
||||
export const ENTITY_TYPES = [
|
||||
${entityTypes.map((t) => ` "${escapeString(t)}",`).join("\n")}
|
||||
] as const;
|
||||
|
||||
export type EntityTypeName = (typeof ENTITY_TYPES)[number];
|
||||
|
||||
export const FIELDS_BY_ENTITY = {
|
||||
${fieldsLines.join(",\n")},
|
||||
} as const;
|
||||
|
||||
export type EntityFieldName<T extends EntityTypeName> =
|
||||
(typeof FIELDS_BY_ENTITY)[T][number];
|
||||
|
||||
export const RELATIONS_BY_ENTITY = {
|
||||
${relationsLines.join(",\n")},
|
||||
} as const;
|
||||
|
||||
export type EntityRelationEntry<T extends EntityTypeName> =
|
||||
(typeof RELATIONS_BY_ENTITY)[T][number];
|
||||
|
||||
export type EntityRelationName<T extends EntityTypeName> =
|
||||
EntityRelationEntry<T>["name"];
|
||||
|
||||
export function entityFields<T extends EntityTypeName>(
|
||||
typeName: T,
|
||||
): readonly EntityFieldName<T>[] {
|
||||
return FIELDS_BY_ENTITY[typeName];
|
||||
}
|
||||
|
||||
export function entityRelations<T extends EntityTypeName>(
|
||||
typeName: T,
|
||||
): readonly EntityRelationEntry<T>[] {
|
||||
return RELATIONS_BY_ENTITY[typeName];
|
||||
}
|
||||
`;
|
||||
}
|
||||
//# sourceMappingURL=generate-types.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"generate-types.js","sourceRoot":"","sources":["../../src/metadata/generate-types.ts"],"names":[],"mappings":"AAEA,SAAS,YAAY,CAAC,KAAa;IACjC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC3D,CAAC;AAED,SAAS,SAAS,CAAC,IAAY;IAC7B,OAAO,0BAA0B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AAC7E,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,OAAwB;IAChE,MAAM,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;IAE5D,MAAM,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QAC7C,MAAM,KAAK,GAAG,CAAC,CAAC,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C"}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
export { fetchMetadataCatalog } from "./catalog.js";
|
||||
export { filterStandardTypeNames, isStandardMetadataName, sanitizeEntityDescription, } from "./filter.js";
|
||||
export type { DescribeMetadataParams, DescribeMetadataResult, EntityMetadataEntry, FetchMetadataCatalogOptions, ListEntitiesResult, MetadataCatalog, MetadataFlag, } from "./types.js";
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/metadata/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,sBAAsB,EACtB,sBAAsB,EACtB,mBAAmB,EACnB,2BAA2B,EAC3B,kBAAkB,EAClB,eAAe,EACf,YAAY,GACb,MAAM,YAAY,CAAC"}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
export { fetchMetadataCatalog } from "./catalog.js";
|
||||
export { filterStandardTypeNames, isStandardMetadataName, sanitizeEntityDescription, } from "./filter.js";
|
||||
//# sourceMappingURL=index.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/metadata/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,aAAa,CAAC"}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
import type { HttpClient, QueryParamValue } from "../http.js";
|
||||
import { type OperationCall } from "../service.js";
|
||||
import type { JsonObject } from "../types.js";
|
||||
import type { DescribeMetadataParams, DescribeMetadataResult, FetchMetadataCatalogOptions, ListEntitiesResult, MetadataCatalog } from "./types.js";
|
||||
export interface MetadataService {
|
||||
listEntities: () => Promise<ListEntitiesResult>;
|
||||
describeMetadata: (params?: DescribeMetadataParams) => Promise<DescribeMetadataResult>;
|
||||
fetchCatalog: (options?: FetchMetadataCatalogOptions) => Promise<MetadataCatalog>;
|
||||
(operation: string, body?: JsonObject, query?: Record<string, QueryParamValue>): Promise<unknown>;
|
||||
[operation: string]: OperationCall | (() => Promise<ListEntitiesResult>) | ((params?: DescribeMetadataParams) => Promise<DescribeMetadataResult>) | ((options?: FetchMetadataCatalogOptions) => Promise<MetadataCatalog>);
|
||||
}
|
||||
export declare function createMetadataService(http: HttpClient): MetadataService;
|
||||
//# sourceMappingURL=service.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../src/metadata/service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,KAAK,EACV,sBAAsB,EACtB,sBAAsB,EACtB,2BAA2B,EAC3B,kBAAkB,EAClB,eAAe,EAChB,MAAM,YAAY,CAAC;AAgBpB,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,MAAM,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAChD,gBAAgB,EAAE,CAChB,MAAM,CAAC,EAAE,sBAAsB,KAC5B,OAAO,CAAC,sBAAsB,CAAC,CAAC;IACrC,YAAY,EAAE,CACZ,OAAO,CAAC,EAAE,2BAA2B,KAClC,OAAO,CAAC,eAAe,CAAC,CAAC;IAC9B,CACE,SAAS,EAAE,MAAM,EACjB,IAAI,CAAC,EAAE,UAAU,EACjB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,GACtC,OAAO,CAAC,OAAO,CAAC,CAAC;IACpB,CAAC,SAAS,EAAE,MAAM,GACd,aAAa,GACb,CAAC,MAAM,OAAO,CAAC,kBAAkB,CAAC,CAAC,GACnC,CAAC,CAAC,MAAM,CAAC,EAAE,sBAAsB,KAAK,OAAO,CAAC,sBAAsB,CAAC,CAAC,GACtE,CAAC,CAAC,OAAO,CAAC,EAAE,2BAA2B,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC;CAC3E;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,UAAU,GAAG,eAAe,CAoBvE"}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
import { createNamespaceService, } from "../service.js";
|
||||
import { fetchMetadataCatalog } from "./catalog.js";
|
||||
function describeMetadataQuery(params) {
|
||||
if (!params)
|
||||
return undefined;
|
||||
const query = {};
|
||||
if (params.typeNames?.length) {
|
||||
query.typeNames = params.typeNames;
|
||||
}
|
||||
if (params.flags?.length) {
|
||||
query.flags = params.flags;
|
||||
}
|
||||
return Object.keys(query).length > 0 ? query : undefined;
|
||||
}
|
||||
export function createMetadataService(http) {
|
||||
const base = createNamespaceService(http, "metadata");
|
||||
const invoke = base;
|
||||
const service = base;
|
||||
service.listEntities = () => invoke("ListEntities", undefined, undefined);
|
||||
service.describeMetadata = (params) => invoke("DescribeMetadata", undefined, describeMetadataQuery(params));
|
||||
service.fetchCatalog = (options) => fetchMetadataCatalog(http, options);
|
||||
return service;
|
||||
}
|
||||
//# sourceMappingURL=service.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../src/metadata/service.ts"],"names":[],"mappings":"AACA,OAAO,EACL,sBAAsB,GAGvB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AASpD,SAAS,qBAAqB,CAC5B,MAA+B;IAE/B,IAAI,CAAC,MAAM;QAAE,OAAO,SAAS,CAAC;IAC9B,MAAM,KAAK,GAAoC,EAAE,CAAC;IAClD,IAAI,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC;QAC7B,KAAK,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;IACrC,CAAC;IACD,IAAI,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC;QACzB,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;IAC7B,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAC3D,CAAC;AAsBD,MAAM,UAAU,qBAAqB,CAAC,IAAgB;IACpD,MAAM,IAAI,GAAG,sBAAsB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACtD,MAAM,MAAM,GAAG,IAAwB,CAAC;IAExC,MAAM,OAAO,GAAG,IAAuB,CAAC;IAExC,OAAO,CAAC,YAAY,GAAG,GAAG,EAAE,CAC1B,MAAM,CAAC,cAAc,EAAE,SAAS,EAAE,SAAS,CAAgC,CAAC;IAE9E,OAAO,CAAC,gBAAgB,GAAG,CAAC,MAA+B,EAAE,EAAE,CAC7D,MAAM,CACJ,kBAAkB,EAClB,SAAS,EACT,qBAAqB,CAAC,MAAM,CAAC,CACK,CAAC;IAEvC,OAAO,CAAC,YAAY,GAAG,CAAC,OAAqC,EAAE,EAAE,CAC/D,oBAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAEtC,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
import type { EntityDescription, FieldDescription, RelationDescription } from "../clarizen-api-types.js";
|
||||
export type MetadataFlag = "fields" | "relations";
|
||||
export interface ListEntitiesResult {
|
||||
typeNames: string[];
|
||||
}
|
||||
export interface DescribeMetadataParams {
|
||||
typeNames?: string[];
|
||||
flags?: MetadataFlag[];
|
||||
}
|
||||
export interface DescribeMetadataResult {
|
||||
entityDescriptions: EntityDescription[];
|
||||
}
|
||||
export interface EntityMetadataEntry {
|
||||
typeName: string;
|
||||
label?: string;
|
||||
fields: FieldDescription[];
|
||||
relations: RelationDescription[];
|
||||
}
|
||||
export interface MetadataCatalog {
|
||||
fetchedAt: string;
|
||||
entities: EntityMetadataEntry[];
|
||||
}
|
||||
export interface FetchMetadataCatalogOptions {
|
||||
flags?: MetadataFlag[];
|
||||
batchSize?: number;
|
||||
onProgress?: (message: string) => void;
|
||||
}
|
||||
//# sourceMappingURL=types.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/metadata/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,0BAA0B,CAAC;AAElC,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,WAAW,CAAC;AAElD,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,sBAAsB;IACrC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,sBAAsB;IACrC,kBAAkB,EAAE,iBAAiB,EAAE,CAAC;CACzC;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,SAAS,EAAE,mBAAmB,EAAE,CAAC;CAClC;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,mBAAmB,EAAE,CAAC;CACjC;AAED,MAAM,WAAW,2BAA2B;IAC1C,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC"}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=types.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/metadata/types.ts"],"names":[],"mappings":""}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
import type { Entity, EntityId } from "./clarizen-api-types.js";
|
||||
import type { HttpClient } from "./http.js";
|
||||
import type { JsonObject } from "./types.js";
|
||||
export declare function entityObjectPath(typeName: string, id?: string): string;
|
||||
export interface EntityGetOptions {
|
||||
fields?: string[];
|
||||
}
|
||||
export declare class EntityObjectsService {
|
||||
private readonly http;
|
||||
constructor(http: HttpClient);
|
||||
get(typeName: string, id: EntityId, options?: EntityGetOptions): Promise<Entity>;
|
||||
create(typeName: string, fields: JsonObject): Promise<{
|
||||
id: EntityId;
|
||||
}>;
|
||||
update(typeName: string, id: EntityId, fields: JsonObject): Promise<JsonObject>;
|
||||
delete(typeName: string, id: EntityId): Promise<JsonObject>;
|
||||
}
|
||||
//# sourceMappingURL=objects.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"objects.d.ts","sourceRoot":"","sources":["../src/objects.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAOtE;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,qBAAa,oBAAoB;IACnB,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC;IAWhF,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC;QAAE,EAAE,EAAE,QAAQ,CAAA;KAAE,CAAC;IAOvE,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IAO/E,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;CAK5D"}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
export function entityObjectPath(typeName, id) {
|
||||
const type = encodeURIComponent(typeName);
|
||||
if (id) {
|
||||
const entityId = id.includes("/") ? id.split("/").pop() : id;
|
||||
return `/V2.0/services/data/objects/${type}/${encodeURIComponent(entityId)}`;
|
||||
}
|
||||
return `/V2.0/services/data/objects/${type}`;
|
||||
}
|
||||
export class EntityObjectsService {
|
||||
http;
|
||||
constructor(http) {
|
||||
this.http = http;
|
||||
}
|
||||
get(typeName, id, options) {
|
||||
const query = {};
|
||||
if (options?.fields?.length) {
|
||||
query.fields = options.fields.join(",");
|
||||
}
|
||||
return this.http.request(entityObjectPath(typeName, id), {
|
||||
method: "GET",
|
||||
query,
|
||||
});
|
||||
}
|
||||
create(typeName, fields) {
|
||||
return this.http.request(entityObjectPath(typeName), {
|
||||
method: "PUT",
|
||||
body: fields,
|
||||
});
|
||||
}
|
||||
update(typeName, id, fields) {
|
||||
return this.http.request(entityObjectPath(typeName, id), {
|
||||
method: "POST",
|
||||
body: fields,
|
||||
});
|
||||
}
|
||||
delete(typeName, id) {
|
||||
return this.http.request(entityObjectPath(typeName, id), {
|
||||
method: "DELETE",
|
||||
});
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=objects.js.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,MAAM,CAAC,QAAgB,EAAE,EAAY,EAAE,MAAkB;QACvD,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,QAAQ,EAAE,EAAE,CAAC,EAAE;YACvD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,MAAM;SACb,CAAC,CAAC;IACL,CAAC;IAED,MAAM,CAAC,QAAgB,EAAE,EAAY;QACnC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,QAAQ,EAAE,EAAE,CAAC,EAAE;YACvD,MAAM,EAAE,QAAQ;SACjB,CAAC,CAAC;IACL,CAAC;CACF"}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import type { HttpClient, QueryParamValue } from "./http.js";
|
||||
import type { JsonObject } from "./types.js";
|
||||
export type OperationCall = <T = JsonObject>(body?: JsonObject, query?: Record<string, QueryParamValue>) => Promise<T>;
|
||||
export type ServiceCall = <T = JsonObject>(operation: string, body?: JsonObject, query?: Record<string, QueryParamValue>) => Promise<T>;
|
||||
export type NamespaceService = ServiceCall & Record<string, OperationCall>;
|
||||
export declare function createNamespaceService(http: HttpClient, namespace: string): NamespaceService;
|
||||
//# sourceMappingURL=service.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,KAAK,EAAkC,UAAU,EAAE,MAAM,YAAY,CAAC;AAa7E,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,GAAG,UAAU,EACzC,IAAI,CAAC,EAAE,UAAU,EACjB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,KACpC,OAAO,CAAC,CAAC,CAAC,CAAC;AAEhB,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,GAAG,UAAU,EACvC,SAAS,EAAE,MAAM,EACjB,IAAI,CAAC,EAAE,UAAU,EACjB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,KACpC,OAAO,CAAC,CAAC,CAAC,CAAC;AAEhB,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AAE3E,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,UAAU,EAChB,SAAS,EAAE,MAAM,GAChB,gBAAgB,CAyBlB"}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
import { ENDPOINTS } from "./endpoints.js";
|
||||
function toCamelCase(name) {
|
||||
return name.charAt(0).toLowerCase() + name.slice(1);
|
||||
}
|
||||
function pickMethod(endpoint) {
|
||||
if (endpoint.httpMethods.includes("POST"))
|
||||
return "POST";
|
||||
if (endpoint.httpMethods.includes("GET"))
|
||||
return "GET";
|
||||
if (endpoint.httpMethods.includes("PUT"))
|
||||
return "PUT";
|
||||
return endpoint.httpMethods[0];
|
||||
}
|
||||
export function createNamespaceService(http, namespace) {
|
||||
const endpoints = ENDPOINTS.filter((e) => e.namespace === namespace);
|
||||
const handler = async (operation, body, query) => {
|
||||
const endpoint = endpoints.find((e) => e.operation.toLowerCase() === operation.toLowerCase());
|
||||
if (!endpoint) {
|
||||
throw new Error(`Unknown ${namespace} operation: ${operation}`);
|
||||
}
|
||||
return http.request(endpoint.path, {
|
||||
method: pickMethod(endpoint),
|
||||
body,
|
||||
query,
|
||||
});
|
||||
};
|
||||
const service = handler;
|
||||
for (const endpoint of endpoints) {
|
||||
const methodName = toCamelCase(endpoint.operation);
|
||||
service[methodName] = (body, query) => handler(endpoint.operation, body, query);
|
||||
}
|
||||
return service;
|
||||
}
|
||||
//# sourceMappingURL=service.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"service.js","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,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OAAO,GAAG,OAA2B,CAAC;IAE5C,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,MAAM,UAAU,GAAG,WAAW,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QACnD,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,IAAK,EAAE,KAAM,EAAE,EAAE,CACtC,OAAO,CAAC,QAAQ,CAAC,SAAS,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IAC7C,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
import type { Entity, EntityQuery, ErrorCode, LoginOptions, Paging } from "./clarizen-api-types.js";
|
||||
export type JsonValue = string | number | boolean | null | JsonValue[] | {
|
||||
[key: string]: JsonValue;
|
||||
};
|
||||
export type JsonObject = {
|
||||
[key: string]: JsonValue;
|
||||
};
|
||||
export interface ClarizenErrorBody {
|
||||
errorCode: ErrorCode | string;
|
||||
message: string;
|
||||
referenceId?: string;
|
||||
}
|
||||
export interface LoginParams {
|
||||
userName: string;
|
||||
password: string;
|
||||
loginOptions?: LoginOptions;
|
||||
}
|
||||
export interface ServerDefinition {
|
||||
serverLocation: string;
|
||||
appLocation?: string;
|
||||
organizationId?: number;
|
||||
}
|
||||
export interface LoginResult {
|
||||
sessionId: string;
|
||||
userId: string;
|
||||
organizationId: string;
|
||||
licenseType: string;
|
||||
serverTime?: string;
|
||||
}
|
||||
export interface SessionInfo {
|
||||
sessionId: string;
|
||||
userId: string;
|
||||
organizationId: string;
|
||||
serverTime?: string;
|
||||
licenseType?: string;
|
||||
customInfo?: Array<{
|
||||
fieldName: string;
|
||||
value: string;
|
||||
}>;
|
||||
}
|
||||
export type EntityQueryParams = EntityQuery;
|
||||
export interface EntityQueryResult {
|
||||
entities: Entity[];
|
||||
paging?: Paging;
|
||||
}
|
||||
export type HttpMethod = "GET" | "POST" | "PUT" | "DELETE";
|
||||
export interface EndpointDefinition {
|
||||
namespace: string;
|
||||
operation: string;
|
||||
path: string;
|
||||
httpMethods: HttpMethod[];
|
||||
description: string;
|
||||
}
|
||||
export type AuthMode = {
|
||||
type: "apiKey";
|
||||
token: string;
|
||||
} | {
|
||||
type: "session";
|
||||
sessionId: string;
|
||||
} | {
|
||||
type: "none";
|
||||
};
|
||||
//# sourceMappingURL=types.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,MAAM,EACN,WAAW,EACX,SAAS,EACT,YAAY,EACZ,MAAM,EACP,MAAM,yBAAyB,CAAC;AAEjC,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,EAAE,GACX;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAEjC,MAAM,MAAM,UAAU,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAEtD,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,SAAS,GAAG,MAAM,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B;AAED,MAAM,WAAW,gBAAgB;IAC/B,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,KAAK,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC1D;AAED,MAAM,MAAM,iBAAiB,GAAG,WAAW,CAAC;AAE5C,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,CAAC;AAE3D,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,QAAQ,GAChB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACjC;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GACtC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=types.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
||||
Reference in New Issue
Block a user