@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,152 @@
|
|
|
1
|
+
import { O as ObjectOrInterfaceDefinition, W as WhereClause, P as PropertyKeys, C as CompileTimeMetadata, b8 as LinkNames, b7 as LinkedType, c as OsdkBase } from './ObjectSet-DkBNIajH.cjs';
|
|
2
|
+
|
|
3
|
+
declare const SourcePrimaryKeySymbol: unique symbol;
|
|
4
|
+
declare function isSourcePkSymbol(value: unknown): value is symbol;
|
|
5
|
+
declare const ShapeDefinitionBrand: unique symbol;
|
|
6
|
+
declare const ShapeLinkResultBrand: unique symbol;
|
|
7
|
+
/** Configuration for how a derived link is loaded at runtime. */
|
|
8
|
+
interface DerivedLinkConfig {
|
|
9
|
+
defer?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/** The result of calling `ShapeLinkBuilder.as()`, binding a link traversal to a target shape. */
|
|
12
|
+
interface ShapeLinkResult<TARGET_SHAPE extends ShapeDefinition<ObjectOrInterfaceDefinition>> {
|
|
13
|
+
readonly __linkResultBrand: typeof ShapeLinkResultBrand;
|
|
14
|
+
readonly targetShape: TARGET_SHAPE;
|
|
15
|
+
readonly objectSetDef: ShapeLinkObjectSetDef;
|
|
16
|
+
readonly config: DerivedLinkConfig;
|
|
17
|
+
}
|
|
18
|
+
/** A single link traversal step in a derived link's object set definition. */
|
|
19
|
+
interface ShapeLinkSegment {
|
|
20
|
+
readonly type: "pivotTo";
|
|
21
|
+
readonly linkName: string;
|
|
22
|
+
readonly sourceType?: string;
|
|
23
|
+
readonly targetType?: string;
|
|
24
|
+
}
|
|
25
|
+
/** Sort clause for a derived link's result set. */
|
|
26
|
+
interface ShapeLinkOrderBy {
|
|
27
|
+
readonly property: string;
|
|
28
|
+
readonly direction: "asc" | "desc";
|
|
29
|
+
}
|
|
30
|
+
/** A set operation (union/intersect/subtract) applied to a derived link's object set. */
|
|
31
|
+
interface ShapeLinkSetOperation {
|
|
32
|
+
readonly type: "union" | "intersect" | "subtract";
|
|
33
|
+
readonly other: ShapeLinkObjectSetDef;
|
|
34
|
+
}
|
|
35
|
+
/** Serializable definition of a derived link's object set: link traversals, filters, ordering, and set operations. */
|
|
36
|
+
interface ShapeLinkObjectSetDef {
|
|
37
|
+
readonly segments: readonly ShapeLinkSegment[];
|
|
38
|
+
readonly where?: WhereClause<ObjectOrInterfaceDefinition>;
|
|
39
|
+
readonly orderBy?: readonly ShapeLinkOrderBy[];
|
|
40
|
+
readonly limit?: number;
|
|
41
|
+
readonly distinct?: boolean;
|
|
42
|
+
readonly setOperations?: readonly ShapeLinkSetOperation[];
|
|
43
|
+
}
|
|
44
|
+
/** How a shape handles null values for a selected property. */
|
|
45
|
+
type NullabilityOp = {
|
|
46
|
+
type: "require";
|
|
47
|
+
} | {
|
|
48
|
+
type: "dropIfNull";
|
|
49
|
+
} | {
|
|
50
|
+
type: "withDefault";
|
|
51
|
+
defaultValue: unknown;
|
|
52
|
+
} | {
|
|
53
|
+
type: "withTransform";
|
|
54
|
+
transform: (value: unknown) => unknown;
|
|
55
|
+
} | {
|
|
56
|
+
type: "select";
|
|
57
|
+
};
|
|
58
|
+
/** Per-property configuration stored in a shape's `__props` map. */
|
|
59
|
+
interface ShapePropertyConfig {
|
|
60
|
+
readonly nullabilityOp: NullabilityOp;
|
|
61
|
+
}
|
|
62
|
+
/** A derived link definition stored in a shape's `__derivedLinks` array. */
|
|
63
|
+
interface ShapeDerivedLinkDef<TARGET_SHAPE extends ShapeDefinition<ObjectOrInterfaceDefinition> = ShapeDefinition<ObjectOrInterfaceDefinition>> {
|
|
64
|
+
readonly name: string;
|
|
65
|
+
readonly objectSetDef: ShapeLinkObjectSetDef;
|
|
66
|
+
readonly targetShape: TARGET_SHAPE;
|
|
67
|
+
readonly config: DerivedLinkConfig;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Type projection from an OSDK type. `__props` is the single source of truth for property config.
|
|
71
|
+
*
|
|
72
|
+
* @typeParam BASE - The base ObjectTypeDefinition or InterfaceDefinition
|
|
73
|
+
* @typeParam SELECTED_PROPS - Record of selected properties and their transformed types
|
|
74
|
+
* @typeParam DERIVED_LINKS - Record of derived link names to their result types
|
|
75
|
+
*/
|
|
76
|
+
interface ShapeDefinition<BASE extends ObjectOrInterfaceDefinition, SELECTED_PROPS extends Record<string, unknown> = {}, DERIVED_LINKS extends Record<string, ShapeDefinition<ObjectOrInterfaceDefinition>> = {}> {
|
|
77
|
+
readonly [ShapeDefinitionBrand]: true;
|
|
78
|
+
readonly __shapeId: string;
|
|
79
|
+
readonly __debugName: string | undefined;
|
|
80
|
+
readonly __baseType: BASE;
|
|
81
|
+
readonly __baseTypeApiName: string;
|
|
82
|
+
readonly __props: Readonly<Record<string, unknown>>;
|
|
83
|
+
readonly __derivedLinks: readonly unknown[];
|
|
84
|
+
readonly __selectedPropsType: SELECTED_PROPS;
|
|
85
|
+
readonly __derivedLinksType: DERIVED_LINKS;
|
|
86
|
+
}
|
|
87
|
+
type ShapeBaseType<S extends ShapeDefinition<ObjectOrInterfaceDefinition>> = S extends ShapeDefinition<infer BASE, infer _P, infer _L> ? BASE : never;
|
|
88
|
+
type ShapeDerivedLinks<S extends ShapeDefinition<ObjectOrInterfaceDefinition>> = S extends ShapeDefinition<infer _B, infer _P, infer LINKS> ? LINKS : never;
|
|
89
|
+
type ShapeInstance<S extends ShapeDefinition<ObjectOrInterfaceDefinition>> = S extends ShapeDefinition<infer BASE, infer PROPS, infer LINKS> ? OsdkBase<BASE> & {
|
|
90
|
+
readonly $rid: string;
|
|
91
|
+
} & PROPS & {
|
|
92
|
+
[K in keyof LINKS]: LINKS[K] extends ShapeDefinition<ObjectOrInterfaceDefinition> ? ShapeInstance<LINKS[K]>[] : never;
|
|
93
|
+
} : never;
|
|
94
|
+
type PropertyType<BASE extends ObjectOrInterfaceDefinition, K extends PropertyKeys<BASE>> = CompileTimeMetadata<BASE>["props"][K];
|
|
95
|
+
type RequiredProperty<T> = NonNullable<T>;
|
|
96
|
+
interface ShapeLinkBuilder<SOURCE extends ObjectOrInterfaceDefinition, CURRENT extends ObjectOrInterfaceDefinition> {
|
|
97
|
+
pivotTo<L extends LinkNames<CURRENT>>(link: L): ShapeLinkBuilder<SOURCE, LinkedType<CURRENT, L>>;
|
|
98
|
+
where(clause: WhereClause<CURRENT>): ShapeLinkBuilder<SOURCE, CURRENT>;
|
|
99
|
+
union(...others: ShapeLinkBuilder<SOURCE, CURRENT>[]): ShapeLinkBuilder<SOURCE, CURRENT>;
|
|
100
|
+
intersect(...others: ShapeLinkBuilder<SOURCE, CURRENT>[]): ShapeLinkBuilder<SOURCE, CURRENT>;
|
|
101
|
+
subtract(...others: ShapeLinkBuilder<SOURCE, CURRENT>[]): ShapeLinkBuilder<SOURCE, CURRENT>;
|
|
102
|
+
orderBy<K extends PropertyKeys<CURRENT>>(property: K, direction?: "asc" | "desc"): ShapeLinkBuilder<SOURCE, CURRENT>;
|
|
103
|
+
limit(n: number): ShapeLinkBuilder<SOURCE, CURRENT>;
|
|
104
|
+
distinct(): ShapeLinkBuilder<SOURCE, CURRENT>;
|
|
105
|
+
as<TARGET_SHAPE extends ShapeDefinition<CURRENT>>(shape: TARGET_SHAPE, config?: DerivedLinkConfig): ShapeLinkResult<TARGET_SHAPE>;
|
|
106
|
+
readonly $primaryKey: symbol;
|
|
107
|
+
}
|
|
108
|
+
interface ShapeBuilder<BASE extends ObjectOrInterfaceDefinition, PROPS extends Record<string, unknown> = {}, LINKS extends Record<string, ShapeDefinition<ObjectOrInterfaceDefinition>> = {}> {
|
|
109
|
+
select<K extends Exclude<PropertyKeys<BASE>, keyof PROPS>>(...props: K[]): ShapeBuilder<BASE, PROPS & {
|
|
110
|
+
[P in K]: PropertyType<BASE, P>;
|
|
111
|
+
}, LINKS>;
|
|
112
|
+
require<K extends Exclude<PropertyKeys<BASE>, keyof PROPS>>(...props: K[]): ShapeBuilder<BASE, PROPS & {
|
|
113
|
+
[P in K]: RequiredProperty<PropertyType<BASE, P>>;
|
|
114
|
+
}, LINKS>;
|
|
115
|
+
dropIfNull<K extends Exclude<PropertyKeys<BASE>, keyof PROPS>>(...props: K[]): ShapeBuilder<BASE, PROPS & {
|
|
116
|
+
[P in K]: RequiredProperty<PropertyType<BASE, P>>;
|
|
117
|
+
}, LINKS>;
|
|
118
|
+
withDefault<K extends Exclude<PropertyKeys<BASE>, keyof PROPS>, V extends NonNullable<PropertyType<BASE, K>>>(prop: K, defaultValue: V): ShapeBuilder<BASE, PROPS & {
|
|
119
|
+
[P in K]: NonNullable<PropertyType<BASE, P>>;
|
|
120
|
+
}, LINKS>;
|
|
121
|
+
withTransform<K extends Exclude<PropertyKeys<BASE>, keyof PROPS>, R>(prop: K, transform: (value: PropertyType<BASE, K>) => R): ShapeBuilder<BASE, PROPS & {
|
|
122
|
+
[P in K]: R;
|
|
123
|
+
}, LINKS>;
|
|
124
|
+
deriveLink<NAME extends string, TARGET_SHAPE extends ShapeDefinition<ObjectOrInterfaceDefinition>>(name: NAME, builder: (linkBuilder: ShapeLinkBuilder<BASE, BASE>) => ShapeLinkResult<TARGET_SHAPE>): ShapeBuilder<BASE, PROPS, LINKS & {
|
|
125
|
+
[K in NAME]: TARGET_SHAPE;
|
|
126
|
+
}>;
|
|
127
|
+
build(): ShapeDefinition<BASE, PROPS, LINKS>;
|
|
128
|
+
}
|
|
129
|
+
interface LinkLoadConfig {
|
|
130
|
+
pageSize?: number;
|
|
131
|
+
autoFetchMore?: boolean | number;
|
|
132
|
+
streamUpdates?: boolean;
|
|
133
|
+
defer?: boolean;
|
|
134
|
+
}
|
|
135
|
+
interface LinkStatus {
|
|
136
|
+
isLoading: boolean;
|
|
137
|
+
error: Error | undefined;
|
|
138
|
+
hasMore: boolean;
|
|
139
|
+
fetchMore: () => Promise<void>;
|
|
140
|
+
}
|
|
141
|
+
interface NullabilityViolation {
|
|
142
|
+
property: string;
|
|
143
|
+
primaryKey: unknown;
|
|
144
|
+
constraint: "require" | "dropIfNull" | "transformError";
|
|
145
|
+
}
|
|
146
|
+
declare class ShapeNullabilityError extends Error {
|
|
147
|
+
readonly shape: ShapeDefinition<ObjectOrInterfaceDefinition>;
|
|
148
|
+
readonly violations: readonly NullabilityViolation[];
|
|
149
|
+
constructor(shape: ShapeDefinition<ObjectOrInterfaceDefinition>, violations: readonly NullabilityViolation[]);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export { type DerivedLinkConfig as D, type LinkLoadConfig as L, type NullabilityViolation as N, type PropertyType as P, type RequiredProperty as R, type ShapeLinkBuilder as S, type ShapeDefinition as a, type ShapeBuilder as b, ShapeNullabilityError as c, SourcePrimaryKeySymbol as d, type LinkStatus as e, type ShapeBaseType as f, type ShapeDerivedLinks as g, type ShapeInstance as h, isSourcePkSymbol as i, type ShapeLinkResult as j, type NullabilityOp as k, type ShapeDerivedLinkDef as l, type ShapeLinkObjectSetDef as m, type ShapeLinkOrderBy as n, type ShapeLinkSegment as o, type ShapeLinkSetOperation as p, type ShapePropertyConfig as q };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DerivedProperty.js","names":["DerivedProperty"],"sources":["DerivedProperty.ts"],"sourcesContent":["/*\n * Copyright 2024 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 { ValidAggregationKeys } from \"../aggregate/AggregatableKeys.js\";\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 { SimplePropertyDef } from \"../ontology/SimplePropertyDef.js\";\nimport type { LinkedType, LinkNames } from \"../util/LinkUtils.js\";\nimport type {\n DatetimeExpressions,\n DefinitionForType,\n NumericExpressions,\n} from \"./Expressions.js\";\nimport type {\n CollectWithPropAggregations,\n MinMaxWithPropAggregateOption,\n} from \"./WithPropertiesAggregationOptions.js\";\n\ndeclare const DerivedPropertyDefinitionBrand: unique symbol;\n\nexport namespace DerivedProperty {\n export interface Definition<\n T extends SimplePropertyDef,\n Q extends ObjectOrInterfaceDefinition,\n > {\n readonly [DerivedPropertyDefinitionBrand]: true;\n }\n\n export interface NumericPropertyDefinition<\n T extends SimplePropertyDef,\n Q extends ObjectOrInterfaceDefinition,\n > extends Definition<T, Q>, NumericExpressions<Q, T> {}\n\n export interface DatetimePropertyDefinition<\n T extends SimplePropertyDef,\n Q extends ObjectOrInterfaceDefinition,\n > extends Definition<T, Q>, DatetimeExpressions<Q, T> {}\n\n export type Creator<\n Q extends ObjectOrInterfaceDefinition,\n T extends SimplePropertyDef,\n > = (\n baseObjectSet: Builder<Q, false>,\n ) =>\n | Definition<T, Q>\n | NumericPropertyDefinition<T, Q>\n | DatetimePropertyDefinition<T, Q>;\n\n export type Clause<\n Q extends ObjectOrInterfaceDefinition,\n > = {\n [key: string]: Creator<Q, SimplePropertyDef>;\n };\n\n interface BaseBuilder<\n Q extends ObjectOrInterfaceDefinition,\n CONSTRAINED extends boolean,\n > extends Filterable<Q, CONSTRAINED>, Pivotable<Q, CONSTRAINED> {\n }\n\n export interface Builder<\n Q extends ObjectOrInterfaceDefinition,\n CONSTRAINED extends boolean,\n > extends BaseBuilder<Q, CONSTRAINED>, Selectable<Q
|
|
1
|
+
{"version":3,"file":"DerivedProperty.js","names":["DerivedProperty"],"sources":["DerivedProperty.ts"],"sourcesContent":["/*\n * Copyright 2024 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 { ValidAggregationKeys } from \"../aggregate/AggregatableKeys.js\";\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 { SimplePropertyDef } from \"../ontology/SimplePropertyDef.js\";\nimport type { LinkedType, LinkNames } from \"../util/LinkUtils.js\";\nimport type {\n DatetimeExpressions,\n DefinitionForType,\n NumericExpressions,\n} from \"./Expressions.js\";\nimport type {\n CollectWithPropAggregations,\n MinMaxWithPropAggregateOption,\n} from \"./WithPropertiesAggregationOptions.js\";\n\ndeclare const DerivedPropertyDefinitionBrand: unique symbol;\n\nexport namespace DerivedProperty {\n export interface Definition<\n T extends SimplePropertyDef,\n Q extends ObjectOrInterfaceDefinition,\n > {\n readonly [DerivedPropertyDefinitionBrand]: true;\n }\n\n export interface NumericPropertyDefinition<\n T extends SimplePropertyDef,\n Q extends ObjectOrInterfaceDefinition,\n > extends Definition<T, Q>, NumericExpressions<Q, T> {}\n\n export interface DatetimePropertyDefinition<\n T extends SimplePropertyDef,\n Q extends ObjectOrInterfaceDefinition,\n > extends Definition<T, Q>, DatetimeExpressions<Q, T> {}\n\n export type Creator<\n Q extends ObjectOrInterfaceDefinition,\n T extends SimplePropertyDef,\n > = (\n baseObjectSet: Builder<Q, false>,\n ) =>\n | Definition<T, Q>\n | NumericPropertyDefinition<T, Q>\n | DatetimePropertyDefinition<T, Q>;\n\n export type Clause<\n Q extends ObjectOrInterfaceDefinition,\n > = {\n [key: string]: Creator<Q, SimplePropertyDef>;\n };\n\n interface BaseBuilder<\n Q extends ObjectOrInterfaceDefinition,\n CONSTRAINED extends boolean,\n > extends Filterable<Q, CONSTRAINED>, Pivotable<Q, CONSTRAINED> {\n }\n\n export interface Builder<\n Q extends ObjectOrInterfaceDefinition,\n CONSTRAINED extends boolean,\n > extends BaseBuilder<Q, CONSTRAINED>, Selectable<Q> {\n }\n\n export interface AggregateBuilder<\n Q extends ObjectOrInterfaceDefinition,\n CONSTRAINED extends boolean,\n > extends BaseBuilder<Q, CONSTRAINED>, Aggregatable<Q> {\n }\n\n export interface SelectPropertyBuilder<\n Q extends ObjectOrInterfaceDefinition,\n CONSTRAINED extends boolean,\n > extends AggregateBuilder<Q, CONSTRAINED>, Selectable<Q> {\n }\n\n export type ValidParts = \"DAYS\" | \"MONTHS\" | \"QUARTERS\" | \"YEARS\";\n}\n\ntype BuilderTypeFromConstraint<\n Q extends ObjectOrInterfaceDefinition,\n CONSTRAINED extends boolean,\n> = CONSTRAINED extends true ? DerivedProperty.AggregateBuilder<Q, true>\n : DerivedProperty.SelectPropertyBuilder<Q, false>;\n\ntype Filterable<\n Q extends ObjectOrInterfaceDefinition,\n CONSTRAINED extends boolean,\n> = {\n readonly where: (\n clause: WhereClause<Q>,\n ) => BuilderTypeFromConstraint<Q, CONSTRAINED>;\n};\n\ntype Pivotable<\n Q extends ObjectOrInterfaceDefinition,\n CONSTRAINED extends boolean,\n> = {\n readonly pivotTo: <L extends LinkNames<Q>>(\n type: L,\n ) => CONSTRAINED extends true\n ? DerivedProperty.AggregateBuilder<LinkedType<Q, L>, true>\n : NonNullable<CompileTimeMetadata<Q>[\"links\"][L][\"multiplicity\"]> extends\n true ? DerivedProperty.AggregateBuilder<LinkedType<Q, L>, true>\n : DerivedProperty.SelectPropertyBuilder<LinkedType<Q, L>, false>;\n};\n\ntype Constant<Q extends ObjectOrInterfaceDefinition> = {\n readonly constant: {\n readonly double: (\n value: number,\n ) => DerivedProperty.NumericPropertyDefinition<\n SimplePropertyDef.Make<\"double\", \"non-nullable\", \"single\">,\n Q\n >;\n\n readonly integer: (\n value: number,\n ) => DerivedProperty.NumericPropertyDefinition<\n SimplePropertyDef.Make<\"integer\", \"non-nullable\", \"single\">,\n Q\n >;\n readonly long: (\n value: string,\n ) => DerivedProperty.NumericPropertyDefinition<\n SimplePropertyDef.Make<\"long\", \"non-nullable\", \"single\">,\n Q\n >;\n\n readonly datetime: (\n value: string,\n ) => DerivedProperty.DatetimePropertyDefinition<\n SimplePropertyDef.Make<\"datetime\", \"non-nullable\", \"single\">,\n Q\n >;\n readonly timestamp: (\n value: string,\n ) => DerivedProperty.DatetimePropertyDefinition<\n SimplePropertyDef.Make<\"timestamp\", \"non-nullable\", \"single\">,\n Q\n >;\n };\n};\n\ntype Aggregatable<\n Q extends ObjectOrInterfaceDefinition,\n> = {\n readonly aggregate: <\n V extends ValidAggregationKeys<\n Q,\n \"withPropertiesAggregate\"\n >,\n >(\n aggregationSpecifier: V,\n opts?: V extends `${any}:${infer P}`\n ? P extends CollectWithPropAggregations ? { limit: number }\n : P extends \"approximatePercentile\" ? { percentile: number }\n : never\n : never,\n ) => DefinitionForType<\n Q,\n V extends `${infer N}:${infer P}`\n ? P extends CollectWithPropAggregations ? SimplePropertyDef.Make<\n CompileTimeMetadata<Q>[\"properties\"][N][\"type\"],\n \"nullable\",\n \"array\"\n >\n : P extends MinMaxWithPropAggregateOption ? SimplePropertyDef.Make<\n CompileTimeMetadata<Q>[\"properties\"][N][\"type\"],\n \"nullable\",\n \"single\"\n >\n : P extends \"approximateDistinct\" | \"exactDistinct\"\n ? SimplePropertyDef.Make<\n \"integer\",\n \"non-nullable\",\n \"single\"\n >\n : SimplePropertyDef.Make<\n \"double\",\n \"nullable\",\n \"single\"\n >\n : V extends \"$count\" ? SimplePropertyDef.Make<\n \"integer\",\n \"non-nullable\",\n \"single\"\n >\n : never\n >;\n};\n\ntype Selectable<Q extends ObjectOrInterfaceDefinition> = {\n readonly selectProperty: <R extends PropertyKeys<Q>>(\n propertyName: R,\n ) => DefinitionForType<\n Q,\n SimplePropertyDef.Make<\n CompileTimeMetadata<Q>[\"properties\"][R][\"type\"],\n CompileTimeMetadata<Q>[\"properties\"][R][\"nullable\"] extends true\n ? \"nullable\"\n : \"non-nullable\",\n CompileTimeMetadata<Q>[\"properties\"][R][\"multiplicity\"] extends true\n ? \"array\"\n : \"single\"\n >\n >;\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAdA,WAqCiBA,eAAe","ignoreList":[]}
|
package/build/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["DistanceUnitMapping","DurationMapping","isOk","TimeseriesDurationMapping"],"sources":["index.ts"],"sourcesContent":["/*\n * Copyright 2023 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 { ActionReturnTypeForOptions } from \"./actions/ActionReturnTypeForOptions.js\";\nexport type {\n ActionEditResponse,\n ActionParam,\n ActionValidationResponse,\n ApplyActionOptions,\n ApplyBatchActionOptions,\n} from \"./actions/Actions.js\";\nexport type { ValidAggregationKeys } from \"./aggregate/AggregatableKeys.js\";\nexport type { AggregateOpts } from \"./aggregate/AggregateOpts.js\";\nexport type { AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy } from \"./aggregate/AggregateOptsThatErrors.js\";\nexport type { AggregationResultsWithGroups } from \"./aggregate/AggregationResultsWithGroups.js\";\nexport type { AggregationResultsWithoutGroups } from \"./aggregate/AggregationResultsWithoutGroups.js\";\nexport type { AggregationClause } from \"./aggregate/AggregationsClause.js\";\nexport type { AggregationsResults } from \"./aggregate/AggregationsResults.js\";\nexport type { GeoFilterOptions } from \"./aggregate/GeoFilter.js\";\nexport type { IntervalRule } from \"./aggregate/IntervalRule.js\";\nexport { DistanceUnitMapping } from \"./aggregate/WhereClause.js\";\nexport type {\n AndWhereClause,\n GeoFilter_Intersects,\n GeoFilter_Within,\n NotWhereClause,\n OrWhereClause,\n PossibleWhereClauseFilters,\n WhereClause,\n} from \"./aggregate/WhereClause.js\";\nexport type {\n OsdkObjectCreatePropertyType,\n OsdkObjectPropertyType,\n} from \"./Definitions.js\";\nexport type {\n OsdkObjectLinksObject,\n SingleLinkAccessor,\n} from \"./definitions/LinkDefinitions.js\";\nexport { type DerivedProperty } from \"./derivedProperties/DerivedProperty.js\";\nexport { DurationMapping } from \"./groupby/GroupByClause.js\";\nexport type {\n AllGroupByValues,\n GroupByClause,\n GroupByRange,\n} from \"./groupby/GroupByClause.js\";\nexport type { Logger } from \"./Logger.js\";\nexport type {\n AllowedBucketKeyTypes,\n AllowedBucketTypes,\n DataValueClientToWire,\n DataValueWireToClient,\n} from \"./mapping/DataValueMapping.js\";\nexport type {\n PropertyValueWireToClient,\n} from \"./mapping/PropertyValueMapping.js\";\nexport type {\n Attachment,\n AttachmentMetadata,\n AttachmentUpload,\n} from \"./object/Attachment.js\";\nexport type {\n AsyncIterArgs,\n Augment,\n Augments,\n FetchPageArgs,\n NullabilityAdherence,\n ObjectSetArgs,\n SelectArg,\n SelectArgToKeys,\n} from \"./object/FetchPageArgs.js\";\nexport type {\n FetchPageResult,\n SingleOsdkResult,\n} from \"./object/FetchPageResult.js\";\nexport type {\n Media,\n MediaMetadata,\n MediaReference,\n MediaUpload,\n} from \"./object/Media.js\";\nexport type {\n PropertyMarkings,\n PropertySecurity,\n} from \"./object/PropertySecurity.js\";\nexport { isOk } from \"./object/Result.js\";\nexport type { Result } from \"./object/Result.js\";\nexport type { BaseObjectSet } from \"./objectSet/BaseObjectSet.js\";\nexport type { ObjectSet } from \"./objectSet/ObjectSet.js\";\nexport type {\n FetchLinksPageResult,\n LinkTypeApiNamesFor,\n MinimalDirectedObjectLinkInstance,\n} from \"./objectSet/ObjectSetLinks.js\";\nexport type { ObjectSetSubscription } from \"./objectSet/ObjectSetListener.js\";\nexport type {\n ActionDefinition,\n ActionMetadata,\n} from \"./ontology/ActionDefinition.js\";\nexport type {\n InterfaceDefinition,\n InterfaceMetadata,\n} from \"./ontology/InterfaceDefinition.js\";\nexport type {\n ObjectOrInterfaceDefinition,\n PropertyKeys,\n} from \"./ontology/ObjectOrInterface.js\";\nexport type { ObjectSpecifier } from \"./ontology/ObjectSpecifier.js\";\nexport type {\n CompileTimeMetadata,\n ObjectMetadata,\n ObjectTypeDefinition,\n PropertyDef,\n VersionBound,\n} from \"./ontology/ObjectTypeDefinition.js\";\nexport type { OntologyMetadata } from \"./ontology/OntologyMetadata.js\";\nexport type { PrimaryKeyTypes } from \"./ontology/PrimaryKeyTypes.js\";\nexport type {\n InterfaceQueryDataType,\n ObjectQueryDataType,\n ObjectSetQueryDataType,\n QueryDataTypeDefinition,\n QueryDefinition,\n QueryMetadata,\n QueryParameterDefinition,\n ThreeDimensionalQueryAggregationDefinition,\n TwoDimensionalQueryAggregationDefinition,\n} from \"./ontology/QueryDefinition.js\";\nexport type { SimplePropertyDef } from \"./ontology/SimplePropertyDef.js\";\nexport type { PropertyBooleanFormattingRule } from \"./ontology/valueFormatting/PropertyBooleanFormattingRule.js\";\nexport type {\n DatetimeFormat,\n DatetimeLocalizedFormat,\n DatetimeLocalizedFormatType,\n DatetimeStringFormat,\n DatetimeTimezone,\n DatetimeTimezoneStatic,\n DatetimeTimezoneUser,\n PropertyDateFormattingRule,\n PropertyTimestampFormattingRule,\n} from \"./ontology/valueFormatting/PropertyDateAndTimestampFormattingRule.js\";\nexport type {\n KnownType,\n PropertyKnownTypeFormattingRule,\n} from \"./ontology/valueFormatting/PropertyKnownTypeFormattingRule.js\";\nexport type {\n Affix,\n DurationBaseValue,\n DurationFormatStyle,\n DurationPrecision,\n HumanReadableFormat,\n NumberFormatAffix,\n NumberFormatCurrency,\n NumberFormatCurrencyStyle,\n NumberFormatCustomUnit,\n NumberFormatDuration,\n NumberFormatFixedValues,\n NumberFormatNotation,\n NumberFormatOptions,\n NumberFormatRatio,\n NumberFormatScale,\n NumberFormatStandard,\n NumberFormatStandardUnit,\n NumberRatioType,\n NumberRoundingMode,\n NumberScaleType,\n PropertyNumberFormattingRule,\n PropertyNumberFormattingRuleType,\n TimeCodeFormat,\n} from \"./ontology/valueFormatting/PropertyNumberFormattingRule.js\";\nexport type { PropertyValueFormattingRule } from \"./ontology/valueFormatting/PropertyValueFormattingRule.js\";\nexport type {\n PropertyTypeReference,\n PropertyTypeReferenceOrStringConstant,\n StringConstant,\n} from \"./ontology/valueFormatting/PropertyValueFormattingUtils.js\";\nexport type {\n BaseWirePropertyTypes,\n WirePropertyTypes,\n} from \"./ontology/WirePropertyTypes.js\";\nexport type {\n ObjectIdentifiers,\n OsdkBase,\n PrimaryKeyType,\n} from \"./OsdkBase.js\";\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport type { OsdkObject } from \"./OsdkObject.js\";\nexport type { ConvertProps, MaybeScore, Osdk } from \"./OsdkObjectFrom.js\";\nexport type { PageResult } from \"./PageResult.js\";\nexport type {\n Range,\n ThreeDimensionalAggregation,\n TwoDimensionalAggregation,\n} from \"./queries/Aggregations.js\";\nexport type { QueryParam, QueryResult } from \"./queries/Queries.js\";\nexport { TimeseriesDurationMapping } from \"./timeseries/timeseries.js\";\nexport type {\n GeotimeSeriesProperty,\n TimeSeriesPoint,\n TimeSeriesProperty,\n TimeSeriesQuery,\n} from \"./timeseries/timeseries.js\";\nexport type { LinkedType, LinkNames } from \"./util/LinkUtils.js\";\nexport {};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAmBA,SAASA,mBAAmB,QAAQ,4BAA4B;AAmBhE,SAASC,eAAe,QAAQ,4BAA4B;
|
|
1
|
+
{"version":3,"file":"index.js","names":["DistanceUnitMapping","DurationMapping","isOk","TimeseriesDurationMapping"],"sources":["index.ts"],"sourcesContent":["/*\n * Copyright 2023 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 { ActionReturnTypeForOptions } from \"./actions/ActionReturnTypeForOptions.js\";\nexport type {\n ActionEditResponse,\n ActionParam,\n ActionValidationResponse,\n ApplyActionOptions,\n ApplyBatchActionOptions,\n} from \"./actions/Actions.js\";\nexport type { ValidAggregationKeys } from \"./aggregate/AggregatableKeys.js\";\nexport type { AggregateOpts } from \"./aggregate/AggregateOpts.js\";\nexport type { AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy } from \"./aggregate/AggregateOptsThatErrors.js\";\nexport type { AggregationResultsWithGroups } from \"./aggregate/AggregationResultsWithGroups.js\";\nexport type { AggregationResultsWithoutGroups } from \"./aggregate/AggregationResultsWithoutGroups.js\";\nexport type { AggregationClause } from \"./aggregate/AggregationsClause.js\";\nexport type { AggregationsResults } from \"./aggregate/AggregationsResults.js\";\nexport type { GeoFilterOptions } from \"./aggregate/GeoFilter.js\";\nexport type { IntervalRule } from \"./aggregate/IntervalRule.js\";\nexport { DistanceUnitMapping } from \"./aggregate/WhereClause.js\";\nexport type {\n AndWhereClause,\n GeoFilter_Intersects,\n GeoFilter_Within,\n NotWhereClause,\n OrWhereClause,\n PossibleWhereClauseFilters,\n WhereClause,\n} from \"./aggregate/WhereClause.js\";\nexport type {\n OsdkObjectCreatePropertyType,\n OsdkObjectPropertyType,\n} from \"./Definitions.js\";\nexport type {\n OsdkObjectLinksObject,\n SingleLinkAccessor,\n} from \"./definitions/LinkDefinitions.js\";\nexport { type DerivedProperty } from \"./derivedProperties/DerivedProperty.js\";\nexport { DurationMapping } from \"./groupby/GroupByClause.js\";\nexport type {\n AllGroupByValues,\n GroupByClause,\n GroupByRange,\n} from \"./groupby/GroupByClause.js\";\nexport type { Logger } from \"./Logger.js\";\nexport type {\n AllowedBucketKeyTypes,\n AllowedBucketTypes,\n DataValueClientToWire,\n DataValueWireToClient,\n} from \"./mapping/DataValueMapping.js\";\nexport type {\n PropertyValueWireToClient,\n} from \"./mapping/PropertyValueMapping.js\";\nexport type {\n Attachment,\n AttachmentMetadata,\n AttachmentUpload,\n} from \"./object/Attachment.js\";\nexport type {\n AsyncIterArgs,\n Augment,\n Augments,\n FetchPageArgs,\n NullabilityAdherence,\n ObjectSetArgs,\n SelectArg,\n SelectArgToKeys,\n} from \"./object/FetchPageArgs.js\";\nexport type {\n FetchPageResult,\n SingleOsdkResult,\n} from \"./object/FetchPageResult.js\";\nexport type {\n Media,\n MediaMetadata,\n MediaPropertyLocation,\n MediaReference,\n MediaUpload,\n} from \"./object/Media.js\";\nexport type {\n PropertyMarkings,\n PropertySecurity,\n} from \"./object/PropertySecurity.js\";\nexport { isOk } from \"./object/Result.js\";\nexport type { Result } from \"./object/Result.js\";\nexport type { BaseObjectSet } from \"./objectSet/BaseObjectSet.js\";\nexport type { ObjectSet } from \"./objectSet/ObjectSet.js\";\nexport type {\n FetchLinksPageResult,\n LinkTypeApiNamesFor,\n MinimalDirectedObjectLinkInstance,\n} from \"./objectSet/ObjectSetLinks.js\";\nexport type { ObjectSetSubscription } from \"./objectSet/ObjectSetListener.js\";\nexport type {\n ActionDefinition,\n ActionMetadata,\n} from \"./ontology/ActionDefinition.js\";\nexport type {\n InterfaceDefinition,\n InterfaceMetadata,\n} from \"./ontology/InterfaceDefinition.js\";\nexport type {\n ObjectOrInterfaceDefinition,\n PropertyKeys,\n} from \"./ontology/ObjectOrInterface.js\";\nexport type { ObjectSpecifier } from \"./ontology/ObjectSpecifier.js\";\nexport type {\n CompileTimeMetadata,\n ObjectMetadata,\n ObjectTypeDefinition,\n PropertyDef,\n VersionBound,\n} from \"./ontology/ObjectTypeDefinition.js\";\nexport type { OntologyMetadata } from \"./ontology/OntologyMetadata.js\";\nexport type { PrimaryKeyTypes } from \"./ontology/PrimaryKeyTypes.js\";\nexport type {\n InterfaceQueryDataType,\n ObjectQueryDataType,\n ObjectSetQueryDataType,\n QueryDataTypeDefinition,\n QueryDefinition,\n QueryMetadata,\n QueryParameterDefinition,\n ThreeDimensionalQueryAggregationDefinition,\n TwoDimensionalQueryAggregationDefinition,\n} from \"./ontology/QueryDefinition.js\";\nexport type { SimplePropertyDef } from \"./ontology/SimplePropertyDef.js\";\nexport type { PropertyBooleanFormattingRule } from \"./ontology/valueFormatting/PropertyBooleanFormattingRule.js\";\nexport type {\n DatetimeFormat,\n DatetimeLocalizedFormat,\n DatetimeLocalizedFormatType,\n DatetimeStringFormat,\n DatetimeTimezone,\n DatetimeTimezoneStatic,\n DatetimeTimezoneUser,\n PropertyDateFormattingRule,\n PropertyTimestampFormattingRule,\n} from \"./ontology/valueFormatting/PropertyDateAndTimestampFormattingRule.js\";\nexport type {\n KnownType,\n PropertyKnownTypeFormattingRule,\n} from \"./ontology/valueFormatting/PropertyKnownTypeFormattingRule.js\";\nexport type {\n Affix,\n DurationBaseValue,\n DurationFormatStyle,\n DurationPrecision,\n HumanReadableFormat,\n NumberFormatAffix,\n NumberFormatCurrency,\n NumberFormatCurrencyStyle,\n NumberFormatCustomUnit,\n NumberFormatDuration,\n NumberFormatFixedValues,\n NumberFormatNotation,\n NumberFormatOptions,\n NumberFormatRatio,\n NumberFormatScale,\n NumberFormatStandard,\n NumberFormatStandardUnit,\n NumberRatioType,\n NumberRoundingMode,\n NumberScaleType,\n PropertyNumberFormattingRule,\n PropertyNumberFormattingRuleType,\n TimeCodeFormat,\n} from \"./ontology/valueFormatting/PropertyNumberFormattingRule.js\";\nexport type { PropertyValueFormattingRule } from \"./ontology/valueFormatting/PropertyValueFormattingRule.js\";\nexport type {\n PropertyTypeReference,\n PropertyTypeReferenceOrStringConstant,\n StringConstant,\n} from \"./ontology/valueFormatting/PropertyValueFormattingUtils.js\";\nexport type {\n BaseWirePropertyTypes,\n WirePropertyTypes,\n} from \"./ontology/WirePropertyTypes.js\";\nexport type {\n ObjectIdentifiers,\n OsdkBase,\n PrimaryKeyType,\n} from \"./OsdkBase.js\";\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport type { OsdkObject } from \"./OsdkObject.js\";\nexport type { ConvertProps, MaybeScore, Osdk } from \"./OsdkObjectFrom.js\";\nexport type { PageResult } from \"./PageResult.js\";\nexport type {\n Range,\n ThreeDimensionalAggregation,\n TwoDimensionalAggregation,\n} from \"./queries/Aggregations.js\";\nexport type { QueryParam, QueryResult } from \"./queries/Queries.js\";\nexport { TimeseriesDurationMapping } from \"./timeseries/timeseries.js\";\nexport type {\n GeotimeSeriesProperty,\n TimeSeriesPoint,\n TimeSeriesProperty,\n TimeSeriesQuery,\n} from \"./timeseries/timeseries.js\";\nexport type { LinkedType, LinkNames } from \"./util/LinkUtils.js\";\nexport {};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAmBA,SAASA,mBAAmB,QAAQ,4BAA4B;AAmBhE,SAASC,eAAe,QAAQ,4BAA4B;AA8C5D,SAASC,IAAI,QAAQ,oBAAoB;;AAoGzC;;AAUA,SAASC,yBAAyB,QAAQ,4BAA4B;AAQtE","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Media.js","names":[],"sources":["Media.ts"],"sourcesContent":["/*\n * Copyright 2024 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 interface Media {\n /**\n * Fetches metadata for media reference property\n */\n fetchMetadata(): Promise<MediaMetadata>;\n /**\n * Fetches content of a media reference property\n */\n fetchContents(): Promise<Response>;\n /**\n * Returns the media reference\n */\n getMediaReference(): MediaReference;\n}\n\n/**\n * Unique identifier of a media item in Foundry.\n */\nexport interface MediaReference {\n mimeType: string;\n reference: {\n type: \"mediaSetViewItem\";\n mediaSetViewItem: {\n mediaItemRid: string;\n mediaSetRid: string;\n mediaSetViewRid: string;\n token?: string;\n /** @deprecated Use `token` instead */\n readToken?: string;\n };\n };\n}\n\n/**\n * Object for uploading Media\n */\nexport interface MediaUpload {\n readonly fileName: string;\n readonly data: Blob;\n}\n\n/**\n * Metadata of a media item\n */\nexport interface MediaMetadata {\n path?: string;\n sizeBytes: number;\n mediaType: string;\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Media.js","names":[],"sources":["Media.ts"],"sourcesContent":["/*\n * Copyright 2024 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 interface Media {\n /**\n * Fetches metadata for media reference property\n */\n fetchMetadata(): Promise<MediaMetadata>;\n /**\n * Fetches content of a media reference property\n */\n fetchContents(): Promise<Response>;\n /**\n * Returns the media reference\n */\n getMediaReference(): MediaReference;\n /**\n * Returns the source location of this media (object type, primary key, property name).\n *\n * Optional because not all media has a source location (e.g., transient/uploaded media).\n */\n getMediaSourceLocation?(): MediaPropertyLocation;\n}\n\n/**\n * Location of a media property on an object.\n */\nexport interface MediaPropertyLocation {\n objectType: string;\n primaryKey: string | number;\n propertyName: string;\n}\n\n/**\n * Unique identifier of a media item in Foundry.\n */\nexport interface MediaReference {\n mimeType: string;\n reference: {\n type: \"mediaSetViewItem\";\n mediaSetViewItem: {\n mediaItemRid: string;\n mediaSetRid: string;\n mediaSetViewRid: string;\n token?: string;\n /** @deprecated Use `token` instead */\n readToken?: string;\n };\n };\n}\n\n/**\n * Object for uploading Media\n */\nexport interface MediaUpload {\n readonly fileName: string;\n readonly data: Blob;\n}\n\n/**\n * Metadata of a media item\n */\nexport interface MediaMetadata {\n path?: string;\n sizeBytes: number;\n mediaType: string;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shapes-internal.js","names":[],"sources":["shapes-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 \"../shapes/internal.js\";\n"],"mappings":"","ignoreList":[]}
|
|
@@ -18,4 +18,6 @@ export { __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference } from "../expe
|
|
|
18
18
|
export { __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid } from "../experimental/fetchOneByRid.js";
|
|
19
19
|
export { __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchPageByRid } from "../experimental/fetchPageByRid.js";
|
|
20
20
|
export { __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks } from "../experimental/getBulkLinks.js";
|
|
21
|
+
// Shapes (unstable — will graduate to @osdk/api/shapes when stable)
|
|
22
|
+
export { configToShapeDefinition, createShapeBuilder, isSourcePkSymbol, ShapeNullabilityError, SourcePrimaryKeySymbol } from "../shapes/index.js";
|
|
21
23
|
//# sourceMappingURL=unstable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unstable.js","names":["__EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference","__EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid","__EXPERIMENTAL__NOT_SUPPORTED_YET__fetchPageByRid","__EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks"],"sources":["unstable.ts"],"sourcesContent":["/*\n * Copyright 2024 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 { Experiment, ExperimentFns } from \"../experimental/Experiment.js\";\n\nexport { __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference } from \"../experimental/createMediaReference.js\";\nexport { __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid } from \"../experimental/fetchOneByRid.js\";\nexport {\n __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchPageByRid,\n type FetchPageByRidPayload,\n} from \"../experimental/fetchPageByRid.js\";\nexport { __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks } from \"../experimental/getBulkLinks.js\";\n\nexport type { EXPERIMENTAL_BulkLinkResult } from \"../objectSet/BulkLinkResult.js\";\nexport type { MinimalObjectSet } from \"../objectSet/ObjectSet.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,uDAAuD,QAAQ,yCAAyC;AACjH,SAASC,gDAAgD,QAAQ,kCAAkC;AACnG,SACEC,iDAAiD,QAE5C,mCAAmC;AAC1C,SAASC,+CAA+C,QAAQ,iCAAiC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"unstable.js","names":["__EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference","__EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid","__EXPERIMENTAL__NOT_SUPPORTED_YET__fetchPageByRid","__EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks","configToShapeDefinition","createShapeBuilder","isSourcePkSymbol","ShapeNullabilityError","SourcePrimaryKeySymbol"],"sources":["unstable.ts"],"sourcesContent":["/*\n * Copyright 2024 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 { Experiment, ExperimentFns } from \"../experimental/Experiment.js\";\n\nexport { __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference } from \"../experimental/createMediaReference.js\";\nexport { __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid } from \"../experimental/fetchOneByRid.js\";\nexport {\n __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchPageByRid,\n type FetchPageByRidPayload,\n} from \"../experimental/fetchPageByRid.js\";\nexport { __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks } from \"../experimental/getBulkLinks.js\";\n\nexport type { EXPERIMENTAL_BulkLinkResult } from \"../objectSet/BulkLinkResult.js\";\nexport type { MinimalObjectSet } from \"../objectSet/ObjectSet.js\";\n\n// Shapes (unstable — will graduate to @osdk/api/shapes when stable)\nexport {\n configToShapeDefinition,\n createShapeBuilder,\n isSourcePkSymbol,\n ShapeNullabilityError,\n SourcePrimaryKeySymbol,\n} from \"../shapes/index.js\";\n\nexport type {\n InferShapeDefinition,\n InlineLinkConfig,\n InlineShapeConfig,\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 \"../shapes/index.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,uDAAuD,QAAQ,yCAAyC;AACjH,SAASC,gDAAgD,QAAQ,kCAAkC;AACnG,SACEC,iDAAiD,QAE5C,mCAAmC;AAC1C,SAASC,+CAA+C,QAAQ,iCAAiC;AAKjG;AACA,SACEC,uBAAuB,EACvBC,kBAAkB,EAClBC,gBAAgB,EAChBC,qBAAqB,EACrBC,sBAAsB,QACjB,oBAAoB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InlineShapeConfig.js","names":[],"sources":["InlineShapeConfig.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 ObjectOrInterfaceDefinition,\n PropertyKeys,\n} from \"../ontology/ObjectOrInterface.js\";\nimport type {\n PropertyType,\n RequiredProperty,\n ShapeDefinition,\n ShapeLinkBuilder,\n} from \"./ShapeDefinition.js\";\n\nexport interface InlineShapeConfig<\n BASE extends ObjectOrInterfaceDefinition,\n> {\n readonly require?: readonly PropertyKeys<BASE>[];\n readonly select?: readonly PropertyKeys<BASE>[];\n readonly dropIfNull?: readonly PropertyKeys<BASE>[];\n readonly defaults?: {\n readonly [K in PropertyKeys<BASE>]?: NonNullable<PropertyType<BASE, K>>;\n };\n readonly transforms?: {\n readonly [K in PropertyKeys<BASE>]?: (\n value: PropertyType<BASE, K>,\n ) => unknown;\n };\n readonly links?: Record<string, InlineLinkConfig<BASE>>;\n}\n\nexport interface InlineLinkConfig<\n SOURCE extends ObjectOrInterfaceDefinition,\n> {\n readonly via: (\n builder: ShapeLinkBuilder<SOURCE, SOURCE>,\n ) => ShapeLinkBuilder<SOURCE, ObjectOrInterfaceDefinition>;\n readonly target: ShapeDefinition<ObjectOrInterfaceDefinition>;\n readonly defer?: boolean;\n}\n\n// --- Type-level inference helpers ---\n\ntype ArrayElement<T> = T extends readonly (infer E)[] ? E : never;\n\nexport type InferInlineProps<\n BASE extends ObjectOrInterfaceDefinition,\n C extends InlineShapeConfig<BASE>,\n> =\n & {\n [K in ArrayElement<C[\"require\"]> & PropertyKeys<BASE>]: RequiredProperty<\n PropertyType<BASE, K>\n >;\n }\n & {\n [K in ArrayElement<C[\"select\"]> & PropertyKeys<BASE>]: PropertyType<\n BASE,\n K\n >;\n }\n & {\n [K in ArrayElement<C[\"dropIfNull\"]> & PropertyKeys<BASE>]: RequiredProperty<\n PropertyType<BASE, K>\n >;\n }\n & {\n [K in keyof C[\"defaults\"] & PropertyKeys<BASE>]: NonNullable<\n PropertyType<BASE, K>\n >;\n }\n & {\n [K in keyof C[\"transforms\"] & PropertyKeys<BASE>]: C[\"transforms\"] extends\n Record<K, (v: PropertyType<BASE, K>) => infer R> ? R : never;\n };\n\nexport type InferInlineLinks<\n BASE extends ObjectOrInterfaceDefinition,\n C extends InlineShapeConfig<BASE>,\n> = C[\"links\"] extends Record<string, InlineLinkConfig<BASE>> ? {\n [K in keyof C[\"links\"] & string]: C[\"links\"][K][\"target\"] extends\n ShapeDefinition<ObjectOrInterfaceDefinition> ? C[\"links\"][K][\"target\"]\n : ShapeDefinition<ObjectOrInterfaceDefinition>;\n }\n : {};\n\nexport type InferShapeDefinition<\n BASE extends ObjectOrInterfaceDefinition,\n C extends InlineShapeConfig<BASE>,\n> = ShapeDefinition<\n BASE,\n InferInlineProps<BASE, C>,\n InferInlineLinks<BASE, C>\n>;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,243 @@
|
|
|
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 { SourcePrimaryKeySymbol } from "./ShapeDefinition.js";
|
|
19
|
+
class ShapeBuilderImpl {
|
|
20
|
+
#state;
|
|
21
|
+
constructor(state) {
|
|
22
|
+
this.#state = state;
|
|
23
|
+
}
|
|
24
|
+
#addProps(props, type) {
|
|
25
|
+
const newProps = {
|
|
26
|
+
...this.#state.props
|
|
27
|
+
};
|
|
28
|
+
for (const prop of props) {
|
|
29
|
+
newProps[prop] = {
|
|
30
|
+
nullabilityOp: {
|
|
31
|
+
type
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
return newProps;
|
|
36
|
+
}
|
|
37
|
+
select(...props) {
|
|
38
|
+
return new ShapeBuilderImpl({
|
|
39
|
+
...this.#state,
|
|
40
|
+
props: this.#addProps(props, "select")
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
require(...props) {
|
|
44
|
+
return new ShapeBuilderImpl({
|
|
45
|
+
...this.#state,
|
|
46
|
+
props: this.#addProps(props, "require")
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
dropIfNull(...props) {
|
|
50
|
+
return new ShapeBuilderImpl({
|
|
51
|
+
...this.#state,
|
|
52
|
+
props: this.#addProps(props, "dropIfNull")
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
withDefault(prop, defaultValue) {
|
|
56
|
+
return new ShapeBuilderImpl({
|
|
57
|
+
...this.#state,
|
|
58
|
+
props: {
|
|
59
|
+
...this.#state.props,
|
|
60
|
+
[prop]: {
|
|
61
|
+
nullabilityOp: {
|
|
62
|
+
type: "withDefault",
|
|
63
|
+
defaultValue
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
withTransform(prop, transform) {
|
|
70
|
+
return new ShapeBuilderImpl({
|
|
71
|
+
...this.#state,
|
|
72
|
+
props: {
|
|
73
|
+
...this.#state.props,
|
|
74
|
+
[prop]: {
|
|
75
|
+
nullabilityOp: {
|
|
76
|
+
type: "withTransform",
|
|
77
|
+
transform
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
deriveLink(name, builder) {
|
|
84
|
+
const linkBuilder = createShapeLinkBuilder(this.#state.baseTypeApiName);
|
|
85
|
+
const linkResult = builder(linkBuilder);
|
|
86
|
+
return new ShapeBuilderImpl({
|
|
87
|
+
...this.#state,
|
|
88
|
+
props: {
|
|
89
|
+
...this.#state.props
|
|
90
|
+
},
|
|
91
|
+
derivedLinks: [...this.#state.derivedLinks, {
|
|
92
|
+
name,
|
|
93
|
+
objectSetDef: linkResult.objectSetDef,
|
|
94
|
+
targetShape: linkResult.targetShape,
|
|
95
|
+
config: linkResult.config
|
|
96
|
+
}]
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
build() {
|
|
100
|
+
const shapeId = computeShapeId({
|
|
101
|
+
baseTypeApiName: this.#state.baseTypeApiName,
|
|
102
|
+
props: this.#state.props,
|
|
103
|
+
derivedLinks: this.#state.derivedLinks
|
|
104
|
+
});
|
|
105
|
+
return {
|
|
106
|
+
__shapeId: shapeId,
|
|
107
|
+
__debugName: this.#state.debugName,
|
|
108
|
+
__baseType: this.#state.baseType,
|
|
109
|
+
__baseTypeApiName: this.#state.baseTypeApiName,
|
|
110
|
+
__props: Object.freeze({
|
|
111
|
+
...this.#state.props
|
|
112
|
+
}),
|
|
113
|
+
__derivedLinks: Object.freeze([...this.#state.derivedLinks]),
|
|
114
|
+
__selectedPropsType: {},
|
|
115
|
+
__derivedLinksType: {}
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
class ShapeLinkBuilderImpl {
|
|
120
|
+
#state;
|
|
121
|
+
$primaryKey = SourcePrimaryKeySymbol;
|
|
122
|
+
constructor(state) {
|
|
123
|
+
this.#state = state;
|
|
124
|
+
}
|
|
125
|
+
pivotTo(link) {
|
|
126
|
+
const newSegments = [...this.#state.segments, {
|
|
127
|
+
type: "pivotTo",
|
|
128
|
+
linkName: link,
|
|
129
|
+
sourceType: this.#state.currentTypeApiName
|
|
130
|
+
// targetType is resolved at link execution time when link metadata is available
|
|
131
|
+
}];
|
|
132
|
+
return new ShapeLinkBuilderImpl({
|
|
133
|
+
...this.#state,
|
|
134
|
+
segments: newSegments,
|
|
135
|
+
// currentTypeApiName is a hint for debugging; actual type resolution happens at execution
|
|
136
|
+
currentTypeApiName: `${this.#state.currentTypeApiName}.${link}`
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** Sets the where filter for this link. Calling multiple times replaces the previous clause (last-write-wins). */
|
|
141
|
+
where(clause) {
|
|
142
|
+
return new ShapeLinkBuilderImpl({
|
|
143
|
+
...this.#state,
|
|
144
|
+
where: clause
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
#setOp(type, others) {
|
|
148
|
+
return new ShapeLinkBuilderImpl({
|
|
149
|
+
...this.#state,
|
|
150
|
+
setOperations: [...this.#state.setOperations, ...others.map(other => ({
|
|
151
|
+
type,
|
|
152
|
+
other: other.toObjectSetDef()
|
|
153
|
+
}))]
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
union(...others) {
|
|
157
|
+
return this.#setOp("union", others);
|
|
158
|
+
}
|
|
159
|
+
intersect(...others) {
|
|
160
|
+
return this.#setOp("intersect", others);
|
|
161
|
+
}
|
|
162
|
+
subtract(...others) {
|
|
163
|
+
return this.#setOp("subtract", others);
|
|
164
|
+
}
|
|
165
|
+
orderBy(property, direction = "asc") {
|
|
166
|
+
return new ShapeLinkBuilderImpl({
|
|
167
|
+
...this.#state,
|
|
168
|
+
orderBy: [...this.#state.orderBy, {
|
|
169
|
+
property: property,
|
|
170
|
+
direction
|
|
171
|
+
}]
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
limit(n) {
|
|
175
|
+
if (!Number.isInteger(n) || n <= 0) {
|
|
176
|
+
throw new Error(`ShapeLinkBuilder.limit() requires a positive integer, got: ${n}`);
|
|
177
|
+
}
|
|
178
|
+
return new ShapeLinkBuilderImpl({
|
|
179
|
+
...this.#state,
|
|
180
|
+
limit: n
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
distinct() {
|
|
184
|
+
return new ShapeLinkBuilderImpl({
|
|
185
|
+
...this.#state,
|
|
186
|
+
distinct: true
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
as(shape, config = {}) {
|
|
190
|
+
// The brand is a compile-time only marker, at runtime it's just undefined
|
|
191
|
+
return {
|
|
192
|
+
targetShape: shape,
|
|
193
|
+
objectSetDef: this.toObjectSetDef(),
|
|
194
|
+
config
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
toObjectSetDef() {
|
|
198
|
+
return {
|
|
199
|
+
segments: Object.freeze([...this.#state.segments]),
|
|
200
|
+
where: this.#state.where,
|
|
201
|
+
orderBy: this.#state.orderBy.length > 0 ? Object.freeze([...this.#state.orderBy]) : undefined,
|
|
202
|
+
limit: this.#state.limit,
|
|
203
|
+
distinct: this.#state.distinct || undefined,
|
|
204
|
+
setOperations: this.#state.setOperations.length > 0 ? Object.freeze([...this.#state.setOperations]) : undefined
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
export function createShapeLinkBuilder(sourceTypeApiName) {
|
|
209
|
+
return new ShapeLinkBuilderImpl({
|
|
210
|
+
sourceTypeApiName,
|
|
211
|
+
currentTypeApiName: sourceTypeApiName,
|
|
212
|
+
segments: [],
|
|
213
|
+
orderBy: [],
|
|
214
|
+
distinct: false,
|
|
215
|
+
setOperations: []
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Creates a new ShapeBuilder for the given base type.
|
|
221
|
+
*
|
|
222
|
+
* @param baseType - The base ObjectTypeDefinition or InterfaceDefinition
|
|
223
|
+
* @param debugName - Optional name for debugging in DevTools
|
|
224
|
+
*
|
|
225
|
+
* @example
|
|
226
|
+
* ```typescript
|
|
227
|
+
* const SlimPlayer = createShapeBuilder(Player, "SlimPlayer")
|
|
228
|
+
* .require("name", "age")
|
|
229
|
+
* .withDefault("position", "Unknown")
|
|
230
|
+
* .build();
|
|
231
|
+
* ```
|
|
232
|
+
*/
|
|
233
|
+
export function createShapeBuilder(baseType, debugName) {
|
|
234
|
+
const state = {
|
|
235
|
+
baseType,
|
|
236
|
+
baseTypeApiName: baseType.apiName,
|
|
237
|
+
debugName,
|
|
238
|
+
props: {},
|
|
239
|
+
derivedLinks: []
|
|
240
|
+
};
|
|
241
|
+
return new ShapeBuilderImpl(state);
|
|
242
|
+
}
|
|
243
|
+
//# sourceMappingURL=ShapeBuilder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ShapeBuilder.js","names":["computeShapeId","SourcePrimaryKeySymbol","ShapeBuilderImpl","state","constructor","addProps","#addProps","props","type","newProps","prop","nullabilityOp","select","require","dropIfNull","withDefault","defaultValue","withTransform","transform","deriveLink","name","builder","linkBuilder","createShapeLinkBuilder","baseTypeApiName","linkResult","derivedLinks","objectSetDef","targetShape","config","build","shapeId","__shapeId","__debugName","debugName","__baseType","baseType","__baseTypeApiName","__props","Object","freeze","__derivedLinks","__selectedPropsType","__derivedLinksType","ShapeLinkBuilderImpl","$primaryKey","pivotTo","link","newSegments","segments","linkName","sourceType","currentTypeApiName","where","clause","setOp","#setOp","others","setOperations","map","other","toObjectSetDef","union","intersect","subtract","orderBy","property","direction","limit","n","Number","isInteger","Error","distinct","as","shape","length","undefined","sourceTypeApiName","createShapeBuilder","apiName"],"sources":["ShapeBuilder.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 { LinkedType, LinkNames } from \"../util/LinkUtils.js\";\nimport { computeShapeId } from \"./computeShapeId.js\";\nimport { SourcePrimaryKeySymbol } from \"./ShapeDefinition.js\";\nimport type {\n DerivedLinkConfig,\n NullabilityOp,\n PropertyType,\n RequiredProperty,\n ShapeBuilder,\n ShapeDefinition,\n ShapeDerivedLinkDef,\n ShapeLinkBuilder,\n ShapeLinkObjectSetDef,\n ShapeLinkOrderBy,\n ShapeLinkResult,\n ShapeLinkSegment,\n ShapeLinkSetOperation,\n ShapePropertyConfig,\n} from \"./ShapeDefinition.js\";\n\ninterface ShapeBuilderState {\n readonly baseType: ObjectOrInterfaceDefinition;\n readonly baseTypeApiName: string;\n readonly debugName: string | undefined;\n readonly props: Record<string, ShapePropertyConfig>;\n readonly derivedLinks: ShapeDerivedLinkDef[];\n}\n\nclass ShapeBuilderImpl<\n BASE extends ObjectOrInterfaceDefinition,\n PROPS extends Record<string, unknown>,\n LINKS extends Record<string, ShapeDefinition<ObjectOrInterfaceDefinition>>,\n> implements ShapeBuilder<BASE, PROPS, LINKS> {\n readonly #state: ShapeBuilderState;\n\n constructor(state: ShapeBuilderState) {\n this.#state = state;\n }\n\n #addProps(\n props: string[],\n type: \"select\" | \"require\" | \"dropIfNull\",\n ): Record<string, ShapePropertyConfig> {\n const newProps = { ...this.#state.props };\n for (const prop of props) {\n newProps[prop] = { nullabilityOp: { type } };\n }\n return newProps;\n }\n\n select<K extends Exclude<PropertyKeys<BASE>, keyof PROPS>>(\n ...props: K[]\n ): ShapeBuilder<BASE, PROPS & { [P in K]: PropertyType<BASE, P> }, LINKS> {\n return new ShapeBuilderImpl({\n ...this.#state,\n props: this.#addProps(props as string[], \"select\"),\n });\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 return new ShapeBuilderImpl({\n ...this.#state,\n props: this.#addProps(props as string[], \"require\"),\n });\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 return new ShapeBuilderImpl({\n ...this.#state,\n props: this.#addProps(props as string[], \"dropIfNull\"),\n });\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 return new ShapeBuilderImpl({\n ...this.#state,\n props: {\n ...this.#state.props,\n [prop as string]: {\n nullabilityOp: { type: \"withDefault\", defaultValue } as NullabilityOp,\n },\n },\n });\n }\n\n withTransform<K extends Exclude<PropertyKeys<BASE>, keyof PROPS>, R>(\n prop: K,\n transform: (value: PropertyType<BASE, K>) => R,\n ): ShapeBuilder<BASE, PROPS & { [P in K]: R }, LINKS> {\n return new ShapeBuilderImpl({\n ...this.#state,\n props: {\n ...this.#state.props,\n [prop as string]: {\n nullabilityOp: { type: \"withTransform\", transform } as NullabilityOp,\n },\n },\n });\n }\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 const linkBuilder = createShapeLinkBuilder<BASE, BASE>(\n this.#state.baseTypeApiName,\n );\n const linkResult = builder(linkBuilder);\n return new ShapeBuilderImpl({\n ...this.#state,\n props: { ...this.#state.props },\n derivedLinks: [\n ...this.#state.derivedLinks,\n {\n name,\n objectSetDef: linkResult.objectSetDef,\n targetShape: linkResult.targetShape,\n config: linkResult.config,\n },\n ],\n });\n }\n\n build(): ShapeDefinition<BASE, PROPS, LINKS> {\n const shapeId = computeShapeId({\n baseTypeApiName: this.#state.baseTypeApiName,\n props: this.#state.props,\n derivedLinks: this.#state.derivedLinks,\n });\n\n return {\n __shapeId: shapeId,\n __debugName: this.#state.debugName,\n __baseType: this.#state.baseType as BASE,\n __baseTypeApiName: this.#state.baseTypeApiName,\n __props: Object.freeze({ ...this.#state.props }),\n __derivedLinks: Object.freeze([...this.#state.derivedLinks]),\n __selectedPropsType: {} as PROPS,\n __derivedLinksType: {} as LINKS,\n } as ShapeDefinition<BASE, PROPS, LINKS>;\n }\n}\n\ninterface ShapeLinkBuilderState {\n readonly sourceTypeApiName: string;\n readonly currentTypeApiName: string;\n readonly segments: ShapeLinkSegment[];\n readonly where?: WhereClause<ObjectOrInterfaceDefinition>;\n readonly orderBy: ShapeLinkOrderBy[];\n readonly limit?: number;\n readonly distinct: boolean;\n readonly setOperations: ShapeLinkSetOperation[];\n}\n\nclass ShapeLinkBuilderImpl<\n SOURCE extends ObjectOrInterfaceDefinition,\n CURRENT extends ObjectOrInterfaceDefinition,\n> implements ShapeLinkBuilder<SOURCE, CURRENT> {\n readonly #state: ShapeLinkBuilderState;\n readonly $primaryKey: symbol = SourcePrimaryKeySymbol;\n\n constructor(state: ShapeLinkBuilderState) {\n this.#state = state;\n }\n\n pivotTo<L extends LinkNames<CURRENT>>(\n link: L,\n ): ShapeLinkBuilder<SOURCE, LinkedType<CURRENT, L>> {\n const newSegments: ShapeLinkSegment[] = [\n ...this.#state.segments,\n {\n type: \"pivotTo\",\n linkName: link as string,\n sourceType: this.#state.currentTypeApiName,\n // targetType is resolved at link execution time when link metadata is available\n },\n ];\n\n return new ShapeLinkBuilderImpl({\n ...this.#state,\n segments: newSegments,\n // currentTypeApiName is a hint for debugging; actual type resolution happens at execution\n currentTypeApiName: `${this.#state.currentTypeApiName}.${link as string}`,\n });\n }\n\n /** Sets the where filter for this link. Calling multiple times replaces the previous clause (last-write-wins). */\n where(clause: WhereClause<CURRENT>): ShapeLinkBuilder<SOURCE, CURRENT> {\n return new ShapeLinkBuilderImpl({\n ...this.#state,\n where: clause as WhereClause<ObjectOrInterfaceDefinition>,\n });\n }\n\n #setOp(\n type: \"union\" | \"intersect\" | \"subtract\",\n others: ShapeLinkBuilder<SOURCE, CURRENT>[],\n ): ShapeLinkBuilder<SOURCE, CURRENT> {\n return new ShapeLinkBuilderImpl({\n ...this.#state,\n setOperations: [\n ...this.#state.setOperations,\n ...others.map((other) => ({\n type,\n other: (other as ShapeLinkBuilderImpl<SOURCE, CURRENT>)\n .toObjectSetDef(),\n })),\n ],\n });\n }\n\n union(\n ...others: ShapeLinkBuilder<SOURCE, CURRENT>[]\n ): ShapeLinkBuilder<SOURCE, CURRENT> {\n return this.#setOp(\"union\", others);\n }\n\n intersect(\n ...others: ShapeLinkBuilder<SOURCE, CURRENT>[]\n ): ShapeLinkBuilder<SOURCE, CURRENT> {\n return this.#setOp(\"intersect\", others);\n }\n\n subtract(\n ...others: ShapeLinkBuilder<SOURCE, CURRENT>[]\n ): ShapeLinkBuilder<SOURCE, CURRENT> {\n return this.#setOp(\"subtract\", others);\n }\n\n orderBy<K extends PropertyKeys<CURRENT>>(\n property: K,\n direction: \"asc\" | \"desc\" = \"asc\",\n ): ShapeLinkBuilder<SOURCE, CURRENT> {\n return new ShapeLinkBuilderImpl({\n ...this.#state,\n orderBy: [\n ...this.#state.orderBy,\n { property: property as string, direction },\n ],\n });\n }\n\n limit(n: number): ShapeLinkBuilder<SOURCE, CURRENT> {\n if (!Number.isInteger(n) || n <= 0) {\n throw new Error(\n `ShapeLinkBuilder.limit() requires a positive integer, got: ${n}`,\n );\n }\n return new ShapeLinkBuilderImpl({\n ...this.#state,\n limit: n,\n });\n }\n\n distinct(): ShapeLinkBuilder<SOURCE, CURRENT> {\n return new ShapeLinkBuilderImpl({\n ...this.#state,\n distinct: true,\n });\n }\n\n as<TARGET_SHAPE extends ShapeDefinition<CURRENT>>(\n shape: TARGET_SHAPE,\n config: DerivedLinkConfig = {},\n ): ShapeLinkResult<TARGET_SHAPE> {\n // The brand is a compile-time only marker, at runtime it's just undefined\n return {\n targetShape: shape,\n objectSetDef: this.toObjectSetDef(),\n config,\n } as ShapeLinkResult<TARGET_SHAPE>;\n }\n\n toObjectSetDef(): ShapeLinkObjectSetDef {\n return {\n segments: Object.freeze([...this.#state.segments]),\n where: this.#state.where,\n orderBy: this.#state.orderBy.length > 0\n ? Object.freeze([...this.#state.orderBy])\n : undefined,\n limit: this.#state.limit,\n distinct: this.#state.distinct || undefined,\n setOperations: this.#state.setOperations.length > 0\n ? Object.freeze([...this.#state.setOperations])\n : undefined,\n };\n }\n}\n\nexport function createShapeLinkBuilder<\n SOURCE extends ObjectOrInterfaceDefinition,\n CURRENT extends ObjectOrInterfaceDefinition,\n>(sourceTypeApiName: string): ShapeLinkBuilder<SOURCE, CURRENT> {\n return new ShapeLinkBuilderImpl({\n sourceTypeApiName,\n currentTypeApiName: sourceTypeApiName,\n segments: [],\n orderBy: [],\n distinct: false,\n setOperations: [],\n });\n}\n\n/**\n * Creates a new ShapeBuilder for the given base type.\n *\n * @param baseType - The base ObjectTypeDefinition or InterfaceDefinition\n * @param debugName - Optional name for debugging in DevTools\n *\n * @example\n * ```typescript\n * const SlimPlayer = createShapeBuilder(Player, \"SlimPlayer\")\n * .require(\"name\", \"age\")\n * .withDefault(\"position\", \"Unknown\")\n * .build();\n * ```\n */\nexport function createShapeBuilder<BASE extends ObjectOrInterfaceDefinition>(\n baseType: BASE,\n debugName?: string,\n): ShapeBuilder<BASE, {}, {}> {\n const state: ShapeBuilderState = {\n baseType,\n baseTypeApiName: baseType.apiName,\n debugName,\n props: {},\n derivedLinks: [],\n };\n\n return new ShapeBuilderImpl(state);\n}\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1,59 @@
|
|
|
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
|
+
export const SourcePrimaryKeySymbol = Symbol.for("osdk.query.$sourcePk");
|
|
18
|
+
const LegacyShapesSymbol = Symbol.for("osdk.shapes.$primaryKey");
|
|
19
|
+
export function isSourcePkSymbol(value) {
|
|
20
|
+
return typeof value === "symbol" && (value === SourcePrimaryKeySymbol || value === LegacyShapesSymbol);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Configuration for how a derived link is loaded at runtime. */
|
|
24
|
+
|
|
25
|
+
/** The result of calling `ShapeLinkBuilder.as()`, binding a link traversal to a target shape. */
|
|
26
|
+
|
|
27
|
+
/** A single link traversal step in a derived link's object set definition. */
|
|
28
|
+
|
|
29
|
+
/** Sort clause for a derived link's result set. */
|
|
30
|
+
|
|
31
|
+
/** A set operation (union/intersect/subtract) applied to a derived link's object set. */
|
|
32
|
+
|
|
33
|
+
/** Serializable definition of a derived link's object set: link traversals, filters, ordering, and set operations. */
|
|
34
|
+
|
|
35
|
+
/** How a shape handles null values for a selected property. */
|
|
36
|
+
|
|
37
|
+
/** Per-property configuration stored in a shape's `__props` map. */
|
|
38
|
+
|
|
39
|
+
/** A derived link definition stored in a shape's `__derivedLinks` array. */
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Type projection from an OSDK type. `__props` is the single source of truth for property config.
|
|
43
|
+
*
|
|
44
|
+
* @typeParam BASE - The base ObjectTypeDefinition or InterfaceDefinition
|
|
45
|
+
* @typeParam SELECTED_PROPS - Record of selected properties and their transformed types
|
|
46
|
+
* @typeParam DERIVED_LINKS - Record of derived link names to their result types
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
export class ShapeNullabilityError extends Error {
|
|
50
|
+
constructor(shape, violations) {
|
|
51
|
+
const props = violations.map(v => v.property).join(", ");
|
|
52
|
+
const shapeName = shape.__debugName ?? shape.__shapeId;
|
|
53
|
+
super(`Shape "${shapeName}" requires these properties to be non-null: ${props}`);
|
|
54
|
+
this.shape = shape;
|
|
55
|
+
this.violations = violations;
|
|
56
|
+
this.name = "ShapeNullabilityError";
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=ShapeDefinition.js.map
|