platform-types 1.10.698 → 1.10.699

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.
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isAllowedStorefrontLiteralValue = exports.isStorefrontLiteralKey = exports.STOREFRONT_WEB_LITERAL_KEYS = void 0;
3
+ exports.isAdoptableStorefrontLiteral = exports.isAllowedStorefrontLiteralValue = exports.isStorefrontLiteralKey = exports.STOREFRONT_WEB_LITERAL_KEYS = void 0;
4
+ const storefrontDesignRegistry_ts_1 = require("./storefrontDesignRegistry.js");
4
5
  /**
5
6
  * Every storefront `WEB` literal key a shop may override, in code-unit order.
6
7
  *
@@ -1178,3 +1179,14 @@ const STOREFRONT_SAME_ORIGIN_PATH_RE = /^\/(?![/\\])[^\s\\\p{Cc}\p{Cf}]*$/u;
1178
1179
  */
1179
1180
  const isAllowedStorefrontLiteralValue = (key, value) => !key.startsWith(STOREFRONT_NAVIGATE_LITERAL_PREFIX) || STOREFRONT_SAME_ORIGIN_PATH_RE.test(value);
1180
1181
  exports.isAllowedStorefrontLiteralValue = isAllowedStorefrontLiteralValue;
1182
+ /**
1183
+ * Whether a shop's stored `value` for `key` is one a save keeps, a read serves and the editor
1184
+ * baseline adopts: a shop-overridable key, a well-formed string within
1185
+ * {@link STOREFRONT_DESIGN_LITERAL_MAX_CODE_POINTS} code points, and an allowed value for it.
1186
+ */
1187
+ const isAdoptableStorefrontLiteral = (key, value) => (0, exports.isStorefrontLiteralKey)(key) &&
1188
+ typeof value === 'string' &&
1189
+ value.isWellFormed() &&
1190
+ Array.from(value).length <= storefrontDesignRegistry_ts_1.STOREFRONT_DESIGN_LITERAL_MAX_CODE_POINTS &&
1191
+ (0, exports.isAllowedStorefrontLiteralValue)(key, value);
1192
+ exports.isAdoptableStorefrontLiteral = isAdoptableStorefrontLiteral;
@@ -558,8 +558,8 @@ declare global {
558
558
  * route's one rule: an absent or empty `updatedAt` reads from 0; anything but digits within
559
559
  * `Number.MAX_SAFE_INTEGER` (`1e5`, `-5`, `0x10`, a blank) answers 400 `INVALID_UPDATED_AT`,
560
560
  * on both routes alike. An `updatedAt` over 32 characters or a `startKey` over 2048 answers
561
- * 400 `STOREFRONT_PREVIEW_INVALID`; a malformed or foreign `startKey` answers 400
562
- * `INVALID_CURSOR`.
561
+ * 400 `STOREFRONT_PREVIEW_INVALID`; a malformed or foreign `startKey`, one whose `updatedAt`
562
+ * DynamoDB cannot store, or one at or below the `updatedAt` floor answers 400 `INVALID_CURSOR`.
563
563
  */
564
564
  | {
565
565
  operation: 'incomes';
@@ -28,3 +28,9 @@ export declare const isStorefrontLiteralKey: (key: string) => boolean;
28
28
  * unconstrained here (key membership, well-formedness and length are checked apart).
29
29
  */
30
30
  export declare const isAllowedStorefrontLiteralValue: (key: string, value: string) => boolean;
31
+ /**
32
+ * Whether a shop's stored `value` for `key` is one a save keeps, a read serves and the editor
33
+ * baseline adopts: a shop-overridable key, a well-formed string within
34
+ * {@link STOREFRONT_DESIGN_LITERAL_MAX_CODE_POINTS} code points, and an allowed value for it.
35
+ */
36
+ export declare const isAdoptableStorefrontLiteral: (key: string, value: unknown) => value is string;
@@ -1,3 +1,4 @@
1
+ import { STOREFRONT_DESIGN_LITERAL_MAX_CODE_POINTS } from "./storefrontDesignRegistry.js";
1
2
  /**
2
3
  * Every storefront `WEB` literal key a shop may override, in code-unit order.
3
4
  *
@@ -1173,3 +1174,13 @@ const STOREFRONT_SAME_ORIGIN_PATH_RE = /^\/(?![/\\])[^\s\\\p{Cc}\p{Cf}]*$/u;
1173
1174
  * unconstrained here (key membership, well-formedness and length are checked apart).
1174
1175
  */
1175
1176
  export const isAllowedStorefrontLiteralValue = (key, value) => !key.startsWith(STOREFRONT_NAVIGATE_LITERAL_PREFIX) || STOREFRONT_SAME_ORIGIN_PATH_RE.test(value);
1177
+ /**
1178
+ * Whether a shop's stored `value` for `key` is one a save keeps, a read serves and the editor
1179
+ * baseline adopts: a shop-overridable key, a well-formed string within
1180
+ * {@link STOREFRONT_DESIGN_LITERAL_MAX_CODE_POINTS} code points, and an allowed value for it.
1181
+ */
1182
+ export const isAdoptableStorefrontLiteral = (key, value) => isStorefrontLiteralKey(key) &&
1183
+ typeof value === 'string' &&
1184
+ value.isWellFormed() &&
1185
+ Array.from(value).length <= STOREFRONT_DESIGN_LITERAL_MAX_CODE_POINTS &&
1186
+ isAllowedStorefrontLiteralValue(key, value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "platform-types",
3
- "version": "1.10.698",
3
+ "version": "1.10.699",
4
4
  "description": "Shared wire and entity contracts for the platform.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",