@ryuzaki13/react-foundation-api 1.1.2 → 1.1.3
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.
|
@@ -17,7 +17,7 @@ export type ErrorReportDeliveryContext = {
|
|
|
17
17
|
export type ErrorReportDeliveryAdapter = (body: ErrorReportDeliveryBody, context: ErrorReportDeliveryContext) => Promise<void>;
|
|
18
18
|
export interface SendErrorReportOptions {
|
|
19
19
|
adapter: ErrorReportDeliveryAdapter;
|
|
20
|
-
queryClient
|
|
20
|
+
queryClient: QueryClient;
|
|
21
21
|
}
|
|
22
22
|
export declare function createErrorReportDeliveryBody(draft: ErrorReportDraft): ErrorReportDeliveryBody;
|
|
23
23
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errorReport.d.ts","sourceRoot":"","sources":["../../src/error-report/errorReport.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,MAAM,8CAA8C,CAAC;AAEtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,MAAM,MAAM,uBAAuB,GAAG;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACxC,KAAK,EAAE,gBAAgB,CAAC;IACxB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,CAAC,IAAI,EAAE,uBAAuB,EAAE,OAAO,EAAE,0BAA0B,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAE/H,MAAM,WAAW,sBAAsB;IACtC,OAAO,EAAE,0BAA0B,CAAC;IACpC,WAAW,
|
|
1
|
+
{"version":3,"file":"errorReport.d.ts","sourceRoot":"","sources":["../../src/error-report/errorReport.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,MAAM,8CAA8C,CAAC;AAEtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,MAAM,MAAM,uBAAuB,GAAG;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACxC,KAAK,EAAE,gBAAgB,CAAC;IACxB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,CAAC,IAAI,EAAE,uBAAuB,EAAE,OAAO,EAAE,0BAA0B,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAE/H,MAAM,WAAW,sBAAsB;IACtC,OAAO,EAAE,0BAA0B,CAAC;IACpC,WAAW,EAAE,WAAW,CAAC;CACzB;AAED,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,gBAAgB,GAAG,uBAAuB,CAW9F;AAED;;;GAGG;AACH,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAoB9H"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/error-report/errorReport.ts"],"sourcesContent":["import {\n\tcreateErrorInfo,\n\tgetErrorReportDraft,\n\tupdateErrorReportDraft,\n\ttype ErrorReportCategory,\n\ttype ErrorReportDraft\n} from \"@ryuzaki13/react-foundation-lib/error-report\";\n\nimport type { QueryClient } from \"@tanstack/react-query\";\n\nexport type ErrorReportDeliveryBody = {\n\treportId: string;\n\tsessionId: string;\n\tcreatedUtc: string;\n\tcategory: ErrorReportCategory;\n\terrorClass: string;\n\terrorMessage: string;\n\tstackTrace?: string;\n\tpayload: string;\n};\n\nexport type ErrorReportDeliveryContext = {\n\tdraft: ErrorReportDraft;\n\tqueryClient?: QueryClient;\n};\n\nexport type ErrorReportDeliveryAdapter = (body: ErrorReportDeliveryBody, context: ErrorReportDeliveryContext) => Promise<void>;\n\nexport interface SendErrorReportOptions {\n\tadapter: ErrorReportDeliveryAdapter;\n\tqueryClient
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/error-report/errorReport.ts"],"sourcesContent":["import {\n\tcreateErrorInfo,\n\tgetErrorReportDraft,\n\tupdateErrorReportDraft,\n\ttype ErrorReportCategory,\n\ttype ErrorReportDraft\n} from \"@ryuzaki13/react-foundation-lib/error-report\";\n\nimport type { QueryClient } from \"@tanstack/react-query\";\n\nexport type ErrorReportDeliveryBody = {\n\treportId: string;\n\tsessionId: string;\n\tcreatedUtc: string;\n\tcategory: ErrorReportCategory;\n\terrorClass: string;\n\terrorMessage: string;\n\tstackTrace?: string;\n\tpayload: string;\n};\n\nexport type ErrorReportDeliveryContext = {\n\tdraft: ErrorReportDraft;\n\tqueryClient?: QueryClient;\n};\n\nexport type ErrorReportDeliveryAdapter = (body: ErrorReportDeliveryBody, context: ErrorReportDeliveryContext) => Promise<void>;\n\nexport interface SendErrorReportOptions {\n\tadapter: ErrorReportDeliveryAdapter;\n\tqueryClient: QueryClient;\n}\n\nexport function createErrorReportDeliveryBody(draft: ErrorReportDraft): ErrorReportDeliveryBody {\n\treturn {\n\t\treportId: draft.reportId,\n\t\tsessionId: draft.sessionId,\n\t\tcreatedUtc: draft.createdUtc,\n\t\tcategory: draft.category,\n\t\terrorClass: draft.payload.error.name,\n\t\terrorMessage: draft.payload.error.message,\n\t\tstackTrace: draft.payload.error.stackTrace,\n\t\tpayload: JSON.stringify(draft.payload)\n\t};\n}\n\n/**\n * Отправляет сохраненный черновик отчета через adapter, который задаёт приложение.\n * Shared API управляет жизненным циклом draft, но не выбирает transport и backend entity.\n */\nexport async function sendErrorReport(reportId: string, options: SendErrorReportOptions): Promise<ErrorReportDraft | undefined> {\n\tconst draft = getErrorReportDraft(reportId);\n\tif (!draft) return undefined;\n\tif (draft.status === \"sent\") return draft;\n\tif (draft.status === \"sending\") return draft;\n\n\tupdateErrorReportDraft(reportId, { status: \"sending\", failedReason: undefined });\n\n\ttry {\n\t\tawait options.adapter(createErrorReportDeliveryBody(draft), {\n\t\t\tdraft,\n\t\t\tqueryClient: options.queryClient\n\t\t});\n\n\t\treturn updateErrorReportDraft(reportId, { status: \"sent\", sentUtc: new Date().toISOString() });\n\t} catch (error) {\n\t\tconst info = createErrorInfo(error);\n\t\tupdateErrorReportDraft(reportId, { status: \"failed\", failedReason: info.message });\n\t\tthrow error;\n\t}\n}\n"],"mappings":";;AAiCA,SAAgB,EAA8B,GAAkD;CAC/F,OAAO;EACN,UAAU,EAAM;EAChB,WAAW,EAAM;EACjB,YAAY,EAAM;EAClB,UAAU,EAAM;EAChB,YAAY,EAAM,QAAQ,MAAM;EAChC,cAAc,EAAM,QAAQ,MAAM;EAClC,YAAY,EAAM,QAAQ,MAAM;EAChC,SAAS,KAAK,UAAU,EAAM,OAAO;CACtC;AACD;AAMA,eAAsB,EAAgB,GAAkB,GAAwE;CAC/H,IAAM,IAAQ,EAAoB,CAAQ;CACrC,OAEL;MADI,EAAM,WAAW,UACjB,EAAM,WAAW,WAAW,OAAO;EAEvC,EAAuB,GAAU;GAAE,QAAQ;GAAW,cAAc,KAAA;EAAU,CAAC;EAE/E,IAAI;GAMH,OALA,MAAM,EAAQ,QAAQ,EAA8B,CAAK,GAAG;IAC3D;IACA,aAAa,EAAQ;GACtB,CAAC,GAEM,EAAuB,GAAU;IAAE,QAAQ;IAAQ,0BAAS,IAAI,KAAK,EAAA,CAAE,YAAY;GAAE,CAAC;EAC9F,SAAS,GAAO;GAGf,MADA,EAAuB,GAAU;IAAE,QAAQ;IAAU,cADxC,EAAgB,CACsC,CAAA,CAAK;GAAQ,CAAC,GAC3E;EACP;CAfuC;AAgBxC"}
|