@ai-matrx/associations 0.14.79 → 0.14.80
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/CHANGELOG.md +11 -1
- package/dist/{CommentThread-iSMK-0Lb.d.cts → CommentThread-BKGU9jR-.d.cts} +7 -0
- package/dist/{CommentThread-iSMK-0Lb.d.ts → CommentThread-BKGU9jR-.d.ts} +7 -0
- package/dist/core/index.cjs +13 -5
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +2 -6
- package/dist/core/index.d.ts +2 -6
- package/dist/core/index.js +13 -5
- package/dist/core/index.js.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/react/index.cjs +18 -1
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +9 -3
- package/dist/react/index.d.ts +9 -3
- package/dist/react/index.js +18 -1
- package/dist/react/index.js.map +1 -1
- package/dist/react/lazy/index.d.cts +1 -1
- package/dist/react/lazy/index.d.ts +1 -1
- package/dist/{results-DS6_WIIP.d.cts → results-DFj4RsFJ.d.cts} +7 -0
- package/dist/{results-DS6_WIIP.d.ts → results-DFj4RsFJ.d.ts} +7 -0
- package/package.json +3 -3
package/dist/core/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as EntityOverlayMap, a as EntityTypeToken, b as EntityOverlayEntry, c as ErrorSink, A as AssociationsRpcError, d as AssociationsDataSource, e as AssociationsIdentity, f as AssociationTargetType, g as AssociationsRpcResult, h as AssociationEdge, i as AssociationTargetEdge, j as AssociationSourceEdge, C as CategoryDimension, P as PlatformCategory, U as UserStateKind, k as UserEntityState, l as CommentAnchor, m as PlatformComment, n as AssociationsEntry, o as CategoriesEntry, p as CommentsEntry, q as AssociationsConfig } from '../results-
|
|
1
|
+
import { E as EntityOverlayMap, a as EntityTypeToken, b as EntityOverlayEntry, c as ErrorSink, A as AssociationsRpcError, d as AssociationsDataSource, e as AssociationsIdentity, f as AssociationTargetType, g as AssociationsRpcResult, h as AssociationEdge, i as AssociationTargetEdge, j as AssociationSourceEdge, C as CategoryDimension, P as PlatformCategory, U as UserStateKind, k as UserEntityState, l as CommentAnchor, m as PlatformComment, n as AssociationsEntry, o as CategoriesEntry, p as CommentsEntry, q as AssociationsConfig } from '../results-DFj4RsFJ.cjs';
|
|
2
2
|
import 'react';
|
|
3
3
|
import '@ai-matrx/data/db';
|
|
4
4
|
|
|
@@ -110,11 +110,7 @@ interface RpcResultHelpers {
|
|
|
110
110
|
mapPgError: PgErrorMapper;
|
|
111
111
|
mapPgErrorPair: PgErrorPairMapper;
|
|
112
112
|
}
|
|
113
|
-
|
|
114
|
-
* Bind the loud funnel to the host's errorSink. Every failure in this
|
|
115
|
-
* package's services passes through the returned `mapPgError` exactly once.
|
|
116
|
-
*/
|
|
117
|
-
declare function createRpcResultHelpers(errorSink: ErrorSink): RpcResultHelpers;
|
|
113
|
+
declare function createRpcResultHelpers(errorSink: ErrorSink, sessionAttached?: () => boolean): RpcResultHelpers;
|
|
118
114
|
|
|
119
115
|
interface CoreDeps {
|
|
120
116
|
dataSource: AssociationsDataSource;
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as EntityOverlayMap, a as EntityTypeToken, b as EntityOverlayEntry, c as ErrorSink, A as AssociationsRpcError, d as AssociationsDataSource, e as AssociationsIdentity, f as AssociationTargetType, g as AssociationsRpcResult, h as AssociationEdge, i as AssociationTargetEdge, j as AssociationSourceEdge, C as CategoryDimension, P as PlatformCategory, U as UserStateKind, k as UserEntityState, l as CommentAnchor, m as PlatformComment, n as AssociationsEntry, o as CategoriesEntry, p as CommentsEntry, q as AssociationsConfig } from '../results-
|
|
1
|
+
import { E as EntityOverlayMap, a as EntityTypeToken, b as EntityOverlayEntry, c as ErrorSink, A as AssociationsRpcError, d as AssociationsDataSource, e as AssociationsIdentity, f as AssociationTargetType, g as AssociationsRpcResult, h as AssociationEdge, i as AssociationTargetEdge, j as AssociationSourceEdge, C as CategoryDimension, P as PlatformCategory, U as UserStateKind, k as UserEntityState, l as CommentAnchor, m as PlatformComment, n as AssociationsEntry, o as CategoriesEntry, p as CommentsEntry, q as AssociationsConfig } from '../results-DFj4RsFJ.js';
|
|
2
2
|
import 'react';
|
|
3
3
|
import '@ai-matrx/data/db';
|
|
4
4
|
|
|
@@ -110,11 +110,7 @@ interface RpcResultHelpers {
|
|
|
110
110
|
mapPgError: PgErrorMapper;
|
|
111
111
|
mapPgErrorPair: PgErrorPairMapper;
|
|
112
112
|
}
|
|
113
|
-
|
|
114
|
-
* Bind the loud funnel to the host's errorSink. Every failure in this
|
|
115
|
-
* package's services passes through the returned `mapPgError` exactly once.
|
|
116
|
-
*/
|
|
117
|
-
declare function createRpcResultHelpers(errorSink: ErrorSink): RpcResultHelpers;
|
|
113
|
+
declare function createRpcResultHelpers(errorSink: ErrorSink, sessionAttached?: () => boolean): RpcResultHelpers;
|
|
118
114
|
|
|
119
115
|
interface CoreDeps {
|
|
120
116
|
dataSource: AssociationsDataSource;
|
package/dist/core/index.js
CHANGED
|
@@ -148,7 +148,9 @@ function readPgFields(e) {
|
|
|
148
148
|
}
|
|
149
149
|
return { pgCode: null, pgMessage: null, pgHint: void 0 };
|
|
150
150
|
}
|
|
151
|
-
|
|
151
|
+
var SIGNED_OUT_LEAD = "You're signed out";
|
|
152
|
+
var SIGNED_OUT_MESSAGE = `${SIGNED_OUT_LEAD}. Sign in again \u2014 your text is kept here.`;
|
|
153
|
+
function createRpcResultHelpers(errorSink, sessionAttached) {
|
|
152
154
|
function mapPgError(e) {
|
|
153
155
|
const { pgCode, pgMessage, pgHint } = readPgFields(e);
|
|
154
156
|
if (pgCode === "PGRST202") {
|
|
@@ -181,10 +183,13 @@ function createRpcResultHelpers(errorSink) {
|
|
|
181
183
|
}
|
|
182
184
|
if (pgCode === "PGRST116")
|
|
183
185
|
return { code: "not_found", message: "Not found" };
|
|
184
|
-
if (pgCode === "
|
|
186
|
+
if (pgCode === "PGRST301" || pgCode === "PGRST303" || pgCode === "28000")
|
|
187
|
+
return { code: "unauthorized", message: SIGNED_OUT_MESSAGE };
|
|
188
|
+
if (pgCode === "42501") {
|
|
189
|
+
const anonymous = /permission denied for function/i.test(pgMessage ?? "") && !(sessionAttached?.() ?? false);
|
|
190
|
+
if (anonymous) return { code: "unauthorized", message: SIGNED_OUT_MESSAGE };
|
|
185
191
|
return { code: "forbidden_org", message: "Permission denied" };
|
|
186
|
-
|
|
187
|
-
return { code: "unauthorized", message: "Your session expired" };
|
|
192
|
+
}
|
|
188
193
|
if (pgCode === "57014") {
|
|
189
194
|
const out2 = {
|
|
190
195
|
code: "internal",
|
|
@@ -1728,7 +1733,10 @@ function createAssociationsStore(config) {
|
|
|
1728
1733
|
identity: config.identity,
|
|
1729
1734
|
errorSink,
|
|
1730
1735
|
guards: createAssociationGuards(errorSink),
|
|
1731
|
-
rpc: createRpcResultHelpers(
|
|
1736
|
+
rpc: createRpcResultHelpers(
|
|
1737
|
+
errorSink,
|
|
1738
|
+
config.identity.sessionAttached ? () => config.identity.sessionAttached() : void 0
|
|
1739
|
+
),
|
|
1732
1740
|
registry
|
|
1733
1741
|
};
|
|
1734
1742
|
const associations = createAssociationsService(deps);
|