dataiku-sdk 0.12.4 → 0.12.5

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.
Files changed (84) hide show
  1. package/README.md +118 -7
  2. package/dist/packages/types/src/index.d.ts +5 -0
  3. package/dist/packages/types/src/index.js +5 -0
  4. package/dist/src/cli/coerce.d.ts +1 -3
  5. package/dist/src/cli/coerce.js +1 -17
  6. package/dist/src/cli/commands/app.js +709 -14
  7. package/dist/src/cli/commands/code-env.js +2 -2
  8. package/dist/src/cli/commands/dashboard.js +1 -1
  9. package/dist/src/cli/commands/dataset.js +2 -2
  10. package/dist/src/cli/commands/folder.js +1 -1
  11. package/dist/src/cli/commands/insight.js +2 -2
  12. package/dist/src/cli/commands/notebook.js +2 -2
  13. package/dist/src/cli/commands/recipe.js +3 -3
  14. package/dist/src/cli/commands/scenario.js +1 -1
  15. package/dist/src/cli/commands/sql.js +1 -1
  16. package/dist/src/cli/commands/variable.js +1 -1
  17. package/dist/src/cli/commands/wiki.js +1 -1
  18. package/dist/src/cli/contract.d.ts +12 -3
  19. package/dist/src/cli/contract.js +805 -49
  20. package/dist/src/cli/flags.js +8 -0
  21. package/dist/src/cli/helpers/app-permissions.d.ts +63 -0
  22. package/dist/src/cli/helpers/app-permissions.js +239 -0
  23. package/dist/src/cli/helpers/app-successor.d.ts +106 -0
  24. package/dist/src/cli/helpers/app-successor.js +625 -0
  25. package/dist/src/cli/helpers/cleanup.js +46 -12
  26. package/dist/src/cli/output.d.ts +12 -1
  27. package/dist/src/cli/output.js +53 -6
  28. package/dist/src/cli/usage.d.ts +1 -1
  29. package/dist/src/cli/usage.js +5 -2
  30. package/dist/src/cli.js +329 -32
  31. package/dist/src/client.d.ts +6 -0
  32. package/dist/src/client.js +28 -1
  33. package/dist/src/errors.d.ts +1 -1
  34. package/dist/src/resources/applications.d.ts +191 -1
  35. package/dist/src/resources/applications.js +549 -10
  36. package/dist/src/resources/datasets.js +8 -0
  37. package/dist/src/resources/futures.js +7 -2
  38. package/dist/src/skill.js +76 -18
  39. package/dist/src/utils/cleanup-ledger.d.ts +34 -1
  40. package/dist/src/utils/cleanup-ledger.js +118 -7
  41. package/dist/src/utils/dss-url.d.ts +6 -0
  42. package/dist/src/utils/dss-url.js +17 -0
  43. package/dist/src/utils/project-incarnation.d.ts +6 -0
  44. package/dist/src/utils/project-incarnation.js +27 -0
  45. package/dist/src/utils/stable-hash.d.ts +11 -0
  46. package/dist/src/utils/stable-hash.js +27 -0
  47. package/node_modules/@sinclair/typebox/build/cjs/compiler/compiler.js +26 -46
  48. package/node_modules/@sinclair/typebox/build/cjs/parser/runtime/guard.d.ts +1 -1
  49. package/node_modules/@sinclair/typebox/build/cjs/parser/runtime/token.d.ts +2 -2
  50. package/node_modules/@sinclair/typebox/build/cjs/syntax/mapping.d.ts +1 -1
  51. package/node_modules/@sinclair/typebox/build/cjs/system/evaluate.d.ts +5 -0
  52. package/node_modules/@sinclair/typebox/build/cjs/system/evaluate.js +11 -0
  53. package/node_modules/@sinclair/typebox/build/cjs/system/index.d.ts +1 -0
  54. package/node_modules/@sinclair/typebox/build/cjs/system/index.js +1 -0
  55. package/node_modules/@sinclair/typebox/build/cjs/type/object/object.d.ts +2 -2
  56. package/node_modules/@sinclair/typebox/build/cjs/type/object/object.js +18 -2
  57. package/node_modules/@sinclair/typebox/build/cjs/value/parse/parse.d.ts +1 -1
  58. package/node_modules/@sinclair/typebox/build/esm/compiler/compiler.mjs +27 -47
  59. package/node_modules/@sinclair/typebox/build/esm/parser/runtime/guard.d.mts +1 -1
  60. package/node_modules/@sinclair/typebox/build/esm/parser/runtime/token.d.mts +2 -2
  61. package/node_modules/@sinclair/typebox/build/esm/syntax/mapping.d.mts +1 -1
  62. package/node_modules/@sinclair/typebox/build/esm/system/evaluate.d.mts +5 -0
  63. package/node_modules/@sinclair/typebox/build/esm/system/evaluate.mjs +7 -0
  64. package/node_modules/@sinclair/typebox/build/esm/system/index.d.mts +1 -0
  65. package/node_modules/@sinclair/typebox/build/esm/system/index.mjs +1 -0
  66. package/node_modules/@sinclair/typebox/build/esm/type/composite/composite.mjs +2 -2
  67. package/node_modules/@sinclair/typebox/build/esm/type/const/const.mjs +3 -3
  68. package/node_modules/@sinclair/typebox/build/esm/type/instantiate/instantiate.mjs +2 -2
  69. package/node_modules/@sinclair/typebox/build/esm/type/mapped/mapped.mjs +3 -3
  70. package/node_modules/@sinclair/typebox/build/esm/type/module/compute.mjs +2 -2
  71. package/node_modules/@sinclair/typebox/build/esm/type/object/object.d.mts +2 -2
  72. package/node_modules/@sinclair/typebox/build/esm/type/object/object.mjs +18 -2
  73. package/node_modules/@sinclair/typebox/build/esm/type/omit/omit.mjs +3 -3
  74. package/node_modules/@sinclair/typebox/build/esm/type/partial/partial.mjs +3 -3
  75. package/node_modules/@sinclair/typebox/build/esm/type/pick/pick.mjs +3 -3
  76. package/node_modules/@sinclair/typebox/build/esm/type/record/record.mjs +3 -3
  77. package/node_modules/@sinclair/typebox/build/esm/type/required/required.mjs +3 -3
  78. package/node_modules/@sinclair/typebox/build/esm/type/type/json.mjs +2 -2
  79. package/node_modules/@sinclair/typebox/build/esm/value/delta/delta.mjs +4 -4
  80. package/node_modules/@sinclair/typebox/build/esm/value/parse/parse.d.mts +1 -1
  81. package/node_modules/@sinclair/typebox/package.json +1 -1
  82. package/package.json +7 -5
  83. package/packages/types/dist/index.d.ts +5 -0
  84. package/packages/types/dist/index.js +5 -0
@@ -15,5 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
16
  };
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
+ __exportStar(require("./evaluate"), exports);
18
19
  __exportStar(require("./policy"), exports);
19
20
  __exportStar(require("./system"), exports);
@@ -45,7 +45,7 @@ export interface TObject<T extends TProperties = TProperties> extends TSchema, O
45
45
  required: TRequiredArray<T>;
46
46
  }
47
47
  /** `[Json]` Creates an Object type */
48
- declare function _Object<T extends TProperties>(properties: T, options?: ObjectOptions): TObject<T>;
48
+ declare function _Object_<T extends TProperties>(properties: T, options?: ObjectOptions): TObject<T>;
49
49
  /** `[Json]` Creates an Object type */
50
- export declare var Object: typeof _Object;
50
+ export declare var Object: typeof _Object_;
51
51
  export {};
@@ -13,10 +13,26 @@ function RequiredArray(properties) {
13
13
  return globalThis.Object.keys(properties).filter((key) => !(0, kind_1.IsOptional)(properties[key]));
14
14
  }
15
15
  /** `[Json]` Creates an Object type */
16
- function _Object(properties, options) {
16
+ function _Object_(properties, options) {
17
17
  const required = RequiredArray(properties);
18
18
  const schema = required.length > 0 ? { [index_1.Kind]: 'Object', type: 'object', required, properties } : { [index_1.Kind]: 'Object', type: 'object', properties };
19
19
  return (0, type_1.CreateType)(schema, options);
20
20
  }
21
+ // ------------------------------------------------------------------
22
+ // TypeScript 7: CommonJS TS2441
23
+ //
24
+ // TypeScript generates a CommonJS shim that patches local variables
25
+ // via an unqualified reference to Object (e.g. the __esModule shim's
26
+ // Object.defineProperty call). Other compiler tools have been
27
+ // observed patching in the same way, but TypeScript 7 has correctly
28
+ // begun flagging variables named Object in CommonJS, since they
29
+ // conflict with the shim and can cause "used before definition"
30
+ // errors. This is CommonJS-specific; no such shim exists for ESM.
31
+ //
32
+ // TypeBox works around this using a `var` declaration, which is
33
+ // known to avoid use-before-definition errors. TypeBox 1.x employs
34
+ // a similar strategy.
35
+ // ------------------------------------------------------------------
21
36
  /** `[Json]` Creates an Object type */
22
- exports.Object = _Object;
37
+ // @ts-ignore - error TS2441: Duplicate identifier 'Object'. Compiler reserves name 'Object' in top level scope of a module.
38
+ exports.Object = _Object_;
@@ -11,7 +11,7 @@ export declare namespace ParseRegistry {
11
11
  function Set(key: string, callback: TParseFunction): void;
12
12
  function Get(key: string): TParseFunction | undefined;
13
13
  }
14
- export declare const ParseDefault: readonly ["Clone", "Clean", "Default", "Convert", "Assert", "Decode"];
14
+ export declare const ParseDefault: readonly ['Clone', 'Clean', 'Default', 'Convert', 'Assert', 'Decode'];
15
15
  /** Parses a value using the default parse pipeline. Will throws an `AssertError` if invalid. */
16
16
  export declare function Parse<Type extends TSchema, Output = StaticDecode<Type>, Result extends Output = Output>(schema: Type, references: TSchema[], value: unknown): Result;
17
17
  /** Parses a value using the default parse pipeline. Will throws an `AssertError` if invalid. */
@@ -1,6 +1,6 @@
1
1
  import { TransformEncode, TransformDecode, HasTransform, TransformDecodeCheckError, TransformEncodeCheckError } from '../value/transform/index.mjs';
2
2
  import { Errors } from '../errors/index.mjs';
3
- import { TypeSystemPolicy } from '../system/index.mjs';
3
+ import { TypeSystemPolicy, Evaluate } from '../system/index.mjs';
4
4
  import { TypeBoxError } from '../type/error/index.mjs';
5
5
  import { Deref } from '../value/deref/index.mjs';
6
6
  import { Hash } from '../value/hash/index.mjs';
@@ -86,35 +86,6 @@ var Character;
86
86
  Character.IsNumeric = IsNumeric;
87
87
  })(Character || (Character = {}));
88
88
  // ------------------------------------------------------------------
89
- // MemberExpression
90
- // ------------------------------------------------------------------
91
- var MemberExpression;
92
- (function (MemberExpression) {
93
- function IsFirstCharacterNumeric(value) {
94
- if (value.length === 0)
95
- return false;
96
- return Character.IsNumeric(value.charCodeAt(0));
97
- }
98
- function IsAccessor(value) {
99
- if (IsFirstCharacterNumeric(value))
100
- return false;
101
- for (let i = 0; i < value.length; i++) {
102
- const code = value.charCodeAt(i);
103
- const check = Character.IsAlpha(code) || Character.IsNumeric(code) || Character.DollarSign(code) || Character.IsUnderscore(code);
104
- if (!check)
105
- return false;
106
- }
107
- return true;
108
- }
109
- function EscapeHyphen(key) {
110
- return key.replace(/'/g, "\\'");
111
- }
112
- function Encode(object, key) {
113
- return IsAccessor(key) ? `${object}.${key}` : `${object}['${EscapeHyphen(key)}']`;
114
- }
115
- MemberExpression.Encode = Encode;
116
- })(MemberExpression || (MemberExpression = {}));
117
- // ------------------------------------------------------------------
118
89
  // Identifier
119
90
  // ------------------------------------------------------------------
120
91
  var Identifier;
@@ -135,15 +106,21 @@ var Identifier;
135
106
  Identifier.Encode = Encode;
136
107
  })(Identifier || (Identifier = {}));
137
108
  // ------------------------------------------------------------------
138
- // LiteralString
109
+ // StringConstant
139
110
  // ------------------------------------------------------------------
140
- var LiteralString;
141
- (function (LiteralString) {
142
- function Escape(content) {
143
- return content.replace(/'/g, "\\'");
144
- }
145
- LiteralString.Escape = Escape;
146
- })(LiteralString || (LiteralString = {}));
111
+ function StringConstant(value) {
112
+ if (!IsString(value))
113
+ throw Error('ConstantString: Not a String');
114
+ const canonical = JSON.stringify(value).slice(1, -1);
115
+ const escaped = canonical.replace(/'/g, "\\'");
116
+ return `'${escaped}'`;
117
+ }
118
+ // ------------------------------------------------------------------
119
+ // MemberExpression
120
+ // ------------------------------------------------------------------
121
+ function MemberExpression(value, key) {
122
+ return `${value}[${StringConstant(key)}]`;
123
+ }
147
124
  // ------------------------------------------------------------------
148
125
  // Errors
149
126
  // ------------------------------------------------------------------
@@ -165,7 +142,7 @@ export class TypeCompilerTypeGuardError extends TypeBoxError {
165
142
  export var Policy;
166
143
  (function (Policy) {
167
144
  function IsExactOptionalProperty(value, key, expression) {
168
- return TypeSystemPolicy.ExactOptionalPropertyTypes ? `('${key}' in ${value} ? ${expression} : true)` : `(${MemberExpression.Encode(value, key)} !== undefined ? ${expression} : true)`;
145
+ return TypeSystemPolicy.ExactOptionalPropertyTypes ? `(${StringConstant(key)} in ${value} ? ${expression} : true)` : `(${MemberExpression(value, key)} !== undefined ? ${expression} : true)`;
169
146
  }
170
147
  Policy.IsExactOptionalProperty = IsExactOptionalProperty;
171
148
  function IsObjectLike(value) {
@@ -310,8 +287,11 @@ export var TypeCompiler;
310
287
  if (typeof schema.const === 'number' || typeof schema.const === 'boolean') {
311
288
  yield `(${value} === ${schema.const})`;
312
289
  }
290
+ else if (typeof schema.const === 'string') {
291
+ yield `(${value} === ${StringConstant(schema.const)})`;
292
+ }
313
293
  else {
314
- yield `(${value} === '${LiteralString.Escape(schema.const)}')`;
294
+ throw Error('Invalid Literal Value');
315
295
  }
316
296
  }
317
297
  function* FromNever(schema, references, value) {
@@ -345,12 +325,12 @@ export var TypeCompiler;
345
325
  yield `Object.getOwnPropertyNames(${value}).length <= ${schema.maxProperties}`;
346
326
  const knownKeys = Object.getOwnPropertyNames(schema.properties);
347
327
  for (const knownKey of knownKeys) {
348
- const memberExpression = MemberExpression.Encode(value, knownKey);
328
+ const memberExpression = MemberExpression(value, knownKey);
349
329
  const property = schema.properties[knownKey];
350
330
  if (schema.required && schema.required.includes(knownKey)) {
351
331
  yield* Visit(property, references, memberExpression);
352
332
  if (ExtendsUndefinedCheck(property) || IsAnyOrUnknown(property))
353
- yield `('${knownKey}' in ${value})`;
333
+ yield `(${StringConstant(knownKey)} in ${value})`;
354
334
  }
355
335
  else {
356
336
  const expression = CreateExpression(property, references, memberExpression);
@@ -362,13 +342,13 @@ export var TypeCompiler;
362
342
  yield `Object.getOwnPropertyNames(${value}).length === ${knownKeys.length}`;
363
343
  }
364
344
  else {
365
- const keys = `[${knownKeys.map((key) => `'${key}'`).join(', ')}]`;
345
+ const keys = `[${knownKeys.map((key) => `${StringConstant(key)}`).join(', ')}]`;
366
346
  yield `Object.getOwnPropertyNames(${value}).every(key => ${keys}.includes(key))`;
367
347
  }
368
348
  }
369
349
  if (typeof schema.additionalProperties === 'object') {
370
350
  const expression = CreateExpression(schema.additionalProperties, references, `${value}[key]`);
371
- const keys = `[${knownKeys.map((key) => `'${key}'`).join(', ')}]`;
351
+ const keys = `[${knownKeys.map((key) => `${StringConstant(key)}`).join(', ')}]`;
372
352
  yield `(Object.getOwnPropertyNames(${value}).every(key => ${keys}.includes(key) || ${expression}))`;
373
353
  }
374
354
  }
@@ -416,7 +396,7 @@ export var TypeCompiler;
416
396
  yield `${variable}.test(${value})`;
417
397
  }
418
398
  if (schema.format !== undefined) {
419
- yield `format('${schema.format}', ${value})`;
399
+ yield `format(${StringConstant(schema.format)}, ${value})`;
420
400
  }
421
401
  }
422
402
  function* FromSymbol(schema, references, value) {
@@ -464,7 +444,7 @@ export var TypeCompiler;
464
444
  function* FromKind(schema, references, value) {
465
445
  const instance = state.instances.size;
466
446
  state.instances.set(instance, schema);
467
- yield `kind('${schema[Kind]}', ${instance}, ${value})`;
447
+ yield `kind(${StringConstant(schema[Kind])}, ${instance}, ${value})`;
468
448
  }
469
449
  function* Visit(schema, references, value, useHoisting = true) {
470
450
  const references_ = IsString(schema.$id) ? [...references, schema] : references;
@@ -638,7 +618,7 @@ export var TypeCompiler;
638
618
  /** Compiles a TypeBox type for optimal runtime type checking. Types must be valid TypeBox types of TSchema */
639
619
  function Compile(schema, references = []) {
640
620
  const generatedCode = Code(schema, references, { language: 'javascript' });
641
- const compiledFunction = globalThis.Function('kind', 'format', 'hash', generatedCode);
621
+ const compiledFunction = Evaluate('kind', 'format', 'hash', generatedCode);
642
622
  const instances = new Map(state.instances);
643
623
  function typeRegistryFunction(kind, instance, value) {
644
624
  if (!TypeRegistry.Has(kind) || !instances.has(instance))
@@ -20,4 +20,4 @@ export declare function IsTuple(value: unknown): value is ITuple;
20
20
  /** Returns true if the value is a Union Parser */
21
21
  export declare function IsUnion(value: unknown): value is IUnion;
22
22
  /** Returns true if the value is a Parser */
23
- export declare function IsParser(value: unknown): value is IContext<unknown> | IUnion<unknown> | IArray<unknown> | IConst<unknown> | IIdent<unknown> | INumber<unknown> | IOptional<unknown> | IRef<unknown> | IString<unknown> | ITuple<unknown>;
23
+ export declare function IsParser(value: unknown): value is IArray<unknown> | IConst<unknown> | IContext<unknown> | IIdent<unknown> | INumber<unknown> | IOptional<unknown> | IRef<unknown> | IString<unknown> | ITuple<unknown> | IUnion<unknown>;
@@ -3,6 +3,6 @@ export declare function Const(value: string, code: string): [] | [string, string
3
3
  /** Scans for the next Ident token */
4
4
  export declare function Ident(code: string): [] | [string, string];
5
5
  /** Scans for the next number token */
6
- export declare function Number(code: string): [string, string] | [];
6
+ export declare function Number(code: string): [] | [string, string];
7
7
  /** Scans the next Literal String value */
8
- export declare function String(options: string[], code: string): [string, string] | [];
8
+ export declare function String(options: string[], code: string): [] | [string, string];
@@ -121,7 +121,7 @@ export declare function AsyncIteratorMapping(input: [unknown, unknown, unknown,
121
121
  export type TIteratorMapping<Input extends [unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['Iterator', '<', infer Type extends T.TSchema, '>'] ? T.TIterator<Type> : never;
122
122
  export declare function IteratorMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TIterator<T.TSchema>;
123
123
  export type TArgumentMapping<Input extends [unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['Argument', '<', infer Type extends T.TSchema, '>'] ? Type extends T.TLiteral<infer Index extends number> ? T.TArgument<Index> : T.TNever : never;
124
- export declare function ArgumentMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TNever | T.TArgument<number>;
124
+ export declare function ArgumentMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TArgument<number> | T.TNever;
125
125
  export type TAwaitedMapping<Input extends [unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['Awaited', '<', infer Type extends T.TSchema, '>'] ? T.TAwaited<Type> : never;
126
126
  export declare function AwaitedMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TSchema;
127
127
  export type TArrayMapping<Input extends [unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['Array', '<', infer Type extends T.TSchema, '>'] ? T.TArray<Type> : never;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Evaluates code in the current environment. This function matches centralized
3
+ * evaluation as implemented in TypeBox 1.x.
4
+ */
5
+ export declare function Evaluate(...args: string[]): globalThis.Function;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Evaluates code in the current environment. This function matches centralized
3
+ * evaluation as implemented in TypeBox 1.x.
4
+ */
5
+ export function Evaluate(...args) {
6
+ return new globalThis.Function(...args);
7
+ }
@@ -1,2 +1,3 @@
1
+ export * from './evaluate.mjs';
1
2
  export * from './policy.mjs';
2
3
  export * from './system.mjs';
@@ -1,2 +1,3 @@
1
+ export * from './evaluate.mjs';
1
2
  export * from './policy.mjs';
2
3
  export * from './system.mjs';
@@ -1,7 +1,7 @@
1
1
  import { IntersectEvaluated } from '../intersect/index.mjs';
2
2
  import { IndexFromPropertyKeys } from '../indexed/index.mjs';
3
3
  import { KeyOfPropertyKeys } from '../keyof/index.mjs';
4
- import { Object } from '../object/index.mjs';
4
+ import { Object as _Object_ } from '../object/index.mjs';
5
5
  import { SetDistinct } from '../sets/index.mjs';
6
6
  // ------------------------------------------------------------------
7
7
  // TypeGuard
@@ -37,6 +37,6 @@ function CompositeProperties(T, K) {
37
37
  export function Composite(T, options) {
38
38
  const K = CompositeKeys(T);
39
39
  const P = CompositeProperties(T, K);
40
- const R = Object(P, options);
40
+ const R = _Object_(P, options);
41
41
  return R;
42
42
  }
@@ -4,7 +4,7 @@ import { Date } from '../date/index.mjs';
4
4
  import { Function as FunctionType } from '../function/index.mjs';
5
5
  import { Literal } from '../literal/index.mjs';
6
6
  import { Null } from '../null/index.mjs';
7
- import { Object } from '../object/index.mjs';
7
+ import { Object as _Object_ } from '../object/index.mjs';
8
8
  import { Symbol } from '../symbol/index.mjs';
9
9
  import { Tuple } from '../tuple/index.mjs';
10
10
  import { Readonly } from '../readonly/index.mjs';
@@ -37,7 +37,7 @@ function FromValue(value, root) {
37
37
  IsArray(value) ? Readonly(Tuple(FromArray(value))) :
38
38
  IsUint8Array(value) ? Uint8Array() :
39
39
  IsDate(value) ? Date() :
40
- IsObject(value) ? ConditionalReadonly(Object(FromProperties(value)), root) :
40
+ IsObject(value) ? ConditionalReadonly(_Object_(FromProperties(value)), root) :
41
41
  IsFunction(value) ? ConditionalReadonly(FunctionType([], Unknown()), root) :
42
42
  IsUndefined(value) ? Undefined() :
43
43
  IsNull(value) ? Null() :
@@ -46,7 +46,7 @@ function FromValue(value, root) {
46
46
  IsNumber(value) ? Literal(value) :
47
47
  IsBoolean(value) ? Literal(value) :
48
48
  IsString(value) ? Literal(value) :
49
- Object({}));
49
+ _Object_({}));
50
50
  }
51
51
  /** `[JavaScript]` Creates a readonly const type from the given value. */
52
52
  export function Const(T, options) {
@@ -3,7 +3,7 @@ import { Unknown } from '../unknown/index.mjs';
3
3
  import { ReadonlyOptional } from '../readonly-optional/index.mjs';
4
4
  import { Readonly } from '../readonly/index.mjs';
5
5
  import { Optional } from '../optional/index.mjs';
6
- import { Object } from '../object/index.mjs';
6
+ import { Object as _Object_ } from '../object/index.mjs';
7
7
  import { Record, RecordKey, RecordValue } from '../record/index.mjs';
8
8
  import * as ValueGuard from '../guard/value.mjs';
9
9
  import * as KindGuard from '../guard/kind.mjs';
@@ -59,7 +59,7 @@ function FromPromise(args, type) {
59
59
  // prettier-ignore
60
60
  function FromObject(args, type) {
61
61
  const mappedProperties = FromProperties(args, type.properties);
62
- return { ...type, ...Object(mappedProperties) }; // retain options
62
+ return { ...type, ..._Object_(mappedProperties) }; // retain options
63
63
  }
64
64
  // prettier-ignore
65
65
  function FromRecord(args, type) {
@@ -9,7 +9,7 @@ import { IndexPropertyKeys } from '../indexed/index.mjs';
9
9
  import { Intersect } from '../intersect/index.mjs';
10
10
  import { Iterator } from '../iterator/index.mjs';
11
11
  import { Literal } from '../literal/index.mjs';
12
- import { Object } from '../object/index.mjs';
12
+ import { Object as _Object_ } from '../object/index.mjs';
13
13
  import { Optional } from '../optional/index.mjs';
14
14
  import { Promise } from '../promise/index.mjs';
15
15
  import { Readonly } from '../readonly/index.mjs';
@@ -81,7 +81,7 @@ function FromSchemaType(K, T) {
81
81
  IsIntersect(T) ? Intersect(FromRest(K, T.allOf), options) :
82
82
  IsUnion(T) ? Union(FromRest(K, T.anyOf), options) :
83
83
  IsTuple(T) ? Tuple(FromRest(K, T.items ?? []), options) :
84
- IsObject(T) ? Object(FromProperties(K, T.properties), options) :
84
+ IsObject(T) ? _Object_(FromProperties(K, T.properties), options) :
85
85
  IsArray(T) ? Array(FromSchemaType(K, T.items), options) :
86
86
  IsPromise(T) ? Promise(FromSchemaType(K, T.item), options) :
87
87
  T);
@@ -98,5 +98,5 @@ export function Mapped(key, map, options) {
98
98
  const K = IsSchema(key) ? IndexPropertyKeys(key) : key;
99
99
  const RT = map({ [Kind]: 'MappedKey', keys: K });
100
100
  const R = MappedFunctionReturnType(K, RT);
101
- return Object(R, options);
101
+ return _Object_(R, options);
102
102
  }
@@ -10,7 +10,7 @@ import { Function as FunctionType } from '../function/index.mjs';
10
10
  import { Intersect } from '../intersect/index.mjs';
11
11
  import { Iterator } from '../iterator/index.mjs';
12
12
  import { KeyOf } from '../keyof/index.mjs';
13
- import { Object } from '../object/index.mjs';
13
+ import { Object as _Object_ } from '../object/index.mjs';
14
14
  import { Omit } from '../omit/index.mjs';
15
15
  import { Pick } from '../pick/index.mjs';
16
16
  import { Never } from '../never/index.mjs';
@@ -104,7 +104,7 @@ function FromIterator(moduleProperties, type) {
104
104
  return Iterator(FromType(moduleProperties, type));
105
105
  }
106
106
  function FromObject(moduleProperties, properties) {
107
- return Object(globalThis.Object.keys(properties).reduce((result, key) => {
107
+ return _Object_(globalThis.Object.keys(properties).reduce((result, key) => {
108
108
  return { ...result, [key]: FromType(moduleProperties, properties[key]) };
109
109
  }, {}));
110
110
  }
@@ -45,7 +45,7 @@ export interface TObject<T extends TProperties = TProperties> extends TSchema, O
45
45
  required: TRequiredArray<T>;
46
46
  }
47
47
  /** `[Json]` Creates an Object type */
48
- declare function _Object<T extends TProperties>(properties: T, options?: ObjectOptions): TObject<T>;
48
+ declare function _Object_<T extends TProperties>(properties: T, options?: ObjectOptions): TObject<T>;
49
49
  /** `[Json]` Creates an Object type */
50
- export declare var Object: typeof _Object;
50
+ export declare var Object: typeof _Object_;
51
51
  export {};
@@ -9,10 +9,26 @@ function RequiredArray(properties) {
9
9
  return globalThis.Object.keys(properties).filter((key) => !IsOptional(properties[key]));
10
10
  }
11
11
  /** `[Json]` Creates an Object type */
12
- function _Object(properties, options) {
12
+ function _Object_(properties, options) {
13
13
  const required = RequiredArray(properties);
14
14
  const schema = required.length > 0 ? { [Kind]: 'Object', type: 'object', required, properties } : { [Kind]: 'Object', type: 'object', properties };
15
15
  return CreateType(schema, options);
16
16
  }
17
+ // ------------------------------------------------------------------
18
+ // TypeScript 7: CommonJS TS2441
19
+ //
20
+ // TypeScript generates a CommonJS shim that patches local variables
21
+ // via an unqualified reference to Object (e.g. the __esModule shim's
22
+ // Object.defineProperty call). Other compiler tools have been
23
+ // observed patching in the same way, but TypeScript 7 has correctly
24
+ // begun flagging variables named Object in CommonJS, since they
25
+ // conflict with the shim and can cause "used before definition"
26
+ // errors. This is CommonJS-specific; no such shim exists for ESM.
27
+ //
28
+ // TypeBox works around this using a `var` declaration, which is
29
+ // known to avoid use-before-definition errors. TypeBox 1.x employs
30
+ // a similar strategy.
31
+ // ------------------------------------------------------------------
17
32
  /** `[Json]` Creates an Object type */
18
- export var Object = _Object;
33
+ // @ts-ignore - error TS2441: Duplicate identifier 'Object'. Compiler reserves name 'Object' in top level scope of a module.
34
+ export var Object = _Object_;
@@ -6,7 +6,7 @@ import { Literal } from '../literal/index.mjs';
6
6
  import { IndexPropertyKeys } from '../indexed/index.mjs';
7
7
  import { Intersect } from '../intersect/index.mjs';
8
8
  import { Union } from '../union/index.mjs';
9
- import { Object } from '../object/index.mjs';
9
+ import { Object as _Object_ } from '../object/index.mjs';
10
10
  // ------------------------------------------------------------------
11
11
  // Mapped
12
12
  // ------------------------------------------------------------------
@@ -41,7 +41,7 @@ function FromProperties(properties, propertyKeys) {
41
41
  function FromObject(type, propertyKeys, properties) {
42
42
  const options = Discard(type, [TransformKind, '$id', 'required', 'properties']);
43
43
  const mappedProperties = FromProperties(properties, propertyKeys);
44
- return Object(mappedProperties, options);
44
+ return _Object_(mappedProperties, options);
45
45
  }
46
46
  // prettier-ignore
47
47
  function UnionFromPropertyKeys(propertyKeys) {
@@ -53,7 +53,7 @@ function OmitResolve(type, propertyKeys) {
53
53
  return (IsIntersect(type) ? Intersect(FromIntersect(type.allOf, propertyKeys)) :
54
54
  IsUnion(type) ? Union(FromUnion(type.anyOf, propertyKeys)) :
55
55
  IsObject(type) ? FromObject(type, propertyKeys, type.properties) :
56
- Object({}));
56
+ _Object_({}));
57
57
  }
58
58
  /** `[Json]` Constructs a type whose keys are picked from the given type */
59
59
  // prettier-ignore
@@ -1,7 +1,7 @@
1
1
  import { CreateType } from '../create/type.mjs';
2
2
  import { Computed } from '../computed/index.mjs';
3
3
  import { Optional } from '../optional/index.mjs';
4
- import { Object } from '../object/index.mjs';
4
+ import { Object as _Object_ } from '../object/index.mjs';
5
5
  import { Intersect } from '../intersect/index.mjs';
6
6
  import { Union } from '../union/index.mjs';
7
7
  import { Ref } from '../ref/index.mjs';
@@ -31,7 +31,7 @@ function FromProperties(properties) {
31
31
  function FromObject(type, properties) {
32
32
  const options = Discard(type, [TransformKind, '$id', 'required', 'properties']);
33
33
  const mappedProperties = FromProperties(properties);
34
- return Object(mappedProperties, options);
34
+ return _Object_(mappedProperties, options);
35
35
  }
36
36
  // prettier-ignore
37
37
  function FromRest(types) {
@@ -60,7 +60,7 @@ function PartialResolve(type) {
60
60
  KindGuard.IsSymbol(type) ? type :
61
61
  KindGuard.IsUndefined(type) ? type :
62
62
  // Passthrough
63
- Object({}));
63
+ _Object_({}));
64
64
  }
65
65
  /** `[Json]` Constructs a type where all properties are optional */
66
66
  export function Partial(type, options) {
@@ -3,7 +3,7 @@ import { Discard } from '../discard/discard.mjs';
3
3
  import { Computed } from '../computed/index.mjs';
4
4
  import { Intersect } from '../intersect/index.mjs';
5
5
  import { Literal } from '../literal/index.mjs';
6
- import { Object } from '../object/index.mjs';
6
+ import { Object as _Object_ } from '../object/index.mjs';
7
7
  import { Union } from '../union/index.mjs';
8
8
  import { IndexPropertyKeys } from '../indexed/index.mjs';
9
9
  import { TransformKind } from '../symbols/symbols.mjs';
@@ -36,7 +36,7 @@ function FromProperties(properties, propertyKeys) {
36
36
  function FromObject(Type, keys, properties) {
37
37
  const options = Discard(Type, [TransformKind, '$id', 'required', 'properties']);
38
38
  const mappedProperties = FromProperties(properties, keys);
39
- return Object(mappedProperties, options);
39
+ return _Object_(mappedProperties, options);
40
40
  }
41
41
  // prettier-ignore
42
42
  function UnionFromPropertyKeys(propertyKeys) {
@@ -48,7 +48,7 @@ function PickResolve(type, propertyKeys) {
48
48
  return (IsIntersect(type) ? Intersect(FromIntersect(type.allOf, propertyKeys)) :
49
49
  IsUnion(type) ? Union(FromUnion(type.anyOf, propertyKeys)) :
50
50
  IsObject(type) ? FromObject(type, propertyKeys, type.properties) :
51
- Object({}));
51
+ _Object_({}));
52
52
  }
53
53
  /** `[Json]` Constructs a type whose keys are picked from the given type */
54
54
  // prettier-ignore
@@ -2,7 +2,7 @@ import { CreateType } from '../create/type.mjs';
2
2
  import { Kind, Hint } from '../symbols/index.mjs';
3
3
  import { Never } from '../never/index.mjs';
4
4
  import { Number } from '../number/index.mjs';
5
- import { Object } from '../object/index.mjs';
5
+ import { Object as _Object_ } from '../object/index.mjs';
6
6
  import { String } from '../string/index.mjs';
7
7
  import { Union } from '../union/index.mjs';
8
8
  import { IsTemplateLiteralFinite } from '../template-literal/index.mjs';
@@ -31,7 +31,7 @@ function RecordCreateFromKeys(K, T, options) {
31
31
  const result = {};
32
32
  for (const K2 of K)
33
33
  result[K2] = T;
34
- return Object(result, { ...options, [Hint]: 'Record' });
34
+ return _Object_(result, { ...options, [Hint]: 'Record' });
35
35
  }
36
36
  // prettier-ignore
37
37
  function FromTemplateLiteralKey(K, T, options) {
@@ -66,7 +66,7 @@ function FromNeverKey(_key, type, options) {
66
66
  }
67
67
  // prettier-ignore
68
68
  function FromBooleanKey(_key, type, options) {
69
- return Object({ true: type, false: type }, options);
69
+ return _Object_({ true: type, false: type }, options);
70
70
  }
71
71
  // prettier-ignore
72
72
  function FromIntegerKey(_key, type, options) {
@@ -1,6 +1,6 @@
1
1
  import { CreateType } from '../create/type.mjs';
2
2
  import { Computed } from '../computed/index.mjs';
3
- import { Object } from '../object/index.mjs';
3
+ import { Object as _Object_ } from '../object/index.mjs';
4
4
  import { Intersect } from '../intersect/index.mjs';
5
5
  import { Union } from '../union/index.mjs';
6
6
  import { Ref } from '../ref/index.mjs';
@@ -30,7 +30,7 @@ function FromProperties(properties) {
30
30
  function FromObject(type, properties) {
31
31
  const options = Discard(type, [TransformKind, '$id', 'required', 'properties']);
32
32
  const mappedProperties = FromProperties(properties);
33
- return Object(mappedProperties, options);
33
+ return _Object_(mappedProperties, options);
34
34
  }
35
35
  // prettier-ignore
36
36
  function FromRest(types) {
@@ -59,7 +59,7 @@ function RequiredResolve(type) {
59
59
  KindGuard.IsSymbol(type) ? type :
60
60
  KindGuard.IsUndefined(type) ? type :
61
61
  // Passthrough
62
- Object({}));
62
+ _Object_({}));
63
63
  }
64
64
  /** `[Json]` Constructs a type where all properties are required */
65
65
  export function Required(type, options) {
@@ -19,7 +19,7 @@ import { Not } from '../not/index.mjs';
19
19
  import { Null } from '../null/index.mjs';
20
20
  import { Module } from '../module/index.mjs';
21
21
  import { Number } from '../number/index.mjs';
22
- import { Object } from '../object/index.mjs';
22
+ import { Object as _Object_ } from '../object/index.mjs';
23
23
  import { Omit } from '../omit/index.mjs';
24
24
  import { Optional } from '../optional/index.mjs';
25
25
  import { Partial } from '../partial/index.mjs';
@@ -148,7 +148,7 @@ export class JsonTypeBuilder {
148
148
  }
149
149
  /** `[Json]` Creates an Object type */
150
150
  Object(properties, options) {
151
- return Object(properties, options);
151
+ return _Object_(properties, options);
152
152
  }
153
153
  /** `[Json]` Constructs a type whose keys are omitted from the given type */
154
154
  Omit(schema, selector, options) {
@@ -4,21 +4,21 @@ import { Clone } from '../clone/index.mjs';
4
4
  import { Equal } from '../equal/equal.mjs';
5
5
  import { TypeBoxError } from '../../type/error/index.mjs';
6
6
  import { Literal } from '../../type/literal/index.mjs';
7
- import { Object } from '../../type/object/index.mjs';
7
+ import { Object as _Object_ } from '../../type/object/index.mjs';
8
8
  import { String } from '../../type/string/index.mjs';
9
9
  import { Unknown } from '../../type/unknown/index.mjs';
10
10
  import { Union } from '../../type/union/index.mjs';
11
- export const Insert = Object({
11
+ export const Insert = _Object_({
12
12
  type: Literal('insert'),
13
13
  path: String(),
14
14
  value: Unknown(),
15
15
  });
16
- export const Update = Object({
16
+ export const Update = _Object_({
17
17
  type: Literal('update'),
18
18
  path: String(),
19
19
  value: Unknown(),
20
20
  });
21
- export const Delete = Object({
21
+ export const Delete = _Object_({
22
22
  type: Literal('delete'),
23
23
  path: String(),
24
24
  });
@@ -11,7 +11,7 @@ export declare namespace ParseRegistry {
11
11
  function Set(key: string, callback: TParseFunction): void;
12
12
  function Get(key: string): TParseFunction | undefined;
13
13
  }
14
- export declare const ParseDefault: readonly ["Clone", "Clean", "Default", "Convert", "Assert", "Decode"];
14
+ export declare const ParseDefault: readonly ['Clone', 'Clean', 'Default', 'Convert', 'Assert', 'Decode'];
15
15
  /** Parses a value using the default parse pipeline. Will throws an `AssertError` if invalid. */
16
16
  export declare function Parse<Type extends TSchema, Output = StaticDecode<Type>, Result extends Output = Output>(schema: Type, references: TSchema[], value: unknown): Result;
17
17
  /** Parses a value using the default parse pipeline. Will throws an `AssertError` if invalid. */
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sinclair/typebox",
3
- "version": "0.34.49",
3
+ "version": "0.34.52",
4
4
  "description": "Json Schema Type Builder with Static Type Resolution for TypeScript",
5
5
  "keywords": [
6
6
  "typescript",