promidas 2.0.0
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/LICENSE +21 -0
- package/README.md +179 -0
- package/dist/builder.d.ts +158 -0
- package/dist/builder.d.ts.map +1 -0
- package/dist/builder.js +255 -0
- package/dist/builder.js.map +1 -0
- package/dist/factory.d.ts +154 -0
- package/dist/factory.d.ts.map +1 -0
- package/dist/factory.js +243 -0
- package/dist/factory.js.map +1 -0
- package/dist/fetcher/client/config.d.ts +140 -0
- package/dist/fetcher/client/config.d.ts.map +1 -0
- package/dist/fetcher/client/config.js +2 -0
- package/dist/fetcher/client/config.js.map +1 -0
- package/dist/fetcher/client/fetch-with-progress.d.ts +156 -0
- package/dist/fetcher/client/fetch-with-progress.d.ts.map +1 -0
- package/dist/fetcher/client/fetch-with-progress.js +313 -0
- package/dist/fetcher/client/fetch-with-progress.js.map +1 -0
- package/dist/fetcher/client/fetch-with-timeout.d.ts +6 -0
- package/dist/fetcher/client/fetch-with-timeout.d.ts.map +1 -0
- package/dist/fetcher/client/fetch-with-timeout.js +48 -0
- package/dist/fetcher/client/fetch-with-timeout.js.map +1 -0
- package/dist/fetcher/client/protopedia-api-custom-client.d.ts +141 -0
- package/dist/fetcher/client/protopedia-api-custom-client.d.ts.map +1 -0
- package/dist/fetcher/client/protopedia-api-custom-client.js +268 -0
- package/dist/fetcher/client/protopedia-api-custom-client.js.map +1 -0
- package/dist/fetcher/client/select-custom-fetch.d.ts +58 -0
- package/dist/fetcher/client/select-custom-fetch.d.ts.map +1 -0
- package/dist/fetcher/client/select-custom-fetch.js +58 -0
- package/dist/fetcher/client/select-custom-fetch.js.map +1 -0
- package/dist/fetcher/errors/fetcher-error.d.ts +10 -0
- package/dist/fetcher/errors/fetcher-error.d.ts.map +1 -0
- package/dist/fetcher/errors/fetcher-error.js +15 -0
- package/dist/fetcher/errors/fetcher-error.js.map +1 -0
- package/dist/fetcher/index.d.ts +73 -0
- package/dist/fetcher/index.d.ts.map +1 -0
- package/dist/fetcher/index.js +70 -0
- package/dist/fetcher/index.js.map +1 -0
- package/dist/fetcher/types/index.d.ts +9 -0
- package/dist/fetcher/types/index.d.ts.map +1 -0
- package/dist/fetcher/types/index.js +7 -0
- package/dist/fetcher/types/index.js.map +1 -0
- package/dist/fetcher/types/progress-event.types.d.ts +221 -0
- package/dist/fetcher/types/progress-event.types.d.ts.map +1 -0
- package/dist/fetcher/types/progress-event.types.js +10 -0
- package/dist/fetcher/types/progress-event.types.js.map +1 -0
- package/dist/fetcher/types/prototype-api.types.d.ts +106 -0
- package/dist/fetcher/types/prototype-api.types.d.ts.map +1 -0
- package/dist/fetcher/types/prototype-api.types.js +2 -0
- package/dist/fetcher/types/prototype-api.types.js.map +1 -0
- package/dist/fetcher/types/result.types.d.ts +75 -0
- package/dist/fetcher/types/result.types.d.ts.map +1 -0
- package/dist/fetcher/types/result.types.js +2 -0
- package/dist/fetcher/types/result.types.js.map +1 -0
- package/dist/fetcher/utils/create-client-fetch.d.ts +63 -0
- package/dist/fetcher/utils/create-client-fetch.d.ts.map +1 -0
- package/dist/fetcher/utils/create-client-fetch.js +89 -0
- package/dist/fetcher/utils/create-client-fetch.js.map +1 -0
- package/dist/fetcher/utils/create-fetch-with-stripped-headers.d.ts +6 -0
- package/dist/fetcher/utils/create-fetch-with-stripped-headers.d.ts.map +1 -0
- package/dist/fetcher/utils/create-fetch-with-stripped-headers.js +40 -0
- package/dist/fetcher/utils/create-fetch-with-stripped-headers.js.map +1 -0
- package/dist/fetcher/utils/errors/handler.d.ts +58 -0
- package/dist/fetcher/utils/errors/handler.d.ts.map +1 -0
- package/dist/fetcher/utils/errors/handler.js +243 -0
- package/dist/fetcher/utils/errors/handler.js.map +1 -0
- package/dist/fetcher/utils/errors/messages.d.ts +75 -0
- package/dist/fetcher/utils/errors/messages.d.ts.map +1 -0
- package/dist/fetcher/utils/errors/messages.js +88 -0
- package/dist/fetcher/utils/errors/messages.js.map +1 -0
- package/dist/fetcher/utils/index.d.ts +13 -0
- package/dist/fetcher/utils/index.d.ts.map +1 -0
- package/dist/fetcher/utils/index.js +12 -0
- package/dist/fetcher/utils/index.js.map +1 -0
- package/dist/fetcher/utils/log-timestamp-normalization-warnings.d.ts +10 -0
- package/dist/fetcher/utils/log-timestamp-normalization-warnings.d.ts.map +1 -0
- package/dist/fetcher/utils/log-timestamp-normalization-warnings.js +32 -0
- package/dist/fetcher/utils/log-timestamp-normalization-warnings.js.map +1 -0
- package/dist/fetcher/utils/normalize-protopedia-timestamp.d.ts +59 -0
- package/dist/fetcher/utils/normalize-protopedia-timestamp.d.ts.map +1 -0
- package/dist/fetcher/utils/normalize-protopedia-timestamp.js +81 -0
- package/dist/fetcher/utils/normalize-protopedia-timestamp.js.map +1 -0
- package/dist/fetcher/utils/normalize-prototype.d.ts +56 -0
- package/dist/fetcher/utils/normalize-prototype.d.ts.map +1 -0
- package/dist/fetcher/utils/normalize-prototype.js +113 -0
- package/dist/fetcher/utils/normalize-prototype.js.map +1 -0
- package/dist/fetcher/utils/sanitize-options.d.ts +14 -0
- package/dist/fetcher/utils/sanitize-options.d.ts.map +1 -0
- package/dist/fetcher/utils/sanitize-options.js +16 -0
- package/dist/fetcher/utils/sanitize-options.js.map +1 -0
- package/dist/fetcher/utils/string-parsers.d.ts +45 -0
- package/dist/fetcher/utils/string-parsers.d.ts.map +1 -0
- package/dist/fetcher/utils/string-parsers.js +53 -0
- package/dist/fetcher/utils/string-parsers.js.map +1 -0
- package/dist/index.d.ts +66 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +70 -0
- package/dist/index.js.map +1 -0
- package/dist/logger/console-logger.d.ts +74 -0
- package/dist/logger/console-logger.d.ts.map +1 -0
- package/dist/logger/console-logger.js +113 -0
- package/dist/logger/console-logger.js.map +1 -0
- package/dist/logger/factory.d.ts +88 -0
- package/dist/logger/factory.d.ts.map +1 -0
- package/dist/logger/factory.js +94 -0
- package/dist/logger/factory.js.map +1 -0
- package/dist/logger/index.d.ts +42 -0
- package/dist/logger/index.d.ts.map +1 -0
- package/dist/logger/index.js +41 -0
- package/dist/logger/index.js.map +1 -0
- package/dist/logger/logger.types.d.ts +49 -0
- package/dist/logger/logger.types.d.ts.map +1 -0
- package/dist/logger/logger.types.js +2 -0
- package/dist/logger/logger.types.js.map +1 -0
- package/dist/repository/errors/validation-error.d.ts +24 -0
- package/dist/repository/errors/validation-error.d.ts.map +1 -0
- package/dist/repository/errors/validation-error.js +26 -0
- package/dist/repository/errors/validation-error.js.map +1 -0
- package/dist/repository/index.d.ts +122 -0
- package/dist/repository/index.d.ts.map +1 -0
- package/dist/repository/index.js +44 -0
- package/dist/repository/index.js.map +1 -0
- package/dist/repository/protopedia-in-memory-repository.d.ts +560 -0
- package/dist/repository/protopedia-in-memory-repository.d.ts.map +1 -0
- package/dist/repository/protopedia-in-memory-repository.js +929 -0
- package/dist/repository/protopedia-in-memory-repository.js.map +1 -0
- package/dist/repository/schemas/index.d.ts +9 -0
- package/dist/repository/schemas/index.d.ts.map +1 -0
- package/dist/repository/schemas/index.js +11 -0
- package/dist/repository/schemas/index.js.map +1 -0
- package/dist/repository/schemas/params.d.ts +44 -0
- package/dist/repository/schemas/params.d.ts.map +1 -0
- package/dist/repository/schemas/params.js +44 -0
- package/dist/repository/schemas/params.js.map +1 -0
- package/dist/repository/schemas/serializable-snapshot.d.ts +33 -0
- package/dist/repository/schemas/serializable-snapshot.d.ts.map +1 -0
- package/dist/repository/schemas/serializable-snapshot.js +45 -0
- package/dist/repository/schemas/serializable-snapshot.js.map +1 -0
- package/dist/repository/types/analysis.types.d.ts +89 -0
- package/dist/repository/types/analysis.types.d.ts.map +1 -0
- package/dist/repository/types/analysis.types.js +2 -0
- package/dist/repository/types/analysis.types.js.map +1 -0
- package/dist/repository/types/index.d.ts +12 -0
- package/dist/repository/types/index.d.ts.map +1 -0
- package/dist/repository/types/index.js +7 -0
- package/dist/repository/types/index.js.map +1 -0
- package/dist/repository/types/repository-events.types.d.ts +110 -0
- package/dist/repository/types/repository-events.types.d.ts.map +1 -0
- package/dist/repository/types/repository-events.types.js +2 -0
- package/dist/repository/types/repository-events.types.js.map +1 -0
- package/dist/repository/types/repository.types.d.ts +330 -0
- package/dist/repository/types/repository.types.d.ts.map +1 -0
- package/dist/repository/types/repository.types.js +2 -0
- package/dist/repository/types/repository.types.js.map +1 -0
- package/dist/repository/types/result.types.d.ts +55 -0
- package/dist/repository/types/result.types.d.ts.map +1 -0
- package/dist/repository/types/result.types.js +2 -0
- package/dist/repository/types/result.types.js.map +1 -0
- package/dist/repository/types/serialization.types.d.ts +61 -0
- package/dist/repository/types/serialization.types.d.ts.map +1 -0
- package/dist/repository/types/serialization.types.js +2 -0
- package/dist/repository/types/serialization.types.js.map +1 -0
- package/dist/repository/types/snapshot-operation.types.d.ts +140 -0
- package/dist/repository/types/snapshot-operation.types.d.ts.map +1 -0
- package/dist/repository/types/snapshot-operation.types.js +2 -0
- package/dist/repository/types/snapshot-operation.types.js.map +1 -0
- package/dist/repository/utils/convert-fetch-result.d.ts +46 -0
- package/dist/repository/utils/convert-fetch-result.d.ts.map +1 -0
- package/dist/repository/utils/convert-fetch-result.js +59 -0
- package/dist/repository/utils/convert-fetch-result.js.map +1 -0
- package/dist/repository/utils/convert-store-result.d.ts +36 -0
- package/dist/repository/utils/convert-store-result.d.ts.map +1 -0
- package/dist/repository/utils/convert-store-result.js +36 -0
- package/dist/repository/utils/convert-store-result.js.map +1 -0
- package/dist/repository/utils/emit-repository-event-safely.d.ts +5 -0
- package/dist/repository/utils/emit-repository-event-safely.d.ts.map +1 -0
- package/dist/repository/utils/emit-repository-event-safely.js +17 -0
- package/dist/repository/utils/emit-repository-event-safely.js.map +1 -0
- package/dist/repository/utils/index.d.ts +3 -0
- package/dist/repository/utils/index.d.ts.map +1 -0
- package/dist/repository/utils/index.js +3 -0
- package/dist/repository/utils/index.js.map +1 -0
- package/dist/repository/validation/index.d.ts +9 -0
- package/dist/repository/validation/index.d.ts.map +1 -0
- package/dist/repository/validation/index.js +10 -0
- package/dist/repository/validation/index.js.map +1 -0
- package/dist/repository/validation/params-validators.d.ts +46 -0
- package/dist/repository/validation/params-validators.d.ts.map +1 -0
- package/dist/repository/validation/params-validators.js +68 -0
- package/dist/repository/validation/params-validators.js.map +1 -0
- package/dist/repository/validation/serializable-snapshot.d.ts +47 -0
- package/dist/repository/validation/serializable-snapshot.d.ts.map +1 -0
- package/dist/repository/validation/serializable-snapshot.js +104 -0
- package/dist/repository/validation/serializable-snapshot.js.map +1 -0
- package/dist/schemas/index.d.ts +8 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +8 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/schemas/normalized-prototype.d.ts +56 -0
- package/dist/schemas/normalized-prototype.d.ts.map +1 -0
- package/dist/schemas/normalized-prototype.js +123 -0
- package/dist/schemas/normalized-prototype.js.map +1 -0
- package/dist/store/errors/store-error.d.ts +148 -0
- package/dist/store/errors/store-error.d.ts.map +1 -0
- package/dist/store/errors/store-error.js +156 -0
- package/dist/store/errors/store-error.js.map +1 -0
- package/dist/store/index.d.ts +84 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.js +83 -0
- package/dist/store/index.js.map +1 -0
- package/dist/store/store.d.ts +295 -0
- package/dist/store/store.d.ts.map +1 -0
- package/dist/store/store.js +411 -0
- package/dist/store/store.js.map +1 -0
- package/dist/store/types/index.d.ts +2 -0
- package/dist/store/types/index.d.ts.map +1 -0
- package/dist/store/types/index.js +2 -0
- package/dist/store/types/index.js.map +1 -0
- package/dist/store/types/result.types.d.ts +67 -0
- package/dist/store/types/result.types.d.ts.map +1 -0
- package/dist/store/types/result.types.js +2 -0
- package/dist/store/types/result.types.js.map +1 -0
- package/dist/types/codes.d.ts +44 -0
- package/dist/types/codes.d.ts.map +1 -0
- package/dist/types/codes.js +9 -0
- package/dist/types/codes.js.map +1 -0
- package/dist/types/index.d.ts +61 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +60 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/normalized-prototype.d.ts +95 -0
- package/dist/types/normalized-prototype.d.ts.map +1 -0
- package/dist/types/normalized-prototype.js +2 -0
- package/dist/types/normalized-prototype.js.map +1 -0
- package/dist/utils/converters/index.d.ts +15 -0
- package/dist/utils/converters/index.d.ts.map +1 -0
- package/dist/utils/converters/index.js +15 -0
- package/dist/utils/converters/index.js.map +1 -0
- package/dist/utils/converters/license-type.d.ts +23 -0
- package/dist/utils/converters/license-type.d.ts.map +1 -0
- package/dist/utils/converters/license-type.js +38 -0
- package/dist/utils/converters/license-type.js.map +1 -0
- package/dist/utils/converters/release-flag.d.ts +24 -0
- package/dist/utils/converters/release-flag.d.ts.map +1 -0
- package/dist/utils/converters/release-flag.js +40 -0
- package/dist/utils/converters/release-flag.js.map +1 -0
- package/dist/utils/converters/status.d.ts +23 -0
- package/dist/utils/converters/status.d.ts.map +1 -0
- package/dist/utils/converters/status.js +40 -0
- package/dist/utils/converters/status.js.map +1 -0
- package/dist/utils/converters/thanks-flag.d.ts +25 -0
- package/dist/utils/converters/thanks-flag.d.ts.map +1 -0
- package/dist/utils/converters/thanks-flag.js +41 -0
- package/dist/utils/converters/thanks-flag.js.map +1 -0
- package/dist/utils/deep-merge.d.ts +38 -0
- package/dist/utils/deep-merge.d.ts.map +1 -0
- package/dist/utils/deep-merge.js +85 -0
- package/dist/utils/deep-merge.js.map +1 -0
- package/dist/utils/index.d.ts +80 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +85 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logger-utils.d.ts +100 -0
- package/dist/utils/logger-utils.d.ts.map +1 -0
- package/dist/utils/logger-utils.js +265 -0
- package/dist/utils/logger-utils.js.map +1 -0
- package/dist/utils/time/constants.d.ts +14 -0
- package/dist/utils/time/constants.d.ts.map +1 -0
- package/dist/utils/time/constants.js +14 -0
- package/dist/utils/time/constants.js.map +1 -0
- package/dist/utils/time/index.d.ts +28 -0
- package/dist/utils/time/index.d.ts.map +1 -0
- package/dist/utils/time/index.js +28 -0
- package/dist/utils/time/index.js.map +1 -0
- package/dist/utils/time/parser.d.ts +91 -0
- package/dist/utils/time/parser.d.ts.map +1 -0
- package/dist/utils/time/parser.js +143 -0
- package/dist/utils/time/parser.js.map +1 -0
- package/dist/utils/validation/index.d.ts +8 -0
- package/dist/utils/validation/index.d.ts.map +1 -0
- package/dist/utils/validation/index.js +7 -0
- package/dist/utils/validation/index.js.map +1 -0
- package/dist/utils/validation/normalized-prototype.d.ts +64 -0
- package/dist/utils/validation/normalized-prototype.d.ts.map +1 -0
- package/dist/utils/validation/normalized-prototype.js +97 -0
- package/dist/utils/validation/normalized-prototype.js.map +1 -0
- package/dist/utils/validation/types.d.ts +62 -0
- package/dist/utils/validation/types.d.ts.map +1 -0
- package/dist/utils/validation/types.js +8 -0
- package/dist/utils/validation/types.js.map +1 -0
- package/dist/version.d.ts +6 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +6 -0
- package/dist/version.js.map +1 -0
- package/package.json +138 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation schema for NormalizedPrototype.
|
|
3
|
+
*
|
|
4
|
+
* This module provides a Zod schema for validating the structure
|
|
5
|
+
* of normalized prototype objects.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
/**
|
|
9
|
+
* Validation schema for NormalizedPrototype.
|
|
10
|
+
*
|
|
11
|
+
* This schema validates the structure of a single prototype object.
|
|
12
|
+
* Used internally for validating deserialized snapshot data.
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* This is a comprehensive schema covering all fields of NormalizedPrototype.
|
|
16
|
+
* Optional fields are marked with .optional() and must be undefined (not null)
|
|
17
|
+
* due to exactOptionalPropertyTypes: true.
|
|
18
|
+
*/
|
|
19
|
+
export const normalizedPrototypeSchema = z.object({
|
|
20
|
+
/* ID */
|
|
21
|
+
id: z.number().int().positive(),
|
|
22
|
+
/* Editorial information */
|
|
23
|
+
createDate: z.string(),
|
|
24
|
+
updateDate: z.string().optional(),
|
|
25
|
+
releaseDate: z.string().optional(),
|
|
26
|
+
createId: z.number().int().optional(),
|
|
27
|
+
updateId: z.number().int().optional(),
|
|
28
|
+
/**
|
|
29
|
+
* Valid release flag code values.
|
|
30
|
+
*
|
|
31
|
+
* - 1: '下書き保存' (Draft) - Not accessible via public API
|
|
32
|
+
* - 2: '一般公開' (Public) - Only this value appears in API responses
|
|
33
|
+
* - 3: '限定共有' (Limited Sharing) - Not accessible via public API
|
|
34
|
+
*/
|
|
35
|
+
releaseFlg: z.union([
|
|
36
|
+
//
|
|
37
|
+
z.literal(1),
|
|
38
|
+
z.literal(2),
|
|
39
|
+
z.literal(3),
|
|
40
|
+
]),
|
|
41
|
+
/* Basic information */
|
|
42
|
+
/**
|
|
43
|
+
* Valid status code values.
|
|
44
|
+
*
|
|
45
|
+
* - 1: 'アイデア' (Idea)
|
|
46
|
+
* - 2: '開発中' (In Development)
|
|
47
|
+
* - 3: '完成' (Completed)
|
|
48
|
+
* - 4: '供養' (Retired/Memorial)
|
|
49
|
+
*
|
|
50
|
+
* All four status values appear in public API responses.
|
|
51
|
+
*/
|
|
52
|
+
status: z.union([
|
|
53
|
+
//
|
|
54
|
+
z.literal(1),
|
|
55
|
+
z.literal(2),
|
|
56
|
+
z.literal(3),
|
|
57
|
+
z.literal(4),
|
|
58
|
+
]),
|
|
59
|
+
prototypeNm: z.string(),
|
|
60
|
+
summary: z.string(),
|
|
61
|
+
freeComment: z.string(),
|
|
62
|
+
systemDescription: z.string(),
|
|
63
|
+
/** Users and Team */
|
|
64
|
+
users: z.array(z.string()),
|
|
65
|
+
teamNm: z.string(),
|
|
66
|
+
/** Tags, Materials, Events, and Awards */
|
|
67
|
+
tags: z.array(z.string()),
|
|
68
|
+
materials: z.array(z.string()),
|
|
69
|
+
events: z.array(z.string()),
|
|
70
|
+
awards: z.array(z.string()),
|
|
71
|
+
/* URLs */
|
|
72
|
+
// URL of official site (if any)
|
|
73
|
+
officialLink: z.string().optional(),
|
|
74
|
+
// URL of YouTube or Vimeo video (if any)
|
|
75
|
+
videoUrl: z.string().optional(),
|
|
76
|
+
// URL of eyecatch image
|
|
77
|
+
mainUrl: z.string(),
|
|
78
|
+
// URLs of related link
|
|
79
|
+
relatedLink: z.string().optional(),
|
|
80
|
+
relatedLink2: z.string().optional(),
|
|
81
|
+
relatedLink3: z.string().optional(),
|
|
82
|
+
relatedLink4: z.string().optional(),
|
|
83
|
+
relatedLink5: z.string().optional(),
|
|
84
|
+
/* counts */
|
|
85
|
+
viewCount: z.number().int(),
|
|
86
|
+
goodCount: z.number().int(),
|
|
87
|
+
commentCount: z.number().int(),
|
|
88
|
+
/* Others */
|
|
89
|
+
uuid: z.string().optional(),
|
|
90
|
+
nid: z.string().optional(),
|
|
91
|
+
revision: z.number().int().optional(),
|
|
92
|
+
/**
|
|
93
|
+
* Valid license type code values.
|
|
94
|
+
*
|
|
95
|
+
* - 0: 'なし' (None) - Not observed in API responses
|
|
96
|
+
* - 1: '表示(CC:BY)' (Display with CC BY license) - All API responses have this value
|
|
97
|
+
*/
|
|
98
|
+
licenseType: z
|
|
99
|
+
.union([
|
|
100
|
+
//
|
|
101
|
+
z.literal(0),
|
|
102
|
+
z.literal(1),
|
|
103
|
+
])
|
|
104
|
+
.optional(),
|
|
105
|
+
/**
|
|
106
|
+
* Valid thanks flag code values.
|
|
107
|
+
*
|
|
108
|
+
* - 0: (Implicit) Message not yet shown - Rarely or never seen in API responses
|
|
109
|
+
* - 1: '初回表示済' ("Thank you for posting" message shown) - Most common value
|
|
110
|
+
* - undefined: Field not present in older prototypes (pre-thanksFlg era, ~3.26% of data)
|
|
111
|
+
*
|
|
112
|
+
* Note: Historical data may not include this field. Always handle undefined case.
|
|
113
|
+
*/
|
|
114
|
+
thanksFlg: z
|
|
115
|
+
.union([
|
|
116
|
+
//
|
|
117
|
+
z.literal(0),
|
|
118
|
+
z.literal(1),
|
|
119
|
+
])
|
|
120
|
+
.optional(),
|
|
121
|
+
slideMode: z.number().int().optional(),
|
|
122
|
+
});
|
|
123
|
+
//# sourceMappingURL=normalized-prototype.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalized-prototype.js","sourceRoot":"","sources":["../../lib/schemas/normalized-prototype.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error classes for PrototypeInMemoryStore operations.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Represents the state of stored data when an error occurs.
|
|
8
|
+
*
|
|
9
|
+
* - `UNCHANGED`: The store's existing data remains intact and unmodified
|
|
10
|
+
* - `UNKNOWN`: The data state is unknown or unspecified (for future extensions)
|
|
11
|
+
*/
|
|
12
|
+
export type StoreDataState = 'UNCHANGED' | 'UNKNOWN';
|
|
13
|
+
/**
|
|
14
|
+
* Base error class for PrototypeInMemoryStore operations.
|
|
15
|
+
*
|
|
16
|
+
* All store-specific errors extend this class, allowing callers to catch
|
|
17
|
+
* all store errors with a single catch block if desired. Each error includes
|
|
18
|
+
* a `dataState` property indicating whether the store's data was affected.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* try {
|
|
23
|
+
* store.setAll(prototypes);
|
|
24
|
+
* } catch (error) {
|
|
25
|
+
* if (error instanceof StoreError) {
|
|
26
|
+
* console.error('Store operation failed:', error.message);
|
|
27
|
+
* console.log('Data state:', error.dataState); // 'UNCHANGED' or 'UNKNOWN'
|
|
28
|
+
* }
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare class StoreError extends Error {
|
|
33
|
+
/**
|
|
34
|
+
* Indicates the state of the store's data when this error occurred.
|
|
35
|
+
*/
|
|
36
|
+
readonly dataState: StoreDataState;
|
|
37
|
+
/**
|
|
38
|
+
* Creates a new StoreError.
|
|
39
|
+
*
|
|
40
|
+
* @param message - Human-readable error message
|
|
41
|
+
* @param dataState - State of the store's data (defaults to 'UNKNOWN')
|
|
42
|
+
* @param options - Error options, including the original error cause for debugging
|
|
43
|
+
*/
|
|
44
|
+
constructor(message: string, dataState?: StoreDataState, options?: ErrorOptions);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Thrown when store configuration is invalid.
|
|
48
|
+
*
|
|
49
|
+
* This error indicates that the configuration provided to the store
|
|
50
|
+
* constructor contains invalid values. Common causes include exceeding
|
|
51
|
+
* maximum allowed limits or providing incompatible settings.
|
|
52
|
+
*
|
|
53
|
+
* This error is thrown before the store is created, so no data state applies.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* try {
|
|
58
|
+
* const store = new PrototypeInMemoryStore({
|
|
59
|
+
* maxDataSizeBytes: 50 * 1024 * 1024, // 50 MiB exceeds 30 MiB limit
|
|
60
|
+
* });
|
|
61
|
+
* } catch (error) {
|
|
62
|
+
* if (error instanceof ConfigurationError) {
|
|
63
|
+
* console.error('Invalid configuration:', error.message);
|
|
64
|
+
* }
|
|
65
|
+
* }
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
export declare class ConfigurationError extends StoreError {
|
|
69
|
+
/**
|
|
70
|
+
* Creates a new ConfigurationError.
|
|
71
|
+
*
|
|
72
|
+
* @param message - Human-readable error message describing the configuration issue
|
|
73
|
+
*/
|
|
74
|
+
constructor(message: string);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Thrown when snapshot data size exceeds the configured maximum limit.
|
|
78
|
+
*
|
|
79
|
+
* This error indicates that the prototypes being stored exceed the
|
|
80
|
+
* `maxDataSizeBytes` limit configured for the store. The error includes
|
|
81
|
+
* both the actual data size and the maximum allowed size for debugging.
|
|
82
|
+
*
|
|
83
|
+
* When this error is thrown, the store's data remains UNCHANGED.
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```typescript
|
|
87
|
+
* try {
|
|
88
|
+
* store.setAll(prototypes);
|
|
89
|
+
* } catch (error) {
|
|
90
|
+
* if (error instanceof DataSizeExceededError) {
|
|
91
|
+
* console.error(
|
|
92
|
+
* `Data too large: ${error.dataSizeBytes} bytes ` +
|
|
93
|
+
* `(max: ${error.maxDataSizeBytes} bytes)`
|
|
94
|
+
* );
|
|
95
|
+
* console.log('Previous data intact:', error.dataState === 'UNCHANGED');
|
|
96
|
+
* }
|
|
97
|
+
* }
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
export declare class DataSizeExceededError extends StoreError {
|
|
101
|
+
/**
|
|
102
|
+
* Actual size of the data in bytes.
|
|
103
|
+
*/
|
|
104
|
+
readonly dataSizeBytes: number;
|
|
105
|
+
/**
|
|
106
|
+
* Maximum allowed size in bytes.
|
|
107
|
+
*/
|
|
108
|
+
readonly maxDataSizeBytes: number;
|
|
109
|
+
/**
|
|
110
|
+
* Creates a new DataSizeExceededError.
|
|
111
|
+
*
|
|
112
|
+
* @param dataState - State of the store's data
|
|
113
|
+
* @param dataSizeBytes - Actual size of the data in bytes
|
|
114
|
+
* @param maxDataSizeBytes - Maximum allowed size in bytes
|
|
115
|
+
*/
|
|
116
|
+
constructor(dataState: StoreDataState, dataSizeBytes: number, maxDataSizeBytes: number);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Thrown when data size estimation fails.
|
|
120
|
+
*
|
|
121
|
+
* This error indicates that the store was unable to calculate the size
|
|
122
|
+
* of the prototypes being stored, typically due to JSON serialization
|
|
123
|
+
* failures (e.g., circular references, unsupported types).
|
|
124
|
+
*
|
|
125
|
+
* When this error is thrown, the store's data remains UNCHANGED.
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```typescript
|
|
129
|
+
* try {
|
|
130
|
+
* store.setAll(prototypes);
|
|
131
|
+
* } catch (error) {
|
|
132
|
+
* if (error instanceof SizeEstimationError) {
|
|
133
|
+
* console.error('Cannot estimate data size:', error.cause);
|
|
134
|
+
* console.log('Previous data intact:', error.dataState === 'UNCHANGED');
|
|
135
|
+
* }
|
|
136
|
+
* }
|
|
137
|
+
* ```
|
|
138
|
+
*/
|
|
139
|
+
export declare class SizeEstimationError extends StoreError {
|
|
140
|
+
/**
|
|
141
|
+
* Creates a new SizeEstimationError.
|
|
142
|
+
*
|
|
143
|
+
* @param dataState - State of the store's data (defaults to 'UNKNOWN')
|
|
144
|
+
* @param cause - The underlying error that caused the estimation to fail
|
|
145
|
+
*/
|
|
146
|
+
constructor(dataState?: StoreDataState, cause?: Error);
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=store-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store-error.d.ts","sourceRoot":"","sources":["../../../lib/store/errors/store-error.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,SAAS,CAAC;AAErD;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,UAAW,SAAQ,KAAK;IACnC;;OAEG;IACH,SAAgB,SAAS,EAAE,cAAc,CAAC;IAE1C;;;;;;OAMG;gBAED,OAAO,EAAE,MAAM,EACf,SAAS,GAAE,cAA0B,EACrC,OAAO,CAAC,EAAE,YAAY;CAMzB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,kBAAmB,SAAQ,UAAU;IAChD;;;;OAIG;gBACS,OAAO,EAAE,MAAM;CAI5B;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,qBAAsB,SAAQ,UAAU;IACnD;;OAEG;IACH,SAAgB,aAAa,EAAE,MAAM,CAAC;IAEtC;;OAEG;IACH,SAAgB,gBAAgB,EAAE,MAAM,CAAC;IAEzC;;;;;;OAMG;gBAED,SAAS,EAAE,cAAc,EACzB,aAAa,EAAE,MAAM,EACrB,gBAAgB,EAAE,MAAM;CAU3B;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,mBAAoB,SAAQ,UAAU;IACjD;;;;;OAKG;gBACS,SAAS,GAAE,cAA0B,EAAE,KAAK,CAAC,EAAE,KAAK;CAIjE"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error classes for PrototypeInMemoryStore operations.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Base error class for PrototypeInMemoryStore operations.
|
|
8
|
+
*
|
|
9
|
+
* All store-specific errors extend this class, allowing callers to catch
|
|
10
|
+
* all store errors with a single catch block if desired. Each error includes
|
|
11
|
+
* a `dataState` property indicating whether the store's data was affected.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* try {
|
|
16
|
+
* store.setAll(prototypes);
|
|
17
|
+
* } catch (error) {
|
|
18
|
+
* if (error instanceof StoreError) {
|
|
19
|
+
* console.error('Store operation failed:', error.message);
|
|
20
|
+
* console.log('Data state:', error.dataState); // 'UNCHANGED' or 'UNKNOWN'
|
|
21
|
+
* }
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export class StoreError extends Error {
|
|
26
|
+
/**
|
|
27
|
+
* Indicates the state of the store's data when this error occurred.
|
|
28
|
+
*/
|
|
29
|
+
dataState;
|
|
30
|
+
/**
|
|
31
|
+
* Creates a new StoreError.
|
|
32
|
+
*
|
|
33
|
+
* @param message - Human-readable error message
|
|
34
|
+
* @param dataState - State of the store's data (defaults to 'UNKNOWN')
|
|
35
|
+
* @param options - Error options, including the original error cause for debugging
|
|
36
|
+
*/
|
|
37
|
+
constructor(message, dataState = 'UNKNOWN', options) {
|
|
38
|
+
super(message, options);
|
|
39
|
+
this.name = 'StoreError';
|
|
40
|
+
this.dataState = dataState;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Thrown when store configuration is invalid.
|
|
45
|
+
*
|
|
46
|
+
* This error indicates that the configuration provided to the store
|
|
47
|
+
* constructor contains invalid values. Common causes include exceeding
|
|
48
|
+
* maximum allowed limits or providing incompatible settings.
|
|
49
|
+
*
|
|
50
|
+
* This error is thrown before the store is created, so no data state applies.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```typescript
|
|
54
|
+
* try {
|
|
55
|
+
* const store = new PrototypeInMemoryStore({
|
|
56
|
+
* maxDataSizeBytes: 50 * 1024 * 1024, // 50 MiB exceeds 30 MiB limit
|
|
57
|
+
* });
|
|
58
|
+
* } catch (error) {
|
|
59
|
+
* if (error instanceof ConfigurationError) {
|
|
60
|
+
* console.error('Invalid configuration:', error.message);
|
|
61
|
+
* }
|
|
62
|
+
* }
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
export class ConfigurationError extends StoreError {
|
|
66
|
+
/**
|
|
67
|
+
* Creates a new ConfigurationError.
|
|
68
|
+
*
|
|
69
|
+
* @param message - Human-readable error message describing the configuration issue
|
|
70
|
+
*/
|
|
71
|
+
constructor(message) {
|
|
72
|
+
super(message, 'UNKNOWN');
|
|
73
|
+
this.name = 'ConfigurationError';
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Thrown when snapshot data size exceeds the configured maximum limit.
|
|
78
|
+
*
|
|
79
|
+
* This error indicates that the prototypes being stored exceed the
|
|
80
|
+
* `maxDataSizeBytes` limit configured for the store. The error includes
|
|
81
|
+
* both the actual data size and the maximum allowed size for debugging.
|
|
82
|
+
*
|
|
83
|
+
* When this error is thrown, the store's data remains UNCHANGED.
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```typescript
|
|
87
|
+
* try {
|
|
88
|
+
* store.setAll(prototypes);
|
|
89
|
+
* } catch (error) {
|
|
90
|
+
* if (error instanceof DataSizeExceededError) {
|
|
91
|
+
* console.error(
|
|
92
|
+
* `Data too large: ${error.dataSizeBytes} bytes ` +
|
|
93
|
+
* `(max: ${error.maxDataSizeBytes} bytes)`
|
|
94
|
+
* );
|
|
95
|
+
* console.log('Previous data intact:', error.dataState === 'UNCHANGED');
|
|
96
|
+
* }
|
|
97
|
+
* }
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
export class DataSizeExceededError extends StoreError {
|
|
101
|
+
/**
|
|
102
|
+
* Actual size of the data in bytes.
|
|
103
|
+
*/
|
|
104
|
+
dataSizeBytes;
|
|
105
|
+
/**
|
|
106
|
+
* Maximum allowed size in bytes.
|
|
107
|
+
*/
|
|
108
|
+
maxDataSizeBytes;
|
|
109
|
+
/**
|
|
110
|
+
* Creates a new DataSizeExceededError.
|
|
111
|
+
*
|
|
112
|
+
* @param dataState - State of the store's data
|
|
113
|
+
* @param dataSizeBytes - Actual size of the data in bytes
|
|
114
|
+
* @param maxDataSizeBytes - Maximum allowed size in bytes
|
|
115
|
+
*/
|
|
116
|
+
constructor(dataState, dataSizeBytes, maxDataSizeBytes) {
|
|
117
|
+
super(`Snapshot data size (${dataSizeBytes} bytes) exceeds maximum limit (${maxDataSizeBytes} bytes)`, dataState);
|
|
118
|
+
this.name = 'DataSizeExceededError';
|
|
119
|
+
this.dataSizeBytes = dataSizeBytes;
|
|
120
|
+
this.maxDataSizeBytes = maxDataSizeBytes;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Thrown when data size estimation fails.
|
|
125
|
+
*
|
|
126
|
+
* This error indicates that the store was unable to calculate the size
|
|
127
|
+
* of the prototypes being stored, typically due to JSON serialization
|
|
128
|
+
* failures (e.g., circular references, unsupported types).
|
|
129
|
+
*
|
|
130
|
+
* When this error is thrown, the store's data remains UNCHANGED.
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* ```typescript
|
|
134
|
+
* try {
|
|
135
|
+
* store.setAll(prototypes);
|
|
136
|
+
* } catch (error) {
|
|
137
|
+
* if (error instanceof SizeEstimationError) {
|
|
138
|
+
* console.error('Cannot estimate data size:', error.cause);
|
|
139
|
+
* console.log('Previous data intact:', error.dataState === 'UNCHANGED');
|
|
140
|
+
* }
|
|
141
|
+
* }
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
export class SizeEstimationError extends StoreError {
|
|
145
|
+
/**
|
|
146
|
+
* Creates a new SizeEstimationError.
|
|
147
|
+
*
|
|
148
|
+
* @param dataState - State of the store's data (defaults to 'UNKNOWN')
|
|
149
|
+
* @param cause - The underlying error that caused the estimation to fail
|
|
150
|
+
*/
|
|
151
|
+
constructor(dataState = 'UNKNOWN', cause) {
|
|
152
|
+
super('Failed to estimate data size for snapshot', dataState, { cause });
|
|
153
|
+
this.name = 'SizeEstimationError';
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
//# sourceMappingURL=store-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store-error.js","sourceRoot":"","sources":["../../../lib/store/errors/store-error.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,OAAO,UAAW,SAAQ,KAAK;IACnC;;OAEG;IACa,SAAS,CAAiB;IAE1C;;;;;;OAMG;IACH,YACE,OAAe,EACf,YAA4B,SAAS,EACrC,OAAsB;QAEtB,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;QACzB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,OAAO,kBAAmB,SAAQ,UAAU;IAChD;;;;OAIG;IACH,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QAC1B,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACnC,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,OAAO,qBAAsB,SAAQ,UAAU;IACnD;;OAEG;IACa,aAAa,CAAS;IAEtC;;OAEG;IACa,gBAAgB,CAAS;IAEzC;;;;;;OAMG;IACH,YACE,SAAyB,EACzB,aAAqB,EACrB,gBAAwB;QAExB,KAAK,CACH,uBAAuB,aAAa,kCAAkC,gBAAgB,SAAS,EAC/F,SAAS,CACV,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;QACpC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;IAC3C,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,mBAAoB,SAAQ,UAAU;IACjD;;;;;OAKG;IACH,YAAY,YAA4B,SAAS,EAAE,KAAa;QAC9D,KAAK,CAAC,2CAA2C,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QACzE,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* In-Memory Prototype Storage Module.
|
|
3
|
+
*
|
|
4
|
+
* This module provides a complete storage layer for managing in-memory snapshots
|
|
5
|
+
* of prototype data, including TTL-based expiration, size limits, and efficient
|
|
6
|
+
* ID-based lookups. It can be used as a standalone module for custom caching
|
|
7
|
+
* solutions or integrated with the repository layer.
|
|
8
|
+
*
|
|
9
|
+
* ## Core Components
|
|
10
|
+
*
|
|
11
|
+
* - {@link PrototypeInMemoryStore} — Main store class with snapshot management, TTL expiration, and ID-based lookups.
|
|
12
|
+
* - {@link PrototypeInMemoryStoreConfig} — Configuration options including TTL and max data size.
|
|
13
|
+
* - {@link PrototypeInMemoryStats} — Statistics and metadata about the current store state.
|
|
14
|
+
*
|
|
15
|
+
* ### Storage Operations & Result Types
|
|
16
|
+
*
|
|
17
|
+
* - {@link SetResult} — Discriminated union result type for `setAll` operations.
|
|
18
|
+
* - {@link StoreErrorCode} — Error codes for precise error classification.
|
|
19
|
+
* - {@link StoreFailureKind} — Failure kinds: `'storage_limit'`, `'serialization'`, or `'unknown'`.
|
|
20
|
+
*
|
|
21
|
+
* ### Error Handling
|
|
22
|
+
*
|
|
23
|
+
* The store throws exceptions by default, but also provides Result types for
|
|
24
|
+
* consumers who prefer explicit error handling:
|
|
25
|
+
*
|
|
26
|
+
* - {@link StoreError} — Base error class for all store errors.
|
|
27
|
+
* - {@link ConfigurationError} — Configuration validation errors.
|
|
28
|
+
* - {@link DataSizeExceededError} — Data size limit exceeded.
|
|
29
|
+
* - {@link SizeEstimationError} — Size estimation failures.
|
|
30
|
+
* - {@link StoreDataState} — Data state after operation: `'UNCHANGED'`, `'CLEARED'`, or `'UNKNOWN'`.
|
|
31
|
+
*
|
|
32
|
+
* ### Dependencies
|
|
33
|
+
*
|
|
34
|
+
* - {@link NormalizedPrototype} — The data type stored in the store.
|
|
35
|
+
* - {@link Logger} — Logger interface for custom logging implementations.
|
|
36
|
+
* - {@link LogLevel} — Log level type for controlling logger verbosity.
|
|
37
|
+
*
|
|
38
|
+
* ## Standalone Usage
|
|
39
|
+
*
|
|
40
|
+
* This module is designed to work independently, allowing you to:
|
|
41
|
+
* - Create custom in-memory caching solutions
|
|
42
|
+
* - Build data snapshot management systems
|
|
43
|
+
* - Integrate with different runtime environments (Node.js, Next.js, etc.)
|
|
44
|
+
*
|
|
45
|
+
* ## Design Philosophy
|
|
46
|
+
*
|
|
47
|
+
* - **Exception-based**: Store operations throw exceptions on errors
|
|
48
|
+
* - **Result types available**: Optional Result pattern for consumers who prefer it
|
|
49
|
+
* - **TTL-based expiration**: Automatic data invalidation after configured time
|
|
50
|
+
* - **Size limits**: Prevents memory overflow with configurable limits
|
|
51
|
+
* - **Type-safe**: Full TypeScript support with discriminated unions
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* import { PrototypeInMemoryStore } from 'promidas/store';
|
|
56
|
+
*
|
|
57
|
+
* const store = new PrototypeInMemoryStore({
|
|
58
|
+
* ttlMs: 30 * 60 * 1000, // 30 minutes
|
|
59
|
+
* maxDataSizeBytes: 50 * 1024 * 1024, // 50MB
|
|
60
|
+
* });
|
|
61
|
+
*
|
|
62
|
+
* // Store data (throws on error)
|
|
63
|
+
* const snapshot = store.setAll(prototypes);
|
|
64
|
+
* console.log(`Stored ${snapshot.count} prototypes`);
|
|
65
|
+
*
|
|
66
|
+
* // Check if data is fresh
|
|
67
|
+
* if (!store.isExpired()) {
|
|
68
|
+
* const prototype = store.getByPrototypeId('proto-123');
|
|
69
|
+
* }
|
|
70
|
+
*
|
|
71
|
+
* // Get statistics
|
|
72
|
+
* const stats = store.getStats();
|
|
73
|
+
* console.log(`Store size: ${stats.dataSizeBytes} bytes`);
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* @module
|
|
77
|
+
* @see {@link ../repository/index.js} for high-level repository integration
|
|
78
|
+
*/
|
|
79
|
+
export { LIMIT_DATA_SIZE_BYTES, PrototypeInMemoryStore, type PrototypeInMemoryStats, type PrototypeInMemoryStoreConfig, type Snapshot as PrototypeInMemorySnapshot, } from './store.js';
|
|
80
|
+
export { StoreError, ConfigurationError, DataSizeExceededError, SizeEstimationError, type StoreDataState, } from './errors/store-error.js';
|
|
81
|
+
export type { SetResult, StoreErrorCode, StoreFailureKind, } from './types/index.js';
|
|
82
|
+
export type { NormalizedPrototype } from '../types/index.js';
|
|
83
|
+
export type { Logger, LogLevel } from '../logger/index.js';
|
|
84
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/store/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6EG;AAGH,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,4BAA4B,EACjC,KAAK,QAAQ,IAAI,yBAAyB,GAC3C,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,KAAK,cAAc,GACpB,MAAM,yBAAyB,CAAC;AAGjC,YAAY,EACV,SAAS,EACT,cAAc,EACd,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAG1B,YAAY,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAG7D,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* In-Memory Prototype Storage Module.
|
|
3
|
+
*
|
|
4
|
+
* This module provides a complete storage layer for managing in-memory snapshots
|
|
5
|
+
* of prototype data, including TTL-based expiration, size limits, and efficient
|
|
6
|
+
* ID-based lookups. It can be used as a standalone module for custom caching
|
|
7
|
+
* solutions or integrated with the repository layer.
|
|
8
|
+
*
|
|
9
|
+
* ## Core Components
|
|
10
|
+
*
|
|
11
|
+
* - {@link PrototypeInMemoryStore} — Main store class with snapshot management, TTL expiration, and ID-based lookups.
|
|
12
|
+
* - {@link PrototypeInMemoryStoreConfig} — Configuration options including TTL and max data size.
|
|
13
|
+
* - {@link PrototypeInMemoryStats} — Statistics and metadata about the current store state.
|
|
14
|
+
*
|
|
15
|
+
* ### Storage Operations & Result Types
|
|
16
|
+
*
|
|
17
|
+
* - {@link SetResult} — Discriminated union result type for `setAll` operations.
|
|
18
|
+
* - {@link StoreErrorCode} — Error codes for precise error classification.
|
|
19
|
+
* - {@link StoreFailureKind} — Failure kinds: `'storage_limit'`, `'serialization'`, or `'unknown'`.
|
|
20
|
+
*
|
|
21
|
+
* ### Error Handling
|
|
22
|
+
*
|
|
23
|
+
* The store throws exceptions by default, but also provides Result types for
|
|
24
|
+
* consumers who prefer explicit error handling:
|
|
25
|
+
*
|
|
26
|
+
* - {@link StoreError} — Base error class for all store errors.
|
|
27
|
+
* - {@link ConfigurationError} — Configuration validation errors.
|
|
28
|
+
* - {@link DataSizeExceededError} — Data size limit exceeded.
|
|
29
|
+
* - {@link SizeEstimationError} — Size estimation failures.
|
|
30
|
+
* - {@link StoreDataState} — Data state after operation: `'UNCHANGED'`, `'CLEARED'`, or `'UNKNOWN'`.
|
|
31
|
+
*
|
|
32
|
+
* ### Dependencies
|
|
33
|
+
*
|
|
34
|
+
* - {@link NormalizedPrototype} — The data type stored in the store.
|
|
35
|
+
* - {@link Logger} — Logger interface for custom logging implementations.
|
|
36
|
+
* - {@link LogLevel} — Log level type for controlling logger verbosity.
|
|
37
|
+
*
|
|
38
|
+
* ## Standalone Usage
|
|
39
|
+
*
|
|
40
|
+
* This module is designed to work independently, allowing you to:
|
|
41
|
+
* - Create custom in-memory caching solutions
|
|
42
|
+
* - Build data snapshot management systems
|
|
43
|
+
* - Integrate with different runtime environments (Node.js, Next.js, etc.)
|
|
44
|
+
*
|
|
45
|
+
* ## Design Philosophy
|
|
46
|
+
*
|
|
47
|
+
* - **Exception-based**: Store operations throw exceptions on errors
|
|
48
|
+
* - **Result types available**: Optional Result pattern for consumers who prefer it
|
|
49
|
+
* - **TTL-based expiration**: Automatic data invalidation after configured time
|
|
50
|
+
* - **Size limits**: Prevents memory overflow with configurable limits
|
|
51
|
+
* - **Type-safe**: Full TypeScript support with discriminated unions
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* import { PrototypeInMemoryStore } from 'promidas/store';
|
|
56
|
+
*
|
|
57
|
+
* const store = new PrototypeInMemoryStore({
|
|
58
|
+
* ttlMs: 30 * 60 * 1000, // 30 minutes
|
|
59
|
+
* maxDataSizeBytes: 50 * 1024 * 1024, // 50MB
|
|
60
|
+
* });
|
|
61
|
+
*
|
|
62
|
+
* // Store data (throws on error)
|
|
63
|
+
* const snapshot = store.setAll(prototypes);
|
|
64
|
+
* console.log(`Stored ${snapshot.count} prototypes`);
|
|
65
|
+
*
|
|
66
|
+
* // Check if data is fresh
|
|
67
|
+
* if (!store.isExpired()) {
|
|
68
|
+
* const prototype = store.getByPrototypeId('proto-123');
|
|
69
|
+
* }
|
|
70
|
+
*
|
|
71
|
+
* // Get statistics
|
|
72
|
+
* const stats = store.getStats();
|
|
73
|
+
* console.log(`Store size: ${stats.dataSizeBytes} bytes`);
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* @module
|
|
77
|
+
* @see {@link ../repository/index.js} for high-level repository integration
|
|
78
|
+
*/
|
|
79
|
+
// Core Store
|
|
80
|
+
export { LIMIT_DATA_SIZE_BYTES, PrototypeInMemoryStore, } from './store.js';
|
|
81
|
+
// Errors
|
|
82
|
+
export { StoreError, ConfigurationError, DataSizeExceededError, SizeEstimationError, } from './errors/store-error.js';
|
|
83
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/store/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6EG;AAEH,aAAa;AACb,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GAIvB,MAAM,YAAY,CAAC;AAEpB,SAAS;AACT,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,GAEpB,MAAM,yBAAyB,CAAC"}
|