@osdk/api 2.8.0-beta.27 → 2.8.0-beta.29
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/CHANGELOG.md +14 -0
- package/build/browser/derivedProperties/DerivedProperty.js.map +1 -1
- package/build/browser/index.js.map +1 -1
- package/build/browser/object/Media.js.map +1 -1
- package/build/browser/public/shapes-internal.js +2 -0
- package/build/browser/public/shapes-internal.js.map +1 -0
- package/build/browser/public/unstable.js +2 -0
- package/build/browser/public/unstable.js.map +1 -1
- package/build/browser/shapes/InlineShapeConfig.js +2 -0
- package/build/browser/shapes/InlineShapeConfig.js.map +1 -0
- package/build/browser/shapes/ShapeBuilder.js +243 -0
- package/build/browser/shapes/ShapeBuilder.js.map +1 -0
- package/build/browser/shapes/ShapeDefinition.js +59 -0
- package/build/browser/shapes/ShapeDefinition.js.map +1 -0
- package/build/browser/shapes/computeShapeId.js +97 -0
- package/build/browser/shapes/computeShapeId.js.map +1 -0
- package/build/browser/shapes/configToShapeDefinition.js +115 -0
- package/build/browser/shapes/configToShapeDefinition.js.map +1 -0
- package/build/browser/shapes/index.js +31 -0
- package/build/browser/shapes/index.js.map +1 -0
- package/build/browser/shapes/internal.js +2 -0
- package/build/browser/shapes/internal.js.map +1 -0
- package/build/cjs/{ObjectSet-By-T_QQB.d.cts → ObjectSet-DkBNIajH.d.cts} +16 -11
- package/build/cjs/index.d.cts +2 -2
- package/build/cjs/public/shapes-internal.cjs +4 -0
- package/build/cjs/public/shapes-internal.cjs.map +1 -0
- package/build/cjs/public/shapes-internal.d.cts +4 -0
- package/build/cjs/public/unstable.cjs +401 -0
- package/build/cjs/public/unstable.cjs.map +1 -1
- package/build/cjs/public/unstable.d.cts +57 -3
- package/build/cjs/shapes-internal-DQ2ODZcP.d.cts +152 -0
- package/build/esm/derivedProperties/DerivedProperty.js.map +1 -1
- package/build/esm/index.js.map +1 -1
- package/build/esm/object/Media.js.map +1 -1
- package/build/esm/public/shapes-internal.js +2 -0
- package/build/esm/public/shapes-internal.js.map +1 -0
- package/build/esm/public/unstable.js +2 -0
- package/build/esm/public/unstable.js.map +1 -1
- package/build/esm/shapes/InlineShapeConfig.js +2 -0
- package/build/esm/shapes/InlineShapeConfig.js.map +1 -0
- package/build/esm/shapes/ShapeBuilder.js +243 -0
- package/build/esm/shapes/ShapeBuilder.js.map +1 -0
- package/build/esm/shapes/ShapeDefinition.js +59 -0
- package/build/esm/shapes/ShapeDefinition.js.map +1 -0
- package/build/esm/shapes/computeShapeId.js +97 -0
- package/build/esm/shapes/computeShapeId.js.map +1 -0
- package/build/esm/shapes/configToShapeDefinition.js +115 -0
- package/build/esm/shapes/configToShapeDefinition.js.map +1 -0
- package/build/esm/shapes/index.js +31 -0
- package/build/esm/shapes/index.js.map +1 -0
- package/build/esm/shapes/internal.js +2 -0
- package/build/esm/shapes/internal.js.map +1 -0
- package/build/types/derivedProperties/DerivedProperty.d.ts +1 -10
- package/build/types/derivedProperties/DerivedProperty.d.ts.map +1 -1
- package/build/types/index.d.ts +1 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/object/Media.d.ts +14 -0
- package/build/types/object/Media.d.ts.map +1 -1
- package/build/types/public/shapes-internal.d.ts +1 -0
- package/build/types/public/shapes-internal.d.ts.map +1 -0
- package/build/types/public/unstable.d.ts +2 -0
- package/build/types/public/unstable.d.ts.map +1 -1
- package/build/types/shapes/InlineShapeConfig.d.ts +29 -0
- package/build/types/shapes/InlineShapeConfig.d.ts.map +1 -0
- package/build/types/shapes/ShapeBuilder.d.ts +21 -0
- package/build/types/shapes/ShapeBuilder.d.ts.map +1 -0
- package/build/types/shapes/ShapeDefinition.d.ts +167 -0
- package/build/types/shapes/ShapeDefinition.d.ts.map +1 -0
- package/build/types/shapes/computeShapeId.d.ts +14 -0
- package/build/types/shapes/computeShapeId.d.ts.map +1 -0
- package/build/types/shapes/configToShapeDefinition.d.ts +6 -0
- package/build/types/shapes/configToShapeDefinition.d.ts.map +1 -0
- package/build/types/shapes/index.d.ts +5 -0
- package/build/types/shapes/index.d.ts.map +1 -0
- package/build/types/shapes/internal.d.ts +1 -0
- package/build/types/shapes/internal.d.ts.map +1 -0
- package/package.json +10 -1
- package/shapes-internal.d.ts +17 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ShapeDefinition.js","names":["SourcePrimaryKeySymbol","Symbol","for","LegacyShapesSymbol","isSourcePkSymbol","value","ShapeNullabilityError","Error","constructor","shape","violations","props","map","v","property","join","shapeName","__debugName","__shapeId","name"],"sources":["ShapeDefinition.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { WhereClause } from \"../aggregate/WhereClause.js\";\nimport type {\n ObjectOrInterfaceDefinition,\n PropertyKeys,\n} from \"../ontology/ObjectOrInterface.js\";\nimport type { CompileTimeMetadata } from \"../ontology/ObjectTypeDefinition.js\";\nimport type { OsdkBase } from \"../OsdkBase.js\";\nimport type { LinkedType, LinkNames } from \"../util/LinkUtils.js\";\n\nexport const SourcePrimaryKeySymbol: unique symbol = Symbol.for(\n \"osdk.query.$sourcePk\",\n);\n\nconst LegacyShapesSymbol = Symbol.for(\"osdk.shapes.$primaryKey\");\n\nexport function isSourcePkSymbol(value: unknown): value is symbol {\n return (\n typeof value === \"symbol\"\n && (value === SourcePrimaryKeySymbol || value === LegacyShapesSymbol)\n );\n}\n\ndeclare const ShapeDefinitionBrand: unique symbol;\n\ndeclare const ShapeLinkResultBrand: unique symbol;\n\n/** Configuration for how a derived link is loaded at runtime. */\nexport interface DerivedLinkConfig {\n defer?: boolean;\n}\n\n/** The result of calling `ShapeLinkBuilder.as()`, binding a link traversal to a target shape. */\nexport interface ShapeLinkResult<\n TARGET_SHAPE extends ShapeDefinition<ObjectOrInterfaceDefinition>,\n> {\n readonly __linkResultBrand: typeof ShapeLinkResultBrand;\n readonly targetShape: TARGET_SHAPE;\n readonly objectSetDef: ShapeLinkObjectSetDef;\n readonly config: DerivedLinkConfig;\n}\n\n/** A single link traversal step in a derived link's object set definition. */\nexport interface ShapeLinkSegment {\n readonly type: \"pivotTo\";\n readonly linkName: string;\n readonly sourceType?: string;\n readonly targetType?: string;\n}\n\n/** Sort clause for a derived link's result set. */\nexport interface ShapeLinkOrderBy {\n readonly property: string;\n readonly direction: \"asc\" | \"desc\";\n}\n\n/** A set operation (union/intersect/subtract) applied to a derived link's object set. */\nexport interface ShapeLinkSetOperation {\n readonly type: \"union\" | \"intersect\" | \"subtract\";\n readonly other: ShapeLinkObjectSetDef;\n}\n\n/** Serializable definition of a derived link's object set: link traversals, filters, ordering, and set operations. */\nexport interface ShapeLinkObjectSetDef {\n readonly segments: readonly ShapeLinkSegment[];\n readonly where?: WhereClause<ObjectOrInterfaceDefinition>;\n readonly orderBy?: readonly ShapeLinkOrderBy[];\n readonly limit?: number;\n readonly distinct?: boolean;\n readonly setOperations?: readonly ShapeLinkSetOperation[];\n}\n\n/** How a shape handles null values for a selected property. */\nexport type NullabilityOp =\n | { type: \"require\" }\n | { type: \"dropIfNull\" }\n | { type: \"withDefault\"; defaultValue: unknown }\n | { type: \"withTransform\"; transform: (value: unknown) => unknown }\n | { type: \"select\" };\n\n/** Per-property configuration stored in a shape's `__props` map. */\nexport interface ShapePropertyConfig {\n readonly nullabilityOp: NullabilityOp;\n}\n\n/** A derived link definition stored in a shape's `__derivedLinks` array. */\nexport interface ShapeDerivedLinkDef<\n TARGET_SHAPE extends ShapeDefinition<ObjectOrInterfaceDefinition> =\n ShapeDefinition<ObjectOrInterfaceDefinition>,\n> {\n readonly name: string;\n readonly objectSetDef: ShapeLinkObjectSetDef;\n readonly targetShape: TARGET_SHAPE;\n readonly config: DerivedLinkConfig;\n}\n\n/**\n * Type projection from an OSDK type. `__props` is the single source of truth for property config.\n *\n * @typeParam BASE - The base ObjectTypeDefinition or InterfaceDefinition\n * @typeParam SELECTED_PROPS - Record of selected properties and their transformed types\n * @typeParam DERIVED_LINKS - Record of derived link names to their result types\n */\nexport interface ShapeDefinition<\n BASE extends ObjectOrInterfaceDefinition,\n SELECTED_PROPS extends Record<string, unknown> = {},\n DERIVED_LINKS extends Record<\n string,\n ShapeDefinition<ObjectOrInterfaceDefinition>\n > = {},\n> {\n readonly [ShapeDefinitionBrand]: true;\n readonly __shapeId: string;\n readonly __debugName: string | undefined;\n readonly __baseType: BASE;\n readonly __baseTypeApiName: string;\n readonly __props: Readonly<Record<string, unknown>>;\n readonly __derivedLinks: readonly unknown[];\n readonly __selectedPropsType: SELECTED_PROPS;\n readonly __derivedLinksType: DERIVED_LINKS;\n}\n\nexport type ShapeBaseType<\n S extends ShapeDefinition<ObjectOrInterfaceDefinition>,\n> = S extends ShapeDefinition<infer BASE, infer _P, infer _L> ? BASE : never;\n\nexport type ShapeSelectedProps<\n S extends ShapeDefinition<ObjectOrInterfaceDefinition>,\n> = S extends ShapeDefinition<infer _B, infer PROPS, infer _L> ? PROPS : never;\n\nexport type ShapeDerivedLinks<\n S extends ShapeDefinition<ObjectOrInterfaceDefinition>,\n> = S extends ShapeDefinition<infer _B, infer _P, infer LINKS> ? LINKS : never;\n\nexport type ShapeInstance<\n S extends ShapeDefinition<ObjectOrInterfaceDefinition>,\n> = S extends ShapeDefinition<infer BASE, infer PROPS, infer LINKS> ?\n & OsdkBase<BASE>\n & { readonly $rid: string }\n & PROPS\n & {\n [K in keyof LINKS]: LINKS[K] extends\n ShapeDefinition<ObjectOrInterfaceDefinition> ? ShapeInstance<LINKS[K]>[]\n : never;\n }\n : never;\n\nexport type PropertyType<\n BASE extends ObjectOrInterfaceDefinition,\n K extends PropertyKeys<BASE>,\n> = CompileTimeMetadata<BASE>[\"props\"][K];\n\nexport type RequiredProperty<T> = NonNullable<T>;\n\nexport interface ShapeLinkBuilder<\n SOURCE extends ObjectOrInterfaceDefinition,\n CURRENT extends ObjectOrInterfaceDefinition,\n> {\n pivotTo<L extends LinkNames<CURRENT>>(\n link: L,\n ): ShapeLinkBuilder<SOURCE, LinkedType<CURRENT, L>>;\n\n where(clause: WhereClause<CURRENT>): ShapeLinkBuilder<SOURCE, CURRENT>;\n\n union(\n ...others: ShapeLinkBuilder<SOURCE, CURRENT>[]\n ): ShapeLinkBuilder<SOURCE, CURRENT>;\n\n intersect(\n ...others: ShapeLinkBuilder<SOURCE, CURRENT>[]\n ): ShapeLinkBuilder<SOURCE, CURRENT>;\n\n subtract(\n ...others: ShapeLinkBuilder<SOURCE, CURRENT>[]\n ): ShapeLinkBuilder<SOURCE, CURRENT>;\n\n orderBy<K extends PropertyKeys<CURRENT>>(\n property: K,\n direction?: \"asc\" | \"desc\",\n ): ShapeLinkBuilder<SOURCE, CURRENT>;\n\n limit(n: number): ShapeLinkBuilder<SOURCE, CURRENT>;\n\n distinct(): ShapeLinkBuilder<SOURCE, CURRENT>;\n\n as<TARGET_SHAPE extends ShapeDefinition<CURRENT>>(\n shape: TARGET_SHAPE,\n config?: DerivedLinkConfig,\n ): ShapeLinkResult<TARGET_SHAPE>;\n\n readonly $primaryKey: symbol;\n}\n\nexport interface ShapeLinkBuilderInternal\n extends\n ShapeLinkBuilder<ObjectOrInterfaceDefinition, ObjectOrInterfaceDefinition>\n{\n toObjectSetDef(): ShapeLinkObjectSetDef;\n}\n\nexport interface ShapeBuilder<\n BASE extends ObjectOrInterfaceDefinition,\n PROPS extends Record<string, unknown> = {},\n LINKS extends Record<\n string,\n ShapeDefinition<ObjectOrInterfaceDefinition>\n > = {},\n> {\n select<K extends Exclude<PropertyKeys<BASE>, keyof PROPS>>(\n ...props: K[]\n ): ShapeBuilder<\n BASE,\n PROPS & { [P in K]: PropertyType<BASE, P> },\n LINKS\n >;\n\n require<K extends Exclude<PropertyKeys<BASE>, keyof PROPS>>(\n ...props: K[]\n ): ShapeBuilder<\n BASE,\n PROPS & { [P in K]: RequiredProperty<PropertyType<BASE, P>> },\n LINKS\n >;\n\n dropIfNull<K extends Exclude<PropertyKeys<BASE>, keyof PROPS>>(\n ...props: K[]\n ): ShapeBuilder<\n BASE,\n PROPS & { [P in K]: RequiredProperty<PropertyType<BASE, P>> },\n LINKS\n >;\n\n withDefault<\n K extends Exclude<PropertyKeys<BASE>, keyof PROPS>,\n V extends NonNullable<PropertyType<BASE, K>>,\n >(\n prop: K,\n defaultValue: V,\n ): ShapeBuilder<\n BASE,\n PROPS & { [P in K]: NonNullable<PropertyType<BASE, P>> },\n LINKS\n >;\n\n withTransform<\n K extends Exclude<PropertyKeys<BASE>, keyof PROPS>,\n R,\n >(\n prop: K,\n transform: (value: PropertyType<BASE, K>) => R,\n ): ShapeBuilder<BASE, PROPS & { [P in K]: R }, LINKS>;\n\n deriveLink<\n NAME extends string,\n TARGET_SHAPE extends ShapeDefinition<ObjectOrInterfaceDefinition>,\n >(\n name: NAME,\n builder: (\n linkBuilder: ShapeLinkBuilder<BASE, BASE>,\n ) => ShapeLinkResult<TARGET_SHAPE>,\n ): ShapeBuilder<BASE, PROPS, LINKS & { [K in NAME]: TARGET_SHAPE }>;\n\n build(): ShapeDefinition<BASE, PROPS, LINKS>;\n}\n\nexport interface LinkLoadConfig {\n pageSize?: number;\n autoFetchMore?: boolean | number;\n streamUpdates?: boolean;\n defer?: boolean;\n}\n\nexport interface LinkStatus {\n isLoading: boolean;\n error: Error | undefined;\n hasMore: boolean;\n fetchMore: () => Promise<void>;\n}\n\nexport interface NullabilityViolation {\n property: string;\n primaryKey: unknown;\n constraint: \"require\" | \"dropIfNull\" | \"transformError\";\n}\n\nexport class ShapeNullabilityError extends Error {\n constructor(\n public readonly shape: ShapeDefinition<ObjectOrInterfaceDefinition>,\n public readonly violations: readonly NullabilityViolation[],\n ) {\n const props = violations.map((v) => v.property).join(\", \");\n const shapeName = shape.__debugName ?? shape.__shapeId;\n super(\n `Shape \"${shapeName}\" requires these properties to be non-null: ${props}`,\n );\n this.name = \"ShapeNullabilityError\";\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAWA,OAAO,MAAMA,sBAAqC,GAAGC,MAAM,CAACC,GAAG,CAC7D,sBACF,CAAC;AAED,MAAMC,kBAAkB,GAAGF,MAAM,CAACC,GAAG,CAAC,yBAAyB,CAAC;AAEhE,OAAO,SAASE,gBAAgBA,CAACC,KAAc,EAAmB;EAChE,OACE,OAAOA,KAAK,KAAK,QAAQ,KACrBA,KAAK,KAAKL,sBAAsB,IAAIK,KAAK,KAAKF,kBAAkB,CAAC;AAEzE;;AAMA;;AAKA;;AAUA;;AAQA;;AAMA;;AAMA;;AAUA;;AAQA;;AAKA;;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;;AAuLA,OAAO,MAAMG,qBAAqB,SAASC,KAAK,CAAC;EAC/CC,WAAWA,CACOC,KAAmD,EACnDC,UAA2C,EAC3D;IACA,MAAMC,KAAK,GAAGD,UAAU,CAACE,GAAG,CAAEC,CAAC,IAAKA,CAAC,CAACC,QAAQ,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC;IAC1D,MAAMC,SAAS,GAAGP,KAAK,CAACQ,WAAW,IAAIR,KAAK,CAACS,SAAS;IACtD,KAAK,CACH,UAAUF,SAAS,+CAA+CL,KAAK,EACzE,CAAC;IAAC,KAPcF,KAAmD,GAAnDA,KAAmD;IAAA,KACnDC,UAA2C,GAA3CA,UAA2C;IAO3D,IAAI,CAACS,IAAI,GAAG,uBAAuB;EACrC;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
function sortedStringify(obj) {
|
|
18
|
+
return JSON.stringify(obj, (_, v) => v && typeof v === "object" && !Array.isArray(v) ? Object.fromEntries(Object.entries(v).sort(([a], [b]) => a.localeCompare(b))) : v);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Computes a stable, deterministic identifier for a shape definition.
|
|
23
|
+
* The ID uniquely represents the combination of base type, property
|
|
24
|
+
* selections/nullability configs, and derived link definitions so
|
|
25
|
+
* that identical shapes produce the same ID across calls.
|
|
26
|
+
*/
|
|
27
|
+
export function computeShapeId(input) {
|
|
28
|
+
const canonical = canonicalizeShapeInput(input);
|
|
29
|
+
return simpleHash(sortedStringify(canonical));
|
|
30
|
+
}
|
|
31
|
+
function canonicalizeShapeInput(input) {
|
|
32
|
+
const sortedPropKeys = [...Object.keys(input.props)].sort();
|
|
33
|
+
const canonicalProps = {};
|
|
34
|
+
for (const key of sortedPropKeys) {
|
|
35
|
+
const config = input.props[key];
|
|
36
|
+
const op = config.nullabilityOp;
|
|
37
|
+
canonicalProps[key] = op.type === "withDefault" ? {
|
|
38
|
+
type: op.type,
|
|
39
|
+
defaultValue: op.defaultValue
|
|
40
|
+
} : op.type;
|
|
41
|
+
}
|
|
42
|
+
const canonicalLinks = input.derivedLinks.map(link => ({
|
|
43
|
+
name: link.name,
|
|
44
|
+
objectSetDef: canonicalizeObjectSetDef(link.objectSetDef),
|
|
45
|
+
targetShapeId: link.targetShape.__shapeId
|
|
46
|
+
}));
|
|
47
|
+
canonicalLinks.sort((a, b) => a.name.localeCompare(b.name));
|
|
48
|
+
return {
|
|
49
|
+
baseType: input.baseTypeApiName,
|
|
50
|
+
props: canonicalProps,
|
|
51
|
+
links: canonicalLinks
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function canonicalizeObjectSetDef(def) {
|
|
55
|
+
const result = {
|
|
56
|
+
segments: def.segments.map(seg => ({
|
|
57
|
+
type: seg.type,
|
|
58
|
+
linkName: seg.linkName,
|
|
59
|
+
sourceType: seg.sourceType
|
|
60
|
+
}))
|
|
61
|
+
};
|
|
62
|
+
if (def.where) {
|
|
63
|
+
result.where = JSON.parse(sortedStringify(def.where));
|
|
64
|
+
}
|
|
65
|
+
if (def.orderBy && def.orderBy.length > 0) {
|
|
66
|
+
result.orderBy = def.orderBy.map(o => ({
|
|
67
|
+
property: o.property,
|
|
68
|
+
direction: o.direction
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
71
|
+
if (def.limit !== undefined) {
|
|
72
|
+
result.limit = def.limit;
|
|
73
|
+
}
|
|
74
|
+
if (def.distinct) {
|
|
75
|
+
result.distinct = true;
|
|
76
|
+
}
|
|
77
|
+
if (def.setOperations && def.setOperations.length > 0) {
|
|
78
|
+
result.setOperations = def.setOperations.map(op => ({
|
|
79
|
+
type: op.type,
|
|
80
|
+
other: canonicalizeObjectSetDef(op.other)
|
|
81
|
+
}));
|
|
82
|
+
}
|
|
83
|
+
return result;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Shape IDs are used for cache keying and equality, not security,
|
|
87
|
+
// so 32-bit is sufficient.
|
|
88
|
+
function simpleHash(str) {
|
|
89
|
+
let hash = 5381;
|
|
90
|
+
for (let i = 0; i < str.length; i++) {
|
|
91
|
+
const char = str.charCodeAt(i);
|
|
92
|
+
hash = (hash << 5) + hash ^ char;
|
|
93
|
+
}
|
|
94
|
+
const positiveHash = hash >>> 0;
|
|
95
|
+
return positiveHash.toString(16).padStart(8, "0");
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=computeShapeId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"computeShapeId.js","names":["sortedStringify","obj","JSON","stringify","_","v","Array","isArray","Object","fromEntries","entries","sort","a","b","localeCompare","computeShapeId","input","canonical","canonicalizeShapeInput","simpleHash","sortedPropKeys","keys","props","canonicalProps","key","config","op","nullabilityOp","type","defaultValue","canonicalLinks","derivedLinks","map","link","name","objectSetDef","canonicalizeObjectSetDef","targetShapeId","targetShape","__shapeId","baseType","baseTypeApiName","links","def","result","segments","seg","linkName","sourceType","where","parse","orderBy","length","o","property","direction","limit","undefined","distinct","setOperations","other","str","hash","i","char","charCodeAt","positiveHash","toString","padStart"],"sources":["computeShapeId.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ShapeDerivedLinkDef,\n ShapeLinkObjectSetDef,\n ShapePropertyConfig,\n} from \"./ShapeDefinition.js\";\n\ninterface ShapeIdInput {\n baseTypeApiName: string;\n props: Record<string, ShapePropertyConfig>;\n derivedLinks: readonly ShapeDerivedLinkDef[];\n}\n\nfunction sortedStringify(obj: unknown): string {\n return JSON.stringify(\n obj,\n (_, v) =>\n v && typeof v === \"object\" && !Array.isArray(v)\n ? Object.fromEntries(\n Object.entries(v).sort(([a], [b]) => a.localeCompare(b)),\n )\n : v,\n );\n}\n\n/**\n * Computes a stable, deterministic identifier for a shape definition.\n * The ID uniquely represents the combination of base type, property\n * selections/nullability configs, and derived link definitions so\n * that identical shapes produce the same ID across calls.\n */\nexport function computeShapeId(input: ShapeIdInput): string {\n const canonical = canonicalizeShapeInput(input);\n return simpleHash(sortedStringify(canonical));\n}\n\nfunction canonicalizeShapeInput(\n input: ShapeIdInput,\n): Record<string, unknown> {\n const sortedPropKeys = [...Object.keys(input.props)].sort();\n const canonicalProps: Record<string, unknown> = {};\n\n for (const key of sortedPropKeys) {\n const config = input.props[key];\n const op = config.nullabilityOp;\n canonicalProps[key] = op.type === \"withDefault\"\n ? { type: op.type, defaultValue: op.defaultValue }\n : op.type;\n }\n\n const canonicalLinks = input.derivedLinks.map((link) => ({\n name: link.name,\n objectSetDef: canonicalizeObjectSetDef(link.objectSetDef),\n targetShapeId: link.targetShape.__shapeId,\n }));\n canonicalLinks.sort((a, b) => a.name.localeCompare(b.name));\n\n return {\n baseType: input.baseTypeApiName,\n props: canonicalProps,\n links: canonicalLinks,\n };\n}\n\nfunction canonicalizeObjectSetDef(\n def: ShapeLinkObjectSetDef,\n): Record<string, unknown> {\n const result: Record<string, unknown> = {\n segments: def.segments.map((seg) => ({\n type: seg.type,\n linkName: seg.linkName,\n sourceType: seg.sourceType,\n })),\n };\n\n if (def.where) {\n result.where = JSON.parse(sortedStringify(def.where));\n }\n\n if (def.orderBy && def.orderBy.length > 0) {\n result.orderBy = def.orderBy.map((o) => ({\n property: o.property,\n direction: o.direction,\n }));\n }\n\n if (def.limit !== undefined) {\n result.limit = def.limit;\n }\n\n if (def.distinct) {\n result.distinct = true;\n }\n\n if (def.setOperations && def.setOperations.length > 0) {\n result.setOperations = def.setOperations.map((op) => ({\n type: op.type,\n other: canonicalizeObjectSetDef(op.other),\n }));\n }\n\n return result;\n}\n\n// Shape IDs are used for cache keying and equality, not security,\n// so 32-bit is sufficient.\nfunction simpleHash(str: string): string {\n let hash = 5381;\n for (let i = 0; i < str.length; i++) {\n const char = str.charCodeAt(i);\n hash = ((hash << 5) + hash) ^ char;\n }\n\n const positiveHash = hash >>> 0;\n return positiveHash.toString(16).padStart(8, \"0\");\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAcA,SAASA,eAAeA,CAACC,GAAY,EAAU;EAC7C,OAAOC,IAAI,CAACC,SAAS,CACnBF,GAAG,EACH,CAACG,CAAC,EAAEC,CAAC,KACHA,CAAC,IAAI,OAAOA,CAAC,KAAK,QAAQ,IAAI,CAACC,KAAK,CAACC,OAAO,CAACF,CAAC,CAAC,GAC3CG,MAAM,CAACC,WAAW,CAClBD,MAAM,CAACE,OAAO,CAACL,CAAC,CAAC,CAACM,IAAI,CAAC,CAAC,CAACC,CAAC,CAAC,EAAE,CAACC,CAAC,CAAC,KAAKD,CAAC,CAACE,aAAa,CAACD,CAAC,CAAC,CACzD,CAAC,GACCR,CACR,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASU,cAAcA,CAACC,KAAmB,EAAU;EAC1D,MAAMC,SAAS,GAAGC,sBAAsB,CAACF,KAAK,CAAC;EAC/C,OAAOG,UAAU,CAACnB,eAAe,CAACiB,SAAS,CAAC,CAAC;AAC/C;AAEA,SAASC,sBAAsBA,CAC7BF,KAAmB,EACM;EACzB,MAAMI,cAAc,GAAG,CAAC,GAAGZ,MAAM,CAACa,IAAI,CAACL,KAAK,CAACM,KAAK,CAAC,CAAC,CAACX,IAAI,CAAC,CAAC;EAC3D,MAAMY,cAAuC,GAAG,CAAC,CAAC;EAElD,KAAK,MAAMC,GAAG,IAAIJ,cAAc,EAAE;IAChC,MAAMK,MAAM,GAAGT,KAAK,CAACM,KAAK,CAACE,GAAG,CAAC;IAC/B,MAAME,EAAE,GAAGD,MAAM,CAACE,aAAa;IAC/BJ,cAAc,CAACC,GAAG,CAAC,GAAGE,EAAE,CAACE,IAAI,KAAK,aAAa,GAC3C;MAAEA,IAAI,E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Q;MACpBC,SAAS,EAAEF,CAAC,CAACE;IACf,CAAC,CAAC,CAAC;EACL;EAEA,IAAIZ,GAAG,CAACa,KAAK,KAAKC,SAAS,EAAE;IAC3Bb,MAAM,CAACY,KAAK,GAAGb,GAAG,CAACa,KAAK;EAC1B;EAEA,IAAIb,GAAG,CAACe,QAAQ,EAAE;IAChBd,MAAM,CAACc,QAAQ,GAAG,IAAI;EACxB;EAEA,IAAIf,GAAG,CAACgB,aAAa,IAAIhB,GAAG,CAACgB,aAAa,CAACP,MAAM,GAAG,CAAC,EAAE;IACrDR,MAAM,CAACe,aAAa,GAAGhB,GAAG,CAACgB,aAAa,CAAC3B,GAAG,CAAEN,EAAE,KAAM;MACpDE,IAAI,EAAEF,EAAE,CAACE,IAAI;MACbgC,KAAK,EAAExB,wBAAwB,CAACV,EAAE,CAACkC,KAAK;IAC1C,CAAC,CAAC,CAAC;EACL;EAEA,OAAOhB,MAAM;AACf;;AAEA;AACA;AACA,SAASzB,UAAUA,CAAC0C,GAAW,EAAU;EACvC,IAAIC,IAAI,GAAG,IAAI;EACf,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,GAAG,CAACT,MAAM,EAAEW,CAAC,EAAE,EAAE;IACnC,MAAMC,IAAI,GAAGH,GAAG,CAACI,UAAU,CAACF,CAAC,CAAC;IAC9BD,IAAI,GAAI,CAACA,IAAI,IAAI,CAAC,IAAIA,IAAI,GAAIE,IAAI;EACpC;EAEA,MAAME,YAAY,GAAGJ,IAAI,KAAK,CAAC;EAC/B,OAAOI,YAAY,CAACC,QAAQ,CAAC,EAAE,CAAC,CAACC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;AACnD","ignoreList":[]}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { computeShapeId } from "./computeShapeId.js";
|
|
18
|
+
import { createShapeLinkBuilder } from "./ShapeBuilder.js";
|
|
19
|
+
export function configToShapeDefinition(baseType, config) {
|
|
20
|
+
const baseTypeApiName = baseType.apiName;
|
|
21
|
+
const props = {};
|
|
22
|
+
const seen = new Set();
|
|
23
|
+
function addProp(prop, config2) {
|
|
24
|
+
if (seen.has(prop)) {
|
|
25
|
+
throw new Error(`Property "${prop}" appears in multiple config arrays`);
|
|
26
|
+
}
|
|
27
|
+
seen.add(prop);
|
|
28
|
+
props[prop] = config2;
|
|
29
|
+
}
|
|
30
|
+
if (config.require) {
|
|
31
|
+
for (const prop of config.require) {
|
|
32
|
+
addProp(prop, {
|
|
33
|
+
nullabilityOp: {
|
|
34
|
+
type: "require"
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (config.select) {
|
|
40
|
+
for (const prop of config.select) {
|
|
41
|
+
addProp(prop, {
|
|
42
|
+
nullabilityOp: {
|
|
43
|
+
type: "select"
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (config.dropIfNull) {
|
|
49
|
+
for (const prop of config.dropIfNull) {
|
|
50
|
+
addProp(prop, {
|
|
51
|
+
nullabilityOp: {
|
|
52
|
+
type: "dropIfNull"
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (config.defaults) {
|
|
58
|
+
for (const [prop, defaultValue] of Object.entries(config.defaults)) {
|
|
59
|
+
addProp(prop, {
|
|
60
|
+
nullabilityOp: {
|
|
61
|
+
type: "withDefault",
|
|
62
|
+
defaultValue
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (config.transforms) {
|
|
68
|
+
for (const [prop, transform] of Object.entries(config.transforms)) {
|
|
69
|
+
if (typeof transform !== "function") {
|
|
70
|
+
throw new Error(`transforms["${prop}"] must be a function, got: ${typeof transform}`);
|
|
71
|
+
}
|
|
72
|
+
addProp(prop, {
|
|
73
|
+
nullabilityOp: {
|
|
74
|
+
type: "withTransform",
|
|
75
|
+
transform
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
const derivedLinks = [];
|
|
81
|
+
if (config.links) {
|
|
82
|
+
for (const [name, linkConfig] of Object.entries(config.links)) {
|
|
83
|
+
const linkBuilder = createShapeLinkBuilder(baseTypeApiName);
|
|
84
|
+
const traversed = linkConfig.via(linkBuilder);
|
|
85
|
+
const objectSetDef = traversed.toObjectSetDef();
|
|
86
|
+
const targetShape = linkConfig.target;
|
|
87
|
+
derivedLinks.push({
|
|
88
|
+
name,
|
|
89
|
+
objectSetDef,
|
|
90
|
+
targetShape,
|
|
91
|
+
config: {
|
|
92
|
+
defer: linkConfig.defer
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
const shapeId = computeShapeId({
|
|
98
|
+
baseTypeApiName,
|
|
99
|
+
props,
|
|
100
|
+
derivedLinks
|
|
101
|
+
});
|
|
102
|
+
return {
|
|
103
|
+
__shapeId: shapeId,
|
|
104
|
+
__debugName: undefined,
|
|
105
|
+
__baseType: baseType,
|
|
106
|
+
__baseTypeApiName: baseTypeApiName,
|
|
107
|
+
__props: Object.freeze({
|
|
108
|
+
...props
|
|
109
|
+
}),
|
|
110
|
+
__derivedLinks: Object.freeze([...derivedLinks]),
|
|
111
|
+
__selectedPropsType: {},
|
|
112
|
+
__derivedLinksType: {}
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=configToShapeDefinition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configToShapeDefinition.js","names":["computeShapeId","createShapeLinkBuilder","configToShapeDefinition","baseType","config","baseTypeApiName","apiName","props","seen","Set","addProp","prop","config2","has","Error","add","require","nullabilityOp","type","select","dropIfNull","defaults","defaultValue","Object","entries","transforms","transform","derivedLinks","links","name","linkConfig","linkBuilder","traversed","via","objectSetDef","toObjectSetDef","targetShape","target","push","defer","shapeId","__shapeId","__debugName","undefined","__baseType","__baseTypeApiName","__props","freeze","__derivedLinks","__selectedPropsType","__derivedLinksType"],"sources":["configToShapeDefinition.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ObjectOrInterfaceDefinition } from \"../ontology/ObjectOrInterface.js\";\nimport { computeShapeId } from \"./computeShapeId.js\";\nimport type {\n InferShapeDefinition,\n InlineShapeConfig,\n} from \"./InlineShapeConfig.js\";\nimport { createShapeLinkBuilder } from \"./ShapeBuilder.js\";\nimport type {\n NullabilityOp,\n ShapeDefinition,\n ShapeDerivedLinkDef,\n ShapeLinkBuilderInternal,\n ShapeLinkObjectSetDef,\n ShapePropertyConfig,\n} from \"./ShapeDefinition.js\";\n\nexport function configToShapeDefinition<\n BASE extends ObjectOrInterfaceDefinition,\n const C extends InlineShapeConfig<BASE>,\n>(\n baseType: BASE,\n config: C,\n): InferShapeDefinition<BASE, C> {\n const baseTypeApiName = baseType.apiName;\n const props: Record<string, ShapePropertyConfig> = {};\n\n const seen = new Set<string>();\n function addProp(prop: string, config2: ShapePropertyConfig) {\n if (seen.has(prop)) {\n throw new Error(`Property \"${prop}\" appears in multiple config arrays`);\n }\n seen.add(prop);\n props[prop] = config2;\n }\n\n if (config.require) {\n for (const prop of config.require) {\n addProp(prop as string, { nullabilityOp: { type: \"require\" } });\n }\n }\n\n if (config.select) {\n for (const prop of config.select) {\n addProp(prop as string, { nullabilityOp: { type: \"select\" } });\n }\n }\n\n if (config.dropIfNull) {\n for (const prop of config.dropIfNull) {\n addProp(prop as string, { nullabilityOp: { type: \"dropIfNull\" } });\n }\n }\n\n if (config.defaults) {\n for (const [prop, defaultValue] of Object.entries(config.defaults)) {\n addProp(prop, {\n nullabilityOp: {\n type: \"withDefault\",\n defaultValue,\n } as NullabilityOp,\n });\n }\n }\n\n if (config.transforms) {\n for (const [prop, transform] of Object.entries(config.transforms)) {\n if (typeof transform !== \"function\") {\n throw new Error(\n `transforms[\"${prop}\"] must be a function, got: ${typeof transform}`,\n );\n }\n addProp(prop, {\n nullabilityOp: {\n type: \"withTransform\",\n transform,\n } as NullabilityOp,\n });\n }\n }\n\n const derivedLinks: ShapeDerivedLinkDef[] = [];\n\n if (config.links) {\n for (const [name, linkConfig] of Object.entries(config.links)) {\n const linkBuilder = createShapeLinkBuilder(baseTypeApiName);\n const traversed = linkConfig.via(linkBuilder as ShapeLinkBuilderInternal);\n const objectSetDef: ShapeLinkObjectSetDef =\n (traversed as ShapeLinkBuilderInternal).toObjectSetDef();\n\n const targetShape: ShapeDefinition<ObjectOrInterfaceDefinition> =\n linkConfig.target;\n\n derivedLinks.push({\n name,\n objectSetDef,\n targetShape,\n config: { defer: linkConfig.defer },\n });\n }\n }\n\n const shapeId = computeShapeId({\n baseTypeApiName,\n props,\n derivedLinks,\n });\n\n return {\n __shapeId: shapeId,\n __debugName: undefined,\n __baseType: baseType,\n __baseTypeApiName: baseTypeApiName,\n __props: Object.freeze({ ...props }),\n __derivedLinks: Object.freeze([...derivedLinks]),\n __selectedPropsType: {} as InferShapeDefinition<\n BASE,\n C\n >[\"__selectedPropsType\"],\n __derivedLinksType: {} as InferShapeDefinition<\n BASE,\n C\n >[\"__derivedLinksType\"],\n } as InferShapeDefinition<BASE, C>;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,cAAc,QAAQ,qBAAqB;AAKpD,SAASC,sBAAsB,QAAQ,mBAAmB;AAU1D,OAAO,SAASC,uBAAuBA,CAIrCC,QAAc,EACdC,MAAS,EACsB;EAC/B,MAAMC,eAAe,GAAGF,QAAQ,CAACG,OAAO;EACxC,MAAMC,KAA0C,GAAG,CAAC,CAAC;EAErD,MAAMC,IAAI,GAAG,IAAIC,GAAG,CAAS,CAAC;EAC9B,SAASC,OAAOA,CAACC,IAAY,EAAEC,OAA4B,EAAE;IAC3D,IAAIJ,IAAI,CAACK,GAAG,CAACF,IAAI,CAAC,EAAE;MAClB,MAAM,IAAIG,KAAK,CAAC,aAAaH,IAAI,qCAAqC,CAAC;IACzE;IACAH,IAAI,CAACO,GAAG,CAACJ,IAAI,CAAC;IACdJ,KAAK,CAACI,IAAI,CAAC,GAAGC,OAAO;EACvB;EAEA,IAAIR,MAAM,CAACY,OAAO,EAAE;IAClB,KAAK,MAAML,IAAI,IAAIP,MAAM,CAACY,OAAO,EAAE;MACjCN,OAAO,CAACC,IAAI,EAAY;QAAEM,aAAa,EAAE;UAAEC,IAAI,EAAE;QAAU;MAAE,CAAC,CAAC;IACjE;EACF;EAEA,IAAId,MAAM,CAACe,MAAM,EAAE;IACjB,KAAK,MAAMR,IAAI,IAAIP,MAAM,CAACe,MAAM,EAAE;MAChCT,OAAO,CAACC,IAAI,EAAY;QAAEM,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;MACzE,MAAMG,YAAmC,GACtCF,SAAS,CAA8BG,cAAc,CAAC,CAAC;MAE1D,MAAMC,WAAyD,GAC7DN,UAAU,CAACO,MAAM;MAEnBV,YAAY,CAACW,IAAI,CAAC;QAChBT,IAAI;QACJK,YAAY;QACZE,WAAW;QACXhC,MAAM,EAAE;UAAEmC,KAAK,EAAET,UAAU,CAACS;QAAM;MACpC,CAAC,CAAC;IACJ;EACF;EAEA,MAAMC,OAAO,GAAGxC,cAAc,CAAC;IAC7BK,eAAe;IACfE,KAAK;IACLoB;EACF,CAAC,CAAC;EAEF,OAAO;IACLc,SAAS,EAAED,OAAO;IAClBE,WAAW,EAAEC,SAAS;IACtBC,UAAU,EAAEzC,QAAQ;IACpB0C,iBAAiB,EAAExC,eAAe;IAClCyC,OAAO,EAAEvB,MAAM,CAACwB,MAAM,CAAC;MAAE,GAAGxC;IAAM,CAAC,CAAC;IACpCyC,cAAc,EAAEzB,MAAM,CAACwB,MAAM,CAAC,CAAC,GAAGpB,YAAY,CAAC,CAAC;IAChDsB,mBAAmB,EAAE,CAAC,CAGE;IACxBC,kBAAkB,EAAE,CAAC;EAIvB,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
// Core types
|
|
18
|
+
|
|
19
|
+
// Inline shape config types
|
|
20
|
+
|
|
21
|
+
// Error types and runtime values
|
|
22
|
+
export { isSourcePkSymbol, ShapeNullabilityError, SourcePrimaryKeySymbol } from "./ShapeDefinition.js";
|
|
23
|
+
|
|
24
|
+
// Builder functions
|
|
25
|
+
export { createShapeBuilder } from "./ShapeBuilder.js";
|
|
26
|
+
|
|
27
|
+
// Inline config converter
|
|
28
|
+
export { configToShapeDefinition } from "./configToShapeDefinition.js";
|
|
29
|
+
|
|
30
|
+
// Inline config converter uses computeShapeId internally but it is not part of the public API.
|
|
31
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["isSourcePkSymbol","ShapeNullabilityError","SourcePrimaryKeySymbol","createShapeBuilder","configToShapeDefinition"],"sources":["index.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// Core types\nexport type {\n LinkLoadConfig,\n LinkStatus,\n NullabilityViolation,\n PropertyType,\n RequiredProperty,\n ShapeBaseType,\n ShapeBuilder,\n ShapeDefinition,\n ShapeDerivedLinks,\n ShapeInstance,\n ShapeLinkBuilder,\n ShapeLinkResult,\n} from \"./ShapeDefinition.js\";\n\n// Inline shape config types\nexport type {\n InferShapeDefinition,\n InlineLinkConfig,\n InlineShapeConfig,\n} from \"./InlineShapeConfig.js\";\n\n// Error types and runtime values\nexport {\n isSourcePkSymbol,\n ShapeNullabilityError,\n SourcePrimaryKeySymbol,\n} from \"./ShapeDefinition.js\";\n\n// Builder functions\nexport { createShapeBuilder } from \"./ShapeBuilder.js\";\n\n// Inline config converter\nexport { configToShapeDefinition } from \"./configToShapeDefinition.js\";\n\n// Inline config converter uses computeShapeId internally but it is not part of the public API.\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAgBA;;AAOA;AACA,SACEA,gBAAgB,EAChBC,qBAAqB,EACrBC,sBAAsB,QACjB,sBAAsB;;AAE7B;AACA,SAASC,kBAAkB,QAAQ,mBAAmB;;AAEtD;AACA,SAASC,uBAAuB,QAAQ,8BAA8B;;AAEtE","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.js","names":[],"sources":["internal.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport type {\n DerivedLinkConfig,\n NullabilityOp,\n ShapeDerivedLinkDef,\n ShapeLinkObjectSetDef,\n ShapeLinkOrderBy,\n ShapeLinkSegment,\n ShapeLinkSetOperation,\n ShapePropertyConfig,\n} from \"./ShapeDefinition.js\";\n"],"mappings":"","ignoreList":[]}
|
|
@@ -36,7 +36,7 @@ export declare namespace DerivedProperty {
|
|
|
36
36
|
export interface Builder<
|
|
37
37
|
Q extends ObjectOrInterfaceDefinition,
|
|
38
38
|
CONSTRAINED extends boolean
|
|
39
|
-
> extends BaseBuilder<Q, CONSTRAINED>, Selectable<Q
|
|
39
|
+
> extends BaseBuilder<Q, CONSTRAINED>, Selectable<Q> {}
|
|
40
40
|
export interface AggregateBuilder<
|
|
41
41
|
Q extends ObjectOrInterfaceDefinition,
|
|
42
42
|
CONSTRAINED extends boolean
|
|
@@ -64,15 +64,6 @@ type Pivotable<
|
|
|
64
64
|
> = {
|
|
65
65
|
readonly pivotTo: <L extends LinkNames<Q>>(type: L) => CONSTRAINED extends true ? DerivedProperty.AggregateBuilder<LinkedType<Q, L>, true> : NonNullable<CompileTimeMetadata<Q>["links"][L]["multiplicity"]> extends true ? DerivedProperty.AggregateBuilder<LinkedType<Q, L>, true> : DerivedProperty.SelectPropertyBuilder<LinkedType<Q, L>, false>
|
|
66
66
|
};
|
|
67
|
-
type Constant<Q extends ObjectOrInterfaceDefinition> = {
|
|
68
|
-
readonly constant: {
|
|
69
|
-
readonly double: (value: number) => DerivedProperty.NumericPropertyDefinition<SimplePropertyDef.Make<"double", "non-nullable", "single">, Q>
|
|
70
|
-
readonly integer: (value: number) => DerivedProperty.NumericPropertyDefinition<SimplePropertyDef.Make<"integer", "non-nullable", "single">, Q>
|
|
71
|
-
readonly long: (value: string) => DerivedProperty.NumericPropertyDefinition<SimplePropertyDef.Make<"long", "non-nullable", "single">, Q>
|
|
72
|
-
readonly datetime: (value: string) => DerivedProperty.DatetimePropertyDefinition<SimplePropertyDef.Make<"datetime", "non-nullable", "single">, Q>
|
|
73
|
-
readonly timestamp: (value: string) => DerivedProperty.DatetimePropertyDefinition<SimplePropertyDef.Make<"timestamp", "non-nullable", "single">, Q>
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
67
|
type Aggregatable<Q extends ObjectOrInterfaceDefinition> = {
|
|
77
68
|
readonly aggregate: <V extends ValidAggregationKeys<Q, "withPropertiesAggregate">>(aggregationSpecifier: V, opts?: V extends `${any}:${infer P}` ? P extends CollectWithPropAggregations ? {
|
|
78
69
|
limit: number
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,cAAc,4BAA4B,kCAAmC;AAC7E,cAAc,mBAAmB,6BAA8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AG,cAAc,GAAG,SACxC,YACA,WAEF,UAAU,gCAAgC,kBAAkB,KAC1D,oBAAoB,GAAG,cAAc,GAAG,SACxC,YACA,YAEF,UAAU,wBAAwB,kBAChC,kBAAkB,KAClB,WACA,gBACA,YAEF,kBAAkB,KAClB,UACA,YACA,YAEA,UAAU,WAAW,kBAAkB,KACrC,WACA,gBACA;AAIT;KAEI,WAAW,UAAU,+BAA+B;UAC9C,iBAAiB,UAAU,aAAa,IAC/CC,cAAc,MACX,kBACH,GACA,kBAAkB,KAChB,oBAAoB,GAAG,cAAc,GAAG,SACxC,oBAAoB,GAAG,cAAc,GAAG,oBAAoB,OACxD,aACA,gBACJ,oBAAoB,GAAG,cAAc,GAAG,wBAAwB,OAC5D,UACA;AAGT","names":["DerivedPropertyDefinitionBrand: unique symbol","baseObjectSet: Builder<Q, false>","clause: WhereClause<Q>","type: L","aggregationSpecifier: V","opts?: V extends `${any}:${infer P}`\n ? P extends CollectWithPropAggregations ? { limit: number }\n : P extends \"approximatePercentile\" ? { percentile: number }\n : never\n : never","propertyName: R"],"sources":["../../../src/derivedProperties/DerivedProperty.ts"],"version":3,"file":"DerivedProperty.d.ts"}
|
package/build/types/index.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export type { PropertyValueWireToClient } from "./mapping/PropertyValueMapping.j
|
|
|
22
22
|
export type { Attachment, AttachmentMetadata, AttachmentUpload } from "./object/Attachment.js";
|
|
23
23
|
export type { AsyncIterArgs, Augment, Augments, FetchPageArgs, NullabilityAdherence, ObjectSetArgs, SelectArg, SelectArgToKeys } from "./object/FetchPageArgs.js";
|
|
24
24
|
export type { FetchPageResult, SingleOsdkResult } from "./object/FetchPageResult.js";
|
|
25
|
-
export type { Media, MediaMetadata, MediaReference, MediaUpload } from "./object/Media.js";
|
|
25
|
+
export type { Media, MediaMetadata, MediaPropertyLocation, MediaReference, MediaUpload } from "./object/Media.js";
|
|
26
26
|
export type { PropertyMarkings, PropertySecurity } from "./object/PropertySecurity.js";
|
|
27
27
|
export { isOk } from "./object/Result.js";
|
|
28
28
|
export type { Result } from "./object/Result.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,cAAc,kCAAkC;AAChD,cACE,oBACA,aACA,0BACA,oBACA,+BACK;AACP,cAAc,4BAA4B;AAC1C,cAAc,qBAAqB;AACnC,cAAc,sEAAsE;AACpF,cAAc,oCAAoC;AAClD,cAAc,uCAAuC;AACrD,cAAc,yBAAyB;AACvC,cAAc,2BAA2B;AACzC,cAAc,wBAAwB;AACtC,cAAc,oBAAoB;AAClC,SAAS,2BAA2B;AACpC,cACE,gBACA,sBACA,kBACA,gBACA,eACA,4BACA,mBACK;AACP,cACE,8BACA,8BACK;AACP,cACE,uBACA,0BACK;AACP,cAAc,uBAAuB;AACrC,SAAS,uBAAuB;AAChC,cACE,kBACA,eACA,oBACK;AACP,cAAc,cAAc;AAC5B,cACE,uBACA,oBACA,uBACA,6BACK;AACP,cACE,iCACK;AACP,cACE,YACA,oBACA,wBACK;AACP,cACE,eACA,SACA,UACA,eACA,sBACA,eACA,WACA,uBACK;AACP,cACE,iBACA,wBACK;AACP,cACE,OACA,eACA,gBACA,mBACK;AACP,cACE,kBACA,wBACK;AACP,SAAS,YAAY;AACrB,cAAc,cAAc;AAC5B,cAAc,qBAAqB;AACnC,cAAc,iBAAiB;AAC/B,cACE,sBACA,qBACA,yCACK;AACP,cAAc,6BAA6B;AAC3C,cACE,kBACA,sBACK;AACP,cACE,qBACA,yBACK;AACP,cACE,6BACA,oBACK;AACP,cAAc,uBAAuB;AACrC,cACE,qBACA,gBACA,sBACA,aACA,oBACK;AACP,cAAc,wBAAwB;AACtC,cAAc,uBAAuB;AACrC,cACE,wBACA,qBACA,wBACA,yBACA,iBACA,eACA,0BACA,4CACA,gDACK;AACP,cAAc,yBAAyB;AACvC,cAAc,qCAAqC;AACnD,cACE,gBACA,yBACA,6BACA,sBACA,kBACA,wBACA,sBACA,4BACA,uCACK;AACP,cACE,WACA,uCACK;AACP,cACE,OACA,mBACA,qBACA,mBACA,qBACA,mBACA,sBACA,2BACA,wBACA,sBACA,yBACA,sBACA,qBACA,mBACA,mBACA,sBACA,0BACA,iBACA,oBACA,iBACA,8BACA,kCACA,sBACK;AACP,cAAc,mCAAmC;AACjD,cACE,uBACA,uCACA,sBACK;AACP,cACE,uBACA,yBACK;AACP,cACE,mBACA,UACA,sBACK;AAEP,cAAc,kBAAkB;AAChC,cAAc,cAAc,YAAY,YAAY;AACpD,cAAc,kBAAkB;AAChC,cACE,OACA,6BACA,iCACK;AACP,cAAc,YAAY,mBAAmB;AAC7C,SAAS,iCAAiC;AAC1C,cACE,uBACA,iBACA,oBACA,uBACK;AACP,cAAc,YAAY,iBAAiB;AAC3C","names":[],"sources":["../../src/index.ts"],"version":3,"file":"index.d.ts"}
|
|
1
|
+
{"mappings":"AAgBA,cAAc,kCAAkC;AAChD,cACE,oBACA,aACA,0BACA,oBACA,+BACK;AACP,cAAc,4BAA4B;AAC1C,cAAc,qBAAqB;AACnC,cAAc,sEAAsE;AACpF,cAAc,oCAAoC;AAClD,cAAc,uCAAuC;AACrD,cAAc,yBAAyB;AACvC,cAAc,2BAA2B;AACzC,cAAc,wBAAwB;AACtC,cAAc,oBAAoB;AAClC,SAAS,2BAA2B;AACpC,cACE,gBACA,sBACA,kBACA,gBACA,eACA,4BACA,mBACK;AACP,cACE,8BACA,8BACK;AACP,cACE,uBACA,0BACK;AACP,cAAc,uBAAuB;AACrC,SAAS,uBAAuB;AAChC,cACE,kBACA,eACA,oBACK;AACP,cAAc,cAAc;AAC5B,cACE,uBACA,oBACA,uBACA,6BACK;AACP,cACE,iCACK;AACP,cACE,YACA,oBACA,wBACK;AACP,cACE,eACA,SACA,UACA,eACA,sBACA,eACA,WACA,uBACK;AACP,cACE,iBACA,wBACK;AACP,cACE,OACA,eACA,uBACA,gBACA,mBACK;AACP,cACE,kBACA,wBACK;AACP,SAAS,YAAY;AACrB,cAAc,cAAc;AAC5B,cAAc,qBAAqB;AACnC,cAAc,iBAAiB;AAC/B,cACE,sBACA,qBACA,yCACK;AACP,cAAc,6BAA6B;AAC3C,cACE,kBACA,sBACK;AACP,cACE,qBACA,yBACK;AACP,cACE,6BACA,oBACK;AACP,cAAc,uBAAuB;AACrC,cACE,qBACA,gBACA,sBACA,aACA,oBACK;AACP,cAAc,wBAAwB;AACtC,cAAc,uBAAuB;AACrC,cACE,wBACA,qBACA,wBACA,yBACA,iBACA,eACA,0BACA,4CACA,gDACK;AACP,cAAc,yBAAyB;AACvC,cAAc,qCAAqC;AACnD,cACE,gBACA,yBACA,6BACA,sBACA,kBACA,wBACA,sBACA,4BACA,uCACK;AACP,cACE,WACA,uCACK;AACP,cACE,OACA,mBACA,qBACA,mBACA,qBACA,mBACA,sBACA,2BACA,wBACA,sBACA,yBACA,sBACA,qBACA,mBACA,mBACA,sBACA,0BACA,iBACA,oBACA,iBACA,8BACA,kCACA,sBACK;AACP,cAAc,mCAAmC;AACjD,cACE,uBACA,uCACA,sBACK;AACP,cACE,uBACA,yBACK;AACP,cACE,mBACA,UACA,sBACK;AAEP,cAAc,kBAAkB;AAChC,cAAc,cAAc,YAAY,YAAY;AACpD,cAAc,kBAAkB;AAChC,cACE,OACA,6BACA,iCACK;AACP,cAAc,YAAY,mBAAmB;AAC7C,SAAS,iCAAiC;AAC1C,cACE,uBACA,iBACA,oBACA,uBACK;AACP,cAAc,YAAY,iBAAiB;AAC3C","names":[],"sources":["../../src/index.ts"],"version":3,"file":"index.d.ts"}
|
|
@@ -11,6 +11,20 @@ export interface Media {
|
|
|
11
11
|
* Returns the media reference
|
|
12
12
|
*/
|
|
13
13
|
getMediaReference(): MediaReference;
|
|
14
|
+
/**
|
|
15
|
+
* Returns the source location of this media (object type, primary key, property name).
|
|
16
|
+
*
|
|
17
|
+
* Optional because not all media has a source location (e.g., transient/uploaded media).
|
|
18
|
+
*/
|
|
19
|
+
getMediaSourceLocation?(): MediaPropertyLocation;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Location of a media property on an object.
|
|
23
|
+
*/
|
|
24
|
+
export interface MediaPropertyLocation {
|
|
25
|
+
objectType: string;
|
|
26
|
+
primaryKey: string | number;
|
|
27
|
+
propertyName: string;
|
|
14
28
|
}
|
|
15
29
|
/**
|
|
16
30
|
* Unique identifier of a media item in Foundry.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,iBAAiB,MAAM;;;;CAIrB,iBAAiB,QAAQ;;;;CAIzB,iBAAiB,QAAQ;;;;CAIzB,qBAAqB;
|
|
1
|
+
{"mappings":"AAgBA,iBAAiB,MAAM;;;;CAIrB,iBAAiB,QAAQ;;;;CAIzB,iBAAiB,QAAQ;;;;CAIzB,qBAAqB;;;;;;CAMrB,2BAA2B;AAC5B;;;;AAKD,iBAAiB,sBAAsB;CACrC;CACA;CACA;AACD;;;;AAKD,iBAAiB,eAAe;CAC9B;CACA,WAAW;EACT,MAAM;EACN,kBAAkB;GAChB;GACA;GACA;GACA;;GAEA;EACD;CACF;AACF;;;;AAKD,iBAAiB,YAAY;UAClB;UACA,MAAM;AAChB;;;;AAKD,iBAAiB,cAAc;CAC7B;CACA;CACA;AACD","names":[],"sources":["../../../src/object/Media.ts"],"version":3,"file":"Media.d.ts"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { DerivedLinkConfig, NullabilityOp, ShapeDerivedLinkDef, ShapeLinkObjectSetDef, ShapeLinkOrderBy, ShapeLinkSegment, ShapeLinkSetOperation, ShapePropertyConfig } from "../shapes/internal.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAgBA,cACE,mBACA,eACA,qBACA,uBACA,kBACA,kBACA,uBACA,2BACK","names":[],"sources":["../../../src/public/shapes-internal.ts"],"version":3,"file":"shapes-internal.d.ts"}
|
|
@@ -5,3 +5,5 @@ export { __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchPageByRid, type FetchPageByRidP
|
|
|
5
5
|
export { __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks } from "../experimental/getBulkLinks.js";
|
|
6
6
|
export type { EXPERIMENTAL_BulkLinkResult } from "../objectSet/BulkLinkResult.js";
|
|
7
7
|
export type { MinimalObjectSet } from "../objectSet/ObjectSet.js";
|
|
8
|
+
export { configToShapeDefinition, createShapeBuilder, isSourcePkSymbol, ShapeNullabilityError, SourcePrimaryKeySymbol } from "../shapes/index.js";
|
|
9
|
+
export type { InferShapeDefinition, InlineLinkConfig, InlineShapeConfig, LinkLoadConfig, LinkStatus, NullabilityViolation, PropertyType, RequiredProperty, ShapeBaseType, ShapeBuilder, ShapeDefinition, ShapeDerivedLinks, ShapeInstance, ShapeLinkBuilder, ShapeLinkResult } from "../shapes/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,cAAc,YAAY,qBAAqB;AAE/C,SAAS,+DAA+D;AACxE,SAAS,wDAAwD;AACjE,SACE,wDACK,6BACA;AACP,SAAS,uDAAuD;AAEhE,cAAc,mCAAmC;AACjD,cAAc,wBAAwB","names":[],"sources":["../../../src/public/unstable.ts"],"version":3,"file":"unstable.d.ts"}
|
|
1
|
+
{"mappings":"AAgBA,cAAc,YAAY,qBAAqB;AAE/C,SAAS,+DAA+D;AACxE,SAAS,wDAAwD;AACjE,SACE,wDACK,6BACA;AACP,SAAS,uDAAuD;AAEhE,cAAc,mCAAmC;AACjD,cAAc,wBAAwB;AAGtC,SACE,yBACA,oBACA,kBACA,uBACA,8BACK;AAEP,cACE,sBACA,kBACA,mBACA,gBACA,YACA,sBACA,cACA,kBACA,eACA,cACA,iBACA,mBACA,eACA,kBACA,uBACK","names":[],"sources":["../../../src/public/unstable.ts"],"version":3,"file":"unstable.d.ts"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ObjectOrInterfaceDefinition, PropertyKeys } from "../ontology/ObjectOrInterface.js";
|
|
2
|
+
import type { PropertyType, RequiredProperty, ShapeDefinition, ShapeLinkBuilder } from "./ShapeDefinition.js";
|
|
3
|
+
export interface InlineShapeConfig<BASE extends ObjectOrInterfaceDefinition> {
|
|
4
|
+
readonly require?: readonly PropertyKeys<BASE>[];
|
|
5
|
+
readonly select?: readonly PropertyKeys<BASE>[];
|
|
6
|
+
readonly dropIfNull?: readonly PropertyKeys<BASE>[];
|
|
7
|
+
readonly defaults?: { readonly [K in PropertyKeys<BASE>]? : NonNullable<PropertyType<BASE, K>> };
|
|
8
|
+
readonly transforms?: { readonly [K in PropertyKeys<BASE>]? : (value: PropertyType<BASE, K>) => unknown };
|
|
9
|
+
readonly links?: Record<string, InlineLinkConfig<BASE>>;
|
|
10
|
+
}
|
|
11
|
+
export interface InlineLinkConfig<SOURCE extends ObjectOrInterfaceDefinition> {
|
|
12
|
+
readonly via: (builder: ShapeLinkBuilder<SOURCE, SOURCE>) => ShapeLinkBuilder<SOURCE, ObjectOrInterfaceDefinition>;
|
|
13
|
+
readonly target: ShapeDefinition<ObjectOrInterfaceDefinition>;
|
|
14
|
+
readonly defer?: boolean;
|
|
15
|
+
}
|
|
16
|
+
type ArrayElement<T> = T extends readonly (infer E)[] ? E : never;
|
|
17
|
+
export type InferInlineProps<
|
|
18
|
+
BASE extends ObjectOrInterfaceDefinition,
|
|
19
|
+
C extends InlineShapeConfig<BASE>
|
|
20
|
+
> = { [K in ArrayElement<C["require"]> & PropertyKeys<BASE>] : RequiredProperty<PropertyType<BASE, K>> } & { [K in ArrayElement<C["select"]> & PropertyKeys<BASE>] : PropertyType<BASE, K> } & { [K in ArrayElement<C["dropIfNull"]> & PropertyKeys<BASE>] : RequiredProperty<PropertyType<BASE, K>> } & { [K in keyof C["defaults"] & PropertyKeys<BASE>] : NonNullable<PropertyType<BASE, K>> } & { [K in keyof C["transforms"] & PropertyKeys<BASE>] : C["transforms"] extends Record<K, (v: PropertyType<BASE, K>) => infer R> ? R : never };
|
|
21
|
+
export type InferInlineLinks<
|
|
22
|
+
BASE extends ObjectOrInterfaceDefinition,
|
|
23
|
+
C extends InlineShapeConfig<BASE>
|
|
24
|
+
> = C["links"] extends Record<string, InlineLinkConfig<BASE>> ? { [K in keyof C["links"] & string] : C["links"][K]["target"] extends ShapeDefinition<ObjectOrInterfaceDefinition> ? C["links"][K]["target"] : ShapeDefinition<ObjectOrInterfaceDefinition> } : {};
|
|
25
|
+
export type InferShapeDefinition<
|
|
26
|
+
BASE extends ObjectOrInterfaceDefinition,
|
|
27
|
+
C extends InlineShapeConfig<BASE>
|
|
28
|
+
> = ShapeDefinition<BASE, InferInlineProps<BASE, C>, InferInlineLinks<BASE, C>>;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAgBA,cACE,6BACA,oBACK,kCAAmC;AAC1C,cACE,cACA,kBACA,iBACA,wBACK,sBAAuB;AAE9B,iBAAiB,kBACf,aAAa,6BACb;UACS,mBAAmB,aAAa;UAChC,kBAAkB,aAAa;UAC/B,sBAAsB,aAAa;UACnC,uBACG,KAAK,aAAa,UAAS,YAAY,aAAa,MAAM;UAE7D,yBACG,KAAK,aAAa,WAC1BA,OAAO,aAAa,MAAM;UAGrB,QAAQ,eAAe,iBAAiB;AAClD;AAED,iBAAiB,iBACf,eAAe,6BACf;UACS,MACPC,SAAS,iBAAiB,QAAQ,YAC/B,iBAAiB,QAAQ;UACrB,QAAQ,gBAAgB;UACxB;AACV;KAII,aAAa,KAAK,0BAA0B,OAAO;AAExD,YAAY;CACV,aAAa;CACb,UAAU,kBAAkB;OAGzB,KAAK,aAAa,EAAE,cAAc,aAAa,SAAQ,iBACtD,aAAa,MAAM,WAIpB,KAAK,aAAa,EAAE,aAAa,aAAa,SAAQ,aACrD,MACA,UAID,KAAK,aAAa,EAAE,iBAAiB,aAAa,SAAQ,iBACzD,aAAa,MAAM,WAIpB,WAAW,EAAE,cAAc,aAAa,SAAQ,YAC/C,aAAa,MAAM,WAIpB,WAAW,EAAE,gBAAgB,aAAa,SAAQ,EAAE,sBACnD,OAAO,IAAIC,GAAG,aAAa,MAAM,aAAa,KAAK;AAGzD,YAAY;CACV,aAAa;CACb,UAAU,kBAAkB;IAC1B,EAAE,iBAAiB,eAAe,iBAAiB,YAClD,WAAW,EAAE,qBAAoB,EAAE,SAAS,GAAG,kBAC9C,gBAAgB,+BAA+B,EAAE,SAAS,GAAG,YAC3D,gBAAgB,iCAEpB,CAAE;AAEN,YAAY;CACV,aAAa;CACb,UAAU,kBAAkB;IAC1B,gBACF,MACA,iBAAiB,MAAM,IACvB,iBAAiB,MAAM","names":["value: PropertyType<BASE, K>","builder: ShapeLinkBuilder<SOURCE, SOURCE>","v: PropertyType<BASE, K>"],"sources":["../../../src/shapes/InlineShapeConfig.ts"],"version":3,"file":"InlineShapeConfig.d.ts"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ObjectOrInterfaceDefinition } from "../ontology/ObjectOrInterface.js";
|
|
2
|
+
import type { ShapeBuilder, ShapeLinkBuilder } from "./ShapeDefinition.js";
|
|
3
|
+
export declare function createShapeLinkBuilder<
|
|
4
|
+
SOURCE extends ObjectOrInterfaceDefinition,
|
|
5
|
+
CURRENT extends ObjectOrInterfaceDefinition
|
|
6
|
+
>(sourceTypeApiName: string): ShapeLinkBuilder<SOURCE, CURRENT>;
|
|
7
|
+
/**
|
|
8
|
+
* Creates a new ShapeBuilder for the given base type.
|
|
9
|
+
*
|
|
10
|
+
* @param baseType - The base ObjectTypeDefinition or InterfaceDefinition
|
|
11
|
+
* @param debugName - Optional name for debugging in DevTools
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const SlimPlayer = createShapeBuilder(Player, "SlimPlayer")
|
|
16
|
+
* .require("name", "age")
|
|
17
|
+
* .withDefault("position", "Unknown")
|
|
18
|
+
* .build();
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare function createShapeBuilder<BASE extends ObjectOrInterfaceDefinition>(baseType: BASE, debugName?: string): ShapeBuilder<BASE, {}, {}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAiBA,cACE,mCAEK,kCAAmC;AAI1C,cAKE,cAGA,wBAOK,sBAAuB;AA0S9B,OAAO,iBAAS;CACd,eAAe;CACf,gBAAgB;EAChBA,4BAA4B,iBAAiB,QAAQ;;;;;;;;;;;;;;;AAyBvD,OAAO,iBAAS,mBAAmB,aAAa,6BAC9CC,UAAU,MACVC,qBACC,aAAa,MAAM,CAAE,GAAE,CAAE","names":["sourceTypeApiName: string","baseType: BASE","debugName?: string"],"sources":["../../../src/shapes/ShapeBuilder.ts"],"version":3,"file":"ShapeBuilder.d.ts"}
|