Skip to main content
Version: 0.13.0 (Previous)

Changelog

โœจ Addedโ€‹

Documentation siteโ€‹

Services (12)โ€‹

Block integration guides (18)โ€‹

Block reference pages (~82 pages)โ€‹

  • Source-verified routes, schemas, features, handlers, validators, and blocks pages where the SDK exports that layer; each domain Reference map lists its exact set (for example, Category and Attribute omit blocks.md; Identity omits handlers.md; Invitation and OAuth omit domain validator pages).
  • Validators alignment: standardized inventory tables across 13 entity validators.md files (identity reference contract).
  • Schemas alignment: standardized section order and inventory tables across block schemas.md files; Common schemas consolidated from nested blocks/common/schemas/ pages into a single reference.
  • Deep route and handler references for high-traffic domains (for example, Authentication routes, Product routes).
  • Removed legacy blocks/user/ documentation tree; replaced by blocks/profile/ with full reference pages.

Component, utility, and driver referenceโ€‹

Reference depth and consistencyโ€‹

  • Unified block index.md contract: Start here โ†’ Common tasks โ†’ Reference map โ†’ Related modules, with Bearer/Cookie/Custom HTTP workflow examples on mountable services.
  • 12 alignment/audit scripts in scripts/ (align-*-md.mjs, audit-*-md.mjs); 2 wired in package.json as align:index-md and audit:index-md.

๐Ÿ”„ Changedโ€‹

Naming and importsโ€‹

  • User โ†’ Profile across services, collections, routes, and examples (profileService, profiles collection, /profiles paths). See Profile service and Profile blocks.
  • Removed the legacy blocks/user/ documentation tree; all user-domain reference now lives under blocks/profile/.
  • Namespace-only imports in canonical integration examples: import { services, primitives, drivers, validators } from '@nodeblocks/backend-sdk'. Flat root imports and deprecated userService names are removed from those guides.

Authentication configurationโ€‹

  • Token lifetimes documented through accessTokenSignOptions, refreshTokenSignOptions, and onetimeTokenSignOptions (replacing flat expiry keys). Default access-token lifetime is 15m (older 2h defaults are no longer shown). See Authentication index and auth utility.
  • Cookie auth (0.13.0): authMode: 'cookie', host cookie-parser, per-service authMode on protected CRUD services, and cookie-mode login/refresh/logout response shapes. See cookie utility.

API response shapesโ€‹

  • Paginated list endpoints document { data, metadata: { pagination } } instead of legacy { count, total, value } envelopes. See Common schemas.

How-to, concepts, and componentsโ€‹


๐Ÿž Fixed (documentation corrections)โ€‹

  • Configuration naming: identity.typeIds and related auth configuration examples corrected from legacy user.typeIds patterns in service and integration guides.
  • Request and response contracts: service and route pages updated after source audits (organization members, auth logout/email templates, order admin create, product and organization list envelopes, chat attachments, and related examples).
  • Change-email behavior: enumeration-hardening flow documented with mapMatchingErrorToFalse on Authentication routes.

SDK 0.13.0 (2026-07-14)โ€‹

โœจ Addedโ€‹

Servicesโ€‹

  • Optional authMode?: 'bearer' | 'cookie' on protected CRUD / domain service configurations (attributes, profile, product, category, organization, location, order, chat, identity, notification, address). When authMode is 'cookie', each service wires getCookieTokenInfo into context.authenticate; otherwise it uses getBearerTokenInfo. See Authentication service and mountable domain integration guides.

Authenticationโ€‹

  • checkIp?: boolean (default true) on AuthenticationServiceConfiguration; both getBearerTokenInfo and getCookieTokenInfo honor this option. See Authentication service.
  • whenCookieAuth utility (exported from utils) branches a composed handler between cookie-mode and bearer-mode implementations based on authMode.
  • context.authenticate typed field on ServiceContext / ServiceDefinition, populated with getCookieTokenInfo or getBearerTokenInfo depending on authMode.
  • Standalone logoutFeature, selecting logoutCookieSchema or logoutBearerSchema at compose time based on authMode.
  • refreshTokenBearerSchema and refreshTokenCookieSchema; refreshTokenSchema remains as a deprecated alias for refreshTokenBearerSchema.
  • cookieOpts.httpOnly and cookieOpts.secure are now configurable (previously hard-coded to true).

๐Ÿ”„ Changedโ€‹

Authenticationโ€‹

  • Session cookie maxAge is derived automatically from each token's expiresIn (accessTokenSignOptions / refreshTokenSignOptions) when cookies are set, so the cookie and token always expire together.
  • loginWithCredentialsRoute: cookie mode returns only { id } in the response body; tokens are delivered via Set-Cookie. Bearer mode is unchanged ({ accessToken, id, refreshToken }).
  • refreshTokenRoute: cookie mode sets refreshed cookies and returns 204 with an empty body; bearer mode is unchanged (200 { accessToken, refreshToken }).
  • setResponseCookie derives access-token and refresh-token cookie options independently from accessTokenSignOptions.expiresIn / refreshTokenSignOptions.expiresIn, instead of sharing a single set of options.

๐Ÿž Fixedโ€‹

Authenticationโ€‹

  • logoutRoute: clears accessToken and refreshToken cookies unconditionally, instead of only when a refreshToken cookie was present on the request; resolves the caller's identity via context.authenticate (cookie- or bearer-aware); treats an already-revoked refresh token as success instead of error; returns success when no refresh token can be resolved instead of error.
  • deactivateRoute: reads the access token from the accessToken cookie in cookie mode instead of always requiring an Authorization header.

Organizationโ€‹

  • createChangeRequestRoute: reads the access token from the accessToken cookie in cookie mode instead of always requiring an Authorization header.

๐Ÿ”’ Securityโ€‹

  • Removed an undocumented bypass in getCookieTokenInfo that accepted an app-type Authorization: Bearer token to skip cookie/session validation entirely.
  • getCookieTokenInfo no longer hard-codes checkIp: false; cookie-authenticated user tokens are IP-checked by default like bearer tokens.

๐Ÿ“ฆ Migrationโ€‹

  • Cookie auth hosts: Setting authMode: 'cookie' on authentication alone is not enough. Pass authMode: 'cookie' on every mounted protected service that must accept cookie sessions, and register cookie-parser middleware.
  • Cookie-mode clients: Read access/refresh tokens from Set-Cookie response headers on POST /auth/login and POST /auth/token/refresh; they are no longer present in the response body.
  • Manual loginWithCredentialsFeature compositions: Add logoutFeature explicitly to keep POST /auth/logout (the authService factory already does this automatically).
  • Access token lifetime: If you relied on the default 2h access token lifetime, set accessTokenSignOptions: { expiresIn: '2h' } explicitly โ€” the default is now 15m.
  • Cookie auth IP checks: If your deployment's client IP can legitimately change between requests (e.g. some proxies or mobile networks), set checkIp: false explicitly in AuthenticationServiceConfiguration.
  • Removed validators: Replace any direct imports of validateResourceAccess, validateOrganizationAccess, validateOrderAccess, validateMessageAccess, validateChannelAccess, verifyAuthentication, requireParam, isUUID, or isNumber with their current equivalents (isAuthenticated, hasOrgRole, ownsResource, ownsOrder, ownsMessage, ownsChannel, etc.).

โš ๏ธ Breaking Changesโ€‹

  • Authentication: AuthenticationServiceConfiguration.cookieOpts.maxAge has been removed. Cookie lifetime follows the matching token's expiresIn. Remove any cookieOpts.maxAge configuration.
  • Authentication: Default accessTokenSignOptions.expiresIn changed from 2h to 15m.
  • Authentication: loginWithCredentialsFeature no longer composes logoutRoute. Custom compositions built directly on loginWithCredentialsFeature (outside authService) must add logoutFeature separately.
  • Authentication: Cookie-mode login and refresh no longer return tokens in the response body.
  • Authentication: getCookieTokenInfo no longer accepts Authorization: Bearer as a bypass path for cookie auth.
  • Validators: Removed unused legacy validator exports from Common validators: validateResourceAccess, validateOrganizationAccess, validateOrderAccess, validateMessageAccess, validateChannelAccess, verifyAuthentication, requireParam, isUUID, and isNumber.

SDK 0.12.0 (2026-07-07)โ€‹

๐Ÿž Fixedโ€‹

Authenticationโ€‹

  • completePasswordResetRoute: revokes all active refresh tokens when a user resets their password to invalidate existing sessions across all devices.
  • changePasswordRoute: revokes all active refresh tokens when a user changes their password.
  • Fingerprint security check: tokenPassesSecurityCheck treats undefined and '' as equivalent; token generation normalizes fingerprint to '' at generation time.
  • logoutRoute: clears auth token cookies only when refresh token revocation succeeds.

๐Ÿ”„ Changedโ€‹

Authenticationโ€‹

  • softDeleteRefreshTokens sets deletedAt instead of delFlg to align with refresh token revocation checks.
  • refreshTokenRoute: rotates refresh tokens on each use (new jti + DB row); returns 401 on reuse of a revoked refresh token without revoking other device sessions; uses resolveRefreshTokenFromRequest for cookie/body resolution.
  • logoutRoute: revokes the presented refresh token (cookie or body) after verifying it belongs to the authenticated identity.
  • Cookie-based refresh reads fingerprint from the x-nb-fingerprint header (same as body path) and runs IP/UA checks. See cookie utility.

โš ๏ธ Breaking Changesโ€‹

  • Cookie-based refresh (refreshTokenRoute) and cookie-based logout (logoutRoute) require the x-nb-fingerprint header. request.body.fingerprint is no longer read on the cookie path.

SDK 0.11.0 (2026-05-26)โ€‹

โœจ Addedโ€‹

Combinatorsโ€‹

  • mapMatchingErrorToFalse: maps only a specific matched error class to ok(false), replacing the previous mapErrorToFalse which converted all errors.

๐Ÿ”„ Changedโ€‹

Profile (formerly User)โ€‹

  • Renamed user handlers, blocks, routes, schemas, features, and service to profile. See Profile service and Profile blocks.
  • Updated users collection references to profiles in organization and product routes and services.
  • Removed deprecated validateUserProfileAccess validator.
  • Updated return type for getProfileById.

๐Ÿ”’ Securityโ€‹

Change Emailโ€‹

  • changeEmailRoute: returns 204 instead of an error when the requested email address is already in use, preventing email enumeration.
  • Uses mapMatchingErrorToFalse to convert only conflict errors to ok(false).

โš ๏ธ Breaking Changesโ€‹

  • Profile rename: user service, routes, blocks, schemas, and features are renamed to profile. Update all imports from user* to profile*.
  • Validators: validateUserProfileAccess has been removed. Use the updated Profile validators instead.
  • Combinators: mapErrorToFalse is renamed to mapMatchingErrorToFalse and requires an error class as the first argument.

SDK 0.10.0 (2026-03-17)โ€‹

โœจ Addedโ€‹

Notification Managementโ€‹

  • New service: Notification service.
  • New endpoints:
    • GET /notifications/identities/:identityId โ€” find notifications with pagination. See Notification routes.
    • POST /notifications/:notificationId/read โ€” mark a single notification as read.
    • POST /notifications/identities/:identityId/read โ€” batch mark as read up to an anchor notification.
  • Notification blocks for create, bulk create, find, get, single update, and batch update operations.

Address Lookupโ€‹

Organization Member Protectionโ€‹

  • Validators to prevent removing the last owner from an organization.
  • Role-assignment validation so members cannot assign roles above their own rank.
  • Same-or-above role validation before deleting organization members. See Organization validators.

๐Ÿž Fixedโ€‹

Identityโ€‹

  • getIdentityRoute: prevents matching token records stored in the identities collection by excluding documents with jti.

Address Lookupโ€‹

  • Japan Post postal code handling requires a full 7-digit code at lookup time.
  • Returns null for ambiguous town names instead of guessing when multiple towns share the same postal code.

๐Ÿ”„ Changedโ€‹

Authentication Configurationโ€‹

  • Replace string-based expiration settings with accessTokenSignOptions, refreshTokenSignOptions, and onetimeTokenSignOptions. See Authentication service and auth utility.
  • Apply shared one-time token signing options across password reset, email change, MFA, and OAuth flows.

Authorization Rulesโ€‹

  • Strengthen organization member upsert and delete routes with additional role hierarchy checks.

SDK 0.9.1 (2026-01-22)โ€‹

โœจ Addedโ€‹

Authenticationโ€‹

  • Password validation to check new password is not the same as the current password.
  • Separate bcrypt compare and matches logic into two blocks; new assertDoesNotMatch block for password-must-not-match flows.

Schema Validationโ€‹

  • Handle type-less schemas with object-related keywords in applySchemaDefaults.
  • Support for union types including object in schema validation.

๐Ÿ”„ Changedโ€‹

  • Enhanced OpenAPI schema generation with improved tag propagation and nullable schema support.

๐Ÿ”’ Securityโ€‹


SDK 0.9.0 (2025-11-04)โ€‹

โœจ Addedโ€‹

Location Managementโ€‹

  • New service: Location service.
  • New endpoints: POST /locations, GET /locations/:locationId, PATCH /locations/:locationId, DELETE /locations/:locationId, GET /locations. See Location routes.
  • Parent-child relationship handling with automatic ancestors calculation.

Profile Follow Systemโ€‹

  • New endpoints:
    • PUT /profiles/:profileId/profile-follows/:followProfileId โ€” create profile follow. See Profile routes.
    • DELETE /profiles/:profileId/profile-follows/:followProfileId โ€” delete profile follow.
    • GET /profiles/:profileId/followers โ€” get profile followers with pagination.

Organization Follow Systemโ€‹

  • New endpoints:
    • PUT /profiles/:profileId/organization-follows/:followOrganizationId โ€” create organization follow.
    • DELETE /profiles/:profileId/organization-follows/:followOrganizationId โ€” delete organization follow.
    • GET /organizations/:organizationId/followers โ€” get organization followers. See Organization routes.

Product Like Systemโ€‹

  • New endpoints:
    • PUT /profiles/:profileId/product-likes/:likeProductId โ€” create product like.
    • DELETE /profiles/:profileId/product-likes/:likeProductId โ€” delete product like.
    • GET /products/:productId/likers โ€” get product likers. See Product routes.

Chat Message Template Managementโ€‹

Product Variant Bulk Operationsโ€‹

  • New endpoints:
    • POST /products/:productId/variants/bulk, PATCH /products/:productId/variants/bulk, DELETE /products/:productId/variants/bulk, GET /products/:productId/variants. See Product routes.

Find Endpointsโ€‹

  • GET /profiles/identities/:identityId โ€” find profiles by identity ID.
  • GET /organizations/:organizationId/orders โ€” find orders by organization ID.
  • GET /organizations/:organizationId/products โ€” find products by organization ID.

Identity Lock/Unlockโ€‹

Chat Channel Icon Managementโ€‹

Soft Deleteโ€‹

  • withSoftDelete combinator for MongoDB collections with automatic filtering and audit trail.

๐Ÿž Fixedโ€‹

  • Add missing updatedAt/createdAt timestamps to all create and update operations.
  • Cast IDs to strings in all database queries for security.

๐Ÿ”„ Changedโ€‹

  • Chat message updates restricted to message owners only (admin override removed). See updateChatMessageRoute.
  • Entity creation simplified: messages and products created without attachments/images; attachments managed via dedicated endpoints.

SDK 0.8.0 (2025-09-24)โ€‹

โœจ Addedโ€‹

Product Variant Managementโ€‹

  • New endpoints:
    • POST /products/:productId/variants โ€” create product variant.
    • GET /products/:productId/variants/:productVariantId โ€” get product variant by ID.
    • PATCH /products/:productId/variants/:productVariantId โ€” update product variant.
    • DELETE /products/:productId/variants/:productVariantId โ€” delete product variant.
  • See Product features and Product routes.

Organization Change Request Systemโ€‹

Organization Managementโ€‹

Multi-Factor Authentication (MFA)โ€‹

One-Time Token (OTT) Authenticationโ€‹

  • loginWithOnetimeTokenRoute: POST /auth/ott/login.
  • OAuth callback flow returns one-time tokens; frontend exchanges via OTT login endpoint.

Pagination Systemโ€‹

๐Ÿž Fixedโ€‹

  • WebSocket IP address availability in WebSocket requests.
  • Pagination metadata return issues.

SDK 0.7.0 (2025-09-12)โ€‹

โœจ Addedโ€‹

Chat Message Attachmentsโ€‹

Chat Channel Messagesโ€‹

Chat Read Receiptsโ€‹

Chat WebSocket Subscriptionโ€‹

LINE OAuth Authenticationโ€‹

Product Image Managementโ€‹

  • New endpoints:
    • POST /products/:productId/images โ€” create product images.
    • DELETE /products/:productId/images/:imageId โ€” delete product image.
  • See Product routes.

Blocksโ€‹

  • Chat read-state blocks: createChatChannelReadState, updateChatChannelReadState, findChatChannelReadStates, and query/payload builders.
  • Chat message blocks: createChatMessage, getChatMessageById, attachment CRUD, and normalization helpers.
  • Product blocks: getProductById, findProducts, image normalization helpers.
  • OAuth blocks: requestLineOAuth, authenticateLineOAuth, verifyLineOAuth.
  • normalizeFile: centralized file normalization utility.

๐Ÿ”„ Changedโ€‹

  • Chat and product normalization refactored to use centralized normalizeFile utility.
  • Entity creation simplified: core messages and products created without attachments/images; attachments managed via dedicated endpoints.

๐Ÿž Fixedโ€‹

  • Chat attachment normalization in update responses; security ID casting; admin access restrictions for attachment operations.
  • OAuth: Google and Twitter flows fixed to use provider/providerId instead of email workarounds.

SDK 0.6.0 (2025-08-28)โ€‹

๐ŸŽฅ Demo Videoโ€‹

๐Ÿ“น NodeBlocks Backend SDK v0.6.0 Demo โ€” Complete walkthrough of all new features and functionality.


โœจ Addedโ€‹

Chat Message Template Systemโ€‹

Twitter OAuth Authenticationโ€‹

Refresh Token Systemโ€‹

WebSocket Support with RxJSโ€‹

  • Enhanced defService to support WebSocket server integration.
  • WebSocket route handling with RxJS bridging; protocol: 'ws' routes alongside HTTP routes.
  • notFromEmitter and markAsFromEmitter for emitter-based message filtering.

๐Ÿ”„ Changedโ€‹

Servicesโ€‹

  • Authentication service: added Twitter OAuth support and refresh token functionality; updated datastore to include chatMessageTemplates collection.

๐Ÿž Fixedโ€‹

  • Organization blocks export issue.
  • refreshTokenRoute: removed isAuthenticated validator from refresh flow.
  • Configuration property names corrected (user.typeIds โ†’ identity.typeIds; user?: string โ†’ regular?: string).

Migration guide (upgrading from 0.6.x docs)โ€‹

  1. Install @nodeblocks/backend-sdk@^0.13.0 and follow the Quickstart.
  2. Replace userService, /users, and users collection examples with profileService, /profiles, and profiles.
  3. Replace flat token expiry keys with accessTokenSignOptions, refreshTokenSignOptions, and onetimeTokenSignOptions. Set accessTokenSignOptions: { expiresIn: '2h' } explicitly if you still need a 2h access token.
  4. For cookie sessions, set authMode: 'cookie' on Authentication and every protected service you mount, register cookie-parser before those routers, and read tokens from Set-Cookie on login/refreshโ€”not from JSON bodies.
  5. Replace removed validator imports (validateResourceAccess, verifyAuthentication, requireParam, and similar) with current exports documented under Common validators and domain validator pages.
  6. Use the block catalogue and domain Reference map tables to find the current route, schema, and validator contracts for each endpoint.
  7. Send the x-nb-fingerprint header on cookie-mode refresh and logout requests (SDK 0.12.0).
  8. Add logoutFeature to custom compositions built on loginWithCredentialsFeature outside authService (SDK 0.13.0).
  9. Remove cookieOpts.maxAge; cookie lifetime follows the matching token expiresIn (SDK 0.13.0).
  10. Replace mapErrorToFalse with mapMatchingErrorToFalse(errorClass, [...]) (SDK 0.11.0); see composition utilities.

Breaking documentation changesโ€‹

  • Versioned snapshots under backend_versioned_docs/version-0.6.0 and version-0.7.0 remain historical references. New integrations should use canary v2 docs at /v2/backend/next.
  • Examples no longer show flat SDK imports, user* service names, or legacy pagination envelopes.
  • Cookie-mode login and refresh examples no longer return access or refresh tokens in response bodies; clients must use session cookies instead.

Security documentation updatesโ€‹

  • Cookie auth no longer documents an undocumented Bearer bypass on cookie-protected routes; IP checking defaults to enabled via checkIp unless explicitly disabled. See Authentication service.
  • Change-email responses document 204 instead of conflict errors to reduce email enumeration; see Authentication routes.
  • Organization member protection, notification ownership, and address lookup validation are documented with current access rules on their respective validators and routes pages.