@stately-cloud/schema
Advanced tools
Comparing version 0.1.3 to 0.2.0
@@ -8,13 +8,18 @@ import { FieldDescriptorProto } from "@bufbuild/protobuf/wkt"; | ||
* that StatelyDB keeps track of for each item, but you must map them to | ||
* fields in the schema to use them. This implicitly makes the field read-only | ||
* - any value set here will be ignored when the item is written. | ||
* fields in the schema to use them. This implicitly makes the field | ||
* read-only. Any value set for this field will be ignored when the item is | ||
* written. | ||
* | ||
* - `createdAtTime` and `lastModifiedAtTime` must only be set on a field that | ||
* has a timestamp type (`timestampSeconds`, `timestampMilliseconds`, or | ||
* `timestampMicroseconds`). | ||
* `timestampMicroseconds`). These represent the time the database first | ||
* created or last modified the item. | ||
* - `createdAtVersion` and `lastModifiedAtVersion` must only be set on a | ||
* field that has a `uint` type. | ||
* - `primaryKeyPath` must only be set on a field that has a `keyPath` type. | ||
* field that has a `uint` type. These represent a monotonically increasing | ||
* version number within a Group that tracks modifications of items and can | ||
* be used to strictly order changes. Note that multiple items can have the | ||
* same createdAt/lastModifiedAtVersion if they were created/modified in the | ||
* same transaction, since they logically were modified at the same time. | ||
*/ | ||
fromMetadata?: "createdAtTime" | "lastModifiedAtTime" | "createdAtVersion" | "lastModifiedAtVersion" | "primaryKeyPath"; | ||
fromMetadata?: "createdAtTime" | "lastModifiedAtTime" | "createdAtVersion" | "lastModifiedAtVersion"; | ||
} | ||
@@ -21,0 +26,0 @@ export interface FieldInitialValue { |
@@ -15,3 +15,2 @@ import { create, isMessage, setExtension } from "@bufbuild/protobuf"; | ||
lastModifiedAtVersion: FieldOptions_FromMetadata.LAST_MODIFIED_AT_VERSION, | ||
primaryKeyPath: FieldOptions_FromMetadata.KEY_PATH, | ||
}; | ||
@@ -52,3 +51,3 @@ const fromInitialValue = { | ||
if (isItemType(type)) { | ||
throw new Error(`Item types should not be used as fields - consider using pointerTo(${fieldConfig.type.name}) instead`); | ||
throw new Error(`Item types should not be used as fields - consider storing a keyPath of ${fieldConfig.type.name}) instead`); | ||
} | ||
@@ -55,0 +54,0 @@ const typeInfo = resolveType(type); |
import { FileDescriptorProto } from "@bufbuild/protobuf/wkt"; | ||
import { Deferred } from "./type-util.js"; | ||
import { Deferred, Plural } from "./type-util.js"; | ||
import { SchemaType } from "./types.js"; | ||
export declare function file(exportedValues: { | ||
[name: string]: Deferred<SchemaType>; | ||
[name: string]: Deferred<Plural<SchemaType>>; | ||
}, fileName: string): FileDescriptorProto; |
import { create } from "@bufbuild/protobuf"; | ||
import { FileDescriptorProtoSchema, } from "@bufbuild/protobuf/wkt"; | ||
import { resolveDeferred } from "./type-util.js"; | ||
import { resolveDeferred, resolvePlural } from "./type-util.js"; | ||
import { resolveType } from "./types.js"; | ||
@@ -20,30 +20,32 @@ const packageName = "stately.generated"; | ||
for (const [_exportName, exportValue] of Object.entries(exportedValues)) { | ||
const fieldConfig = resolveDeferred(exportValue); | ||
const name = fieldConfig.name; | ||
const fqName = `.${packageName}.${name}`; | ||
if (!("parentType" in fieldConfig)) { | ||
// console.warn( | ||
// `Expected ${name} to be either a FieldTypeConfig, or a function that returns FieldTypeConfig. Ignoring it.`, | ||
// ); | ||
continue; | ||
} | ||
const { underlyingType } = resolveType(fieldConfig); | ||
// Don't add the same type twice (e.g. if it's exported multiple times) | ||
if (seenTypes.has(fqName)) { | ||
if (seenTypes.get(fqName) !== underlyingType) { | ||
throw new Error(`Found two types with the same name: ${fqName}`); | ||
const fieldConfigs = resolvePlural(resolveDeferred(exportValue)); | ||
for (const fieldConfig of fieldConfigs) { | ||
const name = fieldConfig.name; | ||
const fqName = `.${packageName}.${name}`; | ||
if (!("parentType" in fieldConfig)) { | ||
// console.warn( | ||
// `Expected ${name} to be either a FieldTypeConfig, or a function that returns FieldTypeConfig. Ignoring it.`, | ||
// ); | ||
continue; | ||
} | ||
continue; | ||
const { underlyingType } = resolveType(fieldConfig); | ||
// Don't add the same type twice (e.g. if it's exported multiple times) | ||
if (seenTypes.has(fqName)) { | ||
if (seenTypes.get(fqName) !== underlyingType) { | ||
throw new Error(`Found two types with the same name: ${fqName}`); | ||
} | ||
continue; | ||
} | ||
if (typeof underlyingType === "number") { | ||
// ignore it | ||
continue; | ||
} | ||
else if ("value" in underlyingType) { | ||
fd.enumType.push(underlyingType); | ||
} | ||
else { | ||
fd.messageType.push(underlyingType); | ||
} | ||
seenTypes.set(fqName, underlyingType); | ||
} | ||
if (typeof underlyingType === "number") { | ||
// ignore it | ||
continue; | ||
} | ||
else if ("value" in underlyingType) { | ||
fd.enumType.push(underlyingType); | ||
} | ||
else { | ||
fd.messageType.push(underlyingType); | ||
} | ||
seenTypes.set(fqName, underlyingType); | ||
} | ||
@@ -50,0 +52,0 @@ // Check messages for references to unexported types |
@@ -10,2 +10,2 @@ /** | ||
export type { Deferred, Plural } from "./type-util.js"; | ||
export { arrayOf, bool, bytes, double, durationMilliseconds, durationSeconds, int, keyPath, pointerTo, string, timestampMicroseconds, timestampMilliseconds, timestampSeconds, type, uint, url, uuid, type SchemaType, } from "./types.js"; | ||
export { arrayOf, bool, bytes, double, durationMilliseconds, durationSeconds, int, keyPath, string, timestampMicroseconds, timestampMilliseconds, timestampSeconds, type, uint, url, uuid, type SchemaType, } from "./types.js"; |
@@ -10,3 +10,4 @@ /** | ||
// mapOf, | ||
pointerTo, string, timestampMicroseconds, timestampMilliseconds, timestampSeconds, type, uint, url, uuid, } from "./types.js"; | ||
// pointerTo, | ||
string, timestampMicroseconds, timestampMilliseconds, timestampSeconds, type, uint, url, uuid, } from "./types.js"; | ||
//# sourceMappingURL=index.js.map |
@@ -11,3 +11,3 @@ // @generated by protoc-gen-es v2.0.0 with parameter "target=js+dts,import_extension=.js" | ||
/*@__PURE__*/ | ||
fileDesc("Cg1vcHRpb25zLnByb3RvEhNzdGF0ZWx5LnNjaGVtYW1vZGVsIrYDCg5NZXNzYWdlT3B0aW9ucxJLCglrZXlfcGF0aHMYASADKAsyKy5zdGF0ZWx5LnNjaGVtYW1vZGVsLk1lc3NhZ2VPcHRpb25zLktleVBhdGhCC7pICMgBAZIBA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VEVSUFJFVF9BU19EVVJBVElPTl9NSUxMSVNFQ09ORFMQBSpNChBCeXRlc0ludGVycHJldEFzEhwKGEJZVEVTX0lOVEVSUFJFVF9BU19CWVRFUxAAEhsKF0JZVEVTX0lOVEVSUFJFVF9BU19VVUlEEAEqcgoRU3RyaW5nSW50ZXJwcmV0QXMSHgoaU1RSSU5HX0lOVEVSUFJFVF9BU19TVFJJTkcQABIgChxTVFJJTkdfSU5URVJQUkVUX0FTX0tFWV9QQVRIEAESGwoXU1RSSU5HX0lOVEVSUFJFVF9BU19VUkwQAkKUAQoXY29tLnN0YXRlbHkuc2NoZW1hbW9kZWxCDE9wdGlvbnNQcm90b1ABogIDU1NYqgITU3RhdGVseS5TY2hlbWFtb2RlbMoCE1N0YXRlbHlcU2NoZW1hbW9kZWziAh9TdGF0ZWx5XFNjaGVtYW1vZGVsXEdQQk1ldGFkYXRh6gIUU3RhdGVseTo6U2NoZW1hbW9kZWxiBnByb3RvMw", [file_buf_validate_validate]); | ||
/** | ||
@@ -14,0 +14,0 @@ * Describes the message stately.schemamodel.MessageOptions. |
@@ -126,3 +126,2 @@ import { DescriptorProto, EnumDescriptorProto, FieldDescriptorProto_Label, FieldDescriptorProto_Type } from "@bufbuild/protobuf/wkt"; | ||
*/ | ||
export declare function pointerTo(dest: Deferred<SchemaType>): Deferred<SchemaType>; | ||
/** | ||
@@ -129,0 +128,0 @@ * A helper to determine if a type is an item type. |
@@ -80,3 +80,6 @@ import { getExtension, hasExtension, isMessage } from "@bufbuild/protobuf"; | ||
/** A 128-bit UUID. The default is null. */ | ||
export const uuid = type("uuid", bytes, { interpretAs: "uuid" }); | ||
export const uuid = type("uuid", bytes, { | ||
interpretAs: "uuid", | ||
valid: "size(this) == 0 || size(this) == 16", | ||
}); | ||
/** | ||
@@ -130,22 +133,22 @@ * A URL. The url may be relative (a path, without a host) or absolute (starting | ||
*/ | ||
export function pointerTo(dest) { | ||
return () => { | ||
const descriptor = resolveDeferred(dest); | ||
if (descriptor.array) { | ||
throw new Error("Pointers cannot point to arrays."); | ||
} | ||
if (!isItemType(descriptor)) { | ||
throw new Error("Pointers can only point to item types."); | ||
} | ||
// TODO: Pointers could actually be the minimal set of IDs required to | ||
// *build* a key path for that item. In that case we'd really store a | ||
// message with the type of the target item, and a special option that says | ||
// "this is a pointer to that item". | ||
// TODO: Right now these are indistinguishable from arbitrary key paths. | ||
// We'd need a new option that explains what type this points to. | ||
return type(`*${descriptor.name}`, string, { | ||
interpretAs: "keyPath", | ||
}); | ||
}; | ||
} | ||
// export function pointerTo(dest: Deferred<SchemaType>): Deferred<SchemaType> { | ||
// return () => { | ||
// const descriptor = resolveDeferred(dest); | ||
// if (descriptor.array) { | ||
// throw new Error("Pointers cannot point to arrays."); | ||
// } | ||
// if (!isItemType(descriptor)) { | ||
// throw new Error("Pointers can only point to item types."); | ||
// } | ||
// // TODO: Pointers could actually be the minimal set of IDs required to | ||
// // *build* a key path for that item. In that case we'd really store a | ||
// // message with the type of the target item, and a special option that says | ||
// // "this is a pointer to that item". | ||
// // TODO: Right now these are indistinguishable from arbitrary key paths. | ||
// // We'd need a new option that explains what type this points to. | ||
// return type(`*${descriptor.name}`, string, { | ||
// interpretAs: "keyPath", | ||
// }); | ||
// }; | ||
// } | ||
/** | ||
@@ -152,0 +155,0 @@ * A helper to determine if a type is an item type. |
{ | ||
"name": "@stately-cloud/schema", | ||
"version": "0.1.3", | ||
"version": "0.2.0", | ||
"author": "Stately Cloud <support@stately.cloud> (https://stately.cloud/)", | ||
@@ -17,11 +17,11 @@ "description": "Schema language for StatelyDB", | ||
"exports": { | ||
"./package.json": "./package.json", | ||
".": { | ||
"default": "./dist/index.js", | ||
"types": "./dist/index.d.ts" | ||
"types": "./dist/index.d.ts", | ||
"default": "./dist/index.js" | ||
}, | ||
"./driver": { | ||
"default": "./dist/driver.js", | ||
"types": "./dist/driver.d.ts" | ||
} | ||
"types": "./dist/driver.d.ts", | ||
"default": "./dist/driver.js" | ||
}, | ||
"./package.json": "./package.json" | ||
}, | ||
@@ -35,14 +35,13 @@ "publishConfig": { | ||
"@types/jest": "29.5.12", | ||
"@types/node": "22.0.0", | ||
"eslint": "8.57.0", | ||
"@types/node": "22.4.1", | ||
"eslint": "9.9.0", | ||
"jest": "29.7.0", | ||
"ts-jest": "29.2.3", | ||
"ts-jest": "29.2.4", | ||
"@stately-cloud/eslint": "1.0.0" | ||
}, | ||
"dependencies": { | ||
"@bufbuild/protobuf": "^2.0.0-beta.2", | ||
"@bufbuild/protoc-gen-es": "^2.0.0-beta.2", | ||
"@bufbuild/protobuf": "^2.0.0", | ||
"fast-equals": "^5.0.1", | ||
"tsx": "^4.7.1", | ||
"typescript": "5.5.4" | ||
"typescript": "^5.5.4" | ||
}, | ||
@@ -49,0 +48,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
226924
4
2637
+ Addedtypescript@5.7.3(transitive)
- Removed@bufbuild/protoc-gen-es@2.2.3(transitive)
- Removed@bufbuild/protoplugin@2.2.3(transitive)
- Removed@typescript/vfs@1.6.1(transitive)
- Removeddebug@4.4.0(transitive)
- Removedms@2.1.3(transitive)
- Removedtypescript@5.4.55.5.4(transitive)
Updated@bufbuild/protobuf@^2.0.0
Updatedtypescript@^5.5.4