@dpuse/dpuse-shared 0.3.824 → 0.3.829
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -16
- package/dist/dpuse-shared-componentModuleConnector.es.js +3 -2
- package/dist/dpuse-shared-componentModuleConnector.es.js.map +1 -1
- package/dist/dpuse-shared-errors.es.js +59 -36
- package/dist/dpuse-shared-errors.es.js.map +1 -1
- package/dist/types/src/component/module/connector/connectorConfig.schema.d.ts +2 -2
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -186,39 +186,39 @@ _Note: Sonda's Vite reports currently exclude CSS files, since Vite does not gen
|
|
|
186
186
|
|Chunk/Module/File|Composition|
|
|
187
187
|
|:------ |:-----------|
|
|
188
188
|
| dist/componentConfig.schema-DT3mO5rS.js | 10.2 kB · brotli 2.3 kB |
|
|
189
|
-
| valibot → dist/index.mjs | `████░░░░░░░░░░░░░░░░`
|
|
190
|
-
| (unassigned) → [unassigned] | `█░░░░░░░░░░░░░░░░░░░` 5.
|
|
191
|
-
| src | `█░░░░░░░░░░░░░░░░░░░` 4.
|
|
189
|
+
| valibot → dist/index.mjs | `████░░░░░░░░░░░░░░░░` 20.6% |
|
|
190
|
+
| (unassigned) → [unassigned] | `█░░░░░░░░░░░░░░░░░░░` 5.2% |
|
|
191
|
+
| src | `█░░░░░░░░░░░░░░░░░░░` 4.1% |
|
|
192
192
|
| componentConfig.schema.ts | `█░░░░░░░░░░░░░░░░░░░` 2.7% |
|
|
193
193
|
| locale.schema.ts | `░░░░░░░░░░░░░░░░░░░░` 0.8% |
|
|
194
|
-
| baseConfig.schema.ts | `░░░░░░░░░░░░░░░░░░░░` 0.
|
|
194
|
+
| baseConfig.schema.ts | `░░░░░░░░░░░░░░░░░░░░` 0.5% |
|
|
195
195
|
| schema.ts | `░░░░░░░░░░░░░░░░░░░░` 0.2% |
|
|
196
196
|
| dist/dpuse-shared-encoding.es.js | 7.4 kB · brotli 1.3 kB |
|
|
197
|
-
| src → index.ts | `████░░░░░░░░░░░░░░░░`
|
|
198
|
-
| (unassigned) → [unassigned] | `█░░░░░░░░░░░░░░░░░░░`
|
|
197
|
+
| src → index.ts | `████░░░░░░░░░░░░░░░░` 18.8% |
|
|
198
|
+
| (unassigned) → [unassigned] | `█░░░░░░░░░░░░░░░░░░░` 2.9% |
|
|
199
|
+
| dist/dpuse-shared-errors.es.js | 4.6 kB · brotli 1.6 kB |
|
|
200
|
+
| src → index.ts | `██░░░░░░░░░░░░░░░░░░` 12.2% |
|
|
201
|
+
| (unassigned) → [unassigned] | `░░░░░░░░░░░░░░░░░░░░` 1.4% |
|
|
199
202
|
| dist/dpuse-shared-componentModuleConnector.es.js | 3.6 kB · brotli 1.2 kB |
|
|
200
|
-
| src | `██░░░░░░░░░░░░░░░░░░` 8.
|
|
201
|
-
| index.ts | `█░░░░░░░░░░░░░░░░░░░` 6.
|
|
202
|
-
| connectorConfig.schema.ts | `░░░░░░░░░░░░░░░░░░░░` 2.
|
|
203
|
-
| (unassigned) → [unassigned] | `░░░░░░░░░░░░░░░░░░░░` 2.
|
|
204
|
-
| dist/dpuse-shared-errors.es.js | 3.5 kB · brotli 1.1 kB |
|
|
205
|
-
| src → index.ts | `██░░░░░░░░░░░░░░░░░░` 9.4% |
|
|
206
|
-
| (unassigned) → [unassigned] | `░░░░░░░░░░░░░░░░░░░░` 1.3% |
|
|
203
|
+
| src | `██░░░░░░░░░░░░░░░░░░` 8.3% |
|
|
204
|
+
| index.ts | `█░░░░░░░░░░░░░░░░░░░` 6.0% |
|
|
205
|
+
| connectorConfig.schema.ts | `░░░░░░░░░░░░░░░░░░░░` 2.3% |
|
|
206
|
+
| (unassigned) → [unassigned] | `░░░░░░░░░░░░░░░░░░░░` 2.2% |
|
|
207
207
|
| dist/dpuse-shared-utilities.es.js | 3.5 kB · brotli 1.1 kB |
|
|
208
|
-
| src → index.ts | `██░░░░░░░░░░░░░░░░░░` 9
|
|
208
|
+
| src → index.ts | `██░░░░░░░░░░░░░░░░░░` 8.9% |
|
|
209
209
|
| (unassigned) → [unassigned] | `░░░░░░░░░░░░░░░░░░░░` 1.4% |
|
|
210
210
|
| dist/dpuse-shared-locale.es.js | 856 B · brotli 330 B |
|
|
211
211
|
| src → index.ts | `░░░░░░░░░░░░░░░░░░░░` 1.6% |
|
|
212
212
|
| (unassigned) → [unassigned] | `░░░░░░░░░░░░░░░░░░░░` 0.9% |
|
|
213
213
|
| dist/dpuse-shared-component.es.js | 834 B · brotli 363 B |
|
|
214
|
-
| src → index.ts | `░░░░░░░░░░░░░░░░░░░░` 1.
|
|
214
|
+
| src → index.ts | `░░░░░░░░░░░░░░░░░░░░` 1.5% |
|
|
215
215
|
| (unassigned) → [unassigned] | `░░░░░░░░░░░░░░░░░░░░` 0.9% |
|
|
216
216
|
| dist/dpuse-shared-componentModuleTool.es.js | 784 B · brotli 398 B |
|
|
217
217
|
| src → index.ts | `░░░░░░░░░░░░░░░░░░░░` 1.7% |
|
|
218
218
|
| (unassigned) → [unassigned] | `░░░░░░░░░░░░░░░░░░░░` 0.6% |
|
|
219
219
|
| dist/dpuse-shared-componentDataView.es.js | 701 B · brotli 297 B |
|
|
220
220
|
| src → index.ts | `░░░░░░░░░░░░░░░░░░░░` 1.6% |
|
|
221
|
-
| (unassigned) → [unassigned] | `░░░░░░░░░░░░░░░░░░░░` 0.
|
|
221
|
+
| (unassigned) → [unassigned] | `░░░░░░░░░░░░░░░░░░░░` 0.4% |
|
|
222
222
|
| dist/dpuse-shared-componentModulePresenter.es.js | 411 B · brotli 225 B |
|
|
223
223
|
| (unassigned) → [unassigned] | `░░░░░░░░░░░░░░░░░░░░` 0.8% |
|
|
224
224
|
| src → presenterConfig.schema.ts | `░░░░░░░░░░░░░░░░░░░░` 0.4% |
|
|
@@ -26,7 +26,8 @@ var m = o([
|
|
|
26
26
|
]), g = u({ label: n }), _ = o([
|
|
27
27
|
"bidirectional",
|
|
28
28
|
"destination",
|
|
29
|
-
"source"
|
|
29
|
+
"source",
|
|
30
|
+
"unknown"
|
|
30
31
|
]), v = u({ label: n }), y = o([
|
|
31
32
|
"apiKey",
|
|
32
33
|
"disabled",
|
|
@@ -142,7 +143,7 @@ var m = o([
|
|
|
142
143
|
function O(e) {
|
|
143
144
|
let t = !1, n = !1;
|
|
144
145
|
for (let r of e) D.has(r) && (t = !0), E.has(r) && (n = !0);
|
|
145
|
-
return t && n ? "bidirectional" : t ? "source" : n ? "destination" : "
|
|
146
|
+
return t && n ? "bidirectional" : t ? "source" : n ? "destination" : "unknown";
|
|
146
147
|
}
|
|
147
148
|
var k = (n, r = "en") => {
|
|
148
149
|
let i = C.find((e) => e.id === n);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dpuse-shared-componentModuleConnector.es.js","names":[],"sources":["../src/component/module/connector/connectorConfig.schema.ts","../src/component/module/connector/index.ts"],"sourcesContent":["/**\n * Defines the configuration metadata for a connector. Used for validation\n * of connector manifests and capability discovery at runtime.\n */\n\n// ── External Dependencies & Registrations\nimport { array, boolean, literal, nullable, number, optional, record, strictObject, string } from 'valibot';\n\n// ── DPUse Framework\nimport { literalUnion } from '@/schema';\nimport { localeLabelSchema } from '@/locale/locale.schema';\nimport { moduleConfigCoreFields } from '@/component/module/moduleConfig.schema';\n\n// ── Schemas - Action Name ────────────────────────────────────────────────────────────────────────────────────────────\n\n// Names of the operations a connector may implement.\nexport const connectorActionNameSchema = literalUnion([\n 'abortOperation',\n 'auditObjectContent',\n 'createObject',\n 'describeConnection',\n 'dropObject',\n 'findObject',\n 'getInfo',\n 'getReadableStream',\n 'getRecord',\n 'listNodes',\n 'previewObject',\n 'removeRecords',\n 'retrieveChunks',\n 'retrieveRecords',\n 'upsertRecords'\n]);\n\n// ── Schemas - Category Configuration ─────────────────────────────────────────────────────────────────────────────────\n\nconst connectorCategoryIdSchema = literalUnion(['application', 'curatedDataset', 'database', 'fileStore']); // Category identifiers used for grouping and filtering connectors.\n\nexport const connectorCategoryConfigSchema = strictObject({\n label: localeLabelSchema\n});\n\n// ── Schemas - Usage ──────────────────────────────────────────────────────────────────────────────────────────────────\n\nexport const connectorUsageIdSchema = literalUnion(['bidirectional', 'destination', 'source']); // Connector data pipeline usage identifiers.\n\nexport const connectorUsageConfigSchema = strictObject({\n label: localeLabelSchema\n});\n\n// ── Schemas - Implementation ─────────────────────────────────────────────────────────────────────────────────────────\n\nconst connectorAuthMethodIdSchema = literalUnion(['apiKey', 'disabled', 'oAuth2', 'none']); // Authentication method identifiers supported by a connector implementation.\n\nconst connectorImplementationParametersSchema = record(string(), string()); // One set of implementation parameters, keyed by name.\n\n// A connector implementation variant. A single connector may expose multiple implementations differing by auth method, limits, or vendor-specific behavior.\nconst connectorImplementationSchema = strictObject({\n authMethodId: connectorAuthMethodIdSchema,\n activeConnectionCount: optional(number()),\n canDescribe: optional(boolean()),\n id: optional(string()),\n label: optional(localeLabelSchema),\n maxConnectionCount: nullable(number()),\n params: optional(array(connectorImplementationParametersSchema))\n});\n\n// ── Schemas - Configuration ──────────────────────────────────────────────────────────────────────────────────────────\n\nexport const connectorConfigSchema = strictObject({\n ...moduleConfigCoreFields,\n typeId: literal('connector'),\n actionNames: array(connectorActionNameSchema),\n category: nullable(connectorCategoryConfigSchema),\n categoryId: connectorCategoryIdSchema,\n implementations: record(string(), connectorImplementationSchema),\n usage: nullable(connectorUsageConfigSchema),\n usageId: nullable(connectorUsageIdSchema)\n});\n","// ── External Dependencies & Registrations\nimport type { InferOutput } from 'valibot';\n\n// ── DPUse Framework\nimport type { Component } from '@/component';\nimport type { EngineConnectorActionOptions } from '@/component/module/engine';\nimport type { ToolConfig } from '@/component/module/tool';\nimport type { ConnectionDescriptionConfig, ConnectionNodeConfig, ObjectColumnConfig } from '@/component/connection';\nimport type {\n connectorActionNameSchema,\n connectorCategoryConfigSchema,\n connectorConfigSchema,\n connectorUsageConfigSchema,\n connectorUsageIdSchema\n} from '@/component/module/connector/connectorConfig.schema';\nimport type { ContentAuditConfig, InferenceRecord, InferenceSummary, ParsingRecord, PreviewConfig, ValueDelimiterId } from '@/component/dataView';\nimport { createLabelMap, DEFAULT_LOCALE_ID, type LocaleLabel, resolveLabel } from '@/locale/label';\nimport type { LocalisedConfig } from '@/locale';\n\n// ── Schemas ──────────────────────────────────────────────────────────────────────────────────────────────────────────\n\nexport { connectorConfigSchema } from '@/component/module/connector/connectorConfig.schema';\n\n// ── Types - Interface ────────────────────────────────────────────────────────────────────────────────────────────────\n\nexport interface ConnectorInterface extends Component {\n abortController: AbortController | undefined;\n readonly config: ConnectorConfig;\n readonly toolConfigs: ToolConfig[];\n abortOperation?(): void; // Abort the active long running action.\n auditObjectContent?(options: AuditObjectContentOptions, chunk: (rowCount: number) => void): Promise<AuditObjectContentResult>;\n createObject?(options: CreateObjectOptions): Promise<void>; // Create an object for a specified connection.\n describeConnection?(options: DescribeConnectionOptions): Promise<DescribeConnectionResult>; // Describe a specified connection.\n dropObject?(options: DropObjectOptions): Promise<void>; // Drop (delete) an object for a specified connection.\n findObject?(options: FindObjectOptions): Promise<FindObjectResult>; // Find an object for a specified connection.\n getInfo?(options: GetInfoOptions): Promise<GetInfoResult>; // Get metadata/info for a node (at any hierarchy level) for a specified connection.\n getReadableStream?(options: GetReadableStreamOptions): Promise<ReadableStream<Uint8Array>>; // Get a reader that can retrieve all records from an object for a specified connection.\n getRecord?(options: GetRecordOptions): Promise<GetRecordResult>; // Get a record for an object for a specified connection.\n listNodes?(options: ListNodesOptions): Promise<ListNodesResult>; // List nodes in a folder for a specified connection.\n previewObject?(options: PreviewObjectOptions): Promise<PreviewConfig>; // Preview an object for a specified connection.\n removeRecords?(options: RemoveRecordsOptions): Promise<void>; // Remove one or more records from an object for a specified connection.\n retrieveChunks?(options: RetrieveChunksOptions, chunk: (data: Uint8Array) => void, complete: () => void): Promise<void>; // Retrieve all chunks from an object for a specified connection.\n retrieveRecords?(\n options: RetrieveRecordsOptions,\n chunk: (typeId: RecordRetrievalTypeId, records: Record<string, unknown>[] | ParsingRecord[]) => void,\n complete: (result: RetrieveRecordsSummary) => void\n ): Promise<void>; // Retrieve all records from an object for a specified connection.\n upsertRecords?(options: UpsertRecordsOptions): Promise<void>; // Upsert one or more records into an object for a specified connection.\n}\n\nexport type ConnectorActionName = InferOutput<typeof connectorActionNameSchema>; // Names of the actions a connector may implement.\n\nexport type ConnectorConstructor = new (connectorUtilities: ConnectorUtilities, toolConfigs: ToolConfig[]) => ConnectorInterface;\n\nexport interface ConnectorUtilities {\n hasReadableStreamTransferSupport(): boolean;\n inferValues: (parsedRecord: ParsingRecord, columnConfigs: ObjectColumnConfig[], hasLeadingRecord: boolean) => InferenceRecord;\n inferDataTypes: (parsedRecords: ParsingRecord[]) => InferenceSummary;\n}\n\n// ── Types - Configuration ────────────────────────────────────────────────────────────────────────────────────────────\n\nexport type ConnectorConfig = InferOutput<typeof connectorConfigSchema>;\n\ntype ConnectorCategoryConfig = InferOutput<typeof connectorCategoryConfigSchema>;\n\ntype ConnectorUsageConfig = InferOutput<typeof connectorUsageConfigSchema>;\n\n// ── Types - Action - Audit Object Content ────────────────────────────────────────────────────────────────────────────\n\nexport interface AuditObjectContentOptions1 extends EngineConnectorActionOptions {\n chunkSize: number | undefined;\n encodingId: string;\n path: string;\n valueDelimiterId: ValueDelimiterId;\n}\nexport interface AuditObjectContentResult1 {\n contentAuditConfig: ContentAuditConfig;\n}\n\nexport interface AuditObjectContentOptions extends EngineConnectorActionOptions {\n chunkSize: number | undefined;\n encodingId: string;\n parsingToolName: string | undefined;\n path: string;\n supportsTransferableStreams: boolean;\n valueDelimiterId: ValueDelimiterId;\n}\nexport interface AuditObjectContentResult {\n processedRowCount: number;\n durationMs: number;\n}\n\n// ── Types - Action - Create Object ───────────────────────────────────────────────────────────────────────────────────\n\nexport interface CreateObjectOptions extends EngineConnectorActionOptions {\n path: string;\n structure: string;\n}\n\n// ── Types - Action - Describe Connection ─────────────────────────────────────────────────────────────────────────────\n\nexport type DescribeConnectionOptions = EngineConnectorActionOptions;\n\ninterface DescribeConnectionResult {\n descriptionConfig: ConnectionDescriptionConfig;\n}\n\n// ── Types - Action - Drop Object ─────────────────────────────────────────────────────────────────────────────────────\n\nexport interface DropObjectOptions extends EngineConnectorActionOptions {\n path: string;\n}\n\n// ── Types - Action - Find Object ─────────────────────────────────────────────────────────────────────────────────────\n\nexport interface FindObjectOptions extends EngineConnectorActionOptions {\n storeId: string | undefined;\n nodeId: string;\n}\nexport interface FindObjectResult {\n path: string | undefined;\n}\n\n// ── Types - Action - Get Info ────────────────────────────────────────────────────────────────────────────────────────\n\nexport interface GetInfoOptions extends EngineConnectorActionOptions {\n path: string;\n}\nexport interface GetInfoResult {\n info: Record<string, unknown>; // Raw, connector-specific metadata — not yet normalized to a common shape.\n}\n\n// ── Types - Action - Get Readable Stream ─────────────────────────────────────────────────────────────────────────────\n\nexport interface GetReadableStreamOptions extends EngineConnectorActionOptions {\n id: string;\n path: string;\n}\n\n// ── Types - Action - Get Record ──────────────────────────────────────────────────────────────────────────────────────\n\nexport interface GetRecordOptions extends EngineConnectorActionOptions {\n id: string;\n path: string;\n}\nexport interface GetRecordResult {\n record?: string[] | Record<string, unknown>;\n}\n\n// ── Types - Action - List Nodes ──────────────────────────────────────────────────────────────────────────────────────\n\nexport interface ListNodesOptions extends EngineConnectorActionOptions {\n folderPath: string;\n limit?: number;\n offset?: number;\n totalCount?: number;\n}\nexport interface ListNodesResult {\n cursor: string | number | undefined;\n connectionNodeConfigs: ConnectionNodeConfig[];\n isMore: boolean;\n totalCount: number;\n}\n\n// ── Types - Action - Preview Object ──────────────────────────────────────────────────────────────────────────────────\n\nexport interface PreviewObjectOptions extends EngineConnectorActionOptions {\n chunkSize: number | undefined;\n extension: string | undefined;\n path: string;\n}\n\n// ── Types - Action - Remove Records ──────────────────────────────────────────────────────────────────────────────────\n\nexport interface RemoveRecordsOptions extends EngineConnectorActionOptions {\n keys: string[];\n path: string;\n}\n\n// ── Types - Action - Retrieve Chunks ─────────────────────────────────────────────────────────────────────────────────\n\nexport interface RetrieveChunksOptions extends EngineConnectorActionOptions {\n chunkSize: number | undefined;\n encodingId: string;\n path: string;\n valueDelimiterId: ValueDelimiterId;\n}\n\n// ── Types - Action - Retrieve Records ────────────────────────────────────────────────────────────────────────────────\n\nexport interface RetrieveRecordsOptions extends EngineConnectorActionOptions {\n chunkSize: number | undefined;\n encodingId: string;\n path: string;\n valueDelimiterId: ValueDelimiterId;\n}\nexport interface RetrieveRecordsSummary {\n byteCount: number; // Number of processed bytes.\n commentLineCount: number; // Count the number of lines being fully commented.\n emptyLineCount: number; // Count the number of processed empty lines; work only with the skip_empty_lines option or an error will be thrown if an empty line is found.\n lineCount: number; // Number of lines encountered in the source dataset, start at 1 for the first line.\n nonUniformRecordCount: number; // Number of non uniform records when relax_column_count is true.\n recordCount: number; // Count the number of processed records.\n}\n\nexport type RecordRetrievalTypeId = 'jsonRecordArray' | 'parsingRecordArray';\n\n// ── Types - Action - Upsert Records ──────────────────────────────────────────────────────────────────────────────────\n\nexport interface UpsertRecordsOptions extends EngineConnectorActionOptions {\n records: Record<string, unknown>[];\n path: string;\n}\n\n// ── Constants ────────────────────────────────────────────────────────────────────────────────────────────────────────\n\nconst CONNECTOR_CATEGORY_CONFIGS: { id: string; label: LocaleLabel }[] = [\n { id: 'application', label: { en: 'Application', es: 'Aplicación' } },\n { id: 'curatedDataset', label: { en: 'Curated Dataset', es: 'Conjunto de Datos Curado' } },\n { id: 'database', label: { en: 'Database', es: 'Base de Datos' } },\n { id: 'fileStore', label: { en: 'File Store', es: 'Almacén de Archivos' } }\n];\n\nexport const CONNECTOR_ACTION_NAME_MAP: Record<ConnectorActionName, string> = {\n abortOperation: 'Abort Operation',\n auditObjectContent: 'Audit Object Content',\n createObject: 'Create Object',\n describeConnection: 'Describe Connection',\n dropObject: 'Drop Object',\n findObject: 'Find Object',\n getInfo: 'Get Info',\n getReadableStream: 'Get Readable Stream',\n getRecord: 'Get Record',\n listNodes: 'List Nodes',\n previewObject: 'Preview Object',\n removeRecords: 'Remove Records',\n retrieveChunks: 'Retrieve Chunks',\n retrieveRecords: 'Retrieve Records',\n upsertRecords: 'Upsert Records'\n};\n\nconst CONNECTOR_USAGE_CONFIGS: { id: string; label: LocaleLabel }[] = [\n { id: 'bidirectional', label: { en: 'Bidirectional', es: 'Bidireccional' } },\n { id: 'destination', label: { en: 'Destination', es: 'Destino' } },\n { id: 'source', label: { en: 'Source', es: 'Origen' } },\n { id: 'unknown', label: { en: 'Unknown', es: 'Desconocido' } }\n];\n\nconst CONNECTOR_DESTINATION_OPERATIONS = new Set<ConnectorActionName>(['createObject', 'dropObject', 'removeRecords', 'upsertRecords']);\nconst CONNECTOR_SOURCE_OPERATIONS = new Set<ConnectorActionName>([\n 'auditObjectContent',\n 'findObject',\n 'getInfo',\n 'getReadableStream',\n 'getRecord',\n 'listNodes',\n 'previewObject',\n 'retrieveChunks',\n 'retrieveRecords'\n]);\n\n// ── Types - Usage ────────────────────────────────────────────────────────────────────────────────────────────────────\n\nexport type ConnectorUsageId = InferOutput<typeof connectorUsageIdSchema>;\n\n// ── Actions ──────────────────────────────────────────────────────────────────────────────────────────────────────────\n\n// Determines whether a connector is a source, destination, or bidirectional connector, based on the actions it implements.\nexport function determineConnectorUsageId(actionNames: ConnectorActionName[]): ConnectorUsageId {\n let isSourceOperation = false;\n let isDestinationOperation = false;\n for (const actionName of actionNames) {\n if (CONNECTOR_SOURCE_OPERATIONS.has(actionName)) isSourceOperation = true;\n if (CONNECTOR_DESTINATION_OPERATIONS.has(actionName)) isDestinationOperation = true;\n }\n if (isSourceOperation && isDestinationOperation) return 'bidirectional';\n if (isSourceOperation) return 'source';\n return isDestinationOperation ? 'destination' : 'source';\n}\n\nexport const constructConnectorCategoryConfig = (id: string, localeId = DEFAULT_LOCALE_ID): LocalisedConfig<ConnectorCategoryConfig> => {\n const connectorCategory = CONNECTOR_CATEGORY_CONFIGS.find((connectorCategory) => connectorCategory.id === id);\n if (connectorCategory) {\n const labelMap = createLabelMap(connectorCategory.label);\n const localizedLabel = resolveLabel(labelMap, localeId);\n return { label: localizedLabel ?? connectorCategory.id, description: '' };\n }\n return { label: id, description: '' };\n};\n\nexport const constructConnectorUsageConfig = (id: string, localeId = DEFAULT_LOCALE_ID): LocalisedConfig<ConnectorUsageConfig> => {\n const connectorUsage = CONNECTOR_USAGE_CONFIGS.find((connectorUsage) => connectorUsage.id === id);\n if (connectorUsage) {\n const labelMap = createLabelMap(connectorUsage.label);\n const localizedLabel = resolveLabel(labelMap, localeId);\n return { label: localizedLabel ?? connectorUsage.id, description: '' };\n }\n return { label: id, description: '' };\n};\n\nexport function getConnectorActionsTable(supported: ConnectorActionName[]): string {\n const supportedSet = new Set(supported);\n let md = '|Action|Supported|\\n';\n md += '|:----|:-------:|\\n';\n for (const id of Object.keys(CONNECTOR_ACTION_NAME_MAP) as ConnectorActionName[]) {\n md += `| ${CONNECTOR_ACTION_NAME_MAP[id]} | ${supportedSet.has(id) ? '✓' : ''} |\\n`;\n }\n return md;\n}\n"],"mappings":";;;;AAgBA,IAAa,IAA4B,EAAa;CAClD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACJ,CAAC,GAIK,IAA4B,EAAa;CAAC;CAAe;CAAkB;CAAY;AAAW,CAAC,GAE5F,IAAgC,EAAa,EACtD,OAAO,EACX,CAAC,GAIY,IAAyB,EAAa;CAAC;CAAiB;CAAe;AAAQ,CAAC,GAEhF,IAA6B,EAAa,EACnD,OAAO,EACX,CAAC,GAIK,IAA8B,EAAa;CAAC;CAAU;CAAY;CAAU;AAAM,CAAC,GAEnF,IAA0C,EAAO,EAAO,GAAG,EAAO,CAAC,GAGnE,IAAgC,EAAa;CAC/C,cAAc;CACd,uBAAuB,EAAS,EAAO,CAAC;CACxC,aAAa,EAAS,EAAQ,CAAC;CAC/B,IAAI,EAAS,EAAO,CAAC;CACrB,OAAO,EAAS,CAAiB;CACjC,oBAAoB,EAAS,EAAO,CAAC;CACrC,QAAQ,EAA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C5F,IAAI,IAAoB,IACpB,IAAyB;CAC7B,KAAK,IAAM,KAAc,GAErB,AADI,EAA4B,IAAI,CAAU,MAAG,IAAoB,KACjE,EAAiC,IAAI,CAAU,MAAG,IAAyB;CAInF,OAFI,KAAqB,IAA+B,kBACpD,IAA0B,WACvB,IAAyB,gBAAgB;AACpD;AAEA,IAAa,KAAoC,GAAY,IAAA,SAA2E;CACpI,IAAM,IAAoB,EAA2B,MAAM,MAAsB,EAAkB,OAAO,CAAE;CAC5G,IAAI,GAAmB;EACnB,IAAM,IAAW,EAAe,EAAkB,KAAK;EAEvD,OAAO;GAAE,OADc,EAAa,GAAU,CAC9B,KAAkB,EAAkB;GAAI,aAAa;EAAG;CAC5E;CACA,OAAO;EAAE,OAAO;EAAI,aAAa;CAAG;AACxC,GAEa,KAAiC,GAAY,IAAA,SAAwE;CAC9H,IAAM,IAAiB,EAAwB,MAAM,MAAmB,EAAe,OAAO,CAAE;CAChG,IAAI,GAAgB;EAChB,IAAM,IAAW,EAAe,EAAe,KAAK;EAEpD,OAAO;GAAE,OADc,EAAa,GAAU,CAC9B,KAAkB,EAAe;GAAI,aAAa;EAAG;CACzE;CACA,OAAO;EAAE,OAAO;EAAI,aAAa;CAAG;AACxC;AAEA,SAAgB,EAAyB,GAA0C;CAC/E,IAAM,IAAe,IAAI,IAAI,CAAS,GAClC,IAAK;CACT,KAAM;CACN,KAAK,IAAM,KAAM,OAAO,KAAK,CAAyB,GAClD,KAAM,KAAK,EAA0B,GAAI,KAAK,EAAa,IAAI,CAAE,IAAI,MAAM,GAAG;CAElF,OAAO;AACX"}
|
|
1
|
+
{"version":3,"file":"dpuse-shared-componentModuleConnector.es.js","names":[],"sources":["../src/component/module/connector/connectorConfig.schema.ts","../src/component/module/connector/index.ts"],"sourcesContent":["/**\n * Defines the configuration metadata for a connector. Used for validation\n * of connector manifests and capability discovery at runtime.\n */\n\n// ── External Dependencies & Registrations\nimport { array, boolean, literal, nullable, number, optional, record, strictObject, string } from 'valibot';\n\n// ── DPUse Framework\nimport { literalUnion } from '@/schema';\nimport { localeLabelSchema } from '@/locale/locale.schema';\nimport { moduleConfigCoreFields } from '@/component/module/moduleConfig.schema';\n\n// ── Schemas - Action Name ────────────────────────────────────────────────────────────────────────────────────────────\n\n// Names of the operations a connector may implement.\nexport const connectorActionNameSchema = literalUnion([\n 'abortOperation',\n 'auditObjectContent',\n 'createObject',\n 'describeConnection',\n 'dropObject',\n 'findObject',\n 'getInfo',\n 'getReadableStream',\n 'getRecord',\n 'listNodes',\n 'previewObject',\n 'removeRecords',\n 'retrieveChunks',\n 'retrieveRecords',\n 'upsertRecords'\n]);\n\n// ── Schemas - Category Configuration ─────────────────────────────────────────────────────────────────────────────────\n\nconst connectorCategoryIdSchema = literalUnion(['application', 'curatedDataset', 'database', 'fileStore']); // Category identifiers used for grouping and filtering connectors.\n\nexport const connectorCategoryConfigSchema = strictObject({\n label: localeLabelSchema\n});\n\n// ── Schemas - Usage ──────────────────────────────────────────────────────────────────────────────────────────────────\n\nexport const connectorUsageIdSchema = literalUnion(['bidirectional', 'destination', 'source', 'unknown']); // Connector data pipeline usage identifiers.\n\nexport const connectorUsageConfigSchema = strictObject({\n label: localeLabelSchema\n});\n\n// ── Schemas - Implementation ─────────────────────────────────────────────────────────────────────────────────────────\n\nconst connectorAuthMethodIdSchema = literalUnion(['apiKey', 'disabled', 'oAuth2', 'none']); // Authentication method identifiers supported by a connector implementation.\n\nconst connectorImplementationParametersSchema = record(string(), string()); // One set of implementation parameters, keyed by name.\n\n// A connector implementation variant. A single connector may expose multiple implementations differing by auth method, limits, or vendor-specific behavior.\nconst connectorImplementationSchema = strictObject({\n authMethodId: connectorAuthMethodIdSchema,\n activeConnectionCount: optional(number()),\n canDescribe: optional(boolean()),\n id: optional(string()),\n label: optional(localeLabelSchema),\n maxConnectionCount: nullable(number()),\n params: optional(array(connectorImplementationParametersSchema))\n});\n\n// ── Schemas - Configuration ──────────────────────────────────────────────────────────────────────────────────────────\n\nexport const connectorConfigSchema = strictObject({\n ...moduleConfigCoreFields,\n typeId: literal('connector'),\n actionNames: array(connectorActionNameSchema),\n category: nullable(connectorCategoryConfigSchema),\n categoryId: connectorCategoryIdSchema,\n implementations: record(string(), connectorImplementationSchema),\n usage: nullable(connectorUsageConfigSchema),\n usageId: nullable(connectorUsageIdSchema)\n});\n","// ── External Dependencies & Registrations\nimport type { InferOutput } from 'valibot';\n\n// ── DPUse Framework\nimport type { Component } from '@/component';\nimport type { EngineConnectorActionOptions } from '@/component/module/engine';\nimport type { ToolConfig } from '@/component/module/tool';\nimport type { ConnectionDescriptionConfig, ConnectionNodeConfig, ObjectColumnConfig } from '@/component/connection';\nimport type {\n connectorActionNameSchema,\n connectorCategoryConfigSchema,\n connectorConfigSchema,\n connectorUsageConfigSchema,\n connectorUsageIdSchema\n} from '@/component/module/connector/connectorConfig.schema';\nimport type { ContentAuditConfig, InferenceRecord, InferenceSummary, ParsingRecord, PreviewConfig, ValueDelimiterId } from '@/component/dataView';\nimport { createLabelMap, DEFAULT_LOCALE_ID, type LocaleLabel, resolveLabel } from '@/locale/label';\nimport type { LocalisedConfig } from '@/locale';\n\n// ── Schemas ──────────────────────────────────────────────────────────────────────────────────────────────────────────\n\nexport { connectorConfigSchema } from '@/component/module/connector/connectorConfig.schema';\n\n// ── Types - Interface ────────────────────────────────────────────────────────────────────────────────────────────────\n\nexport interface ConnectorInterface extends Component {\n abortController: AbortController | undefined;\n readonly config: ConnectorConfig;\n readonly toolConfigs: ToolConfig[];\n abortOperation?(): void; // Abort the active long running action.\n auditObjectContent?(options: AuditObjectContentOptions, chunk: (rowCount: number) => void): Promise<AuditObjectContentResult>;\n createObject?(options: CreateObjectOptions): Promise<void>; // Create an object for a specified connection.\n describeConnection?(options: DescribeConnectionOptions): Promise<DescribeConnectionResult>; // Describe a specified connection.\n dropObject?(options: DropObjectOptions): Promise<void>; // Drop (delete) an object for a specified connection.\n findObject?(options: FindObjectOptions): Promise<FindObjectResult>; // Find an object for a specified connection.\n getInfo?(options: GetInfoOptions): Promise<GetInfoResult>; // Get metadata/info for a node (at any hierarchy level) for a specified connection.\n getReadableStream?(options: GetReadableStreamOptions): Promise<ReadableStream<Uint8Array>>; // Get a reader that can retrieve all records from an object for a specified connection.\n getRecord?(options: GetRecordOptions): Promise<GetRecordResult>; // Get a record for an object for a specified connection.\n listNodes?(options: ListNodesOptions): Promise<ListNodesResult>; // List nodes in a folder for a specified connection.\n previewObject?(options: PreviewObjectOptions): Promise<PreviewConfig>; // Preview an object for a specified connection.\n removeRecords?(options: RemoveRecordsOptions): Promise<void>; // Remove one or more records from an object for a specified connection.\n retrieveChunks?(options: RetrieveChunksOptions, chunk: (data: Uint8Array) => void, complete: () => void): Promise<void>; // Retrieve all chunks from an object for a specified connection.\n retrieveRecords?(\n options: RetrieveRecordsOptions,\n chunk: (typeId: RecordRetrievalTypeId, records: Record<string, unknown>[] | ParsingRecord[]) => void,\n complete: (result: RetrieveRecordsSummary) => void\n ): Promise<void>; // Retrieve all records from an object for a specified connection.\n upsertRecords?(options: UpsertRecordsOptions): Promise<void>; // Upsert one or more records into an object for a specified connection.\n}\n\nexport type ConnectorActionName = InferOutput<typeof connectorActionNameSchema>; // Names of the actions a connector may implement.\n\nexport type ConnectorConstructor = new (connectorUtilities: ConnectorUtilities, toolConfigs: ToolConfig[]) => ConnectorInterface;\n\nexport interface ConnectorUtilities {\n hasReadableStreamTransferSupport(): boolean;\n inferValues: (parsedRecord: ParsingRecord, columnConfigs: ObjectColumnConfig[], hasLeadingRecord: boolean) => InferenceRecord;\n inferDataTypes: (parsedRecords: ParsingRecord[]) => InferenceSummary;\n}\n\n// ── Types - Configuration ────────────────────────────────────────────────────────────────────────────────────────────\n\nexport type ConnectorConfig = InferOutput<typeof connectorConfigSchema>;\n\ntype ConnectorCategoryConfig = InferOutput<typeof connectorCategoryConfigSchema>;\n\ntype ConnectorUsageConfig = InferOutput<typeof connectorUsageConfigSchema>;\n\n// ── Types - Action - Audit Object Content ────────────────────────────────────────────────────────────────────────────\n\nexport interface AuditObjectContentOptions1 extends EngineConnectorActionOptions {\n chunkSize: number | undefined;\n encodingId: string;\n path: string;\n valueDelimiterId: ValueDelimiterId;\n}\nexport interface AuditObjectContentResult1 {\n contentAuditConfig: ContentAuditConfig;\n}\n\nexport interface AuditObjectContentOptions extends EngineConnectorActionOptions {\n chunkSize: number | undefined;\n encodingId: string;\n parsingToolName: string | undefined;\n path: string;\n supportsTransferableStreams: boolean;\n valueDelimiterId: ValueDelimiterId;\n}\nexport interface AuditObjectContentResult {\n processedRowCount: number;\n durationMs: number;\n}\n\n// ── Types - Action - Create Object ───────────────────────────────────────────────────────────────────────────────────\n\nexport interface CreateObjectOptions extends EngineConnectorActionOptions {\n path: string;\n structure: string;\n}\n\n// ── Types - Action - Describe Connection ─────────────────────────────────────────────────────────────────────────────\n\nexport type DescribeConnectionOptions = EngineConnectorActionOptions;\n\ninterface DescribeConnectionResult {\n descriptionConfig: ConnectionDescriptionConfig;\n}\n\n// ── Types - Action - Drop Object ─────────────────────────────────────────────────────────────────────────────────────\n\nexport interface DropObjectOptions extends EngineConnectorActionOptions {\n path: string;\n}\n\n// ── Types - Action - Find Object ─────────────────────────────────────────────────────────────────────────────────────\n\nexport interface FindObjectOptions extends EngineConnectorActionOptions {\n storeId: string | undefined;\n nodeId: string;\n}\nexport interface FindObjectResult {\n path: string | undefined;\n}\n\n// ── Types - Action - Get Info ────────────────────────────────────────────────────────────────────────────────────────\n\nexport interface GetInfoOptions extends EngineConnectorActionOptions {\n path: string;\n}\nexport interface GetInfoResult {\n info: Record<string, unknown>; // Raw, connector-specific metadata — not yet normalized to a common shape.\n}\n\n// ── Types - Action - Get Readable Stream ─────────────────────────────────────────────────────────────────────────────\n\nexport interface GetReadableStreamOptions extends EngineConnectorActionOptions {\n id: string;\n path: string;\n}\n\n// ── Types - Action - Get Record ──────────────────────────────────────────────────────────────────────────────────────\n\nexport interface GetRecordOptions extends EngineConnectorActionOptions {\n id: string;\n path: string;\n}\nexport interface GetRecordResult {\n record?: string[] | Record<string, unknown>;\n}\n\n// ── Types - Action - List Nodes ──────────────────────────────────────────────────────────────────────────────────────\n\nexport interface ListNodesOptions extends EngineConnectorActionOptions {\n folderPath: string;\n limit?: number;\n offset?: number;\n totalCount?: number;\n}\nexport interface ListNodesResult {\n cursor: string | number | undefined;\n connectionNodeConfigs: ConnectionNodeConfig[];\n isMore: boolean;\n totalCount: number;\n}\n\n// ── Types - Action - Preview Object ──────────────────────────────────────────────────────────────────────────────────\n\nexport interface PreviewObjectOptions extends EngineConnectorActionOptions {\n chunkSize: number | undefined;\n extension: string | undefined;\n path: string;\n}\n\n// ── Types - Action - Remove Records ──────────────────────────────────────────────────────────────────────────────────\n\nexport interface RemoveRecordsOptions extends EngineConnectorActionOptions {\n keys: string[];\n path: string;\n}\n\n// ── Types - Action - Retrieve Chunks ─────────────────────────────────────────────────────────────────────────────────\n\nexport interface RetrieveChunksOptions extends EngineConnectorActionOptions {\n chunkSize: number | undefined;\n encodingId: string;\n path: string;\n valueDelimiterId: ValueDelimiterId;\n}\n\n// ── Types - Action - Retrieve Records ────────────────────────────────────────────────────────────────────────────────\n\nexport interface RetrieveRecordsOptions extends EngineConnectorActionOptions {\n chunkSize: number | undefined;\n encodingId: string;\n path: string;\n valueDelimiterId: ValueDelimiterId;\n}\nexport interface RetrieveRecordsSummary {\n byteCount: number; // Number of processed bytes.\n commentLineCount: number; // Count the number of lines being fully commented.\n emptyLineCount: number; // Count the number of processed empty lines; work only with the skip_empty_lines option or an error will be thrown if an empty line is found.\n lineCount: number; // Number of lines encountered in the source dataset, start at 1 for the first line.\n nonUniformRecordCount: number; // Number of non uniform records when relax_column_count is true.\n recordCount: number; // Count the number of processed records.\n}\n\nexport type RecordRetrievalTypeId = 'jsonRecordArray' | 'parsingRecordArray';\n\n// ── Types - Action - Upsert Records ──────────────────────────────────────────────────────────────────────────────────\n\nexport interface UpsertRecordsOptions extends EngineConnectorActionOptions {\n records: Record<string, unknown>[];\n path: string;\n}\n\n// ── Constants ────────────────────────────────────────────────────────────────────────────────────────────────────────\n\nconst CONNECTOR_CATEGORY_CONFIGS: { id: string; label: LocaleLabel }[] = [\n { id: 'application', label: { en: 'Application', es: 'Aplicación' } },\n { id: 'curatedDataset', label: { en: 'Curated Dataset', es: 'Conjunto de Datos Curado' } },\n { id: 'database', label: { en: 'Database', es: 'Base de Datos' } },\n { id: 'fileStore', label: { en: 'File Store', es: 'Almacén de Archivos' } }\n];\n\nexport const CONNECTOR_ACTION_NAME_MAP: Record<ConnectorActionName, string> = {\n abortOperation: 'Abort Operation',\n auditObjectContent: 'Audit Object Content',\n createObject: 'Create Object',\n describeConnection: 'Describe Connection',\n dropObject: 'Drop Object',\n findObject: 'Find Object',\n getInfo: 'Get Info',\n getReadableStream: 'Get Readable Stream',\n getRecord: 'Get Record',\n listNodes: 'List Nodes',\n previewObject: 'Preview Object',\n removeRecords: 'Remove Records',\n retrieveChunks: 'Retrieve Chunks',\n retrieveRecords: 'Retrieve Records',\n upsertRecords: 'Upsert Records'\n};\n\nconst CONNECTOR_USAGE_CONFIGS: { id: string; label: LocaleLabel }[] = [\n { id: 'bidirectional', label: { en: 'Bidirectional', es: 'Bidireccional' } },\n { id: 'destination', label: { en: 'Destination', es: 'Destino' } },\n { id: 'source', label: { en: 'Source', es: 'Origen' } },\n { id: 'unknown', label: { en: 'Unknown', es: 'Desconocido' } }\n];\n\nconst CONNECTOR_DESTINATION_OPERATIONS = new Set<ConnectorActionName>(['createObject', 'dropObject', 'removeRecords', 'upsertRecords']);\nconst CONNECTOR_SOURCE_OPERATIONS = new Set<ConnectorActionName>([\n 'auditObjectContent',\n 'findObject',\n 'getInfo',\n 'getReadableStream',\n 'getRecord',\n 'listNodes',\n 'previewObject',\n 'retrieveChunks',\n 'retrieveRecords'\n]);\n\n// ── Types - Usage ────────────────────────────────────────────────────────────────────────────────────────────────────\n\nexport type ConnectorUsageId = InferOutput<typeof connectorUsageIdSchema>;\n\n// ── Actions ──────────────────────────────────────────────────────────────────────────────────────────────────────────\n\n// Determines whether a connector is a source, destination, or bidirectional connector, based on the actions it implements.\nexport function determineConnectorUsageId(actionNames: ConnectorActionName[]): ConnectorUsageId {\n let isSourceOperation = false;\n let isDestinationOperation = false;\n for (const actionName of actionNames) {\n if (CONNECTOR_SOURCE_OPERATIONS.has(actionName)) isSourceOperation = true;\n if (CONNECTOR_DESTINATION_OPERATIONS.has(actionName)) isDestinationOperation = true;\n }\n if (isSourceOperation && isDestinationOperation) return 'bidirectional';\n if (isSourceOperation) return 'source';\n return isDestinationOperation ? 'destination' : 'unknown'; // Neither reads nor writes data, e.g. only 'abortOperation' or 'describeConnection'.\n}\n\nexport const constructConnectorCategoryConfig = (id: string, localeId = DEFAULT_LOCALE_ID): LocalisedConfig<ConnectorCategoryConfig> => {\n const connectorCategory = CONNECTOR_CATEGORY_CONFIGS.find((connectorCategory) => connectorCategory.id === id);\n if (connectorCategory) {\n const labelMap = createLabelMap(connectorCategory.label);\n const localizedLabel = resolveLabel(labelMap, localeId);\n return { label: localizedLabel ?? connectorCategory.id, description: '' };\n }\n return { label: id, description: '' };\n};\n\nexport const constructConnectorUsageConfig = (id: string, localeId = DEFAULT_LOCALE_ID): LocalisedConfig<ConnectorUsageConfig> => {\n const connectorUsage = CONNECTOR_USAGE_CONFIGS.find((connectorUsage) => connectorUsage.id === id);\n if (connectorUsage) {\n const labelMap = createLabelMap(connectorUsage.label);\n const localizedLabel = resolveLabel(labelMap, localeId);\n return { label: localizedLabel ?? connectorUsage.id, description: '' };\n }\n return { label: id, description: '' };\n};\n\nexport function getConnectorActionsTable(supported: ConnectorActionName[]): string {\n const supportedSet = new Set(supported);\n let md = '|Action|Supported|\\n';\n md += '|:----|:-------:|\\n';\n for (const id of Object.keys(CONNECTOR_ACTION_NAME_MAP) as ConnectorActionName[]) {\n md += `| ${CONNECTOR_ACTION_NAME_MAP[id]} | ${supportedSet.has(id) ? '✓' : ''} |\\n`;\n }\n return md;\n}\n"],"mappings":";;;;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W,EAAe,EAAe,KAAK;EAEpD,OAAO;GAAE,OADc,EAAa,GAAU,CAC9B,KAAkB,EAAe;GAAI,aAAa;EAAG;CACzE;CACA,OAAO;EAAE,OAAO;EAAI,aAAa;CAAG;AACxC;AAEA,SAAgB,EAAyB,GAA0C;CAC/E,IAAM,IAAe,IAAI,IAAI,CAAS,GAClC,IAAK;CACT,KAAM;CACN,KAAK,IAAM,KAAM,OAAO,KAAK,CAAyB,GAClD,KAAM,KAAK,EAA0B,GAAI,KAAK,EAAa,IAAI,CAAE,IAAI,MAAM,GAAG;CAElF,OAAO;AACX"}
|
|
@@ -1,49 +1,55 @@
|
|
|
1
1
|
//#region src/errors/index.ts
|
|
2
|
-
var e = 2048, t =
|
|
2
|
+
var e = 2048, t = "[REDACTED]", n = /api[-_]?key|authori[sz]ation|cookie|credential|passw(?:or)?d|private[-_]?key|secret|token/i, r = [
|
|
3
|
+
[/\b(Bearer|Basic) +[\w.~+/=-]+/gi, (e, n) => `${n} ${t}`],
|
|
4
|
+
[/(?<![\w-])([\w-]+)(["']?[ \t]*[:=][ \t]*["']?)([^\s"'&,;}?#]+)/g, (e, r, i, a) => n.test(r) && !/^(?:Basic|Bearer)$/i.test(a) ? `${r}${i}${t}` : e],
|
|
5
|
+
[/\beyJ[\w-]+\.[\w-]+\.[\w-]*/g, () => t],
|
|
6
|
+
[/\b(?:sk-|xaat-|xapt-|sl\.)[\w-]{16,}/g, () => t],
|
|
7
|
+
[/(?<![\w.+-])[\w.+-]+@[\w-]+\.[\w.-]+/g, () => t]
|
|
8
|
+
], i = class extends Error {
|
|
3
9
|
data;
|
|
4
10
|
locator;
|
|
5
11
|
constructor(e, t, n, r) {
|
|
6
12
|
super(e, r), this.name = "DPUseError", this.data = n, this.locator = t;
|
|
7
13
|
}
|
|
8
|
-
},
|
|
14
|
+
}, a = class extends i {
|
|
9
15
|
constructor(e, t, n, r) {
|
|
10
16
|
super(e, t, n, r), this.name = "AppError";
|
|
11
17
|
}
|
|
12
|
-
},
|
|
18
|
+
}, o = class extends i {
|
|
13
19
|
constructor(e, t, n, r) {
|
|
14
20
|
super(e, t, n, r), this.name = "APIError";
|
|
15
21
|
}
|
|
16
|
-
},
|
|
22
|
+
}, s = class extends i {
|
|
17
23
|
constructor(e, t, n, r) {
|
|
18
24
|
super(e, t, n, r), this.name = "EngineError";
|
|
19
25
|
}
|
|
20
|
-
},
|
|
26
|
+
}, c = class extends i {
|
|
21
27
|
constructor(e, t, n, r) {
|
|
22
28
|
super(e, t, n, r), this.name = "ConnectorError";
|
|
23
29
|
}
|
|
24
|
-
},
|
|
30
|
+
}, l = class extends i {
|
|
25
31
|
constructor(e, t, n, r) {
|
|
26
32
|
super(e, t, n, r), this.name = "FetchError";
|
|
27
33
|
}
|
|
28
34
|
};
|
|
29
|
-
async function
|
|
35
|
+
async function u(e, t, n) {
|
|
30
36
|
let r = ` - ${e.statusText}`, i = `${t} Response status '${String(e.status)}${e.statusText ? r : ""}' received.`, a;
|
|
31
37
|
try {
|
|
32
38
|
a = await e.text();
|
|
33
39
|
} catch (e) {
|
|
34
|
-
a = `<body unavailable: ${
|
|
40
|
+
a = `<body unavailable: ${p(e).message}>`;
|
|
35
41
|
}
|
|
36
|
-
return new
|
|
42
|
+
return new l(i, n, { body: x(a) });
|
|
37
43
|
}
|
|
38
|
-
function
|
|
44
|
+
function d(e) {
|
|
39
45
|
return e.map((e) => e.message).join(" ");
|
|
40
46
|
}
|
|
41
|
-
function
|
|
47
|
+
function f(e) {
|
|
42
48
|
try {
|
|
43
49
|
e();
|
|
44
50
|
} catch {}
|
|
45
51
|
}
|
|
46
|
-
function
|
|
52
|
+
function p(e) {
|
|
47
53
|
if (e instanceof Error) return e;
|
|
48
54
|
if (typeof e == "string") return Error(e);
|
|
49
55
|
if (typeof e == "number" || typeof e == "boolean" || typeof e == "bigint") return Error(String(e));
|
|
@@ -55,24 +61,24 @@ function u(e) {
|
|
|
55
61
|
}
|
|
56
62
|
return /* @__PURE__ */ Error("Unknown error");
|
|
57
63
|
}
|
|
58
|
-
function
|
|
59
|
-
let t = /* @__PURE__ */ new Set(), n = [], r =
|
|
64
|
+
function m(e) {
|
|
65
|
+
let t = /* @__PURE__ */ new Set(), n = [], r = p(e);
|
|
60
66
|
for (; r != null && !t.has(r);) {
|
|
61
67
|
t.add(r);
|
|
62
|
-
let [e, i] =
|
|
63
|
-
/(?:\.{3}|[.!?])$/.test(e.message) || (e.message += "."), n.push(e), r = i;
|
|
68
|
+
let [e, i] = S(r);
|
|
69
|
+
/(?:\.{3}|[.!?])$/.test(e.message) || (e.message += "."), n.push(v(e)), r = i;
|
|
64
70
|
}
|
|
65
71
|
return n;
|
|
66
72
|
}
|
|
67
|
-
function
|
|
73
|
+
function h(e) {
|
|
68
74
|
let t;
|
|
69
75
|
for (let n of e.toReversed()) {
|
|
70
|
-
let e =
|
|
76
|
+
let e = _(n, t);
|
|
71
77
|
n.stack !== void 0 && (e.stack = n.stack), t = e;
|
|
72
78
|
}
|
|
73
79
|
return t ?? /* @__PURE__ */ Error("No error to unserialise.");
|
|
74
80
|
}
|
|
75
|
-
function
|
|
81
|
+
function g(e) {
|
|
76
82
|
let t;
|
|
77
83
|
try {
|
|
78
84
|
t = JSON.stringify(e);
|
|
@@ -81,13 +87,13 @@ function p(e) {
|
|
|
81
87
|
}
|
|
82
88
|
return t === "" && (t = "Unknown error"), t;
|
|
83
89
|
}
|
|
84
|
-
function
|
|
90
|
+
function _(e, t) {
|
|
85
91
|
switch (e.name) {
|
|
86
|
-
case "APIError": return new
|
|
87
|
-
case "AppError": return new
|
|
88
|
-
case "ConnectorError": return new
|
|
89
|
-
case "EngineError": return new
|
|
90
|
-
case "FetchError": return new
|
|
92
|
+
case "APIError": return new o(e.message, e.locator, e.data, { cause: t });
|
|
93
|
+
case "AppError": return new a(e.message, e.locator, e.data, { cause: t });
|
|
94
|
+
case "ConnectorError": return new c(e.message, e.locator, e.data, { cause: t });
|
|
95
|
+
case "EngineError": return new s(e.message, e.locator, e.data, { cause: t });
|
|
96
|
+
case "FetchError": return new l(e.message, e.locator, e.data, { cause: t });
|
|
91
97
|
default: {
|
|
92
98
|
let n = e.name;
|
|
93
99
|
return new class extends Error {
|
|
@@ -96,32 +102,49 @@ function m(e, t) {
|
|
|
96
102
|
}
|
|
97
103
|
}
|
|
98
104
|
}
|
|
99
|
-
function
|
|
105
|
+
function v(e) {
|
|
106
|
+
let { data: t, message: n, stack: r } = e;
|
|
107
|
+
return {
|
|
108
|
+
...e,
|
|
109
|
+
data: t === void 0 ? void 0 : b(t, /* @__PURE__ */ new WeakSet(), 0),
|
|
110
|
+
message: y(n),
|
|
111
|
+
stack: r === void 0 ? void 0 : y(r)
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
function y(e) {
|
|
115
|
+
let t = e;
|
|
116
|
+
for (let [e, n] of r) t = t.replaceAll(e, (e, ...t) => n(e, ...t));
|
|
117
|
+
return t;
|
|
118
|
+
}
|
|
119
|
+
function b(e, r, i) {
|
|
120
|
+
return typeof e == "string" ? y(e) : typeof e != "object" || !e ? e : i >= 10 ? t : r.has(e) ? "[Circular]" : (r.add(e), Array.isArray(e) ? e.map((e) => b(e, r, i + 1)) : Object.fromEntries(Object.entries(e).map(([e, a]) => [e, a != null && n.test(e) ? t : b(a, r, i + 1)])));
|
|
121
|
+
}
|
|
122
|
+
function x(t) {
|
|
100
123
|
if (t != null && t !== "") return t.length > e ? `${t.slice(0, e)}... [truncated]` : t;
|
|
101
124
|
}
|
|
102
|
-
function
|
|
103
|
-
let
|
|
104
|
-
if (e instanceof
|
|
125
|
+
function S(e) {
|
|
126
|
+
let t = e.cause == null ? null : p(e.cause);
|
|
127
|
+
if (e instanceof i) return [{
|
|
105
128
|
data: e.data,
|
|
106
129
|
locator: e.locator,
|
|
107
130
|
message: e.message,
|
|
108
131
|
name: e.name,
|
|
109
132
|
stack: e.stack
|
|
110
|
-
},
|
|
111
|
-
let
|
|
133
|
+
}, t];
|
|
134
|
+
let n = Object.fromEntries(Object.entries(e).filter(([e]) => e !== "cause"));
|
|
112
135
|
return e.name ? [{
|
|
113
|
-
data:
|
|
136
|
+
data: n,
|
|
114
137
|
locator: "",
|
|
115
138
|
message: e.message,
|
|
116
139
|
name: e.name,
|
|
117
140
|
stack: e.stack
|
|
118
|
-
},
|
|
119
|
-
data:
|
|
141
|
+
}, t] : [{
|
|
142
|
+
data: n,
|
|
120
143
|
locator: "",
|
|
121
|
-
message:
|
|
144
|
+
message: g(e),
|
|
122
145
|
name: "Error",
|
|
123
146
|
stack: void 0
|
|
124
147
|
}, null];
|
|
125
148
|
}
|
|
126
149
|
//#endregion
|
|
127
|
-
export {
|
|
150
|
+
export { o as APIError, a as AppError, c as ConnectorError, i as DPUseError, s as EngineError, l as FetchError, u as buildFetchError, d as concatenateSerialisedErrorMessages, f as ignoreErrors, p as normalizeToError, m as serialiseError, h as unserialiseError };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dpuse-shared-errors.es.js","names":[],"sources":["../src/errors/index.ts"],"sourcesContent":["// ── Types ────────────────────────────────────────────────────────────────────────────────────────────────────────────\n\n// Serializable representation of an error; used for transporting errors across api and worker boundaries\nexport interface SerialisedError {\n data: Record<string, unknown> | undefined;\n locator: string; // Error locator 'package.module.method'\n message: string; // Human-readable error message\n name: string; // Error class or type name\n stack: string | undefined; // Stack trace if available\n}\n\n// ── Constants ───────────────────────────────────────────────────────────────────────────────────────────────────────\n\nconst RESPONSE_ERROR_BODY_LIMIT = 2048;\n\n// ── Errors ───────────────────────────────────────────────────────────────────────────────────────────────────────────\n\n// Base class for all DPUse errors; includes a locator for the error; never thrown directly\nexport class DPUseError extends Error {\n readonly data: Record<string, unknown> | undefined;\n readonly locator: string; // Error locator 'package.module.method'\n constructor(message: string, locator: string, data?: Record<string, unknown>, options?: ErrorOptions) {\n super(message, options);\n this.name = 'DPUseError';\n this.data = data;\n this.locator = locator;\n }\n}\n\n// Thrown when an app (studio/assistant) error occurs\nexport class AppError extends DPUseError {\n constructor(message: string, locator: string, data?: Record<string, unknown>, options?: ErrorOptions) {\n super(message, locator, data, options);\n this.name = 'AppError';\n }\n}\n\n// Thrown when an API request fails\nexport class APIError extends DPUseError {\n constructor(message: string, locator: string, data?: Record<string, unknown>, options?: ErrorOptions) {\n super(message, locator, data, options);\n this.name = 'APIError';\n }\n}\n\n// Thrown when an engine request fails\nexport class EngineError extends DPUseError {\n constructor(message: string, locator: string, data?: Record<string, unknown>, options?: ErrorOptions) {\n super(message, locator, data, options);\n this.name = 'EngineError';\n }\n}\n\n// Thrown when an connector operation fails; will always be wrapped in an engine error\nexport class ConnectorError extends DPUseError {\n constructor(message: string, locator: string, data?: Record<string, unknown>, options?: ErrorOptions) {\n super(message, locator, data, options);\n this.name = 'ConnectorError';\n }\n}\n\n// Thrown when an HTTP request fails; may include a sanitized portion of the response body for diagnostic purposes\nexport class FetchError extends DPUseError {\n constructor(message: string, locator: string, data?: Record<string, unknown>, options?: ErrorOptions) {\n super(message, locator, data, options);\n this.name = 'FetchError';\n }\n}\n\n// ── Actions ──────────────────────────────────────────────────────────────────────────────────────────────────────────\n\n// Builds a fetch error from an HTTP response; includes a text copy of the response body\nexport async function buildFetchError(response: { status: number; statusText: string; text: () => Promise<string> }, message: string, locator: string): Promise<FetchError> {\n const responseStatusStuff = ` - ${response.statusText}`;\n const fetchMessage = `${message} Response status '${String(response.status)}${response.statusText ? responseStatusStuff : ''}' received.`;\n let bodyText: string;\n try {\n bodyText = await response.text();\n } catch (error) {\n const normalised = normalizeToError(error);\n bodyText = `<body unavailable: ${normalised.message}>`;\n }\n return new FetchError(fetchMessage, locator, { body: sanitizeResponseErrorBody(bodyText) });\n}\n\n// Concatenates serialized error messages into a single string\nexport function concatenateSerialisedErrorMessages(serialisedErrors: SerialisedError[]): string {\n return serialisedErrors.map((serialisedError) => serialisedError.message).join(' ');\n}\n\n// Ignore best-effort cleanup errors to keep teardown noise-free\nexport function ignoreErrors(action: () => void): void {\n try {\n action();\n } catch {\n // Intentionally ignore errors\n }\n}\n\n// Normalizes an unknown thrown value into an error\nexport function normalizeToError(value: unknown): Error {\n if (value instanceof Error) return value;\n if (typeof value === 'string') return new Error(value);\n if (typeof value === 'number' || typeof value === 'boolean' || typeof value === 'bigint') return new Error(String(value));\n if (typeof value === 'symbol') return new Error(value.description ?? 'Unknown error');\n if (typeof value === 'object') {\n try {\n return new Error(JSON.stringify(value));\n } catch {\n return new Error('Unknown error');\n }\n }\n return new Error('Unknown error');\n}\n\n// Serializes an error and its cause chain into a array of serialised error objects;\n// errors are ordered from outermost to root cause;\n// cycles in the cause chain are safely ignored;\n// messages are normalized to end with punctuation\nexport function serialiseError(error?: unknown): SerialisedError[] {\n const seenCauses = new Set();\n const serialisedErrors: SerialisedError[] = [];\n let cause: Error | null = normalizeToError(error);\n while (cause != null && !seenCauses.has(cause)) {\n seenCauses.add(cause);\n const [serialisedError, nextCause] = serialiseSingleError(cause);\n if (!/(?:\\.{3}|[.!?])$/.test(serialisedError.message)) serialisedError.message += '.';\n serialisedErrors.push(serialisedError);\n cause = nextCause;\n }\n return serialisedErrors;\n}\n\n// Unserialises an array of serialised error objects back into an error with a cause chain;\n// reconstructs the appropriate error class based on serialized properties;\n// chains errors from outermost to root cause using the `cause` option;\n// returns a placeholder error if the input array is empty\nexport function unserialiseError(serialisedErrors: SerialisedError[]): Error {\n // Build the error chain from root cause (end) to outermost (start)\n let rebuiltError: Error | undefined;\n for (const serialised of serialisedErrors.toReversed()) {\n const error = reconstructError(serialised, rebuiltError);\n if (serialised.stack !== undefined) error.stack = serialised.stack; // Restore stack trace if available\n rebuiltError = error;\n }\n return rebuiltError ?? new Error('No error to unserialise.');\n}\n\n// ── Helpers ──────────────────────────────────────────────────────────────────────────────────────────────────────────\n\n// Builds a fallback message for non-error throwables\nfunction buildFallbackMessage(cause: unknown): string {\n let fallbackMessage: string;\n try {\n fallbackMessage = JSON.stringify(cause);\n } catch {\n if (typeof cause === 'symbol') fallbackMessage = cause.description ?? 'Unknown error';\n else if (typeof cause === 'bigint') fallbackMessage = cause.toString();\n else fallbackMessage = 'Unknown error';\n }\n if (fallbackMessage === '') fallbackMessage = 'Unknown error';\n return fallbackMessage;\n}\n\nfunction reconstructError(serialised: SerialisedError, cause: Error | undefined): Error {\n switch (serialised.name) {\n case 'APIError':\n return new APIError(serialised.message, serialised.locator, serialised.data, { cause });\n case 'AppError':\n return new AppError(serialised.message, serialised.locator, serialised.data, { cause });\n case 'ConnectorError':\n return new ConnectorError(serialised.message, serialised.locator, serialised.data, { cause });\n case 'EngineError':\n return new EngineError(serialised.message, serialised.locator, serialised.data, { cause });\n case 'FetchError':\n return new FetchError(serialised.message, serialised.locator, serialised.data, { cause });\n default: {\n const name = serialised.name;\n return new (class extends Error {\n override name = name;\n })(serialised.message, { cause });\n }\n }\n}\n\n// Sanitizes a response body; limits body size to avoid excessive payloads when logging\nfunction sanitizeResponseErrorBody(body?: string): string | undefined {\n if (body == null || body === '') return undefined;\n return body.length > RESPONSE_ERROR_BODY_LIMIT ? `${body.slice(0, RESPONSE_ERROR_BODY_LIMIT)}... [truncated]` : body;\n}\n\nfunction serialiseSingleError(cause: Error): [SerialisedError, Error | null] {\n const nextCause = cause.cause == null ? null : normalizeToError(cause.cause);\n if (cause instanceof DPUseError) {\n return [{ data: cause.data, locator: cause.locator, message: cause.message, name: cause.name, stack: cause.stack }, nextCause];\n }\n const customProperties = Object.fromEntries(Object.entries(cause).filter(([k]) => k !== 'cause'));\n return cause.name\n ? [{ data: customProperties, locator: '', message: cause.message, name: cause.name, stack: cause.stack }, nextCause]\n : [{ data: customProperties, locator: '', message: buildFallbackMessage(cause), name: 'Error', stack: undefined }, null];\n}\n"],"mappings":";AAaA,IAAM,IAA4B,MAKrB,IAAb,cAAgC,MAAM;CAClC;CACA;CACA,YAAY,GAAiB,GAAiB,GAAgC,GAAwB;EAIlG,AAHA,MAAM,GAAS,CAAO,GACtB,KAAK,OAAO,cACZ,KAAK,OAAO,GACZ,KAAK,UAAU;CACnB;AACJ,GAG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AM,EAAM;EAAM,OAAO,EAAM;CAAM,GAAG,CAAS,IACjH,CAAC;EAAE,MAAM;EAAkB,SAAS;EAAI,SAAS,EAAqB,CAAK;EAAG,MAAM;EAAS,OAAO,KAAA;CAAU,GAAG,IAAI;AAC/H"}
|
|
1
|
+
{"version":3,"file":"dpuse-shared-errors.es.js","names":[],"sources":["../src/errors/index.ts"],"sourcesContent":["// ── Types ────────────────────────────────────────────────────────────────────────────────────────────────────────────\n\n// Serializable representation of an error; used for transporting errors across api and worker boundaries\nexport interface SerialisedError {\n data: Record<string, unknown> | undefined;\n locator: string; // Error locator 'package.module.method'\n message: string; // Human-readable error message\n name: string; // Error class or type name\n stack: string | undefined; // Stack trace if available\n}\n\n// ── Constants ───────────────────────────────────────────────────────────────────────────────────────────────────────\n\nconst RESPONSE_ERROR_BODY_LIMIT = 2048;\n\n// Redaction — serialised errors are shown in the browser and stored in Axiom, so secrets and email addresses are masked\n// first. Best effort: it catches the common shapes, not every possible secret.\nconst REDACTED = '[REDACTED]';\nconst REDACTION_MAX_DEPTH = 10; // Deeper 'data' is replaced whole rather than walked.\nconst SECRET_KEY_PATTERN = /api[-_]?key|authori[sz]ation|cookie|credential|passw(?:or)?d|private[-_]?key|secret|token/i; // A 'data' field whose name matches has its whole value masked.\n// Each pattern is anchored to the start of a word, so it runs in linear time even over a long response body.\nconst SECRET_TEXT_PATTERNS: [RegExp, (match: string, ...groups: string[]) => string][] = [\n [/\\b(Bearer|Basic) +[\\w.~+/=-]+/gi, (_match, scheme) => `${scheme} ${REDACTED}`], // Authorisation header values.\n // Any 'name: value' or 'name=value' pair, in JSON, query strings, form bodies or headers; masked when the name looks\n // secret. A bare 'Basic' or 'Bearer' value is the scheme left by the pattern above, whose token is already masked.\n [\n /(?<![\\w-])([\\w-]+)([\"']?[ \\t]*[:=][ \\t]*[\"']?)([^\\s\"'&,;}?#]+)/g,\n (match, name, separator, value) => (SECRET_KEY_PATTERN.test(name) && !/^(?:Basic|Bearer)$/i.test(value) ? `${name}${separator}${REDACTED}` : match)\n ],\n [/\\beyJ[\\w-]+\\.[\\w-]+\\.[\\w-]*/g, () => REDACTED], // JSON web tokens.\n [/\\b(?:sk-|xaat-|xapt-|sl\\.)[\\w-]{16,}/g, () => REDACTED], // Known token prefixes: OpenAI, Anthropic, Axiom, Dropbox.\n [/(?<![\\w.+-])[\\w.+-]+@[\\w-]+\\.[\\w.-]+/g, () => REDACTED] // Email addresses.\n];\n\n// ── Errors ───────────────────────────────────────────────────────────────────────────────────────────────────────────\n\n// Base class for all DPUse errors; includes a locator for the error; never thrown directly\nexport class DPUseError extends Error {\n readonly data: Record<string, unknown> | undefined;\n readonly locator: string; // Error locator 'package.module.method'\n constructor(message: string, locator: string, data?: Record<string, unknown>, options?: ErrorOptions) {\n super(message, options);\n this.name = 'DPUseError';\n this.data = data;\n this.locator = locator;\n }\n}\n\n// Thrown when an app (studio/assistant) error occurs\nexport class AppError extends DPUseError {\n constructor(message: string, locator: string, data?: Record<string, unknown>, options?: ErrorOptions) {\n super(message, locator, data, options);\n this.name = 'AppError';\n }\n}\n\n// Thrown when an API request fails\nexport class APIError extends DPUseError {\n constructor(message: string, locator: string, data?: Record<string, unknown>, options?: ErrorOptions) {\n super(message, locator, data, options);\n this.name = 'APIError';\n }\n}\n\n// Thrown when an engine request fails\nexport class EngineError extends DPUseError {\n constructor(message: string, locator: string, data?: Record<string, unknown>, options?: ErrorOptions) {\n super(message, locator, data, options);\n this.name = 'EngineError';\n }\n}\n\n// Thrown when an connector operation fails; will always be wrapped in an engine error\nexport class ConnectorError extends DPUseError {\n constructor(message: string, locator: string, data?: Record<string, unknown>, options?: ErrorOptions) {\n super(message, locator, data, options);\n this.name = 'ConnectorError';\n }\n}\n\n// Thrown when an HTTP request fails; may include a sanitized portion of the response body for diagnostic purposes\nexport class FetchError extends DPUseError {\n constructor(message: string, locator: string, data?: Record<string, unknown>, options?: ErrorOptions) {\n super(message, locator, data, options);\n this.name = 'FetchError';\n }\n}\n\n// ── Actions ──────────────────────────────────────────────────────────────────────────────────────────────────────────\n\n// Builds a fetch error from an HTTP response; includes a text copy of the response body\nexport async function buildFetchError(response: { status: number; statusText: string; text: () => Promise<string> }, message: string, locator: string): Promise<FetchError> {\n const responseStatusStuff = ` - ${response.statusText}`;\n const fetchMessage = `${message} Response status '${String(response.status)}${response.statusText ? responseStatusStuff : ''}' received.`;\n let bodyText: string;\n try {\n bodyText = await response.text();\n } catch (error) {\n const normalised = normalizeToError(error);\n bodyText = `<body unavailable: ${normalised.message}>`;\n }\n return new FetchError(fetchMessage, locator, { body: sanitizeResponseErrorBody(bodyText) });\n}\n\n// Concatenates serialized error messages into a single string\nexport function concatenateSerialisedErrorMessages(serialisedErrors: SerialisedError[]): string {\n return serialisedErrors.map((serialisedError) => serialisedError.message).join(' ');\n}\n\n// Ignore best-effort cleanup errors to keep teardown noise-free\nexport function ignoreErrors(action: () => void): void {\n try {\n action();\n } catch {\n // Intentionally ignore errors\n }\n}\n\n// Normalizes an unknown thrown value into an error\nexport function normalizeToError(value: unknown): Error {\n if (value instanceof Error) return value;\n if (typeof value === 'string') return new Error(value);\n if (typeof value === 'number' || typeof value === 'boolean' || typeof value === 'bigint') return new Error(String(value));\n if (typeof value === 'symbol') return new Error(value.description ?? 'Unknown error');\n if (typeof value === 'object') {\n try {\n return new Error(JSON.stringify(value));\n } catch {\n return new Error('Unknown error');\n }\n }\n return new Error('Unknown error');\n}\n\n// Serializes an error and its cause chain into a array of serialised error objects;\n// errors are ordered from outermost to root cause;\n// cycles in the cause chain are safely ignored;\n// messages are normalized to end with punctuation;\n// secrets and email addresses in messages, stacks and data are redacted\nexport function serialiseError(error?: unknown): SerialisedError[] {\n const seenCauses = new Set();\n const serialisedErrors: SerialisedError[] = [];\n let cause: Error | null = normalizeToError(error);\n while (cause != null && !seenCauses.has(cause)) {\n seenCauses.add(cause);\n const [serialisedError, nextCause] = serialiseSingleError(cause);\n if (!/(?:\\.{3}|[.!?])$/.test(serialisedError.message)) serialisedError.message += '.';\n serialisedErrors.push(redactSerialisedError(serialisedError));\n cause = nextCause;\n }\n return serialisedErrors;\n}\n\n// Unserialises an array of serialised error objects back into an error with a cause chain;\n// reconstructs the appropriate error class based on serialized properties;\n// chains errors from outermost to root cause using the `cause` option;\n// returns a placeholder error if the input array is empty\nexport function unserialiseError(serialisedErrors: SerialisedError[]): Error {\n // Build the error chain from root cause (end) to outermost (start)\n let rebuiltError: Error | undefined;\n for (const serialised of serialisedErrors.toReversed()) {\n const error = reconstructError(serialised, rebuiltError);\n if (serialised.stack !== undefined) error.stack = serialised.stack; // Restore stack trace if available\n rebuiltError = error;\n }\n return rebuiltError ?? new Error('No error to unserialise.');\n}\n\n// ── Helpers ──────────────────────────────────────────────────────────────────────────────────────────────────────────\n\n// Builds a fallback message for non-error throwables\nfunction buildFallbackMessage(cause: unknown): string {\n let fallbackMessage: string;\n try {\n fallbackMessage = JSON.stringify(cause);\n } catch {\n if (typeof cause === 'symbol') fallbackMessage = cause.description ?? 'Unknown error';\n else if (typeof cause === 'bigint') fallbackMessage = cause.toString();\n else fallbackMessage = 'Unknown error';\n }\n if (fallbackMessage === '') fallbackMessage = 'Unknown error';\n return fallbackMessage;\n}\n\nfunction reconstructError(serialised: SerialisedError, cause: Error | undefined): Error {\n switch (serialised.name) {\n case 'APIError':\n return new APIError(serialised.message, serialised.locator, serialised.data, { cause });\n case 'AppError':\n return new AppError(serialised.message, serialised.locator, serialised.data, { cause });\n case 'ConnectorError':\n return new ConnectorError(serialised.message, serialised.locator, serialised.data, { cause });\n case 'EngineError':\n return new EngineError(serialised.message, serialised.locator, serialised.data, { cause });\n case 'FetchError':\n return new FetchError(serialised.message, serialised.locator, serialised.data, { cause });\n default: {\n const name = serialised.name;\n return new (class extends Error {\n override name = name;\n })(serialised.message, { cause });\n }\n }\n}\n\nfunction redactSerialisedError(serialisedError: SerialisedError): SerialisedError {\n const { data, message, stack } = serialisedError;\n return {\n ...serialisedError,\n data: data === undefined ? undefined : (redactValue(data, new WeakSet(), 0) as Record<string, unknown>),\n message: redactText(message),\n stack: stack === undefined ? undefined : redactText(stack)\n };\n}\n\nfunction redactText(text: string): string {\n let redactedText = text;\n for (const [pattern, replacement] of SECRET_TEXT_PATTERNS)\n redactedText = redactedText.replaceAll(pattern, (match: string, ...groups: string[]) => replacement(match, ...groups));\n return redactedText;\n}\n\n// Walks 'data', masking any field whose name looks secret and any secret found in text.\nfunction redactValue(value: unknown, seen: WeakSet<object>, depth: number): unknown {\n if (typeof value === 'string') return redactText(value);\n if (typeof value !== 'object' || value === null) return value;\n if (depth >= REDACTION_MAX_DEPTH) return REDACTED;\n if (seen.has(value)) return '[Circular]';\n seen.add(value);\n return Array.isArray(value)\n ? value.map((item) => redactValue(item, seen, depth + 1))\n : Object.fromEntries(\n Object.entries(value).map(([key, entryValue]) => [key, entryValue != null && SECRET_KEY_PATTERN.test(key) ? REDACTED : redactValue(entryValue, seen, depth + 1)])\n );\n}\n\n// Sanitizes a response body; limits body size to avoid excessive payloads when logging\nfunction sanitizeResponseErrorBody(body?: string): string | undefined {\n if (body == null || body === '') return undefined;\n return body.length > RESPONSE_ERROR_BODY_LIMIT ? `${body.slice(0, RESPONSE_ERROR_BODY_LIMIT)}... [truncated]` : body;\n}\n\nfunction serialiseSingleError(cause: Error): [SerialisedError, Error | null] {\n const nextCause = cause.cause == null ? null : normalizeToError(cause.cause);\n if (cause instanceof DPUseError) {\n return [{ data: cause.data, locator: cause.locator, message: cause.message, name: cause.name, stack: cause.stack }, nextCause];\n }\n const customProperties = Object.fromEntries(Object.entries(cause).filter(([k]) => k !== 'cause'));\n return cause.name\n ? [{ data: customProperties, locator: '', message: cause.message, name: cause.name, stack: cause.stack }, nextCause]\n : [{ data: customProperties, locator: '', message: buildFallbackMessage(cause), name: 'Error', stack: undefined }, null];\n}\n"],"mappings":";AAaA,IAAM,IAA4B,MAI5B,IAAW,cAEX,IAAqB,8FAErB,IAAmF;CACrF,CAAC,oCAAoC,GAAQ,MAAW,GAAG,EAAO,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O,CAAC;CAChG,OAAO,EAAM,OACP,CAAC;EAAE,MAAM;EAAkB,SAAS;EAAI,SAAS,EAAM;EAAS,MAAM,EAAM;EAAM,OAAO,EAAM;CAAM,GAAG,CAAS,IACjH,CAAC;EAAE,MAAM;EAAkB,SAAS;EAAI,SAAS,EAAqB,CAAK;EAAG,MAAM;EAAS,OAAO,KAAA;CAAU,GAAG,IAAI;AAC/H"}
|
|
@@ -9,7 +9,7 @@ export declare const connectorCategoryConfigSchema: import('valibot').StrictObje
|
|
|
9
9
|
readonly es: import('valibot').StringSchema<undefined>;
|
|
10
10
|
}, undefined>;
|
|
11
11
|
}, undefined>;
|
|
12
|
-
export declare const connectorUsageIdSchema: import('valibot').UnionSchema<readonly [import('valibot').LiteralSchema<"bidirectional", undefined>, import('valibot').LiteralSchema<"destination", undefined>, import('valibot').LiteralSchema<"source", undefined>], undefined>;
|
|
12
|
+
export declare const connectorUsageIdSchema: import('valibot').UnionSchema<readonly [import('valibot').LiteralSchema<"bidirectional", undefined>, import('valibot').LiteralSchema<"destination", undefined>, import('valibot').LiteralSchema<"source", undefined>, import('valibot').LiteralSchema<"unknown", undefined>], undefined>;
|
|
13
13
|
export declare const connectorUsageConfigSchema: import('valibot').StrictObjectSchema<{
|
|
14
14
|
readonly label: import('valibot').StrictObjectSchema<{
|
|
15
15
|
readonly en: import('valibot').StringSchema<undefined>;
|
|
@@ -44,7 +44,7 @@ export declare const connectorConfigSchema: import('valibot').StrictObjectSchema
|
|
|
44
44
|
readonly es: import('valibot').StringSchema<undefined>;
|
|
45
45
|
}, undefined>;
|
|
46
46
|
}, undefined>, undefined>;
|
|
47
|
-
readonly usageId: import('valibot').NullableSchema<import('valibot').UnionSchema<readonly [import('valibot').LiteralSchema<"bidirectional", undefined>, import('valibot').LiteralSchema<"destination", undefined>, import('valibot').LiteralSchema<"source", undefined>], undefined>, undefined>;
|
|
47
|
+
readonly usageId: import('valibot').NullableSchema<import('valibot').UnionSchema<readonly [import('valibot').LiteralSchema<"bidirectional", undefined>, import('valibot').LiteralSchema<"destination", undefined>, import('valibot').LiteralSchema<"source", undefined>, import('valibot').LiteralSchema<"unknown", undefined>], undefined>, undefined>;
|
|
48
48
|
readonly vendorAccountURL: import('valibot').NullableSchema<import('valibot').StringSchema<undefined>, undefined>;
|
|
49
49
|
readonly vendorDocumentationURL: import('valibot').NullableSchema<import('valibot').StringSchema<undefined>, undefined>;
|
|
50
50
|
readonly vendorHomeURL: import('valibot').NullableSchema<import('valibot').StringSchema<undefined>, undefined>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dpuse/dpuse-shared",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.829",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Common constants, types and utilities used across all DPUse projects.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -170,10 +170,10 @@
|
|
|
170
170
|
"valibot": "^1.5.0"
|
|
171
171
|
},
|
|
172
172
|
"devDependencies": {
|
|
173
|
-
"@dpuse/dpuse-development": "^0.3.
|
|
174
|
-
"@dpuse/eslint-config-dpuse": "^1.0.
|
|
173
|
+
"@dpuse/dpuse-development": "^0.3.723",
|
|
174
|
+
"@dpuse/eslint-config-dpuse": "^1.0.123",
|
|
175
175
|
"@types/node": "^26.6.2",
|
|
176
|
-
"@vitest/coverage-v8": "^5.0.
|
|
176
|
+
"@vitest/coverage-v8": "^5.0.2",
|
|
177
177
|
"eslint": "^10.11.0",
|
|
178
178
|
"fallow": "^3.28.0",
|
|
179
179
|
"prettier": "^3.9.9",
|
|
@@ -181,6 +181,6 @@
|
|
|
181
181
|
"typescript": "^6.0.3",
|
|
182
182
|
"vite": "^8.3.1",
|
|
183
183
|
"vite-plugin-dts": "^5.1.1",
|
|
184
|
-
"vitest": "^5.0.
|
|
184
|
+
"vitest": "^5.0.2"
|
|
185
185
|
}
|
|
186
186
|
}
|