@prisma/orm-framework 8.0.0-rc.18-dev.20 → 8.0.0-rc.18-dev.21

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.
@@ -11,4 +11,5 @@ import { n as ContractValidationPhase, t as ContractValidationError } from "./co
11
11
  import { a as EnumMemberCodecFor, c as NamespaceEnumAccessors, d as buildNamespacedEnums, f as createEnumAccessor, i as EnumMemberCodec, l as NamespacedEnums, n as EnumAccessor, o as EnumMemberNames, r as EnumEntriesToAccessors, s as EnumValues, t as ContractEnumAccessor, u as buildEnumsMapForNamespace } from "./enum-accessor-GZPV-WpP.mjs";
12
12
  import { a as compareByNameProperty, c as createStorageSort, i as PathSegment$1, l as matchesPathPattern, n as PathPattern, o as compareCodeUnits, r as PathSegment, s as createPreserveEmptyPredicate, t as NamedArraySortTarget } from "./hashing-utils-ZiNLX0QQ.mjs";
13
13
  import { n as DomainModelShape, r as validateContractDomain, t as DomainContractShape } from "./validate-domain-B5kmlBFB.mjs";
14
- export { type $, type ApplicationDomain, type ApplicationDomainNamespace, type ApplyParameterizedOutputTypes, type Brand, type CanonicalizeContractOptions, type ColumnDefault, type ColumnDefaultLiteralInputValue, type ColumnDefaultLiteralValue, type Contract, type ContractDiscriminator, type ContractEmbedRelation, type ContractEnum, type ContractEnumAccessor, type ContractExecutionSection, ContractExecutionSectionSchema, type ContractField, type ContractFieldType, type ContractManyToManyRelation, type ContractMarkerRecord, type ContractModel, type ContractModelBase, type ContractNonJunctionRelation, type ContractReferenceRelation, type ContractRelation, type ContractRelationOn, type ContractRelationThrough, type ContractToManyRelation, type ContractToOneRelation, ContractValidationError, type ContractValidationPhase, type ContractValueObject, type ContractValueObjectDefinitions, type ContractWithDomain, type ControlPolicy, type CrossReference, CrossReferenceSchema, type DocCollection, type DocIndex, type DomainContractShape, type DomainModelShape, type EmbedRelationKeys, type EnumAccessor, type EnumEntriesToAccessors, type EnumMemberCodec, type EnumMemberCodecFor, type EnumMemberNames, type EnumValues, type ExecutionHashBase, type ExecutionMutationDefault, type ExecutionMutationDefaultPhases, type ExecutionMutationDefaultValue, type ExecutionSection, type Expr, type FieldType, type GeneratedValueSpec, type JsonPrimitive, type JsonValue, type LedgerEntryRecord, type ModelStorageBase, type NamedArraySortTarget, type NamespaceEnumAccessors, type NamespaceId, type NamespacedEnums, type ParameterizedOutputType, type ParameterizedOutputTypesFunction, type PathPattern, type PlanMeta, type PathSegment as PreserveEmptyPathSegment, type PreserveEmptyPredicate, type ProfileHashBase, type ReferenceRelationKeys, type ResolvedDomainModel, type ScalarFieldType, type SerializeContract, type Source, type StorageBase, type StorageEntitySlot, type StorageHashBase, type StorageNamespace, type StorageSort, type PathSegment$1 as StorageSortPathSegment, UNBOUND_DOMAIN_NAMESPACE_ID, type UnionFieldType, type ValueObjectFieldType, type ValueSetRef, applySpecifierDefaultControlPolicy, asNamespaceId, buildEnumsMapForNamespace, buildExecutionSection, buildNamespacedEnums, canonicalizeContract, canonicalizeContractToObject, compareByNameProperty, compareCodeUnits, computeExecutionHash, computeProfileHash, computeStorageHash, coreHash, createEnumAccessor, createPreserveEmptyPredicate, createStorageSort, crossRef, domainModelsAtDefaultNamespace, domainValueObjectsAtDefaultNamespace, effectiveControlPolicy, executionHash, isColumnDefault, isColumnDefaultLiteralInputValue, isExecutionMutationDefaultValue, isPlainRecord, matchesPathPattern, profileHash, resolveDomainModel, soleDomainNamespaceId, validateContractDomain };
14
+ import { t as validateContractOnce } from "./validate-once-gfCOHsDh.mjs";
15
+ export { type $, type ApplicationDomain, type ApplicationDomainNamespace, type ApplyParameterizedOutputTypes, type Brand, type CanonicalizeContractOptions, type ColumnDefault, type ColumnDefaultLiteralInputValue, type ColumnDefaultLiteralValue, type Contract, type ContractDiscriminator, type ContractEmbedRelation, type ContractEnum, type ContractEnumAccessor, type ContractExecutionSection, ContractExecutionSectionSchema, type ContractField, type ContractFieldType, type ContractManyToManyRelation, type ContractMarkerRecord, type ContractModel, type ContractModelBase, type ContractNonJunctionRelation, type ContractReferenceRelation, type ContractRelation, type ContractRelationOn, type ContractRelationThrough, type ContractToManyRelation, type ContractToOneRelation, ContractValidationError, type ContractValidationPhase, type ContractValueObject, type ContractValueObjectDefinitions, type ContractWithDomain, type ControlPolicy, type CrossReference, CrossReferenceSchema, type DocCollection, type DocIndex, type DomainContractShape, type DomainModelShape, type EmbedRelationKeys, type EnumAccessor, type EnumEntriesToAccessors, type EnumMemberCodec, type EnumMemberCodecFor, type EnumMemberNames, type EnumValues, type ExecutionHashBase, type ExecutionMutationDefault, type ExecutionMutationDefaultPhases, type ExecutionMutationDefaultValue, type ExecutionSection, type Expr, type FieldType, type GeneratedValueSpec, type JsonPrimitive, type JsonValue, type LedgerEntryRecord, type ModelStorageBase, type NamedArraySortTarget, type NamespaceEnumAccessors, type NamespaceId, type NamespacedEnums, type ParameterizedOutputType, type ParameterizedOutputTypesFunction, type PathPattern, type PlanMeta, type PathSegment as PreserveEmptyPathSegment, type PreserveEmptyPredicate, type ProfileHashBase, type ReferenceRelationKeys, type ResolvedDomainModel, type ScalarFieldType, type SerializeContract, type Source, type StorageBase, type StorageEntitySlot, type StorageHashBase, type StorageNamespace, type StorageSort, type PathSegment$1 as StorageSortPathSegment, UNBOUND_DOMAIN_NAMESPACE_ID, type UnionFieldType, type ValueObjectFieldType, type ValueSetRef, applySpecifierDefaultControlPolicy, asNamespaceId, buildEnumsMapForNamespace, buildExecutionSection, buildNamespacedEnums, canonicalizeContract, canonicalizeContractToObject, compareByNameProperty, compareCodeUnits, computeExecutionHash, computeProfileHash, computeStorageHash, coreHash, createEnumAccessor, createPreserveEmptyPredicate, createStorageSort, crossRef, domainModelsAtDefaultNamespace, domainValueObjectsAtDefaultNamespace, effectiveControlPolicy, executionHash, isColumnDefault, isColumnDefaultLiteralInputValue, isExecutionMutationDefaultValue, isPlainRecord, matchesPathPattern, profileHash, resolveDomainModel, soleDomainNamespaceId, validateContractDomain, validateContractOnce };
package/dist/contract.mjs CHANGED
@@ -9,4 +9,5 @@ import { t as resolveDomainModel } from "./resolve-domain-model-BovPAsW2-8rwyzjx
9
9
  import { t as asNamespaceId } from "./namespace-id-asbWpwMw-3yxn-tRe.mjs";
10
10
  import { a as domainModelsAtDefaultNamespace, c as executionHash, d as isExecutionMutationDefaultValue, f as profileHash, i as crossRef, l as isColumnDefault, n as CrossReferenceSchema, o as domainValueObjectsAtDefaultNamespace, r as coreHash, s as effectiveControlPolicy, t as ContractExecutionSectionSchema, u as isColumnDefaultLiteralInputValue } from "./types-QyibIZST.mjs";
11
11
  import { t as validateContractDomain } from "./validate-domain-CbXHDYpF.mjs";
12
- export { ContractExecutionSectionSchema, ContractValidationError, CrossReferenceSchema, UNBOUND_DOMAIN_NAMESPACE_ID, applySpecifierDefaultControlPolicy, asNamespaceId, buildEnumsMapForNamespace, buildExecutionSection, buildNamespacedEnums, canonicalizeContract, canonicalizeContractToObject, compareByNameProperty, compareCodeUnits, computeExecutionHash, computeProfileHash, computeStorageHash, coreHash, createEnumAccessor, createPreserveEmptyPredicate, createStorageSort, crossRef, domainModelsAtDefaultNamespace, domainValueObjectsAtDefaultNamespace, effectiveControlPolicy, executionHash, isColumnDefault, isColumnDefaultLiteralInputValue, isExecutionMutationDefaultValue, isPlainRecord, matchesPathPattern, profileHash, resolveDomainModel, soleDomainNamespaceId, validateContractDomain };
12
+ import { t as validateContractOnce } from "./validate-once-D-IwXHYP.mjs";
13
+ export { ContractExecutionSectionSchema, ContractValidationError, CrossReferenceSchema, UNBOUND_DOMAIN_NAMESPACE_ID, applySpecifierDefaultControlPolicy, asNamespaceId, buildEnumsMapForNamespace, buildExecutionSection, buildNamespacedEnums, canonicalizeContract, canonicalizeContractToObject, compareByNameProperty, compareCodeUnits, computeExecutionHash, computeProfileHash, computeStorageHash, coreHash, createEnumAccessor, createPreserveEmptyPredicate, createStorageSort, crossRef, domainModelsAtDefaultNamespace, domainValueObjectsAtDefaultNamespace, effectiveControlPolicy, executionHash, isColumnDefault, isColumnDefaultLiteralInputValue, isExecutionMutationDefaultValue, isPlainRecord, matchesPathPattern, profileHash, resolveDomainModel, soleDomainNamespaceId, validateContractDomain, validateContractOnce };
@@ -0,0 +1,2 @@
1
+ import { t as validateContractOnce } from "./validate-once-gfCOHsDh.mjs";
2
+ export { validateContractOnce };
@@ -0,0 +1,2 @@
1
+ import { t as validateContractOnce } from "./validate-once-D-IwXHYP.mjs";
2
+ export { validateContractOnce };
@@ -0,0 +1,42 @@
1
+ import { t as blindCast } from "./casts-DpaahrlC-Bd5n2coI.mjs";
2
+ //#region ../../../1-framework/0-foundation/contract/dist/validate-once.mjs
3
+ const validatedContractsKey = Symbol.for("prisma.orm.validatedContracts");
4
+ function validatedContracts() {
5
+ const existing = Reflect.get(globalThis, validatedContractsKey);
6
+ if (existing instanceof WeakMap) return existing;
7
+ const created = /* @__PURE__ */ new WeakMap();
8
+ Object.defineProperty(globalThis, validatedContractsKey, { value: created });
9
+ return created;
10
+ }
11
+ function isObject(value) {
12
+ return typeof value === "object" && value !== null;
13
+ }
14
+ /**
15
+ * Runs `validate` on `input` unless `validator` already validated `input`, or `input` is a result
16
+ * of that validation. The record is kept on `globalThis` under a `Symbol.for` key, so separate
17
+ * bundles and copies of the code in one program share it; `validator` names the validation rules,
18
+ * including the version that owns them, so another version validates again.
19
+ *
20
+ * The returned contract's top level is frozen; its nested objects are not. The input is not frozen,
21
+ * because it belongs to the caller. Neither may be changed after the call: a later call returns the
22
+ * recorded contract without validating again.
23
+ */
24
+ function validateContractOnce(input, validator, validate) {
25
+ const registry = validatedContracts();
26
+ if (isObject(input)) {
27
+ const recorded = registry.get(input);
28
+ if (recorded !== void 0 && recorded.validator === validator) return blindCast(recorded.contract);
29
+ }
30
+ const contract = Object.freeze(validate(input));
31
+ const record = {
32
+ validator,
33
+ contract
34
+ };
35
+ registry.set(contract, record);
36
+ if (isObject(input)) registry.set(input, record);
37
+ return contract;
38
+ }
39
+ //#endregion
40
+ export { validateContractOnce as t };
41
+
42
+ //# sourceMappingURL=validate-once-D-IwXHYP.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-once-D-IwXHYP.mjs","names":[],"sources":["../../../../1-framework/0-foundation/contract/dist/validate-once.mjs"],"sourcesContent":["import { blindCast } from \"@internal/utils/casts\";\n//#region src/validate-once.ts\nconst validatedContractsKey = Symbol.for(\"prisma.orm.validatedContracts\");\nfunction validatedContracts() {\n\tconst existing = Reflect.get(globalThis, validatedContractsKey);\n\tif (existing instanceof WeakMap) return existing;\n\tconst created = /* @__PURE__ */ new WeakMap();\n\tObject.defineProperty(globalThis, validatedContractsKey, { value: created });\n\treturn created;\n}\nfunction isObject(value) {\n\treturn typeof value === \"object\" && value !== null;\n}\n/**\n* Runs `validate` on `input` unless `validator` already validated `input`, or `input` is a result\n* of that validation. The record is kept on `globalThis` under a `Symbol.for` key, so separate\n* bundles and copies of the code in one program share it; `validator` names the validation rules,\n* including the version that owns them, so another version validates again.\n*\n* The returned contract's top level is frozen; its nested objects are not. The input is not frozen,\n* because it belongs to the caller. Neither may be changed after the call: a later call returns the\n* recorded contract without validating again.\n*/\nfunction validateContractOnce(input, validator, validate) {\n\tconst registry = validatedContracts();\n\tif (isObject(input)) {\n\t\tconst recorded = registry.get(input);\n\t\tif (recorded !== void 0 && recorded.validator === validator) return blindCast(recorded.contract);\n\t}\n\tconst contract = Object.freeze(validate(input));\n\tconst record = {\n\t\tvalidator,\n\t\tcontract\n\t};\n\tregistry.set(contract, record);\n\tif (isObject(input)) registry.set(input, record);\n\treturn contract;\n}\n//#endregion\nexport { validateContractOnce };\n\n//# sourceMappingURL=validate-once.mjs.map"],"mappings":";;AAEA,MAAM,wBAAwB,OAAO,IAAI,+BAA+B;AACxE,SAAS,qBAAqB;CAC7B,MAAM,WAAW,QAAQ,IAAI,YAAY,qBAAqB;CAC9D,IAAI,oBAAoB,SAAS,OAAO;CACxC,MAAM,0BAA0B,IAAI,QAAQ;CAC5C,OAAO,eAAe,YAAY,uBAAuB,EAAE,OAAO,QAAQ,CAAC;CAC3E,OAAO;AACR;AACA,SAAS,SAAS,OAAO;CACxB,OAAO,OAAO,UAAU,YAAY,UAAU;AAC/C;;;;;;;;;;;AAWA,SAAS,qBAAqB,OAAO,WAAW,UAAU;CACzD,MAAM,WAAW,mBAAmB;CACpC,IAAI,SAAS,KAAK,GAAG;EACpB,MAAM,WAAW,SAAS,IAAI,KAAK;EACnC,IAAI,aAAa,KAAK,KAAK,SAAS,cAAc,WAAW,OAAO,UAAU,SAAS,QAAQ;CAChG;CACA,MAAM,WAAW,OAAO,OAAO,SAAS,KAAK,CAAC;CAC9C,MAAM,SAAS;EACd;EACA;CACD;CACA,SAAS,IAAI,UAAU,MAAM;CAC7B,IAAI,SAAS,KAAK,GAAG,SAAS,IAAI,OAAO,MAAM;CAC/C,OAAO;AACR"}
@@ -0,0 +1,16 @@
1
+ //#region ../../../1-framework/0-foundation/contract/dist/validate-once.d.mts
2
+ //#region src/validate-once.d.ts
3
+ /**
4
+ * Runs `validate` on `input` unless `validator` already validated `input`, or `input` is a result
5
+ * of that validation. The record is kept on `globalThis` under a `Symbol.for` key, so separate
6
+ * bundles and copies of the code in one program share it; `validator` names the validation rules,
7
+ * including the version that owns them, so another version validates again.
8
+ *
9
+ * The returned contract's top level is frozen; its nested objects are not. The input is not frozen,
10
+ * because it belongs to the caller. Neither may be changed after the call: a later call returns the
11
+ * recorded contract without validating again.
12
+ */
13
+ declare function validateContractOnce<TContract extends object>(input: unknown, validator: string, validate: (input: unknown) => TContract): TContract;
14
+ //#endregion
15
+ export { validateContractOnce as t };
16
+ //# sourceMappingURL=validate-once-gfCOHsDh.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-once-gfCOHsDh.d.mts","names":[],"sources":["../../../../1-framework/0-foundation/contract/dist/validate-once.d.mts"],"mappings":";;;;;;;;;;;;iBAWiB,qBAAqB,0BAA0B,gBAAgB,mBAAmB,WAAW,mBAAmB,YAAY"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/orm-framework",
3
- "version": "8.0.0-rc.18-dev.20",
3
+ "version": "8.0.0-rc.18-dev.21",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -16,20 +16,20 @@
16
16
  "uniku": "^0.5.0"
17
17
  },
18
18
  "devDependencies": {
19
- "@internal/config": "8.0.0-rc.18-dev.20",
20
- "@internal/contract": "8.0.0-rc.18-dev.20",
21
- "@internal/contract-authoring": "8.0.0-rc.18-dev.20",
22
- "@internal/errors": "8.0.0-rc.18-dev.20",
23
- "@internal/framework-components": "8.0.0-rc.18-dev.20",
24
- "@internal/ids": "8.0.0-rc.18-dev.20",
25
- "@internal/operations": "8.0.0-rc.18-dev.20",
26
- "@internal/psl-parser": "8.0.0-rc.18-dev.20",
27
- "@internal/psl-printer": "8.0.0-rc.18-dev.20",
28
- "@internal/ts-render": "8.0.0-rc.18-dev.20",
29
- "@repo/tsconfig": "8.0.0-rc.18-dev.20",
30
- "@internal/publish-surface": "8.0.0-rc.18-dev.20",
31
- "@repo/tsdown": "8.0.0-rc.18-dev.20",
32
- "@internal/utils": "8.0.0-rc.18-dev.20",
19
+ "@internal/config": "8.0.0-rc.18-dev.21",
20
+ "@internal/contract": "8.0.0-rc.18-dev.21",
21
+ "@internal/contract-authoring": "8.0.0-rc.18-dev.21",
22
+ "@internal/errors": "8.0.0-rc.18-dev.21",
23
+ "@internal/framework-components": "8.0.0-rc.18-dev.21",
24
+ "@internal/ids": "8.0.0-rc.18-dev.21",
25
+ "@internal/operations": "8.0.0-rc.18-dev.21",
26
+ "@internal/psl-parser": "8.0.0-rc.18-dev.21",
27
+ "@internal/psl-printer": "8.0.0-rc.18-dev.21",
28
+ "@internal/ts-render": "8.0.0-rc.18-dev.21",
29
+ "@repo/tsconfig": "8.0.0-rc.18-dev.21",
30
+ "@internal/publish-surface": "8.0.0-rc.18-dev.21",
31
+ "@repo/tsdown": "8.0.0-rc.18-dev.21",
32
+ "@internal/utils": "8.0.0-rc.18-dev.21",
33
33
  "tsdown": "0.22.14",
34
34
  "typescript": "5.9.3",
35
35
  "vitest": "5.0.0-rc.2"
@@ -67,6 +67,7 @@
67
67
  "./contract/resolve-domain-model": "./dist/contract__resolve-domain-model.mjs",
68
68
  "./contract/types": "./dist/contract__types.mjs",
69
69
  "./contract/validate-domain": "./dist/contract__validate-domain.mjs",
70
+ "./contract/validate-once": "./dist/contract__validate-once.mjs",
70
71
  "./contract-authoring": "./dist/contract-authoring.mjs",
71
72
  "./errors": "./dist/errors.mjs",
72
73
  "./errors/control": "./dist/errors__control.mjs",