@payez/next-mvp 4.4.5 → 4.4.7
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 +10 -3
- package/dist/api/auth-handler.js +5 -3
- package/dist/api-handlers/account/change-password.js +33 -8
- package/dist/api-handlers/account/masked-info.js +2 -1
- package/dist/api-handlers/account/recovery/forward.d.ts +14 -0
- package/dist/api-handlers/account/recovery/forward.js +105 -0
- package/dist/api-handlers/account/recovery/initiate.js +4 -0
- package/dist/api-handlers/account/recovery/send-code.d.ts +12 -2
- package/dist/api-handlers/account/recovery/send-code.js +11 -84
- package/dist/api-handlers/account/recovery/verify-code.d.ts +11 -2
- package/dist/api-handlers/account/recovery/verify-code.js +10 -84
- package/dist/api-handlers/account/reset-password.js +24 -1
- package/dist/api-handlers/account/send-code.d.ts +1 -15
- package/dist/api-handlers/account/send-code.js +3 -6
- package/dist/api-handlers/account/update-phone.js +6 -1
- package/dist/api-handlers/account/validate-password.js +3 -1
- package/dist/api-handlers/account/verify-email.d.ts +1 -17
- package/dist/api-handlers/account/verify-email.js +4 -6
- package/dist/api-handlers/account/verify-sms.d.ts +1 -17
- package/dist/api-handlers/account/verify-sms.js +4 -6
- package/dist/api-handlers/admin/analytics.js +12 -4
- package/dist/api-handlers/admin/audit.js +12 -4
- package/dist/api-handlers/admin/redis-sessions.js +16 -8
- package/dist/api-handlers/admin/sessions.js +14 -6
- package/dist/api-handlers/admin/site-logs.js +39 -16
- package/dist/api-handlers/admin/stats.js +14 -4
- package/dist/api-handlers/admin/users.js +14 -6
- package/dist/api-handlers/admin/vibe-data.js +19 -11
- package/dist/api-handlers/auth/jwks.js +2 -1
- package/dist/api-handlers/auth/login.js +13 -4
- package/dist/api-handlers/auth/passkey-signin.js +6 -0
- package/dist/api-handlers/auth/refresh.js +38 -11
- package/dist/api-handlers/auth/signout.js +2 -1
- package/dist/api-handlers/auth/status.js +4 -1
- package/dist/api-handlers/auth/update-session.d.ts +25 -4
- package/dist/api-handlers/auth/update-session.js +38 -11
- package/dist/api-handlers/auth/validate.js +4 -2
- package/dist/api-handlers/auth/verify-code.js +3 -2
- package/dist/api-handlers/mfa/backup-code-verify.d.ts +1 -18
- package/dist/api-handlers/mfa/backup-code-verify.js +4 -6
- package/dist/api-handlers/mfa/backup-codes.js +2 -1
- package/dist/api-handlers/mfa/methods.js +2 -1
- package/dist/api-handlers/mfa/totp-confirm.js +2 -1
- package/dist/api-handlers/mfa/totp-enroll.js +2 -1
- package/dist/api-handlers/mfa/totp-verify.d.ts +1 -19
- package/dist/api-handlers/mfa/totp-verify.js +4 -6
- package/dist/api-handlers/passkeys/list.js +2 -1
- package/dist/api-handlers/passkeys/manage.js +2 -1
- package/dist/api-handlers/passkeys/register-options.js +2 -1
- package/dist/api-handlers/passkeys/register-verify.js +2 -1
- package/dist/api-handlers/session/refresh-viability.d.ts +4 -2
- package/dist/api-handlers/session/refresh-viability.js +10 -7
- package/dist/api-handlers/session/viability.js +4 -3
- package/dist/api-handlers/test/force-expire.js +5 -3
- package/dist/auth/auth-decision.js +2 -1
- package/dist/auth/better-auth.d.ts +58 -14
- package/dist/auth/better-auth.js +125 -54
- package/dist/auth/utils/idp-client.js +2 -1
- package/dist/client/better-auth-client.d.ts +101 -956
- package/dist/components/admin/DataBrowserTab.js +4 -1
- package/dist/components/admin/SessionsTab.js +9 -3
- package/dist/components/recovery/RequestedStep.d.ts +11 -0
- package/dist/components/recovery/RequestedStep.js +14 -0
- package/dist/components/recovery/SetPasswordStep.js +10 -1
- package/dist/config/env.d.ts +0 -2
- package/dist/config/env.js +0 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +8 -1
- package/dist/lib/app-slug.d.ts +21 -0
- package/dist/lib/app-slug.js +51 -0
- package/dist/lib/ensure-fresh-access-token.d.ts +26 -0
- package/dist/lib/ensure-fresh-access-token.js +105 -4
- package/dist/lib/idp-client-config.d.ts +20 -0
- package/dist/lib/idp-client-config.js +73 -45
- package/dist/lib/idp-fetch.js +1 -1
- package/dist/lib/never-in-response.d.ts +30 -0
- package/dist/lib/never-in-response.js +71 -0
- package/dist/lib/password-rules.d.ts +22 -0
- package/dist/lib/password-rules.js +43 -0
- package/dist/lib/safe-error-response.d.ts +67 -0
- package/dist/lib/safe-error-response.js +130 -0
- package/dist/lib/session-cookie-shape.d.ts +22 -19
- package/dist/lib/session-cookie-shape.js +14 -18
- package/dist/lib/session-store.d.ts +8 -1
- package/dist/lib/session-store.js +170 -24
- package/dist/lib/startup-init.d.ts +6 -0
- package/dist/lib/startup-init.js +30 -4
- package/dist/lib/token-lifecycle.js +2 -1
- package/dist/lib/token-log-id.d.ts +18 -0
- package/dist/lib/token-log-id.js +84 -0
- package/dist/lib/two-factor-verify-failure.d.ts +78 -0
- package/dist/lib/two-factor-verify-failure.js +220 -0
- package/dist/middleware/create-middleware.d.ts +4 -1
- package/dist/middleware/create-middleware.js +79 -8
- package/dist/pages/login/page.js +5 -0
- package/dist/pages/recovery/page.js +14 -4
- package/dist/pages/test-env/JwtInspectPage.js +7 -149
- package/dist/pages/test-env/RefreshTokenPage.js +4 -1
- package/dist/pages/test-env/redact-credentials.d.ts +6 -0
- package/dist/pages/test-env/redact-credentials.js +101 -0
- package/dist/pages/verify-code/page.js +6 -3
- package/dist/routes/auth/logout.d.ts +2 -1
- package/dist/routes/auth/logout.js +4 -2
- package/dist/routes/auth/session.d.ts +0 -3
- package/dist/routes/auth/session.js +16 -10
- package/dist/routes/auth/settings.js +4 -1
- package/dist/routes/auth/viability.d.ts +3 -2
- package/dist/routes/auth/viability.js +11 -7
- package/dist/server/auth.d.ts +36 -294
- package/dist/server/auth.js +32 -31
- package/dist/server/decode-session.js +15 -26
- package/dist/server/verified-session-token.d.ts +13 -0
- package/dist/server/verified-session-token.js +103 -0
- package/dist/stores/authStore.js +14 -3
- package/dist/types/recovery.d.ts +1 -1
- package/dist/utils/api.d.ts +18 -0
- package/dist/utils/api.js +51 -9
- package/dist/vibe/client.d.ts +132 -16
- package/dist/vibe/client.js +288 -82
- package/dist/vibe/document-unwrap.d.ts +50 -0
- package/dist/vibe/document-unwrap.js +78 -0
- package/dist/vibe/errors.d.ts +17 -0
- package/dist/vibe/errors.js +21 -1
- package/dist/vibe/generic.d.ts +2 -49
- package/dist/vibe/generic.js +17 -78
- package/dist/vibe/index.d.ts +1 -1
- package/dist/vibe/index.js +2 -1
- package/dist/vibe/sessions.js +2 -1
- package/package.json +13 -2
- package/scripts/verify-release-provenance.mjs +410 -0
- package/src/api/auth-handler.ts +5 -3
- package/src/api-handlers/account/change-password.ts +36 -8
- package/src/api-handlers/account/masked-info.ts +2 -1
- package/src/api-handlers/account/recovery/forward.ts +117 -0
- package/src/api-handlers/account/recovery/initiate.ts +3 -0
- package/src/api-handlers/account/recovery/send-code.ts +13 -99
- package/src/api-handlers/account/recovery/verify-code.ts +12 -99
- package/src/api-handlers/account/reset-password.ts +30 -1
- package/src/api-handlers/account/send-code.ts +3 -9
- package/src/api-handlers/account/update-phone.ts +6 -1
- package/src/api-handlers/account/validate-password.ts +3 -1
- package/src/api-handlers/account/verify-email.ts +4 -9
- package/src/api-handlers/account/verify-sms.ts +4 -9
- package/src/api-handlers/admin/analytics.ts +13 -5
- package/src/api-handlers/admin/audit.ts +13 -5
- package/src/api-handlers/admin/redis-sessions.ts +16 -8
- package/src/api-handlers/admin/sessions.ts +15 -7
- package/src/api-handlers/admin/site-logs.ts +39 -16
- package/src/api-handlers/admin/stats.ts +15 -5
- package/src/api-handlers/admin/users.ts +15 -7
- package/src/api-handlers/admin/vibe-data.ts +20 -12
- package/src/api-handlers/auth/jwks.ts +2 -1
- package/src/api-handlers/auth/login.ts +13 -4
- package/src/api-handlers/auth/passkey-signin.ts +4 -0
- package/src/api-handlers/auth/refresh.ts +38 -11
- package/src/api-handlers/auth/signout.ts +2 -1
- package/src/api-handlers/auth/status.ts +4 -1
- package/src/api-handlers/auth/update-session.ts +45 -11
- package/src/api-handlers/auth/validate.ts +4 -2
- package/src/api-handlers/auth/verify-code.ts +3 -2
- package/src/api-handlers/mfa/backup-code-verify.ts +4 -9
- package/src/api-handlers/mfa/backup-codes.ts +2 -1
- package/src/api-handlers/mfa/methods.ts +2 -1
- package/src/api-handlers/mfa/totp-confirm.ts +2 -1
- package/src/api-handlers/mfa/totp-enroll.ts +2 -1
- package/src/api-handlers/mfa/totp-verify.ts +4 -9
- package/src/api-handlers/passkeys/list.ts +2 -1
- package/src/api-handlers/passkeys/manage.ts +2 -1
- package/src/api-handlers/passkeys/register-options.ts +2 -1
- package/src/api-handlers/passkeys/register-verify.ts +2 -1
- package/src/api-handlers/session/refresh-viability.ts +10 -7
- package/src/api-handlers/session/viability.ts +4 -3
- package/src/api-handlers/test/force-expire.ts +5 -3
- package/src/auth/auth-decision.ts +2 -1
- package/src/auth/better-auth.ts +128 -61
- package/src/auth/utils/idp-client.ts +2 -1
- package/src/components/admin/DataBrowserTab.tsx +4 -1
- package/src/components/admin/SessionsTab.tsx +10 -3
- package/src/components/recovery/RequestedStep.tsx +30 -0
- package/src/components/recovery/SetPasswordStep.tsx +24 -3
- package/src/config/env.ts +0 -2
- package/src/hooks/useViabilitySession.ts +2 -1
- package/src/index.ts +4 -0
- package/src/lib/app-slug.ts +50 -0
- package/src/lib/ensure-fresh-access-token.ts +133 -4
- package/src/lib/idp-client-config.ts +98 -45
- package/src/lib/idp-fetch.ts +1 -1
- package/src/lib/never-in-response.ts +64 -0
- package/src/lib/password-rules.ts +50 -0
- package/src/lib/safe-error-response.ts +126 -0
- package/src/lib/session-cookie-shape.ts +23 -22
- package/src/lib/session-store.ts +167 -24
- package/src/lib/startup-init.ts +29 -4
- package/src/lib/token-lifecycle.ts +2 -1
- package/src/lib/token-log-id.ts +69 -0
- package/src/lib/two-factor-verify-failure.ts +248 -0
- package/src/middleware/create-middleware.ts +97 -9
- package/src/pages/login/page.tsx +4 -0
- package/src/pages/recovery/page.tsx +21 -4
- package/src/pages/test-env/JwtInspectPage.tsx +11 -233
- package/src/pages/test-env/RefreshTokenPage.tsx +9 -4
- package/src/pages/test-env/redact-credentials.ts +96 -0
- package/src/pages/verify-code/page.tsx +6 -3
- package/src/routes/auth/logout.ts +4 -2
- package/src/routes/auth/session.ts +16 -10
- package/src/routes/auth/settings.ts +5 -1
- package/src/routes/auth/viability.ts +11 -7
- package/src/server/auth.ts +33 -35
- package/src/server/decode-session.ts +16 -26
- package/src/server/verified-session-token.ts +103 -0
- package/src/stores/authStore.ts +16 -5
- package/src/types/recovery.ts +1 -1
- package/src/utils/api.ts +47 -8
- package/src/vibe/client.ts +378 -91
- package/src/vibe/document-unwrap.ts +103 -0
- package/src/vibe/errors.ts +24 -0
- package/src/vibe/generic.ts +8 -100
- package/src/vibe/index.ts +1 -0
- package/src/vibe/sessions.ts +2 -1
package/dist/vibe/errors.d.ts
CHANGED
|
@@ -81,3 +81,20 @@ export declare class VibeConflictError extends VibeError {
|
|
|
81
81
|
export declare class VibeServiceError extends VibeError {
|
|
82
82
|
constructor(message?: string, details?: Record<string, unknown>);
|
|
83
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* PAY-1767 (NightHawk 64534): thrown when a NON-ATOMIC `createMany` fails part-way. It CARRIES what was
|
|
86
|
+
* already created, so the caller can reconcile instead of guessing whether k-1 rows persisted. This is the
|
|
87
|
+
* point of the class: a partial write whose extent is invisible is the hazard, not the partial write itself.
|
|
88
|
+
*/
|
|
89
|
+
export declare class VibeBatchCreateError extends VibeError {
|
|
90
|
+
/** How many records were created before the failure. */
|
|
91
|
+
readonly createdCount: number;
|
|
92
|
+
/** The document ids that were created before the failure. */
|
|
93
|
+
readonly createdIds: Array<number | string>;
|
|
94
|
+
constructor(message: string, details: {
|
|
95
|
+
createdCount: number;
|
|
96
|
+
createdIds: Array<number | string>;
|
|
97
|
+
failedIndex: number;
|
|
98
|
+
total: number;
|
|
99
|
+
}, cause?: unknown);
|
|
100
|
+
}
|
package/dist/vibe/errors.js
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* =============================================================================
|
|
22
22
|
*/
|
|
23
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
exports.VibeServiceError = exports.VibeConflictError = exports.VibeRateLimitError = exports.VibeAuthError = exports.VibeValidationError = exports.VibeNotFoundError = exports.VibeError = void 0;
|
|
24
|
+
exports.VibeBatchCreateError = exports.VibeServiceError = exports.VibeConflictError = exports.VibeRateLimitError = exports.VibeAuthError = exports.VibeValidationError = exports.VibeNotFoundError = exports.VibeError = void 0;
|
|
25
25
|
/**
|
|
26
26
|
* Base error class for all Vibe API errors
|
|
27
27
|
*/
|
|
@@ -144,3 +144,23 @@ class VibeServiceError extends VibeError {
|
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
exports.VibeServiceError = VibeServiceError;
|
|
147
|
+
/**
|
|
148
|
+
* PAY-1767 (NightHawk 64534): thrown when a NON-ATOMIC `createMany` fails part-way. It CARRIES what was
|
|
149
|
+
* already created, so the caller can reconcile instead of guessing whether k-1 rows persisted. This is the
|
|
150
|
+
* point of the class: a partial write whose extent is invisible is the hazard, not the partial write itself.
|
|
151
|
+
*/
|
|
152
|
+
class VibeBatchCreateError extends VibeError {
|
|
153
|
+
/** How many records were created before the failure. */
|
|
154
|
+
createdCount;
|
|
155
|
+
/** The document ids that were created before the failure. */
|
|
156
|
+
createdIds;
|
|
157
|
+
constructor(message, details, cause) {
|
|
158
|
+
super(message, 'BATCH_PARTIAL_FAILURE', 500, details);
|
|
159
|
+
this.name = 'VibeBatchCreateError';
|
|
160
|
+
this.createdCount = details.createdCount;
|
|
161
|
+
this.createdIds = details.createdIds;
|
|
162
|
+
if (cause !== undefined)
|
|
163
|
+
this.cause = cause;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
exports.VibeBatchCreateError = VibeBatchCreateError;
|
package/dist/vibe/generic.d.ts
CHANGED
|
@@ -52,55 +52,8 @@ export declare function vibeQueryPath(collection: string, table: string): string
|
|
|
52
52
|
* @returns Grid API path string
|
|
53
53
|
*/
|
|
54
54
|
export declare function vibeGridPath(collection: string, table: string): string;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
* Vibe stores actual table data as JSON string in the 'data' field.
|
|
58
|
-
*/
|
|
59
|
-
export interface VibeDocumentWrapper {
|
|
60
|
-
document_id: number;
|
|
61
|
-
client_id?: number;
|
|
62
|
-
user_id?: number;
|
|
63
|
-
collection?: string;
|
|
64
|
-
table_name?: string;
|
|
65
|
-
data: string | Record<string, unknown>;
|
|
66
|
-
collection_schema_id?: number;
|
|
67
|
-
created_at?: string;
|
|
68
|
-
created_by?: number;
|
|
69
|
-
updated_at?: string | null;
|
|
70
|
-
updated_by?: number | null;
|
|
71
|
-
deleted_at?: string | null;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Unwrap a Vibe document response.
|
|
75
|
-
* Vibe returns documents with a wrapper where actual data is a JSON string.
|
|
76
|
-
*
|
|
77
|
-
* @param doc - Raw Vibe document (wrapper format)
|
|
78
|
-
* @returns Unwrapped document with schema fields only.
|
|
79
|
-
* Storage-layer document_id preserved as _vibe_doc_id for update/delete paths.
|
|
80
|
-
* See PayEz-Core/docs/vibe-primary-key-standard.md
|
|
81
|
-
*
|
|
82
|
-
* @example
|
|
83
|
-
* const raw = { document_id: 123, data: '{"user_id":15,"name":"John","email":"john@example.com"}' };
|
|
84
|
-
* const unwrapped = unwrapVibeDocument(raw);
|
|
85
|
-
* // => { user_id: 15, name: 'John', email: 'john@example.com', _vibe_doc_id: 123 }
|
|
86
|
-
*/
|
|
87
|
-
export declare function unwrapVibeDocument<T extends Record<string, unknown> = Record<string, unknown>>(doc: VibeDocumentWrapper | Record<string, unknown> | null | undefined): (T & {
|
|
88
|
-
_vibe_doc_id?: number;
|
|
89
|
-
}) | null;
|
|
90
|
-
/**
|
|
91
|
-
* Extract and unwrap array of documents from Vibe response.
|
|
92
|
-
*
|
|
93
|
-
* @param responseData - Raw Vibe API response
|
|
94
|
-
* @returns Array of unwrapped documents
|
|
95
|
-
*
|
|
96
|
-
* @example
|
|
97
|
-
* const response = await fetch('/api/vibe/data/ideal_resume/resumes');
|
|
98
|
-
* const data = await response.json();
|
|
99
|
-
* const resumes = extractVibeDocuments(data);
|
|
100
|
-
*/
|
|
101
|
-
export declare function extractVibeDocuments<T extends Record<string, unknown> = Record<string, unknown>>(responseData: unknown): Array<T & {
|
|
102
|
-
_vibe_doc_id?: number;
|
|
103
|
-
}>;
|
|
55
|
+
export { unwrapVibeDocument, extractVibeDocuments } from './document-unwrap';
|
|
56
|
+
export type { VibeDocumentWrapper } from './document-unwrap';
|
|
104
57
|
/**
|
|
105
58
|
* Generic table delegate for dynamic collection/table access.
|
|
106
59
|
* Provides Prisma-like methods for any table.
|
package/dist/vibe/generic.js
CHANGED
|
@@ -24,12 +24,10 @@
|
|
|
24
24
|
* =============================================================================
|
|
25
25
|
*/
|
|
26
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
exports.GenericCollection = exports.GenericTableDelegate = void 0;
|
|
27
|
+
exports.GenericCollection = exports.GenericTableDelegate = exports.extractVibeDocuments = exports.unwrapVibeDocument = void 0;
|
|
28
28
|
exports.vibeTablePath = vibeTablePath;
|
|
29
29
|
exports.vibeQueryPath = vibeQueryPath;
|
|
30
30
|
exports.vibeGridPath = vibeGridPath;
|
|
31
|
-
exports.unwrapVibeDocument = unwrapVibeDocument;
|
|
32
|
-
exports.extractVibeDocuments = extractVibeDocuments;
|
|
33
31
|
exports.vibeCollection = vibeCollection;
|
|
34
32
|
exports.vibeTable = vibeTable;
|
|
35
33
|
const client_1 = require("./client");
|
|
@@ -73,76 +71,17 @@ function vibeQueryPath(collection, table) {
|
|
|
73
71
|
function vibeGridPath(collection, table) {
|
|
74
72
|
return `/v1/collections/${collection}/tables/${table}/grid`;
|
|
75
73
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
* const unwrapped = unwrapVibeDocument(raw);
|
|
88
|
-
* // => { user_id: 15, name: 'John', email: 'john@example.com', _vibe_doc_id: 123 }
|
|
89
|
-
*/
|
|
90
|
-
function unwrapVibeDocument(doc) {
|
|
91
|
-
if (!doc)
|
|
92
|
-
return null;
|
|
93
|
-
// Handle case where doc is already unwrapped (has schema fields directly)
|
|
94
|
-
if (!('document_id' in doc) && !('data' in doc)) {
|
|
95
|
-
return doc;
|
|
96
|
-
}
|
|
97
|
-
const wrapper = doc;
|
|
98
|
-
let parsedData = {};
|
|
99
|
-
if (typeof wrapper.data === 'string') {
|
|
100
|
-
try {
|
|
101
|
-
parsedData = JSON.parse(wrapper.data);
|
|
102
|
-
}
|
|
103
|
-
catch {
|
|
104
|
-
console.warn('[vibe-generic] Failed to parse document data JSON:', wrapper.data);
|
|
105
|
-
parsedData = {};
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
else if (typeof wrapper.data === 'object' && wrapper.data !== null) {
|
|
109
|
-
parsedData = wrapper.data;
|
|
110
|
-
}
|
|
111
|
-
// Preserve document_id as _vibe_doc_id for Vibe API update/delete paths only
|
|
112
|
-
const documentId = wrapper.document_id ?? doc.document_id;
|
|
113
|
-
if (documentId != null) {
|
|
114
|
-
parsedData._vibe_doc_id = documentId;
|
|
115
|
-
}
|
|
116
|
-
return parsedData;
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Extract and unwrap array of documents from Vibe response.
|
|
120
|
-
*
|
|
121
|
-
* @param responseData - Raw Vibe API response
|
|
122
|
-
* @returns Array of unwrapped documents
|
|
123
|
-
*
|
|
124
|
-
* @example
|
|
125
|
-
* const response = await fetch('/api/vibe/data/ideal_resume/resumes');
|
|
126
|
-
* const data = await response.json();
|
|
127
|
-
* const resumes = extractVibeDocuments(data);
|
|
128
|
-
*/
|
|
129
|
-
function extractVibeDocuments(responseData) {
|
|
130
|
-
if (!responseData || typeof responseData !== 'object') {
|
|
131
|
-
return [];
|
|
132
|
-
}
|
|
133
|
-
const data = responseData;
|
|
134
|
-
// Try common response shapes
|
|
135
|
-
const docs = data.data ??
|
|
136
|
-
data.items ??
|
|
137
|
-
data.documents ??
|
|
138
|
-
(Array.isArray(responseData) ? responseData : null);
|
|
139
|
-
if (!Array.isArray(docs)) {
|
|
140
|
-
return [];
|
|
141
|
-
}
|
|
142
|
-
return docs
|
|
143
|
-
.map((doc) => unwrapVibeDocument(doc))
|
|
144
|
-
.filter((d) => d !== null);
|
|
145
|
-
}
|
|
74
|
+
// -----------------------------------------------------------------------------
|
|
75
|
+
// DOCUMENT UNWRAPPING
|
|
76
|
+
//
|
|
77
|
+
// PAY-1767: the wrapper type and the two helpers MOVED to ./document-unwrap, so the typed client
|
|
78
|
+
// (client.ts) can unwrap reads without importing this module (which imports client.ts). Re-exported
|
|
79
|
+
// here so every existing `from './generic'` / package import keeps working unchanged.
|
|
80
|
+
// -----------------------------------------------------------------------------
|
|
81
|
+
var document_unwrap_1 = require("./document-unwrap");
|
|
82
|
+
Object.defineProperty(exports, "unwrapVibeDocument", { enumerable: true, get: function () { return document_unwrap_1.unwrapVibeDocument; } });
|
|
83
|
+
Object.defineProperty(exports, "extractVibeDocuments", { enumerable: true, get: function () { return document_unwrap_1.extractVibeDocuments; } });
|
|
84
|
+
const document_unwrap_2 = require("./document-unwrap");
|
|
146
85
|
// -----------------------------------------------------------------------------
|
|
147
86
|
// GENERIC TABLE DELEGATE
|
|
148
87
|
// -----------------------------------------------------------------------------
|
|
@@ -209,7 +148,7 @@ class GenericTableDelegate {
|
|
|
209
148
|
const path = vibeTablePath(this.collection, this.tableName);
|
|
210
149
|
const url = `${this.client.getBaseUrl()}${path}${queryString ? `?${queryString}` : ''}`;
|
|
211
150
|
const response = await this.client.request(url, 'GET');
|
|
212
|
-
const unwrapped = extractVibeDocuments(response);
|
|
151
|
+
const unwrapped = (0, document_unwrap_2.extractVibeDocuments)(response);
|
|
213
152
|
return {
|
|
214
153
|
data: unwrapped,
|
|
215
154
|
meta: response.meta || { total: unwrapped.length, limit: options?.take || 50, offset: options?.skip || 0 },
|
|
@@ -223,7 +162,7 @@ class GenericTableDelegate {
|
|
|
223
162
|
const path = vibeTablePath(this.collection, this.tableName, options.where.id);
|
|
224
163
|
const url = `${this.client.getBaseUrl()}${path}`;
|
|
225
164
|
const response = await this.client.request(url, 'GET');
|
|
226
|
-
const unwrapped = unwrapVibeDocument(response.data);
|
|
165
|
+
const unwrapped = (0, document_unwrap_2.unwrapVibeDocument)(response.data);
|
|
227
166
|
if (!unwrapped) {
|
|
228
167
|
throw new errors_1.VibeNotFoundError(`Document ${options.where.id} not found in ${this.collection}/${this.tableName}`, 'NOT_FOUND', { collection: this.collection, table: this.tableName, id: options.where.id });
|
|
229
168
|
}
|
|
@@ -257,7 +196,7 @@ class GenericTableDelegate {
|
|
|
257
196
|
const path = vibeTablePath(this.collection, this.tableName);
|
|
258
197
|
const url = `${this.client.getBaseUrl()}${path}`;
|
|
259
198
|
const response = await this.client.request(url, 'POST', options.data);
|
|
260
|
-
const unwrapped = unwrapVibeDocument(response.data);
|
|
199
|
+
const unwrapped = (0, document_unwrap_2.unwrapVibeDocument)(response.data);
|
|
261
200
|
if (!unwrapped) {
|
|
262
201
|
throw new errors_1.VibeServiceError('Failed to parse created document');
|
|
263
202
|
}
|
|
@@ -270,7 +209,7 @@ class GenericTableDelegate {
|
|
|
270
209
|
const path = vibeTablePath(this.collection, this.tableName, options.where.id);
|
|
271
210
|
const url = `${this.client.getBaseUrl()}${path}`;
|
|
272
211
|
const response = await this.client.request(url, 'PUT', options.data);
|
|
273
|
-
const unwrapped = unwrapVibeDocument(response.data);
|
|
212
|
+
const unwrapped = (0, document_unwrap_2.unwrapVibeDocument)(response.data);
|
|
274
213
|
if (!unwrapped) {
|
|
275
214
|
throw new errors_1.VibeServiceError('Failed to parse updated document');
|
|
276
215
|
}
|
|
@@ -283,7 +222,7 @@ class GenericTableDelegate {
|
|
|
283
222
|
const path = vibeTablePath(this.collection, this.tableName, options.where.id);
|
|
284
223
|
const url = `${this.client.getBaseUrl()}${path}`;
|
|
285
224
|
const response = await this.client.request(url, 'DELETE');
|
|
286
|
-
const unwrapped = unwrapVibeDocument(response.data);
|
|
225
|
+
const unwrapped = (0, document_unwrap_2.unwrapVibeDocument)(response.data);
|
|
287
226
|
if (!unwrapped) {
|
|
288
227
|
throw new errors_1.VibeServiceError('Failed to parse deleted document');
|
|
289
228
|
}
|
package/dist/vibe/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export { vibe, createVibeClient, VibeClient, VibeTableDelegate } from './client'
|
|
|
16
16
|
export type { VibeClientConfig, FindManyOptions, FindUniqueOptions, CreateOptions, UpdateOptions, DeleteOptions, CountOptions, FindManyResult, WhereClause, OrderByClause, FilterOperator, FilterValue, OrderDirection, } from './client';
|
|
17
17
|
export type { VibeAuditFields, VibeMeta, VibeResponse, VibeErrorResponse, VibeTableTypes, VibeTableName, VibeTableType, IVibeUser, IVibeLoginSession, SessionStatus, IVibeProfile, IVibeSetting, IVibeFile, IVibeNotification, NotificationType, IVibeActivityLog, ActivityAction, IVibeTag, IVibeComment, IVibeSiteLog, LogLevel, } from './types';
|
|
18
18
|
export { VibeUser, VibeLoginSession, VibeProfile, VibeSetting, VibeFile, VibeNotification, VibeActivityLog, VibeTag, VibeComment, VibeSiteLog, } from './types';
|
|
19
|
-
export { VibeError, VibeNotFoundError, VibeValidationError, VibeAuthError, VibeRateLimitError, VibeConflictError, VibeServiceError, } from './errors';
|
|
19
|
+
export { VibeError, VibeNotFoundError, VibeValidationError, VibeAuthError, VibeRateLimitError, VibeConflictError, VibeServiceError, VibeBatchCreateError, } from './errors';
|
|
20
20
|
export { createLoginSession, getUserSessions, getAllSessions, getSessionById, revokeSession, revokeAllUserSessions, updateSessionActivity, isSessionValid, checkSessionRevocation, getSessionStats, } from './sessions';
|
|
21
21
|
export type { CreateSessionInput, SessionQueryOptions } from './sessions';
|
|
22
22
|
export { vibeCollection, vibeTable, vibeTablePath, vibeQueryPath, vibeGridPath, unwrapVibeDocument, extractVibeDocuments, GenericCollection, GenericTableDelegate, } from './generic';
|
package/dist/vibe/index.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* =============================================================================
|
|
15
15
|
*/
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.generateBackendHmacSignature = exports.hasEnterpriseAuthHeaders = exports.validateEnterpriseAuth = exports.GenericTableDelegate = exports.GenericCollection = exports.extractVibeDocuments = exports.unwrapVibeDocument = exports.vibeGridPath = exports.vibeQueryPath = exports.vibeTablePath = exports.vibeTable = exports.vibeCollection = exports.getSessionStats = exports.checkSessionRevocation = exports.isSessionValid = exports.updateSessionActivity = exports.revokeAllUserSessions = exports.revokeSession = exports.getSessionById = exports.getAllSessions = exports.getUserSessions = exports.createLoginSession = exports.VibeServiceError = exports.VibeConflictError = exports.VibeRateLimitError = exports.VibeAuthError = exports.VibeValidationError = exports.VibeNotFoundError = exports.VibeError = exports.VibeSiteLog = exports.VibeComment = exports.VibeTag = exports.VibeActivityLog = exports.VibeNotification = exports.VibeFile = exports.VibeSetting = exports.VibeProfile = exports.VibeLoginSession = exports.VibeUser = exports.VibeTableDelegate = exports.VibeClient = exports.createVibeClient = exports.vibe = void 0;
|
|
17
|
+
exports.generateBackendHmacSignature = exports.hasEnterpriseAuthHeaders = exports.validateEnterpriseAuth = exports.GenericTableDelegate = exports.GenericCollection = exports.extractVibeDocuments = exports.unwrapVibeDocument = exports.vibeGridPath = exports.vibeQueryPath = exports.vibeTablePath = exports.vibeTable = exports.vibeCollection = exports.getSessionStats = exports.checkSessionRevocation = exports.isSessionValid = exports.updateSessionActivity = exports.revokeAllUserSessions = exports.revokeSession = exports.getSessionById = exports.getAllSessions = exports.getUserSessions = exports.createLoginSession = exports.VibeBatchCreateError = exports.VibeServiceError = exports.VibeConflictError = exports.VibeRateLimitError = exports.VibeAuthError = exports.VibeValidationError = exports.VibeNotFoundError = exports.VibeError = exports.VibeSiteLog = exports.VibeComment = exports.VibeTag = exports.VibeActivityLog = exports.VibeNotification = exports.VibeFile = exports.VibeSetting = exports.VibeProfile = exports.VibeLoginSession = exports.VibeUser = exports.VibeTableDelegate = exports.VibeClient = exports.createVibeClient = exports.vibe = void 0;
|
|
18
18
|
// Client exports
|
|
19
19
|
var client_1 = require("./client");
|
|
20
20
|
Object.defineProperty(exports, "vibe", { enumerable: true, get: function () { return client_1.vibe; } });
|
|
@@ -42,6 +42,7 @@ Object.defineProperty(exports, "VibeAuthError", { enumerable: true, get: functio
|
|
|
42
42
|
Object.defineProperty(exports, "VibeRateLimitError", { enumerable: true, get: function () { return errors_1.VibeRateLimitError; } });
|
|
43
43
|
Object.defineProperty(exports, "VibeConflictError", { enumerable: true, get: function () { return errors_1.VibeConflictError; } });
|
|
44
44
|
Object.defineProperty(exports, "VibeServiceError", { enumerable: true, get: function () { return errors_1.VibeServiceError; } });
|
|
45
|
+
Object.defineProperty(exports, "VibeBatchCreateError", { enumerable: true, get: function () { return errors_1.VibeBatchCreateError; } });
|
|
45
46
|
// Session management exports
|
|
46
47
|
var sessions_1 = require("./sessions");
|
|
47
48
|
Object.defineProperty(exports, "createLoginSession", { enumerable: true, get: function () { return sessions_1.createLoginSession; } });
|
package/dist/vibe/sessions.js
CHANGED
|
@@ -105,7 +105,8 @@ async function vibeProxyRequest(endpoint, method, accessToken, body) {
|
|
|
105
105
|
}
|
|
106
106
|
if (!response.ok) {
|
|
107
107
|
const errorText = await response.text();
|
|
108
|
-
|
|
108
|
+
// PAY-1427: never the raw proxy body - the request carried a Bearer token and an error page can echo it.
|
|
109
|
+
console.error(`[vibe-sessions] Proxy error ${response.status}:`, { bodyLength: errorText.length });
|
|
109
110
|
return null;
|
|
110
111
|
}
|
|
111
112
|
const data = await response.json();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payez/next-mvp",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.7",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"dev:local": "pwsh -NoProfile -ExecutionPolicy Bypass -File scripts/dev-local.ps1",
|
|
25
25
|
"dev:broker": "pwsh -NoProfile -ExecutionPolicy Bypass -File scripts/dev-broker.ps1",
|
|
26
26
|
"check:publish-health": "node scripts/check-publish-health.mjs",
|
|
27
|
+
"check:provenance": "node scripts/verify-release-provenance.mjs",
|
|
27
28
|
"census:reach": "node scripts/module-reach.mjs",
|
|
28
29
|
"build:incremental": "npx tsc --project tsconfig.json"
|
|
29
30
|
},
|
|
@@ -63,6 +64,11 @@
|
|
|
63
64
|
"require": "./dist/auth/better-auth.js",
|
|
64
65
|
"default": "./dist/auth/better-auth.js"
|
|
65
66
|
},
|
|
67
|
+
"./auth/safe-callback": {
|
|
68
|
+
"types": "./dist/auth/safe-callback.d.ts",
|
|
69
|
+
"require": "./dist/auth/safe-callback.js",
|
|
70
|
+
"default": "./dist/auth/safe-callback.js"
|
|
71
|
+
},
|
|
66
72
|
"./components/auth/FederatedAuthSection": {
|
|
67
73
|
"types": "./dist/components/auth/FederatedAuthSection.d.ts",
|
|
68
74
|
"require": "./dist/components/auth/FederatedAuthSection.js",
|
|
@@ -178,6 +184,11 @@
|
|
|
178
184
|
"require": "./dist/lib/idp-client-config.js",
|
|
179
185
|
"default": "./dist/lib/idp-client-config.js"
|
|
180
186
|
},
|
|
187
|
+
"./lib/never-in-response": {
|
|
188
|
+
"types": "./dist/lib/never-in-response.d.ts",
|
|
189
|
+
"require": "./dist/lib/never-in-response.js",
|
|
190
|
+
"default": "./dist/lib/never-in-response.js"
|
|
191
|
+
},
|
|
181
192
|
"./hooks/useAuthSettings": {
|
|
182
193
|
"types": "./dist/hooks/useAuthSettings.d.ts",
|
|
183
194
|
"require": "./dist/hooks/useAuthSettings.js",
|
|
@@ -943,7 +954,7 @@
|
|
|
943
954
|
"@azure/identity": "^4.0.1",
|
|
944
955
|
"@azure/keyvault-secrets": "^4.7.0",
|
|
945
956
|
"@upstash/redis": "^1.35.6",
|
|
946
|
-
"better-auth": "1.
|
|
957
|
+
"better-auth": "1.6.33",
|
|
947
958
|
"ioredis": "^5.3.2",
|
|
948
959
|
"jose": "^5.2.4",
|
|
949
960
|
"jsonwebtoken": "^9.0.2",
|