26.07 Storage Modulev0.1.47 → v0.1.48
Changed in v0.1.48 (2026-04-18): change storage again, now it can just give artifact: string in the Embedding
→+14 −2
| v0.1.47 | v0.1.48 | ||
|---|---|---|---|
| 27 | where | 27 | where |
| 28 | - `storage` is OPTIONAL and its value MUST be one of those specified above. When it is provided, the Storage module is in use. When its value is `"impl"`, the implementation MUST specify the `Storage` and use it to resolve the scene with the `Form` object. | 28 | - `storage` is OPTIONAL and its value MUST be one of those specified above. When it is provided, the Storage module is in use. When its value is `"impl"`, the implementation MUST specify the `Storage` and use it to resolve the scene with the `Form` object. |
| 29 | - `storagePath` is OPTIONAL and its value MUST be of type `string` and MUST be a path or URL to a JSON file of the `Storage` data used for the `Form`. If it is not provided, the default value `"./storage.json"` MUST be used. Its value MUST be ignored if `storage` has a value other than `"path"`. | 29 | - `storagePath` is OPTIONAL and its value MUST be of type `string` and MUST be a path or URL to a JSON file of the `Storage` data used for the `Form`. If it is not provided, the default value `"./storage.json"` MUST be used. Its value MUST be ignored if `storage` has a value other than `"path"`. |
| 30 | - `storageOverwrite` is OPTIONAL and its value MUST be of type `boolean`. If it is not provided, the default value `true` MUST be used. Its value MUST be ignored if `storage` is not specified. When it is `true`, any conflict between an `Artifact` in `Form` and an `Artifact` in `Storage` MUST be resolved in favor of the `Artifact` in `Storage`; when it is `false`, the `Artifact` in `Form` MUST be merged into the corresponding `Artifact` in `Storage` member by member at every level, where each member present in `Form` overwrites the corresponding member in `Storage`, and the merged `Artifact` MUST be used, providing further customization of the scene in addition to the `Storage` data. | 30 | - `storageOverwrite` is OPTIONAL and its value MUST be of type `boolean`. If it is not provided, the default value `true` MUST be used. Its value MUST be ignored if `storage` is not specified. When it is `true`, any conflict between an `Artifact` in `Form` and an `Artifact` in `Storage` MUST be resolved in favor of the `Artifact` in `Storage`; when it is `false`, the `Artifact` in `Form` MUST be merged into the corresponding `Artifact` in `Storage` member by member at every level, where each member present in `Form` overwrites the corresponding member in `Storage`, and the merged `Artifact` MUST be used, providing further customization of the scene in addition to the `Storage` data. |
| 31 | - `storageEnforce` is OPTIONAL and its value MUST be of type `boolean`. If it is not provided, the default value `true` MUST be used. Its value MUST be ignored if `storage` is not specified. When it is `true`, any `Artifact` in `Form` that is not present in `Storage` MUST be discarded. | 31 | - `storageEnforce` is OPTIONAL and its value MUST be of type `boolean`. If it is not provided, the default value `true` MUST be used. Its value MUST be ignored if `storage` is not specified. When it is `true`, any `Artifact` in `Form` that is not present in `Storage` MUST be discarded. |
| 32 | 32 | ||
| 33 | When a `storage` value is provided, it is valid, though not recommended, to have an `Artifact` in `Form` containing only `metadata`with an `id`, and use `storageOverwrite` to resolve it to the corresponding `Artifact` in `Storage`. `Storage` MUST contain the full information of the artifacts. If `Storage` is not provided or the relevant `Artifact` is missing from `Storage`, an `Artifact` missing a `content` or `type` member MUST be discarded. | 33 | `Storage` MUST contain the full information of artifacts. |
| 34 | |||
| 35 | When a `storage` value is provided, the `artifact` member of the `Embedding` object MAY be a `string` to reference the artifact in the storage. | ||
| 36 | ```ts | ||
| 37 | interface Embedding { | ||
| 38 | artifact: Artifact | string // REQUIRED | ||
| 39 | // ... | ||
| 40 | } | ||
| 41 | ``` | ||
| 42 | where | ||
| 43 | - The value of `artifact` MUST be either of type `Artifact` or a `string`. When it is a `string`, it MUST be the `id` of an `Artifact` in `Storage`. If `Storage` is not provided or the relevant `Artifact` is missing from `Storage`, an `Embedding` whose `artifact` is of type `string` MUST be discarded. | ||
| 44 | |||
| 45 | An `Embedding` whose `artifact` is of type `string` MUST always be resolved in favor of the `Artifact` in `Storage`, regardless of the `storageOverwrite` value. | ||