@burdenoff/be-sdk 2026.1021.4 → 2026.1021.6

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.
Files changed (47) hide show
  1. package/README.md +92 -0
  2. package/dist/cache/index.js +2 -2
  3. package/dist/chunk-4KK6YJ46.js +41 -0
  4. package/dist/chunk-4KK6YJ46.js.map +1 -0
  5. package/dist/chunk-AE4PRE4N.js +731 -0
  6. package/dist/chunk-AE4PRE4N.js.map +1 -0
  7. package/dist/{chunk-YCSIHUYP.js → chunk-HDUS6UBO.js} +3 -3
  8. package/dist/{chunk-YCSIHUYP.js.map → chunk-HDUS6UBO.js.map} +1 -1
  9. package/dist/{chunk-HIO3DNKK.js → chunk-KCGJCY5U.js} +2 -2
  10. package/dist/{chunk-HIO3DNKK.js.map → chunk-KCGJCY5U.js.map} +1 -1
  11. package/dist/{chunk-AT52BRVL.js → chunk-OXGIVASV.js} +3 -3
  12. package/dist/{chunk-AT52BRVL.js.map → chunk-OXGIVASV.js.map} +1 -1
  13. package/dist/{chunk-GSIJ2DBJ.js → chunk-PPFJTSHA.js} +3 -3
  14. package/dist/{chunk-GSIJ2DBJ.js.map → chunk-PPFJTSHA.js.map} +1 -1
  15. package/dist/chunk-QZG27OR7.js +22 -0
  16. package/dist/chunk-QZG27OR7.js.map +1 -0
  17. package/dist/{chunk-2TTE5KSS.js → chunk-UCNTCCV6.js} +5 -54
  18. package/dist/chunk-UCNTCCV6.js.map +1 -0
  19. package/dist/chunk-X3MNBBOL.js +941 -0
  20. package/dist/chunk-X3MNBBOL.js.map +1 -0
  21. package/dist/{chunk-TNYNRKLQ.js → chunk-XJKVW34Q.js} +3 -3
  22. package/dist/{chunk-TNYNRKLQ.js.map → chunk-XJKVW34Q.js.map} +1 -1
  23. package/dist/client-WSFUJHLI.js +11 -0
  24. package/dist/client-WSFUJHLI.js.map +1 -0
  25. package/dist/export/index.js +5 -3
  26. package/dist/files/index.d.ts +3 -0
  27. package/dist/files/index.js +5 -0
  28. package/dist/files/index.js.map +1 -0
  29. package/dist/gateway/index.d.ts +2 -1
  30. package/dist/gateway/index.js +4 -2
  31. package/dist/gateway/security/index.js +1 -1
  32. package/dist/index-BWhuZl8f.d.ts +59 -0
  33. package/dist/index-BjtgcJxt.d.ts +208 -0
  34. package/dist/index-C_t30VyQ.d.ts +284 -0
  35. package/dist/index.d.ts +4 -1
  36. package/dist/index.js +21 -18
  37. package/dist/index.js.map +1 -1
  38. package/dist/init/index.js +5 -3
  39. package/dist/server/index.js +1 -1
  40. package/dist/tags/index.d.ts +3 -0
  41. package/dist/tags/index.js +5 -0
  42. package/dist/tags/index.js.map +1 -0
  43. package/dist/tracker/index.js +2 -2
  44. package/dist/types-B376RbyK.d.ts +108 -0
  45. package/package.json +3 -3
  46. package/dist/chunk-2TTE5KSS.js.map +0 -1
  47. package/dist/index-Dy6neH2G.d.ts +0 -166
@@ -0,0 +1,59 @@
1
+ import { f as GatewayRequestHeaders } from './layer-GNAVXBMf.js';
2
+ import { I as IGatewayClient, G as GatewayClientConfig, a as GraphQLRequestOptions, b as GraphQLResponse, c as ICircuitBreaker, d as GatewayClientHealth, C as CircuitBreakerStats, e as CircuitState, f as GatewayError, g as GatewayErrorType, h as GraphQLError, R as RequestContext } from './types-B376RbyK.js';
3
+ import { i as index$1 } from './index-D3d2TAS-.js';
4
+
5
+ declare class GatewayClient implements IGatewayClient {
6
+ private config;
7
+ private layerManager;
8
+ private internalCircuitBreaker;
9
+ private crossLayerCircuitBreaker;
10
+ private retryConfig;
11
+ private defaultHeaders;
12
+ constructor(config: GatewayClientConfig);
13
+ private getInternalUrl;
14
+ private getCrossLayerUrl;
15
+ internalQuery<T = unknown>(options: GraphQLRequestOptions): Promise<GraphQLResponse<T>>;
16
+ crossLayerQuery<T = unknown>(options: GraphQLRequestOptions): Promise<GraphQLResponse<T>>;
17
+ query<T = unknown>(gatewayUrl: string, options: GraphQLRequestOptions): Promise<GraphQLResponse<T>>;
18
+ getInternalCircuitBreaker(): ICircuitBreaker;
19
+ getCrossLayerCircuitBreaker(): ICircuitBreaker;
20
+ getHealthStatus(): GatewayClientHealth;
21
+ updateDefaultHeaders(headers: Partial<GatewayRequestHeaders>): void;
22
+ private createRequestContext;
23
+ private shouldRetryError;
24
+ private calculateRetryDelay;
25
+ private logRetryAttempt;
26
+ private executeWithRetry;
27
+ private buildRequestHeaders;
28
+ private handleGraphQLErrors;
29
+ private handleFetchError;
30
+ private executeRequest;
31
+ private sleep;
32
+ }
33
+ declare function createGatewayClient(config: GatewayClientConfig): GatewayClient;
34
+ declare function createGatewayClientFromEnv(): GatewayClient;
35
+
36
+ declare function signServiceJwt(actorId: string, ttlSeconds?: number): Promise<string | null>;
37
+
38
+ declare const index_CircuitBreakerStats: typeof CircuitBreakerStats;
39
+ declare const index_CircuitState: typeof CircuitState;
40
+ type index_GatewayClient = GatewayClient;
41
+ declare const index_GatewayClient: typeof GatewayClient;
42
+ declare const index_GatewayClientConfig: typeof GatewayClientConfig;
43
+ declare const index_GatewayClientHealth: typeof GatewayClientHealth;
44
+ declare const index_GatewayError: typeof GatewayError;
45
+ declare const index_GatewayErrorType: typeof GatewayErrorType;
46
+ declare const index_GraphQLError: typeof GraphQLError;
47
+ declare const index_GraphQLRequestOptions: typeof GraphQLRequestOptions;
48
+ declare const index_GraphQLResponse: typeof GraphQLResponse;
49
+ declare const index_ICircuitBreaker: typeof ICircuitBreaker;
50
+ declare const index_IGatewayClient: typeof IGatewayClient;
51
+ declare const index_RequestContext: typeof RequestContext;
52
+ declare const index_createGatewayClient: typeof createGatewayClient;
53
+ declare const index_createGatewayClientFromEnv: typeof createGatewayClientFromEnv;
54
+ declare const index_signServiceJwt: typeof signServiceJwt;
55
+ declare namespace index {
56
+ export { index_CircuitBreakerStats as CircuitBreakerStats, index_CircuitState as CircuitState, index_GatewayClient as GatewayClient, index_GatewayClientConfig as GatewayClientConfig, index_GatewayClientHealth as GatewayClientHealth, index_GatewayError as GatewayError, index_GatewayErrorType as GatewayErrorType, index_GraphQLError as GraphQLError, index_GraphQLRequestOptions as GraphQLRequestOptions, index_GraphQLResponse as GraphQLResponse, index_ICircuitBreaker as ICircuitBreaker, index_IGatewayClient as IGatewayClient, index_RequestContext as RequestContext, index$1 as Security, index_createGatewayClient as createGatewayClient, index_createGatewayClientFromEnv as createGatewayClientFromEnv, index_signServiceJwt as signServiceJwt };
57
+ }
58
+
59
+ export { GatewayClient as G, createGatewayClientFromEnv as a, createGatewayClient as c, index as i, signServiceJwt as s };
@@ -0,0 +1,208 @@
1
+ import { a as GraphQLRequestOptions, b as GraphQLResponse, h as GraphQLError } from './types-B376RbyK.js';
2
+
3
+ declare const FILE_ACTOR_TYPES: readonly ["user", "app", "service", "super_admin"];
4
+ type FileActorType = (typeof FILE_ACTOR_TYPES)[number];
5
+ interface FileActor {
6
+ actorId: string;
7
+ workspaceId: string;
8
+ actorType?: FileActorType;
9
+ }
10
+ declare const FILE_VISIBILITIES: readonly ["PRIVATE", "PUBLIC", "TEAM", "WORKSPACE"];
11
+ type FileVisibility = (typeof FILE_VISIBILITIES)[number];
12
+ type FileStatus = 'ACTIVE' | 'ARCHIVED' | 'DELETED' | 'UPLOADING';
13
+ type FileUploadType = 'DIRECT' | 'MULTIPART' | 'RESUMABLE';
14
+ type FileBytes = Uint8Array | ArrayBuffer;
15
+ interface UploadFileInput {
16
+ fileName: string;
17
+ data: FileBytes;
18
+ mimeType: string;
19
+ extension?: string;
20
+ folderId?: string | null;
21
+ description?: string | null;
22
+ visibility?: FileVisibility;
23
+ declareSha256?: boolean;
24
+ }
25
+ interface StoredFile {
26
+ fileId: string;
27
+ name: string;
28
+ mimeType: string;
29
+ size: number;
30
+ workspaceId: string;
31
+ sha256Hash: string | null;
32
+ }
33
+ interface FileMetadata {
34
+ id: string;
35
+ name: string;
36
+ mimeType: string;
37
+ extension: string;
38
+ size: number;
39
+ status: FileStatus;
40
+ visibility: FileVisibility;
41
+ workspaceId: string;
42
+ folderId: string | null;
43
+ uploadedById: string;
44
+ description: string | null;
45
+ sha256Hash: string | null;
46
+ createdAt: Date | null;
47
+ updatedAt: Date | null;
48
+ canRead: boolean | null;
49
+ canDelete: boolean | null;
50
+ }
51
+ interface RequireFileOptions {
52
+ requireActive?: boolean;
53
+ requireReadable?: boolean;
54
+ }
55
+ interface DownloadUrlOptions {
56
+ expiresInSeconds?: number;
57
+ }
58
+ interface DownloadFileOptions {
59
+ maxBytes?: number;
60
+ }
61
+ interface DownloadedFile {
62
+ bytes: Uint8Array;
63
+ mimeType: string;
64
+ name: string;
65
+ size: number;
66
+ }
67
+ interface DeleteFileOptions {
68
+ permanent?: boolean;
69
+ }
70
+ interface FilesTransport {
71
+ internalQuery<T = unknown>(options: GraphQLRequestOptions): Promise<GraphQLResponse<T>>;
72
+ }
73
+ type FilesFetch = (url: string, init?: RequestInit) => Promise<Response>;
74
+ interface RawFileMetadata {
75
+ id: string;
76
+ name: string;
77
+ mimeType: string;
78
+ extension: string;
79
+ size: string | number;
80
+ status: FileStatus;
81
+ visibility: FileVisibility;
82
+ workspaceId: string;
83
+ folderId?: string | null;
84
+ uploadedById: string;
85
+ description?: string | null;
86
+ sha256Hash?: string | null;
87
+ createdAt?: string | null;
88
+ updatedAt?: string | null;
89
+ canRead?: boolean | null;
90
+ canDelete?: boolean | null;
91
+ }
92
+
93
+ type FilesClientErrorCode = 'INVALID_INPUT' | 'MISSING_CONTEXT' | 'NOT_FOUND' | 'QUOTA_EXCEEDED' | 'TOO_LARGE' | 'STORAGE_ERROR' | 'UPSTREAM_ERROR' | 'CONFIGURATION_ERROR';
94
+ declare const FILES_CLIENT_GRAPHQL_CODES: Record<FilesClientErrorCode, string>;
95
+ declare class FilesClientError extends Error {
96
+ readonly code: FilesClientErrorCode;
97
+ readonly details: Record<string, unknown>;
98
+ constructor(code: FilesClientErrorCode, message: string, details?: Record<string, unknown>);
99
+ get graphqlCode(): string;
100
+ }
101
+ declare function isFilesClientError(error: unknown): error is FilesClientError;
102
+ declare function classifyFilesErrors(errors: readonly GraphQLError[]): FilesClientErrorCode;
103
+ declare function toFilesClientError(error: unknown, operation: string): FilesClientError;
104
+
105
+ declare const MAX_DOWNLOAD_URL_TTL_SECONDS = 604800;
106
+ declare const MIN_DOWNLOAD_URL_TTL_SECONDS = 60;
107
+ interface FilesClientOptions {
108
+ client?: FilesTransport | (() => FilesTransport | Promise<FilesTransport>);
109
+ serviceName?: string;
110
+ fetch?: FilesFetch;
111
+ requestTimeoutMs?: number;
112
+ transferTimeoutMs?: number;
113
+ maxUploadBytes?: number;
114
+ maxDownloadBytes?: number;
115
+ defaultDownloadUrlTtlSeconds?: number;
116
+ }
117
+ declare function fileExtensionOf(fileName: string): string;
118
+ declare function clampDownloadUrlTtl(seconds: number | null | undefined, fallback: number): number;
119
+ declare function mapFileMetadata(raw: RawFileMetadata): FileMetadata;
120
+ declare class FilesClient {
121
+ private readonly clientOption;
122
+ private readonly serviceName;
123
+ private readonly fetchImpl;
124
+ private readonly requestTimeoutMs;
125
+ private readonly transferTimeoutMs;
126
+ private readonly maxUploadBytes;
127
+ private readonly maxDownloadBytes;
128
+ private readonly defaultDownloadUrlTtlSeconds;
129
+ private clientPromise;
130
+ constructor(options?: FilesClientOptions);
131
+ uploadFile(input: UploadFileInput, actor: FileActor): Promise<StoredFile>;
132
+ getFile(fileId: string, actor: FileActor): Promise<FileMetadata | null>;
133
+ requireFile(fileId: string, actor: FileActor, options?: RequireFileOptions): Promise<FileMetadata>;
134
+ getDownloadUrl(fileId: string, actor: FileActor, options?: DownloadUrlOptions): Promise<string>;
135
+ downloadFile(fileId: string, actor: FileActor, options?: DownloadFileOptions): Promise<DownloadedFile>;
136
+ downloadFileAsBase64(fileId: string, actor: FileActor, options?: DownloadFileOptions): Promise<{
137
+ base64: string;
138
+ mimeType: string;
139
+ name: string;
140
+ size: number;
141
+ }>;
142
+ deleteFile(fileId: string, actor: FileActor, options?: DeleteFileOptions): Promise<boolean>;
143
+ private putDirect;
144
+ private uploadParts;
145
+ private abortQuietly;
146
+ private assertUsable;
147
+ private transfer;
148
+ private readBounded;
149
+ private requireActor;
150
+ private getClient;
151
+ private request;
152
+ }
153
+
154
+ declare const FILE_REFERENCE_KIND: "burdenoff.file";
155
+ interface FileReference {
156
+ kind: typeof FILE_REFERENCE_KIND;
157
+ fileId: string;
158
+ name: string;
159
+ mimeType: string;
160
+ size: number;
161
+ sha256Hash: string | null;
162
+ }
163
+ declare function toFileReference(file: StoredFile | FileMetadata): FileReference;
164
+ declare function isFileReference(value: unknown): value is FileReference;
165
+
166
+ type index_DeleteFileOptions = DeleteFileOptions;
167
+ type index_DownloadFileOptions = DownloadFileOptions;
168
+ type index_DownloadUrlOptions = DownloadUrlOptions;
169
+ type index_DownloadedFile = DownloadedFile;
170
+ declare const index_FILES_CLIENT_GRAPHQL_CODES: typeof FILES_CLIENT_GRAPHQL_CODES;
171
+ declare const index_FILE_ACTOR_TYPES: typeof FILE_ACTOR_TYPES;
172
+ declare const index_FILE_REFERENCE_KIND: typeof FILE_REFERENCE_KIND;
173
+ declare const index_FILE_VISIBILITIES: typeof FILE_VISIBILITIES;
174
+ type index_FileActor = FileActor;
175
+ type index_FileActorType = FileActorType;
176
+ type index_FileBytes = FileBytes;
177
+ type index_FileMetadata = FileMetadata;
178
+ type index_FileReference = FileReference;
179
+ type index_FileStatus = FileStatus;
180
+ type index_FileUploadType = FileUploadType;
181
+ type index_FileVisibility = FileVisibility;
182
+ type index_FilesClient = FilesClient;
183
+ declare const index_FilesClient: typeof FilesClient;
184
+ type index_FilesClientError = FilesClientError;
185
+ declare const index_FilesClientError: typeof FilesClientError;
186
+ type index_FilesClientErrorCode = FilesClientErrorCode;
187
+ type index_FilesClientOptions = FilesClientOptions;
188
+ type index_FilesFetch = FilesFetch;
189
+ type index_FilesTransport = FilesTransport;
190
+ declare const index_MAX_DOWNLOAD_URL_TTL_SECONDS: typeof MAX_DOWNLOAD_URL_TTL_SECONDS;
191
+ declare const index_MIN_DOWNLOAD_URL_TTL_SECONDS: typeof MIN_DOWNLOAD_URL_TTL_SECONDS;
192
+ type index_RawFileMetadata = RawFileMetadata;
193
+ type index_RequireFileOptions = RequireFileOptions;
194
+ type index_StoredFile = StoredFile;
195
+ type index_UploadFileInput = UploadFileInput;
196
+ declare const index_clampDownloadUrlTtl: typeof clampDownloadUrlTtl;
197
+ declare const index_classifyFilesErrors: typeof classifyFilesErrors;
198
+ declare const index_fileExtensionOf: typeof fileExtensionOf;
199
+ declare const index_isFileReference: typeof isFileReference;
200
+ declare const index_isFilesClientError: typeof isFilesClientError;
201
+ declare const index_mapFileMetadata: typeof mapFileMetadata;
202
+ declare const index_toFileReference: typeof toFileReference;
203
+ declare const index_toFilesClientError: typeof toFilesClientError;
204
+ declare namespace index {
205
+ export { type index_DeleteFileOptions as DeleteFileOptions, type index_DownloadFileOptions as DownloadFileOptions, type index_DownloadUrlOptions as DownloadUrlOptions, type index_DownloadedFile as DownloadedFile, index_FILES_CLIENT_GRAPHQL_CODES as FILES_CLIENT_GRAPHQL_CODES, index_FILE_ACTOR_TYPES as FILE_ACTOR_TYPES, index_FILE_REFERENCE_KIND as FILE_REFERENCE_KIND, index_FILE_VISIBILITIES as FILE_VISIBILITIES, type index_FileActor as FileActor, type index_FileActorType as FileActorType, type index_FileBytes as FileBytes, type index_FileMetadata as FileMetadata, type index_FileReference as FileReference, type index_FileStatus as FileStatus, type index_FileUploadType as FileUploadType, type index_FileVisibility as FileVisibility, index_FilesClient as FilesClient, index_FilesClientError as FilesClientError, type index_FilesClientErrorCode as FilesClientErrorCode, type index_FilesClientOptions as FilesClientOptions, type index_FilesFetch as FilesFetch, type index_FilesTransport as FilesTransport, index_MAX_DOWNLOAD_URL_TTL_SECONDS as MAX_DOWNLOAD_URL_TTL_SECONDS, index_MIN_DOWNLOAD_URL_TTL_SECONDS as MIN_DOWNLOAD_URL_TTL_SECONDS, type index_RawFileMetadata as RawFileMetadata, type index_RequireFileOptions as RequireFileOptions, type index_StoredFile as StoredFile, type index_UploadFileInput as UploadFileInput, index_clampDownloadUrlTtl as clampDownloadUrlTtl, index_classifyFilesErrors as classifyFilesErrors, index_fileExtensionOf as fileExtensionOf, index_isFileReference as isFileReference, index_isFilesClientError as isFilesClientError, index_mapFileMetadata as mapFileMetadata, index_toFileReference as toFileReference, index_toFilesClientError as toFilesClientError };
206
+ }
207
+
208
+ export { isFileReference as A, isFilesClientError as B, mapFileMetadata as C, type DeleteFileOptions as D, toFileReference as E, FILES_CLIENT_GRAPHQL_CODES as F, toFilesClientError as G, MAX_DOWNLOAD_URL_TTL_SECONDS as M, type RawFileMetadata as R, type StoredFile as S, type UploadFileInput as U, type DownloadFileOptions as a, type DownloadUrlOptions as b, type DownloadedFile as c, FILE_ACTOR_TYPES as d, FILE_REFERENCE_KIND as e, FILE_VISIBILITIES as f, type FileActor as g, type FileActorType as h, index as i, type FileBytes as j, type FileMetadata as k, type FileReference as l, type FileStatus as m, type FileUploadType as n, type FileVisibility as o, FilesClient as p, FilesClientError as q, type FilesClientErrorCode as r, type FilesClientOptions as s, type FilesFetch as t, type FilesTransport as u, MIN_DOWNLOAD_URL_TTL_SECONDS as v, type RequireFileOptions as w, clampDownloadUrlTtl as x, classifyFilesErrors as y, fileExtensionOf as z };
@@ -0,0 +1,284 @@
1
+ import { a as GraphQLRequestOptions, b as GraphQLResponse } from './types-B376RbyK.js';
2
+
3
+ declare const TAG_ACTOR_TYPES: readonly ["user", "app", "service", "super_admin"];
4
+ type TagActorType = (typeof TAG_ACTOR_TYPES)[number];
5
+ interface TagActor {
6
+ actorId: string;
7
+ workspaceId: string;
8
+ actorType?: TagActorType;
9
+ }
10
+ declare const TAG_ASSIGNMENT_SOURCES: readonly ["AUTOMATIC", "COMPUTED", "IMPORTED", "INHERITED", "MANUAL", "MIGRATED"];
11
+ type TagAssignmentSource = (typeof TAG_ASSIGNMENT_SOURCES)[number];
12
+ interface RawTagAssignment {
13
+ id: string;
14
+ tagId: string;
15
+ entityType: string;
16
+ entityId: string;
17
+ source: string;
18
+ assignedById?: string | null;
19
+ createdAt?: string | null;
20
+ validFrom?: string | null;
21
+ validTo?: string | null;
22
+ metadata?: unknown;
23
+ tag?: {
24
+ id: string;
25
+ key?: string | null;
26
+ label?: string | null;
27
+ color?: string | null;
28
+ } | null;
29
+ }
30
+ interface EntityTagInfo {
31
+ id: string;
32
+ key: string | null;
33
+ label: string | null;
34
+ color: string | null;
35
+ }
36
+ interface EntityTagAssignment {
37
+ id: string;
38
+ tagId: string;
39
+ tag: {
40
+ id: string;
41
+ } | null;
42
+ tagInfo: EntityTagInfo | null;
43
+ entityType: string;
44
+ entityId: string;
45
+ source: string;
46
+ assignedBy: string | null;
47
+ assignedAt: Date | null;
48
+ validFrom: Date | null;
49
+ validTo: Date | null;
50
+ metadata: unknown;
51
+ }
52
+ interface AvailableTag {
53
+ id: string;
54
+ key: string;
55
+ label: string;
56
+ color: string | null;
57
+ }
58
+ interface TagVocabularyRef {
59
+ id: string;
60
+ key: string;
61
+ name: string;
62
+ }
63
+ interface TagVocabularyConfig {
64
+ key: string;
65
+ name: string;
66
+ description?: string;
67
+ id?: string;
68
+ }
69
+ interface TagEntityOptions {
70
+ tagId: string;
71
+ source?: string | null;
72
+ validFrom?: Date | null;
73
+ validTo?: Date | null;
74
+ metadata?: Record<string, unknown> | null;
75
+ }
76
+ interface CreateTagOptions {
77
+ label: string;
78
+ color?: string | null;
79
+ vocabularyId?: string | null;
80
+ }
81
+ interface FindEntitiesByTagsOptions {
82
+ matchAll?: boolean;
83
+ limit?: number | null;
84
+ cursor?: string | null;
85
+ }
86
+ interface TaggedEntityPage {
87
+ entityIds: string[];
88
+ total: number;
89
+ hasMore: boolean;
90
+ nextCursor: string | null;
91
+ }
92
+ interface TagsGatewayClient {
93
+ internalQuery<T = unknown>(options: GraphQLRequestOptions): Promise<GraphQLResponse<T>>;
94
+ }
95
+
96
+ type EntityTagsErrorCode = 'INVALID_ENTITY_TYPE' | 'INVALID_SOURCE' | 'INVALID_INPUT' | 'MISSING_CONTEXT' | 'UPSTREAM_ERROR' | 'CONFIGURATION_ERROR';
97
+ declare const ENTITY_TAGS_GRAPHQL_CODES: Record<EntityTagsErrorCode, string>;
98
+ declare class EntityTagsError extends Error {
99
+ readonly code: EntityTagsErrorCode;
100
+ readonly details: Record<string, unknown>;
101
+ constructor(code: EntityTagsErrorCode, message: string, details?: Record<string, unknown>);
102
+ get graphqlCode(): string;
103
+ }
104
+ declare function isEntityTagsError(error: unknown): error is EntityTagsError;
105
+
106
+ interface EntityTagsFieldNames {
107
+ entityTags: string;
108
+ searchTags: string;
109
+ availableTags: string;
110
+ entitiesByTags: string;
111
+ tagEntity: string;
112
+ untagEntity: string;
113
+ replaceEntityTags: string;
114
+ createTag: string;
115
+ }
116
+ interface EntityTagsTypeNames {
117
+ getEntityTagsInput: string;
118
+ tagEntityInput: string;
119
+ untagEntityInput: string;
120
+ replaceEntityTagsInput: string;
121
+ createTagInput: string;
122
+ entitiesByTagsInput: string;
123
+ tagInfo: string;
124
+ tagAssignment: string;
125
+ availableTag: string;
126
+ taggedEntityPage: string;
127
+ }
128
+ declare function assertTagPrefix(prefix: string): void;
129
+ declare function entityTagsFieldNames(prefix: string): EntityTagsFieldNames;
130
+ declare function entityTagsTypeNames(prefix: string, overrides?: Partial<EntityTagsTypeNames>): EntityTagsTypeNames;
131
+
132
+ interface TagsGatewayAdapterOptions {
133
+ entityTypes: readonly string[];
134
+ vocabulary: TagVocabularyConfig;
135
+ defaultSource?: TagAssignmentSource;
136
+ client?: TagsGatewayClient | (() => TagsGatewayClient | Promise<TagsGatewayClient>);
137
+ serviceName?: string;
138
+ requestTimeoutMs?: number;
139
+ }
140
+ declare function slugifyTagKey(label: string): string;
141
+ declare function mapTagAssignment(raw: RawTagAssignment): EntityTagAssignment;
142
+ declare class TagsGatewayAdapter {
143
+ readonly entityTypes: readonly string[];
144
+ readonly vocabulary: Readonly<TagVocabularyConfig>;
145
+ readonly defaultSource: TagAssignmentSource;
146
+ private readonly entityTypeSet;
147
+ private readonly requestTimeoutMs;
148
+ private readonly clientOption;
149
+ private readonly serviceName;
150
+ private clientPromise;
151
+ constructor(options: TagsGatewayAdapterOptions);
152
+ isValidEntityType(entityType: string): boolean;
153
+ assertEntityType(entityType: string): void;
154
+ resolveSource(source: string | null | undefined): TagAssignmentSource;
155
+ getEntityTags(entityType: string, entityId: string, actor: TagActor): Promise<EntityTagAssignment[]>;
156
+ tagEntity(entityType: string, entityId: string, options: TagEntityOptions, actor: TagActor): Promise<EntityTagAssignment>;
157
+ untagEntity(entityType: string, entityId: string, tagId: string, actor: TagActor): Promise<boolean>;
158
+ replaceEntityTags(entityType: string, entityId: string, tagIds: readonly string[], actor: TagActor): Promise<EntityTagAssignment[]>;
159
+ findEntityIdsByTags(entityType: string, tagIds: readonly string[], actor: TagActor, options?: FindEntitiesByTagsOptions): Promise<TaggedEntityPage>;
160
+ searchTags(query: string, actor: TagActor, limit?: number | null): Promise<AvailableTag[]>;
161
+ getAvailableTags(actor: TagActor, limit?: number | null): Promise<AvailableTag[]>;
162
+ createTag(options: CreateTagOptions, actor: TagActor): Promise<AvailableTag>;
163
+ ensureWorkspaceVocabulary(actor: TagActor, override?: Partial<TagVocabularyConfig>): Promise<string>;
164
+ getVocabularyById(id: string, actor: TagActor): Promise<TagVocabularyRef | null>;
165
+ getVocabularyByKey(key: string, actor: TagActor): Promise<TagVocabularyRef | null>;
166
+ createVocabulary(vocabulary: TagVocabularyConfig, actor: TagActor): Promise<TagVocabularyRef | null>;
167
+ private requireActor;
168
+ private getClient;
169
+ private request;
170
+ }
171
+
172
+ interface EntityTagsRbacOptions {
173
+ resource: string;
174
+ scopeType?: string;
175
+ readAction?: string;
176
+ updateAction?: string;
177
+ createAction?: string;
178
+ }
179
+ interface EntityTagsSdlOptions {
180
+ prefix: string;
181
+ productLabel?: string;
182
+ rbac: EntityTagsRbacOptions;
183
+ extendTypes?: readonly string[];
184
+ typeNames?: Partial<EntityTagsTypeNames>;
185
+ externalTypes?: readonly (keyof EntityTagsTypeNames)[];
186
+ includeEntitiesByTags?: boolean;
187
+ includeUniversalTagStub?: boolean;
188
+ }
189
+ declare const UNIVERSAL_TAG_STUB_SDL = "\n \"UniversalTag is owned by wspace-tags-svc; only its key is resolvable here.\"\n type UniversalTag @key(fields: \"id\", resolvable: false) {\n id: ID!\n }\n";
190
+ declare function buildEntityTagsSdl(options: EntityTagsSdlOptions): string;
191
+
192
+ interface EntityTagBinding {
193
+ entityType: string;
194
+ entityId?: (parent: Record<string, unknown>) => string | null | undefined;
195
+ }
196
+ type EntityTagOperation = 'tag' | 'untag' | 'replace' | 'createTag';
197
+ interface EntityTagMutationEvent {
198
+ operation: EntityTagOperation;
199
+ fieldName: string;
200
+ actor: TagActor;
201
+ entityType?: string;
202
+ entityId?: string;
203
+ tagId?: string;
204
+ tagIds?: string[];
205
+ source?: string;
206
+ tag?: AvailableTag;
207
+ vocabularyId?: string;
208
+ }
209
+ interface EntityTagAccessCheck {
210
+ entityType: string;
211
+ entityId: string;
212
+ access: 'read' | 'write';
213
+ actor: TagActor;
214
+ }
215
+ interface CreateEntityTagResolversOptions<TContext> {
216
+ prefix: string;
217
+ adapter: TagsGatewayAdapter;
218
+ entities?: Readonly<Record<string, EntityTagBinding>>;
219
+ getActor?: (context: TContext) => TagActor;
220
+ authorizeEntity?: (check: EntityTagAccessCheck, context: TContext) => void | Promise<void>;
221
+ onMutation?: (event: EntityTagMutationEvent, context: TContext) => void | Promise<void>;
222
+ mapError?: (error: EntityTagsError, context: TContext) => Error;
223
+ includeEntitiesByTags?: boolean;
224
+ }
225
+ type Resolver<TArgs, TResult, TContext> = (parent: unknown, args: TArgs, context: TContext) => Promise<TResult>;
226
+ type TagAssignmentsResolver<TContext> = (parent: Record<string, unknown>, args: unknown, context: TContext) => Promise<EntityTagAssignment[]>;
227
+ interface EntityTagResolvers<TContext> {
228
+ Query: Record<string, Resolver<never, unknown, TContext>>;
229
+ Mutation: Record<string, Resolver<never, unknown, TContext>>;
230
+ types: Record<string, {
231
+ tagAssignments: TagAssignmentsResolver<TContext>;
232
+ }>;
233
+ }
234
+ declare function defaultTagActor(context: unknown): TagActor;
235
+ declare function createEntityTagResolvers<TContext>(options: CreateEntityTagResolversOptions<TContext>): EntityTagResolvers<TContext>;
236
+
237
+ type index_AvailableTag = AvailableTag;
238
+ type index_CreateEntityTagResolversOptions<TContext> = CreateEntityTagResolversOptions<TContext>;
239
+ type index_CreateTagOptions = CreateTagOptions;
240
+ declare const index_ENTITY_TAGS_GRAPHQL_CODES: typeof ENTITY_TAGS_GRAPHQL_CODES;
241
+ type index_EntityTagAccessCheck = EntityTagAccessCheck;
242
+ type index_EntityTagAssignment = EntityTagAssignment;
243
+ type index_EntityTagBinding = EntityTagBinding;
244
+ type index_EntityTagInfo = EntityTagInfo;
245
+ type index_EntityTagMutationEvent = EntityTagMutationEvent;
246
+ type index_EntityTagOperation = EntityTagOperation;
247
+ type index_EntityTagResolvers<TContext> = EntityTagResolvers<TContext>;
248
+ type index_EntityTagsError = EntityTagsError;
249
+ declare const index_EntityTagsError: typeof EntityTagsError;
250
+ type index_EntityTagsErrorCode = EntityTagsErrorCode;
251
+ type index_EntityTagsFieldNames = EntityTagsFieldNames;
252
+ type index_EntityTagsRbacOptions = EntityTagsRbacOptions;
253
+ type index_EntityTagsSdlOptions = EntityTagsSdlOptions;
254
+ type index_EntityTagsTypeNames = EntityTagsTypeNames;
255
+ type index_FindEntitiesByTagsOptions = FindEntitiesByTagsOptions;
256
+ type index_RawTagAssignment = RawTagAssignment;
257
+ declare const index_TAG_ACTOR_TYPES: typeof TAG_ACTOR_TYPES;
258
+ declare const index_TAG_ASSIGNMENT_SOURCES: typeof TAG_ASSIGNMENT_SOURCES;
259
+ type index_TagActor = TagActor;
260
+ type index_TagActorType = TagActorType;
261
+ type index_TagAssignmentSource = TagAssignmentSource;
262
+ type index_TagEntityOptions = TagEntityOptions;
263
+ type index_TagVocabularyConfig = TagVocabularyConfig;
264
+ type index_TagVocabularyRef = TagVocabularyRef;
265
+ type index_TaggedEntityPage = TaggedEntityPage;
266
+ type index_TagsGatewayAdapter = TagsGatewayAdapter;
267
+ declare const index_TagsGatewayAdapter: typeof TagsGatewayAdapter;
268
+ type index_TagsGatewayAdapterOptions = TagsGatewayAdapterOptions;
269
+ type index_TagsGatewayClient = TagsGatewayClient;
270
+ declare const index_UNIVERSAL_TAG_STUB_SDL: typeof UNIVERSAL_TAG_STUB_SDL;
271
+ declare const index_assertTagPrefix: typeof assertTagPrefix;
272
+ declare const index_buildEntityTagsSdl: typeof buildEntityTagsSdl;
273
+ declare const index_createEntityTagResolvers: typeof createEntityTagResolvers;
274
+ declare const index_defaultTagActor: typeof defaultTagActor;
275
+ declare const index_entityTagsFieldNames: typeof entityTagsFieldNames;
276
+ declare const index_entityTagsTypeNames: typeof entityTagsTypeNames;
277
+ declare const index_isEntityTagsError: typeof isEntityTagsError;
278
+ declare const index_mapTagAssignment: typeof mapTagAssignment;
279
+ declare const index_slugifyTagKey: typeof slugifyTagKey;
280
+ declare namespace index {
281
+ export { type index_AvailableTag as AvailableTag, type index_CreateEntityTagResolversOptions as CreateEntityTagResolversOptions, type index_CreateTagOptions as CreateTagOptions, index_ENTITY_TAGS_GRAPHQL_CODES as ENTITY_TAGS_GRAPHQL_CODES, type index_EntityTagAccessCheck as EntityTagAccessCheck, type index_EntityTagAssignment as EntityTagAssignment, type index_EntityTagBinding as EntityTagBinding, type index_EntityTagInfo as EntityTagInfo, type index_EntityTagMutationEvent as EntityTagMutationEvent, type index_EntityTagOperation as EntityTagOperation, type index_EntityTagResolvers as EntityTagResolvers, index_EntityTagsError as EntityTagsError, type index_EntityTagsErrorCode as EntityTagsErrorCode, type index_EntityTagsFieldNames as EntityTagsFieldNames, type index_EntityTagsRbacOptions as EntityTagsRbacOptions, type index_EntityTagsSdlOptions as EntityTagsSdlOptions, type index_EntityTagsTypeNames as EntityTagsTypeNames, type index_FindEntitiesByTagsOptions as FindEntitiesByTagsOptions, type index_RawTagAssignment as RawTagAssignment, index_TAG_ACTOR_TYPES as TAG_ACTOR_TYPES, index_TAG_ASSIGNMENT_SOURCES as TAG_ASSIGNMENT_SOURCES, type index_TagActor as TagActor, type index_TagActorType as TagActorType, type index_TagAssignmentSource as TagAssignmentSource, type index_TagEntityOptions as TagEntityOptions, type index_TagVocabularyConfig as TagVocabularyConfig, type index_TagVocabularyRef as TagVocabularyRef, type index_TaggedEntityPage as TaggedEntityPage, index_TagsGatewayAdapter as TagsGatewayAdapter, type index_TagsGatewayAdapterOptions as TagsGatewayAdapterOptions, type index_TagsGatewayClient as TagsGatewayClient, index_UNIVERSAL_TAG_STUB_SDL as UNIVERSAL_TAG_STUB_SDL, index_assertTagPrefix as assertTagPrefix, index_buildEntityTagsSdl as buildEntityTagsSdl, index_createEntityTagResolvers as createEntityTagResolvers, index_defaultTagActor as defaultTagActor, index_entityTagsFieldNames as entityTagsFieldNames, index_entityTagsTypeNames as entityTagsTypeNames, index_isEntityTagsError as isEntityTagsError, index_mapTagAssignment as mapTagAssignment, index_slugifyTagKey as slugifyTagKey };
282
+ }
283
+
284
+ export { type AvailableTag as A, assertTagPrefix as B, type CreateEntityTagResolversOptions as C, buildEntityTagsSdl as D, ENTITY_TAGS_GRAPHQL_CODES as E, type FindEntitiesByTagsOptions as F, createEntityTagResolvers as G, defaultTagActor as H, entityTagsFieldNames as I, entityTagsTypeNames as J, isEntityTagsError as K, mapTagAssignment as L, slugifyTagKey as M, type RawTagAssignment as R, TAG_ACTOR_TYPES as T, UNIVERSAL_TAG_STUB_SDL as U, type CreateTagOptions as a, type EntityTagAccessCheck as b, type EntityTagAssignment as c, type EntityTagBinding as d, type EntityTagInfo as e, type EntityTagMutationEvent as f, type EntityTagOperation as g, type EntityTagResolvers as h, index as i, EntityTagsError as j, type EntityTagsErrorCode as k, type EntityTagsFieldNames as l, type EntityTagsRbacOptions as m, type EntityTagsSdlOptions as n, type EntityTagsTypeNames as o, TAG_ASSIGNMENT_SOURCES as p, type TagActor as q, type TagActorType as r, type TagAssignmentSource as s, type TagEntityOptions as t, type TagVocabularyConfig as u, type TagVocabularyRef as v, type TaggedEntityPage as w, TagsGatewayAdapter as x, type TagsGatewayAdapterOptions as y, type TagsGatewayClient as z };
package/dist/index.d.ts CHANGED
@@ -20,6 +20,8 @@ export { createInternalClient, createInternalClientForTenant, createInternalClie
20
20
  export { i as Lifecycle } from './index-CoMKgL-p.js';
21
21
  export { BillingPlanTransport, PlanTier, RESOURCE_CAP_DEFAULTS, ResourceCap, ResourceCapDefaults, ResourceCapExceededError, ResourceCapsConfig, ResourceCapsModule, ResourceName, WorkspaceResourceCapScope, configureResourceCaps, getResourceCaps } from './resource-caps/index.js';
22
22
  export { i as Sharing } from './index-kssw5ziY.js';
23
+ export { i as Tags } from './index-C_t30VyQ.js';
24
+ export { i as Files } from './index-BjtgcJxt.js';
23
25
  export { i as Cache } from './index-Cx5I3ydM.js';
24
26
  export { i as Middleware } from './index-DSOpj8DI.js';
25
27
  export { i as Observability } from './index-4gKQKZ2B.js';
@@ -33,7 +35,7 @@ export { i as DataLoader } from './index-DW9q22GH.js';
33
35
  export { i as Instrumentation } from './index-Dvv6irk0.js';
34
36
  export { i as Layer } from './index-BCUkR8sC.js';
35
37
  export { i as Crypto } from './index-e_18DzAg.js';
36
- export { i as Gateway } from './index-Dy6neH2G.js';
38
+ export { i as Gateway } from './index-BWhuZl8f.js';
37
39
  export { i as FeatureFlags } from './index-Rc5EphmY.js';
38
40
  export { i as Captcha, R as RecaptchaVerifyOptions, a as RecaptchaVerifyResult, b as isCaptchaEnabled, v as verifyCaptcha, c as verifyCaptchaIfEnabled } from './index-B70b5mYS.js';
39
41
  export { i as Platform } from './index-DfYu1p9e.js';
@@ -57,6 +59,7 @@ import './graph-emitter-r5TylDBm.js';
57
59
  import './prisma-extension-gYhYriA0.js';
58
60
  import '@temporalio/client';
59
61
  import '@temporalio/common';
62
+ import './types-B376RbyK.js';
60
63
  import 'elysia';
61
64
  import './types-Bo2wkjSP.js';
62
65
  import './graphql/services/index.js';
package/dist/index.js CHANGED
@@ -1,8 +1,11 @@
1
1
  export { sharing_exports as Sharing } from './chunk-DS3YMJ4X.js';
2
+ export { tags_exports as Tags } from './chunk-X3MNBBOL.js';
2
3
  export { TemporalClient, TemporalClientFactory, TemporalModule, TemporalWorker, TemporalWorkerFactory, TemporalWorkerManager } from './chunk-YNDJQRI3.js';
3
- import { ActivityModule, UsageModule, TrackerModule } from './chunk-YCSIHUYP.js';
4
- export { ActivityModule, TrackerModule, UsageModule } from './chunk-YCSIHUYP.js';
4
+ import { ActivityModule, UsageModule, TrackerModule } from './chunk-HDUS6UBO.js';
5
+ export { ActivityModule, TrackerModule, UsageModule } from './chunk-HDUS6UBO.js';
5
6
  export { NAME_MAX_LENGTH, NAME_MIN_LENGTH, RbacCoverageError, USERNAME_MAX_LENGTH, USERNAME_MIN_LENGTH, validation_exports as Validation, analyzeRbacCoverage, assertRbacCoverage, lengthInCodePoints, validateName, validateUserFields, validateUsername } from './chunk-WVOW3CJR.js';
7
+ import { TenantNotificationsModule, NotificationsModule } from './chunk-INAZ3PKF.js';
8
+ export { tenant_notifications_exports as Notifications, NotificationsModule } from './chunk-INAZ3PKF.js';
6
9
  export { observability_exports as Observability } from './chunk-VAT66FJA.js';
7
10
  export { platform_exports as Platform } from './chunk-N2UT3ESH.js';
8
11
  export { prisma_exports as Prisma } from './chunk-DTE2MHKE.js';
@@ -11,12 +14,23 @@ import { RBACModule } from './chunk-5JNHVKHG.js';
11
14
  export { RBACModule, createRBACDirective, createRBACDirectiveForLayer, createRBACDirectiveFromEnv } from './chunk-5JNHVKHG.js';
12
15
  import './chunk-GRGTUP44.js';
13
16
  import './chunk-3Z2VRCT6.js';
17
+ export { init_exports as Init } from './chunk-PPFJTSHA.js';
18
+ export { RESOURCE_CAP_DEFAULTS, ResourceCapExceededError, ResourceCapsModule, configureResourceCaps, getResourceCaps } from './chunk-MZCBEJ67.js';
14
19
  export { instrumentation_exports as Instrumentation } from './chunk-E5DTAGCA.js';
20
+ import './chunk-AWPNRV3L.js';
15
21
  export { middleware_exports as Middleware } from './chunk-ELU7VL3E.js';
16
- import { TenantNotificationsModule, NotificationsModule } from './chunk-INAZ3PKF.js';
17
- export { tenant_notifications_exports as Notifications, NotificationsModule } from './chunk-INAZ3PKF.js';
18
- export { export_exports as Export } from './chunk-TNYNRKLQ.js';
22
+ export { export_exports as Export } from './chunk-XJKVW34Q.js';
19
23
  export { feature_flags_exports as FeatureFlags } from './chunk-UNASM5VJ.js';
24
+ export { files_exports as Files } from './chunk-AE4PRE4N.js';
25
+ export { gateway_exports as Gateway } from './chunk-QZG27OR7.js';
26
+ import './chunk-KCGJCY5U.js';
27
+ import { GatewayClient } from './chunk-UCNTCCV6.js';
28
+ import './chunk-FZRODKIN.js';
29
+ export { layer_exports as Layer } from './chunk-5NT2OEDQ.js';
30
+ import './chunk-VFCMR5GX.js';
31
+ import { ContextManager } from './chunk-RZOFS2BQ.js';
32
+ export { ContextManager } from './chunk-RZOFS2BQ.js';
33
+ import { GatewayError, GatewayErrorType } from './chunk-4KK6YJ46.js';
20
34
  import { GraphModule } from './chunk-V3N6HDFE.js';
21
35
  export { graph_exports as Graph, GraphModule } from './chunk-V3N6HDFE.js';
22
36
  import './chunk-IZZ45AGA.js';
@@ -29,24 +43,13 @@ export { graphql_exports as GraphQL } from './chunk-KMNSVLDS.js';
29
43
  import './chunk-MWPYA2HD.js';
30
44
  import './chunk-LKCBI6B2.js';
31
45
  export { i18n_exports as I18n, createTranslator, getLanguage, getLocale, hasI18n, t } from './chunk-EBDHIL7V.js';
32
- export { init_exports as Init } from './chunk-GSIJ2DBJ.js';
33
- export { RESOURCE_CAP_DEFAULTS, ResourceCapExceededError, ResourceCapsModule, configureResourceCaps, getResourceCaps } from './chunk-MZCBEJ67.js';
34
- import './chunk-AWPNRV3L.js';
35
- import { GatewayClient, GatewayError, GatewayErrorType } from './chunk-2TTE5KSS.js';
36
- export { gateway_exports as Gateway } from './chunk-2TTE5KSS.js';
37
- import './chunk-HIO3DNKK.js';
38
- import './chunk-FZRODKIN.js';
39
- export { layer_exports as Layer } from './chunk-5NT2OEDQ.js';
40
- import './chunk-VFCMR5GX.js';
41
- import { ContextManager } from './chunk-RZOFS2BQ.js';
42
- export { ContextManager } from './chunk-RZOFS2BQ.js';
43
46
  import { AuthModule } from './chunk-GJWQK3IU.js';
44
47
  export { AuthModule } from './chunk-GJWQK3IU.js';
45
48
  export { utils_exports as Utils } from './chunk-B7I4TABG.js';
46
- export { cache_exports as Cache } from './chunk-AT52BRVL.js';
49
+ export { cache_exports as Cache } from './chunk-OXGIVASV.js';
50
+ import './chunk-A5F6Z5UE.js';
47
51
  import { disposeAll } from './chunk-KO2ZXZ7W.js';
48
52
  export { lifecycle_exports as Lifecycle, disposeAll, getRegisteredDisposableCount, registerDisposable, unregisterDisposable } from './chunk-KO2ZXZ7W.js';
49
- import './chunk-A5F6Z5UE.js';
50
53
  export { captcha_exports as Captcha, isCaptchaEnabled, verifyCaptcha, verifyCaptchaIfEnabled } from './chunk-YMZEUTD2.js';
51
54
  export { createInternalClient, createInternalClientForTenant, createInternalClientForWorkspaces } from './chunk-KJOSPVB2.js';
52
55
  export { crypto_exports as Crypto } from './chunk-SBS4S2PJ.js';