@typespec/compiler 0.61.0-dev.1 → 0.61.0-dev.11
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/dist/manifest.js +2 -2
- package/dist/src/core/binder.d.ts +4 -4
- package/dist/src/core/checker.js +1 -1
- package/dist/src/core/checker.js.map +1 -1
- package/dist/src/core/cli/actions/compile/compile.js +0 -1
- package/dist/src/core/cli/actions/compile/compile.js.map +1 -1
- package/dist/src/core/cli/actions/compile/watch.js +3 -0
- package/dist/src/core/cli/actions/compile/watch.js.map +1 -1
- package/dist/src/core/helpers/index.d.ts.map +1 -1
- package/dist/src/core/helpers/index.js +1 -3
- package/dist/src/core/helpers/index.js.map +1 -1
- package/dist/src/core/index.d.ts +1 -1
- package/dist/src/core/index.d.ts.map +1 -1
- package/dist/src/core/index.js +2 -6
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/core/library.js +1 -1
- package/dist/src/core/library.js.map +1 -1
- package/dist/src/core/logger/support-hyperlinks.d.ts.map +1 -1
- package/dist/src/core/logger/support-hyperlinks.js +0 -1
- package/dist/src/core/logger/support-hyperlinks.js.map +1 -1
- package/dist/src/core/numeric.js +1 -1
- package/dist/src/core/numeric.js.map +1 -1
- package/dist/src/core/program.d.ts.map +1 -1
- package/dist/src/core/program.js +17 -14
- package/dist/src/core/program.js.map +1 -1
- package/dist/src/core/projector.js +5 -5
- package/dist/src/core/projector.js.map +1 -1
- package/dist/src/core/source-loader.d.ts +2 -2
- package/dist/src/core/source-loader.d.ts.map +1 -1
- package/dist/src/core/source-loader.js +1 -1
- package/dist/src/core/source-loader.js.map +1 -1
- package/dist/src/core/state-accessors.d.ts +8 -8
- package/dist/src/core/types.d.ts +1 -1
- package/dist/src/core/types.d.ts.map +1 -1
- package/dist/src/emitter-framework/type-emitter.d.ts.map +1 -1
- package/dist/src/emitter-framework/type-emitter.js +0 -1
- package/dist/src/emitter-framework/type-emitter.js.map +1 -1
- package/dist/src/experimental/index.d.ts +5 -0
- package/dist/src/experimental/index.d.ts.map +1 -0
- package/dist/src/experimental/index.js +5 -0
- package/dist/src/experimental/index.js.map +1 -0
- package/dist/src/experimental/mutators.d.ts +57 -0
- package/dist/src/experimental/mutators.d.ts.map +1 -0
- package/dist/src/experimental/mutators.js +173 -0
- package/dist/src/experimental/mutators.js.map +1 -0
- package/dist/src/experimental/realm.d.ts +34 -0
- package/dist/src/experimental/realm.d.ts.map +1 -0
- package/dist/src/experimental/realm.js +128 -0
- package/dist/src/experimental/realm.js.map +1 -0
- package/dist/src/experimental/state-accessor.d.ts +13 -0
- package/dist/src/experimental/state-accessor.d.ts.map +1 -0
- package/dist/src/experimental/state-accessor.js +14 -0
- package/dist/src/experimental/state-accessor.js.map +1 -0
- package/dist/src/experimental/typekit/define-kit.d.ts +28 -0
- package/dist/src/experimental/typekit/define-kit.d.ts.map +1 -0
- package/dist/src/experimental/typekit/define-kit.js +45 -0
- package/dist/src/experimental/typekit/define-kit.js.map +1 -0
- package/dist/src/experimental/typekit/index.d.ts +3 -0
- package/dist/src/experimental/typekit/index.d.ts.map +1 -0
- package/dist/src/experimental/typekit/index.js +3 -0
- package/dist/src/experimental/typekit/index.js.map +1 -0
- package/dist/src/experimental/typekit/kits/index.d.ts +9 -0
- package/dist/src/experimental/typekit/kits/index.d.ts.map +1 -0
- package/dist/src/experimental/typekit/kits/index.js +9 -0
- package/dist/src/experimental/typekit/kits/index.js.map +1 -0
- package/dist/src/experimental/typekit/kits/literal.d.ts +59 -0
- package/dist/src/experimental/typekit/kits/literal.d.ts.map +1 -0
- package/dist/src/experimental/typekit/kits/literal.js +51 -0
- package/dist/src/experimental/typekit/kits/literal.js.map +1 -0
- package/dist/src/experimental/typekit/kits/model-property.d.ts +45 -0
- package/dist/src/experimental/typekit/kits/model-property.d.ts.map +1 -0
- package/dist/src/experimental/typekit/kits/model-property.js +19 -0
- package/dist/src/experimental/typekit/kits/model-property.js.map +1 -0
- package/dist/src/experimental/typekit/kits/model.d.ts +48 -0
- package/dist/src/experimental/typekit/kits/model.d.ts.map +1 -0
- package/dist/src/experimental/typekit/kits/model.js +26 -0
- package/dist/src/experimental/typekit/kits/model.js.map +1 -0
- package/dist/src/experimental/typekit/kits/realm.d.ts +24 -0
- package/dist/src/experimental/typekit/kits/realm.d.ts.map +1 -0
- package/dist/src/experimental/typekit/kits/realm.js +17 -0
- package/dist/src/experimental/typekit/kits/realm.js.map +1 -0
- package/dist/src/experimental/typekit/kits/scalar.d.ts +354 -0
- package/dist/src/experimental/typekit/kits/scalar.d.ts.map +1 -0
- package/dist/src/experimental/typekit/kits/scalar.js +91 -0
- package/dist/src/experimental/typekit/kits/scalar.js.map +1 -0
- package/dist/src/experimental/typekit/kits/type.d.ts +25 -0
- package/dist/src/experimental/typekit/kits/type.d.ts.map +1 -0
- package/dist/src/experimental/typekit/kits/type.js +55 -0
- package/dist/src/experimental/typekit/kits/type.js.map +1 -0
- package/dist/src/experimental/typekit/kits/union-variant.d.ts +43 -0
- package/dist/src/experimental/typekit/kits/union-variant.d.ts.map +1 -0
- package/dist/src/experimental/typekit/kits/union-variant.js +22 -0
- package/dist/src/experimental/typekit/kits/union-variant.js.map +1 -0
- package/dist/src/experimental/typekit/kits/union.d.ts +56 -0
- package/dist/src/experimental/typekit/kits/union.d.ts.map +1 -0
- package/dist/src/experimental/typekit/kits/union.js +69 -0
- package/dist/src/experimental/typekit/kits/union.js.map +1 -0
- package/dist/src/experimental/typekit/utils.d.ts +8 -0
- package/dist/src/experimental/typekit/utils.d.ts.map +1 -0
- package/dist/src/experimental/typekit/utils.js +28 -0
- package/dist/src/experimental/typekit/utils.js.map +1 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/init/scaffold.d.ts.map +1 -1
- package/dist/src/init/scaffold.js.map +1 -1
- package/dist/src/lib/decorators.d.ts +35 -19
- package/dist/src/lib/decorators.d.ts.map +1 -1
- package/dist/src/lib/decorators.js +71 -91
- package/dist/src/lib/decorators.js.map +1 -1
- package/dist/src/lib/encoded-names.js +6 -8
- package/dist/src/lib/encoded-names.js.map +1 -1
- package/dist/src/lib/examples.d.ts.map +1 -1
- package/dist/src/lib/examples.js +5 -2
- package/dist/src/lib/examples.js.map +1 -1
- package/dist/src/lib/service.d.ts +3 -1
- package/dist/src/lib/service.d.ts.map +1 -1
- package/dist/src/lib/service.js +6 -9
- package/dist/src/lib/service.js.map +1 -1
- package/dist/src/lib/tsp-index.d.ts.map +1 -1
- package/dist/src/lib/tsp-index.js +0 -1
- package/dist/src/lib/tsp-index.js.map +1 -1
- package/dist/src/lib/utils.d.ts +4 -0
- package/dist/src/lib/utils.d.ts.map +1 -0
- package/dist/src/lib/utils.js +11 -0
- package/dist/src/lib/utils.js.map +1 -0
- package/dist/src/{core → module-resolver}/module-resolver.d.ts +2 -21
- package/dist/src/module-resolver/module-resolver.d.ts.map +1 -0
- package/dist/src/{core → module-resolver}/module-resolver.js +1 -1
- package/dist/src/module-resolver/module-resolver.js.map +1 -0
- package/dist/src/runner.js +1 -1
- package/dist/src/runner.js.map +1 -1
- package/dist/src/server/completion.d.ts.map +1 -1
- package/dist/src/server/completion.js.map +1 -1
- package/dist/src/server/file-system-cache.js +2 -2
- package/dist/src/server/file-system-cache.js.map +1 -1
- package/dist/src/server/server.js +0 -2
- package/dist/src/server/server.js.map +1 -1
- package/dist/src/server/serverlib.js +6 -6
- package/dist/src/server/serverlib.js.map +1 -1
- package/dist/src/types/package-json.d.ts +40 -0
- package/dist/src/types/package-json.d.ts.map +1 -0
- package/dist/src/types/package-json.js +2 -0
- package/dist/src/types/package-json.js.map +1 -0
- package/dist/src/utils/misc.d.ts.map +1 -1
- package/dist/src/utils/misc.js +1 -3
- package/dist/src/utils/misc.js.map +1 -1
- package/package.json +16 -12
- package/templates/emitter-ts/eslint.config.js +1 -1
- package/templates/library-ts/eslint.config.js +1 -1
- package/templates/scaffolding.json +4 -4
- package/dist/src/core/module-resolver.d.ts.map +0 -1
- package/dist/src/core/module-resolver.js.map +0 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { ModelProperty, Type } from "../../../core/types.js";
|
|
2
|
+
import { EncodeData } from "../../../lib/decorators.js";
|
|
3
|
+
export interface ModelPropertyKit {
|
|
4
|
+
/**
|
|
5
|
+
* Check if the given `type` is a model property.
|
|
6
|
+
*
|
|
7
|
+
* @param type The type to check.
|
|
8
|
+
*/
|
|
9
|
+
is(type: Type): type is ModelProperty;
|
|
10
|
+
/**
|
|
11
|
+
* Get the encoding of the model property or its type. The property's type
|
|
12
|
+
* must be a scalar.
|
|
13
|
+
*
|
|
14
|
+
* @param property The model property to get the encoding for.
|
|
15
|
+
*/
|
|
16
|
+
getEncoding(property: ModelProperty): EncodeData | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Get the format of the model property or its type. The property's type must
|
|
19
|
+
* be a string.
|
|
20
|
+
*
|
|
21
|
+
* @param property The model property to get the format for.
|
|
22
|
+
*/
|
|
23
|
+
getFormat(property: ModelProperty): string | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Get the visibility of the model property.
|
|
26
|
+
*/
|
|
27
|
+
getVisibility(property: ModelProperty): string[] | undefined;
|
|
28
|
+
}
|
|
29
|
+
interface TypeKit {
|
|
30
|
+
/**
|
|
31
|
+
* Utilities for working with model properties.
|
|
32
|
+
*
|
|
33
|
+
* For many reflection operations, the metadata being asked for may be found
|
|
34
|
+
* on the model property or the type of the model property. In such cases,
|
|
35
|
+
* these operations will return the metadata from the model property if it
|
|
36
|
+
* exists, or the type of the model property if it exists.
|
|
37
|
+
*/
|
|
38
|
+
modelProperty: ModelPropertyKit;
|
|
39
|
+
}
|
|
40
|
+
declare module "../define-kit.js" {
|
|
41
|
+
interface TypekitPrototype extends TypeKit {
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export {};
|
|
45
|
+
//# sourceMappingURL=model-property.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-property.d.ts","sourceRoot":"","sources":["../../../../../src/experimental/typekit/kits/model-property.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAU,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAuC,MAAM,4BAA4B,CAAC;AAG7F,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,IAAI,aAAa,CAAC;IAEtC;;;;;OAKG;IACH,WAAW,CAAC,QAAQ,EAAE,aAAa,GAAG,UAAU,GAAG,SAAS,CAAC;IAE7D;;;;;OAKG;IACH,SAAS,CAAC,QAAQ,EAAE,aAAa,GAAG,MAAM,GAAG,SAAS,CAAC;IAGvD;;OAEG;IACH,aAAa,CAAC,QAAQ,EAAE,aAAa,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC;CAC9D;AAED,UAAU,OAAO;IACf;;;;;;;OAOG;IACH,aAAa,EAAE,gBAAgB,CAAC;CACjC;AAED,OAAO,QAAQ,kBAAkB,CAAC;IAChC,UAAU,gBAAiB,SAAQ,OAAO;KAAG;CAC9C"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { getEncode, getFormat, getVisibility } from "../../../lib/decorators.js";
|
|
2
|
+
import { defineKit } from "../define-kit.js";
|
|
3
|
+
defineKit({
|
|
4
|
+
modelProperty: {
|
|
5
|
+
is(type) {
|
|
6
|
+
return type.kind === "ModelProperty";
|
|
7
|
+
},
|
|
8
|
+
getEncoding(type) {
|
|
9
|
+
return getEncode(this.program, type) ?? getEncode(this.program, type.type);
|
|
10
|
+
},
|
|
11
|
+
getFormat(type) {
|
|
12
|
+
return getFormat(this.program, type) ?? getFormat(this.program, type.type);
|
|
13
|
+
},
|
|
14
|
+
getVisibility(property) {
|
|
15
|
+
return getVisibility(this.program, property);
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
//# sourceMappingURL=model-property.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-property.js","sourceRoot":"","sources":["../../../../../src/experimental/typekit/kits/model-property.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC7F,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAiD7C,SAAS,CAAU;IACjB,aAAa,EAAE;QACb,EAAE,CAAC,IAAI;YACL,OAAO,IAAI,CAAC,IAAI,KAAK,eAAe,CAAC;QACvC,CAAC;QAED,WAAW,CAAC,IAAI;YACd,OAAO,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,IAAc,CAAC,CAAC;QACvF,CAAC;QAED,SAAS,CAAC,IAAI;YACZ,OAAO,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,IAAc,CAAC,CAAC;QACvF,CAAC;QAED,aAAa,CAAC,QAAQ;YACpB,OAAO,aAAa,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QAC/C,CAAC;KACF;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { Model, ModelProperty, SourceModel, Type } from "../../../core/types.js";
|
|
2
|
+
import { DecoratorArgs } from "../utils.js";
|
|
3
|
+
interface ModelDescriptor {
|
|
4
|
+
/**
|
|
5
|
+
* The name of the Model. If name is provided, it is a Model declaration.
|
|
6
|
+
* Otherwise, it is a Model expression.
|
|
7
|
+
*/
|
|
8
|
+
name?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Decorators to apply to the Model.
|
|
11
|
+
*/
|
|
12
|
+
decorators?: DecoratorArgs[];
|
|
13
|
+
/**
|
|
14
|
+
* Properties of the model.
|
|
15
|
+
*/
|
|
16
|
+
properties: Record<string, ModelProperty>;
|
|
17
|
+
/**
|
|
18
|
+
* Models that extend this model.
|
|
19
|
+
*/
|
|
20
|
+
derivedModels?: Model[];
|
|
21
|
+
/**
|
|
22
|
+
* Models that this model extends.
|
|
23
|
+
*/
|
|
24
|
+
sourceModels?: SourceModel[];
|
|
25
|
+
}
|
|
26
|
+
export interface ModelKit {
|
|
27
|
+
model: {
|
|
28
|
+
/**
|
|
29
|
+
* Create a model type.
|
|
30
|
+
*
|
|
31
|
+
* @param desc The descriptor of the model.
|
|
32
|
+
*/
|
|
33
|
+
create(desc: ModelDescriptor): Model;
|
|
34
|
+
/**
|
|
35
|
+
* Check if the given `type` is a model..
|
|
36
|
+
*
|
|
37
|
+
* @param type The type to check.
|
|
38
|
+
*/
|
|
39
|
+
is(type: Type): type is Model;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
declare module "../define-kit.js" {
|
|
43
|
+
interface TypekitPrototype extends ModelKit {
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export declare const ModelKit: void;
|
|
47
|
+
export {};
|
|
48
|
+
//# sourceMappingURL=model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../../../src/experimental/typekit/kits/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAGtF,OAAO,EAAwB,aAAa,EAAE,MAAM,aAAa,CAAC;AAElE,UAAU,eAAe;IACvB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,UAAU,CAAC,EAAE,aAAa,EAAE,CAAC;IAE7B;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAE1C;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,EAAE,CAAC;IAExB;;OAEG;IACH,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;CAC9B;AAED,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE;QACL;;;;WAIG;QACH,MAAM,CAAC,IAAI,EAAE,eAAe,GAAG,KAAK,CAAC;QAErC;;;;WAIG;QACH,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,IAAI,KAAK,CAAC;KAC/B,CAAC;CACH;AAED,OAAO,QAAQ,kBAAkB,CAAC;IAChC,UAAU,gBAAiB,SAAQ,QAAQ;KAAG;CAC/C;AAED,eAAO,MAAM,QAAQ,MAuBnB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createRekeyableMap } from "../../../utils/misc.js";
|
|
2
|
+
import { defineKit } from "../define-kit.js";
|
|
3
|
+
import { decoratorApplication } from "../utils.js";
|
|
4
|
+
export const ModelKit = defineKit({
|
|
5
|
+
model: {
|
|
6
|
+
create(desc) {
|
|
7
|
+
const properties = createRekeyableMap(Array.from(Object.entries(desc.properties)));
|
|
8
|
+
const model = this.program.checker.createType({
|
|
9
|
+
kind: "Model",
|
|
10
|
+
name: desc.name ?? "",
|
|
11
|
+
decorators: decoratorApplication(desc.decorators),
|
|
12
|
+
properties: properties,
|
|
13
|
+
expression: desc.name === undefined,
|
|
14
|
+
node: undefined,
|
|
15
|
+
derivedModels: desc.derivedModels ?? [],
|
|
16
|
+
sourceModels: desc.sourceModels ?? [],
|
|
17
|
+
});
|
|
18
|
+
this.program.checker.finishType(model);
|
|
19
|
+
return model;
|
|
20
|
+
},
|
|
21
|
+
is(type) {
|
|
22
|
+
return type.kind === "Model";
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
//# sourceMappingURL=model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../../../src/experimental/typekit/kits/model.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAiB,MAAM,aAAa,CAAC;AAoDlE,MAAM,CAAC,MAAM,QAAQ,GAAG,SAAS,CAAW;IAC1C,KAAK,EAAE;QACL,MAAM,CAAC,IAAI;YACT,MAAM,UAAU,GAAG,kBAAkB,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;YACnF,MAAM,KAAK,GAAU,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC;gBACnD,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,EAAE;gBACrB,UAAU,EAAE,oBAAoB,CAAC,IAAI,CAAC,UAAU,CAAC;gBACjD,UAAU,EAAE,UAAU;gBACtB,UAAU,EAAE,IAAI,CAAC,IAAI,KAAK,SAAS;gBACnC,IAAI,EAAE,SAAgB;gBACtB,aAAa,EAAE,IAAI,CAAC,aAAa,IAAI,EAAE;gBACvC,YAAY,EAAE,IAAI,CAAC,YAAY,IAAI,EAAE;aACtC,CAAC,CAAC;YAEH,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;YACvC,OAAO,KAAK,CAAC;QACf,CAAC;QAED,EAAE,CAAC,IAAI;YACL,OAAO,IAAI,CAAC,IAAI,KAAK,OAAO,CAAC;QAC/B,CAAC;KACF;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Realm } from "../../realm.js";
|
|
2
|
+
/** @experimental */
|
|
3
|
+
export interface RealmKit {
|
|
4
|
+
/**
|
|
5
|
+
* Gets the current realm used by the typekit.
|
|
6
|
+
*/
|
|
7
|
+
get(): Realm;
|
|
8
|
+
/**
|
|
9
|
+
* Sets the current realm to be used by the typekit.
|
|
10
|
+
*/
|
|
11
|
+
set(realm: Realm): void;
|
|
12
|
+
}
|
|
13
|
+
interface BaseTypeKit {
|
|
14
|
+
/**
|
|
15
|
+
* Utilities for working with general types.
|
|
16
|
+
*/
|
|
17
|
+
realm: RealmKit;
|
|
18
|
+
}
|
|
19
|
+
declare module "../define-kit.js" {
|
|
20
|
+
interface TypekitPrototype extends BaseTypeKit {
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=realm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"realm.d.ts","sourceRoot":"","sources":["../../../../../src/experimental/typekit/kits/realm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGvC,oBAAoB;AACpB,MAAM,WAAW,QAAQ;IACvB;;OAEG;IACH,GAAG,IAAI,KAAK,CAAC;IACb;;OAEG;IACH,GAAG,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACzB;AAED,UAAU,WAAW;IACnB;;OAEG;IACH,KAAK,EAAE,QAAQ,CAAC;CACjB;AAED,OAAO,QAAQ,kBAAkB,CAAC;IAChC,UAAU,gBAAiB,SAAQ,WAAW;KAAG;CAClD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Realm } from "../../realm.js";
|
|
2
|
+
import { defineKit } from "../define-kit.js";
|
|
3
|
+
let _realm;
|
|
4
|
+
defineKit({
|
|
5
|
+
realm: {
|
|
6
|
+
get() {
|
|
7
|
+
if (!_realm) {
|
|
8
|
+
_realm = new Realm(this.program, " typekit realm");
|
|
9
|
+
}
|
|
10
|
+
return _realm;
|
|
11
|
+
},
|
|
12
|
+
set(realm) {
|
|
13
|
+
_realm = realm;
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=realm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"realm.js","sourceRoot":"","sources":["../../../../../src/experimental/typekit/kits/realm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAyB7C,IAAI,MAAa,CAAC;AAElB,SAAS,CAAc;IACrB,KAAK,EAAE;QACL,GAAG;YACD,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,MAAM,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;YACrD,CAAC;YAED,OAAO,MAAM,CAAC;QAChB,CAAC;QACD,GAAG,CAAC,KAAY;YACd,MAAM,GAAG,KAAK,CAAC;QACjB,CAAC;KACF;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
import type { Scalar, Type } from "../../../core/types.js";
|
|
2
|
+
import { type EncodeData } from "../../../lib/decorators.js";
|
|
3
|
+
interface ScalarKit {
|
|
4
|
+
/**
|
|
5
|
+
* Operations for scalar types like strings, numerics, booleans, dates, etc.
|
|
6
|
+
*/
|
|
7
|
+
scalar: {
|
|
8
|
+
/**
|
|
9
|
+
* Check if `type` is any scalar type.
|
|
10
|
+
*
|
|
11
|
+
* @param type The type to check.
|
|
12
|
+
*/
|
|
13
|
+
is(type: Type): type is Scalar;
|
|
14
|
+
/**
|
|
15
|
+
* Check if `type` is exactly the standard boolean type.
|
|
16
|
+
*
|
|
17
|
+
* @param type The type to check.
|
|
18
|
+
*/
|
|
19
|
+
isBoolean(type: Type): type is Scalar;
|
|
20
|
+
/**
|
|
21
|
+
* Check if `type` is exactly the standard bytes type.
|
|
22
|
+
*
|
|
23
|
+
* @param type The type to check.
|
|
24
|
+
*/
|
|
25
|
+
isBytes(type: Type): type is Scalar;
|
|
26
|
+
/**
|
|
27
|
+
* Check if `type` is exactly the standard decimal type.
|
|
28
|
+
*
|
|
29
|
+
* @param type The type to check.
|
|
30
|
+
*/
|
|
31
|
+
isDecimal(type: Type): type is Scalar;
|
|
32
|
+
/**
|
|
33
|
+
* Check if `type` is exactly the standard decimal128 type.
|
|
34
|
+
*
|
|
35
|
+
* @param type The type to check.
|
|
36
|
+
*/
|
|
37
|
+
isDecimal128(type: Type): type is Scalar;
|
|
38
|
+
/**
|
|
39
|
+
* Check if `type` is exactly the standard duration type.
|
|
40
|
+
*
|
|
41
|
+
* @param type The type to check.
|
|
42
|
+
*/
|
|
43
|
+
isDuration(type: Type): type is Scalar;
|
|
44
|
+
/**
|
|
45
|
+
* Check if `type` is exactly the standard float type.
|
|
46
|
+
*
|
|
47
|
+
* @param type The type to check.
|
|
48
|
+
*/
|
|
49
|
+
isFloat(type: Type): type is Scalar;
|
|
50
|
+
/**
|
|
51
|
+
* Check if `type` is exactly the standard float32 type.
|
|
52
|
+
*
|
|
53
|
+
* @param type The type to check.
|
|
54
|
+
*/
|
|
55
|
+
isFloat32(type: Type): type is Scalar;
|
|
56
|
+
/**
|
|
57
|
+
* Check if `type` is exactly the standard float64 type.
|
|
58
|
+
*
|
|
59
|
+
* @param type The type to check.
|
|
60
|
+
*/
|
|
61
|
+
isFloat64(type: Type): type is Scalar;
|
|
62
|
+
/**
|
|
63
|
+
* Check if `type` is exactly the standard int8 type.
|
|
64
|
+
*
|
|
65
|
+
* @param type The type to check.
|
|
66
|
+
*/
|
|
67
|
+
isInt8(type: Type): type is Scalar;
|
|
68
|
+
/**
|
|
69
|
+
* Check if `type` is exactly the standard int16 type.
|
|
70
|
+
*
|
|
71
|
+
* @param type The type to check.
|
|
72
|
+
*/
|
|
73
|
+
isInt16(type: Type): type is Scalar;
|
|
74
|
+
/**
|
|
75
|
+
* Check if `type` is exactly the standard int32 type.
|
|
76
|
+
*
|
|
77
|
+
* @param type The type to check.
|
|
78
|
+
*/
|
|
79
|
+
isInt32(type: Type): type is Scalar;
|
|
80
|
+
/**
|
|
81
|
+
* Check if `type` is exactly the standard int64 type.
|
|
82
|
+
*
|
|
83
|
+
* @param type The type to check.
|
|
84
|
+
*/
|
|
85
|
+
isInt64(type: Type): type is Scalar;
|
|
86
|
+
/**
|
|
87
|
+
* Check if `type` is exactly the standard integer type.
|
|
88
|
+
*
|
|
89
|
+
* @param type The type to check.
|
|
90
|
+
*/
|
|
91
|
+
isInteger(type: Type): type is Scalar;
|
|
92
|
+
/**
|
|
93
|
+
* Check if `type` is exactly the standard offsetDateTime type.
|
|
94
|
+
*
|
|
95
|
+
* @param type The type to check.
|
|
96
|
+
*/
|
|
97
|
+
isOffsetDateTime(type: Type): type is Scalar;
|
|
98
|
+
/**
|
|
99
|
+
* Check if `type` is exactly the standard plainDate type.
|
|
100
|
+
*
|
|
101
|
+
* @param type The type to check.
|
|
102
|
+
*/
|
|
103
|
+
isPlainDate(type: Type): type is Scalar;
|
|
104
|
+
/**
|
|
105
|
+
* Check if `type` is exactly the standard plainTime type.
|
|
106
|
+
*
|
|
107
|
+
* @param type The type to check.
|
|
108
|
+
*/
|
|
109
|
+
isPlainTime(type: Type): type is Scalar;
|
|
110
|
+
/**
|
|
111
|
+
* Check if `type` is exactly the standard safeint type.
|
|
112
|
+
*
|
|
113
|
+
* @param type The type to check.
|
|
114
|
+
*/
|
|
115
|
+
isSafeint(type: Type): type is Scalar;
|
|
116
|
+
/**
|
|
117
|
+
* Check if `type` is exactly the standard uint8 type.
|
|
118
|
+
*
|
|
119
|
+
* @param type The type to check.
|
|
120
|
+
*/
|
|
121
|
+
isUint8(type: Type): type is Scalar;
|
|
122
|
+
/**
|
|
123
|
+
* Check if `type` is exactly the standard uint16 type.
|
|
124
|
+
*
|
|
125
|
+
* @param type The type to check.
|
|
126
|
+
*/
|
|
127
|
+
isUint16(type: Type): type is Scalar;
|
|
128
|
+
/**
|
|
129
|
+
* Check if `type` is exactly the standard uint32 type.
|
|
130
|
+
*
|
|
131
|
+
* @param type The type to check.
|
|
132
|
+
*/
|
|
133
|
+
isUint32(type: Type): type is Scalar;
|
|
134
|
+
/**
|
|
135
|
+
* Check if `type` is exactly the standard uint64 type.
|
|
136
|
+
*
|
|
137
|
+
* @param type The type to check.
|
|
138
|
+
*/
|
|
139
|
+
isUint64(type: Type): type is Scalar;
|
|
140
|
+
/**
|
|
141
|
+
* Check if `type` is exactly the standard url type.
|
|
142
|
+
*
|
|
143
|
+
* @param type The type to check.
|
|
144
|
+
*/
|
|
145
|
+
isUrl(type: Type): type is Scalar;
|
|
146
|
+
/**
|
|
147
|
+
* Check if `type` is exactly the standard utcDateTime type.
|
|
148
|
+
*
|
|
149
|
+
* @param type The type to check.
|
|
150
|
+
*/
|
|
151
|
+
isUtcDateTime(type: Type): type is Scalar;
|
|
152
|
+
/**
|
|
153
|
+
*
|
|
154
|
+
* @param type The type to check.
|
|
155
|
+
*/
|
|
156
|
+
isNumeric(type: Type): type is Scalar;
|
|
157
|
+
/**
|
|
158
|
+
* Check if `type` is exactly the standard string type.
|
|
159
|
+
*
|
|
160
|
+
* @param type The type to check.
|
|
161
|
+
*/
|
|
162
|
+
isString(type: Type): type is Scalar;
|
|
163
|
+
/**
|
|
164
|
+
* Check if `type` extends the standard boolean type.
|
|
165
|
+
*
|
|
166
|
+
* @param type The type to check.
|
|
167
|
+
*/
|
|
168
|
+
extendsBoolean(type: Type): type is Scalar;
|
|
169
|
+
/**
|
|
170
|
+
* Check if `type` extends the standard string type.
|
|
171
|
+
*
|
|
172
|
+
* @param type The type to check.
|
|
173
|
+
*/
|
|
174
|
+
extendsString(type: Type): type is Scalar;
|
|
175
|
+
/**
|
|
176
|
+
* Check if `type` extends the standard numeric type.
|
|
177
|
+
*
|
|
178
|
+
* @param type The type to check.
|
|
179
|
+
*/
|
|
180
|
+
extendsNumeric(type: Type): type is Scalar;
|
|
181
|
+
/**
|
|
182
|
+
* Check if `type` extends the standard bytes type.
|
|
183
|
+
*
|
|
184
|
+
* @param type The type to check.
|
|
185
|
+
*/
|
|
186
|
+
extendsBytes(type: Type): type is Scalar;
|
|
187
|
+
/**
|
|
188
|
+
* Check if `type` extends the standard decimal type.
|
|
189
|
+
*
|
|
190
|
+
* @param type The type to check.
|
|
191
|
+
*/
|
|
192
|
+
extendsDecimal(type: Type): type is Scalar;
|
|
193
|
+
/**
|
|
194
|
+
* Check if `type` extends the standard decimal128 type.
|
|
195
|
+
*
|
|
196
|
+
* @param type The type to check.
|
|
197
|
+
*/
|
|
198
|
+
extendsDecimal128(type: Type): type is Scalar;
|
|
199
|
+
/**
|
|
200
|
+
* Check if `type` extends the standard duration type.
|
|
201
|
+
*
|
|
202
|
+
* @param type The type to check.
|
|
203
|
+
*/
|
|
204
|
+
extendsDuration(type: Type): type is Scalar;
|
|
205
|
+
/**
|
|
206
|
+
* Check if `type` extends the standard float type.
|
|
207
|
+
*
|
|
208
|
+
* @param type The type to check.
|
|
209
|
+
*/
|
|
210
|
+
extendsFloat(type: Type): type is Scalar;
|
|
211
|
+
/**
|
|
212
|
+
* Check if `type` extends the standard float32 type.
|
|
213
|
+
*
|
|
214
|
+
* @param type The type to check.
|
|
215
|
+
*/
|
|
216
|
+
extendsFloat32(type: Type): type is Scalar;
|
|
217
|
+
/**
|
|
218
|
+
* Check if `type` extends the standard float64 type.
|
|
219
|
+
*
|
|
220
|
+
* @param type The type to check.
|
|
221
|
+
*/
|
|
222
|
+
extendsFloat64(type: Type): type is Scalar;
|
|
223
|
+
/**
|
|
224
|
+
* Check if `type` extends the standard int8 type.
|
|
225
|
+
*
|
|
226
|
+
* @param type The type to check.
|
|
227
|
+
*/
|
|
228
|
+
extendsInt8(type: Type): type is Scalar;
|
|
229
|
+
/**
|
|
230
|
+
* Check if `type` extends the standard int16 type.
|
|
231
|
+
*
|
|
232
|
+
* @param type The type to check.
|
|
233
|
+
*/
|
|
234
|
+
extendsInt16(type: Type): type is Scalar;
|
|
235
|
+
/**
|
|
236
|
+
* Check if `type` extends the standard int32 type.
|
|
237
|
+
*
|
|
238
|
+
* @param type The type to check.
|
|
239
|
+
*/
|
|
240
|
+
extendsInt32(type: Type): type is Scalar;
|
|
241
|
+
/**
|
|
242
|
+
* Check if `type` extends the standard int64 type.
|
|
243
|
+
*
|
|
244
|
+
* @param type The type to check.
|
|
245
|
+
*/
|
|
246
|
+
extendsInt64(type: Type): type is Scalar;
|
|
247
|
+
/**
|
|
248
|
+
* Check if `type` extends the standard integer type.
|
|
249
|
+
*
|
|
250
|
+
* @param type The type to check.
|
|
251
|
+
*/
|
|
252
|
+
extendsInteger(type: Type): type is Scalar;
|
|
253
|
+
/**
|
|
254
|
+
* Check if `type` extends the standard offsetDateTime type.
|
|
255
|
+
*
|
|
256
|
+
* @param type The type to check.
|
|
257
|
+
*/
|
|
258
|
+
extendsOffsetDateTime(type: Type): type is Scalar;
|
|
259
|
+
/**
|
|
260
|
+
* Check if `type` extends the standard plainDate type.
|
|
261
|
+
*
|
|
262
|
+
* @param type The type to check.
|
|
263
|
+
*/
|
|
264
|
+
extendsPlainDate(type: Type): type is Scalar;
|
|
265
|
+
/**
|
|
266
|
+
* Check if `type` extends the standard plainTime type.
|
|
267
|
+
*
|
|
268
|
+
* @param type The type to check.
|
|
269
|
+
*/
|
|
270
|
+
extendsPlainTime(type: Type): type is Scalar;
|
|
271
|
+
/**
|
|
272
|
+
* Check if `type` extends the standard safeint type.
|
|
273
|
+
*
|
|
274
|
+
* @param type The type to check.
|
|
275
|
+
*/
|
|
276
|
+
extendsSafeint(type: Type): type is Scalar;
|
|
277
|
+
/**
|
|
278
|
+
* Check if `type` extends the standard uint8 type.
|
|
279
|
+
*
|
|
280
|
+
* @param type The type to check.
|
|
281
|
+
*/
|
|
282
|
+
extendsUint8(type: Type): type is Scalar;
|
|
283
|
+
/**
|
|
284
|
+
* Check if `type` extends the standard uint16 type.
|
|
285
|
+
*
|
|
286
|
+
* @param type The type to check.
|
|
287
|
+
*/
|
|
288
|
+
extendsUint16(type: Type): type is Scalar;
|
|
289
|
+
/**
|
|
290
|
+
* Check if `type` extends the standard uint32 type.
|
|
291
|
+
*
|
|
292
|
+
* @param type The type to check.
|
|
293
|
+
*/
|
|
294
|
+
extendsUint32(type: Type): type is Scalar;
|
|
295
|
+
/**
|
|
296
|
+
* Check if `type` extends the standard uint64 type.
|
|
297
|
+
*
|
|
298
|
+
* @param type The type to check.
|
|
299
|
+
*/
|
|
300
|
+
extendsUint64(type: Type): type is Scalar;
|
|
301
|
+
/**
|
|
302
|
+
* Check if `type` extends the standard url type.
|
|
303
|
+
*
|
|
304
|
+
* @param type The type to check.
|
|
305
|
+
*/
|
|
306
|
+
extendsUrl(type: Type): type is Scalar;
|
|
307
|
+
/**
|
|
308
|
+
* Check if `type` extends the standard utcDateTime type.
|
|
309
|
+
*
|
|
310
|
+
* @param type The type to check.
|
|
311
|
+
*/
|
|
312
|
+
extendsUtcDateTime(type: Type): type is Scalar;
|
|
313
|
+
/**
|
|
314
|
+
* Get the standard built-in base type of a scalar. For all built-in scalar
|
|
315
|
+
* types (numeric, string, int32, etc.) this will just return the scalar
|
|
316
|
+
* type. For user-defined scalars, this will return the first base scalar
|
|
317
|
+
* that is built-in. For user-defined scalars without a standard base type,
|
|
318
|
+
* this will return null.
|
|
319
|
+
*
|
|
320
|
+
* @param type The scalar to check.
|
|
321
|
+
*/
|
|
322
|
+
getStdBase(type: Scalar): Scalar | null;
|
|
323
|
+
/**
|
|
324
|
+
* Get the encoding information for a scalar type. Returns undefined if no
|
|
325
|
+
* encoding data is specified.
|
|
326
|
+
*
|
|
327
|
+
* Note: This will return the encoding data for the scalar type itself, not
|
|
328
|
+
* the model property that uses the scalar type. If this scalar might be
|
|
329
|
+
* referenced from a model property, use {@link modelProperty.getEncoding}
|
|
330
|
+
* instead.
|
|
331
|
+
*
|
|
332
|
+
* @param scalar The scalar to get the encoding data for.
|
|
333
|
+
*/
|
|
334
|
+
getEncoding(scalar: Scalar): EncodeData | undefined;
|
|
335
|
+
/**
|
|
336
|
+
* Get the well-known format for a string scalar. Returns undefined if no
|
|
337
|
+
* format is specified.
|
|
338
|
+
*
|
|
339
|
+
* Note: This will return the format data for the scalar type itself, not
|
|
340
|
+
* the model property that uses the scalar type. If this scalar might be
|
|
341
|
+
* referenced from a model property, use {@link ModelPropertyKit.getEncoding}
|
|
342
|
+
* instead.
|
|
343
|
+
*
|
|
344
|
+
* @param scalar The scalar to get the format for.
|
|
345
|
+
*/
|
|
346
|
+
getFormat(scalar: Scalar): string | undefined;
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
declare module "../define-kit.js" {
|
|
350
|
+
interface TypekitPrototype extends ScalarKit {
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
export {};
|
|
354
|
+
//# sourceMappingURL=scalar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scalar.d.ts","sourceRoot":"","sources":["../../../../../src/experimental/typekit/kits/scalar.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAuB,MAAM,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,EAAE,KAAK,UAAU,EAAwB,MAAM,4BAA4B,CAAC;AAKnF,UAAU,SAAS;IACjB;;OAEG;IACH,MAAM,EAAE;QACN;;;;WAIG;QACH,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,IAAI,MAAM,CAAC;QAE/B;;;;WAIG;QACH,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,IAAI,MAAM,CAAC;QAEtC;;;;WAIG;QACH,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,IAAI,MAAM,CAAC;QAEpC;;;;WAIG;QACH,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,IAAI,MAAM,CAAC;QAEtC;;;;WAIG;QACH,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,IAAI,MAAM,CAAC;QAEzC;;;;WAIG;QACH,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,IAAI,MAAM,CAAC;QAEvC;;;;WAIG;QACH,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,IAAI,MAAM,CAAC;QAEpC;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;;;;;;WAUG;QACH,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAAC;QAEpD;;;;;;;;;;WAUG;QACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;KAC/C,CAAC;CACH;AAED,OAAO,QAAQ,kBAAkB,CAAC;IAChC,UAAU,gBAAiB,SAAQ,SAAS;KAAG;CAChD"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { isIntrinsicType } from "../../../core/decorator-utils.js";
|
|
2
|
+
import { getEncode, getFormat } from "../../../lib/decorators.js";
|
|
3
|
+
import { defineKit } from "../define-kit.js";
|
|
4
|
+
defineKit({
|
|
5
|
+
scalar: {
|
|
6
|
+
is(type) {
|
|
7
|
+
return type.kind === "Scalar";
|
|
8
|
+
},
|
|
9
|
+
extendsBoolean: extendsStdType("boolean"),
|
|
10
|
+
extendsBytes: extendsStdType("bytes"),
|
|
11
|
+
extendsDecimal: extendsStdType("decimal"),
|
|
12
|
+
extendsDecimal128: extendsStdType("decimal128"),
|
|
13
|
+
extendsDuration: extendsStdType("duration"),
|
|
14
|
+
extendsFloat: extendsStdType("float"),
|
|
15
|
+
extendsFloat32: extendsStdType("float32"),
|
|
16
|
+
extendsFloat64: extendsStdType("float64"),
|
|
17
|
+
extendsInt8: extendsStdType("int8"),
|
|
18
|
+
extendsInt16: extendsStdType("int16"),
|
|
19
|
+
extendsInt32: extendsStdType("int32"),
|
|
20
|
+
extendsInt64: extendsStdType("int64"),
|
|
21
|
+
extendsInteger: extendsStdType("integer"),
|
|
22
|
+
extendsNumeric: extendsStdType("numeric"),
|
|
23
|
+
extendsOffsetDateTime: extendsStdType("offsetDateTime"),
|
|
24
|
+
extendsPlainDate: extendsStdType("plainDate"),
|
|
25
|
+
extendsPlainTime: extendsStdType("plainTime"),
|
|
26
|
+
extendsSafeint: extendsStdType("safeint"),
|
|
27
|
+
extendsString: extendsStdType("string"),
|
|
28
|
+
extendsUint8: extendsStdType("uint8"),
|
|
29
|
+
extendsUint16: extendsStdType("uint16"),
|
|
30
|
+
extendsUint32: extendsStdType("uint32"),
|
|
31
|
+
extendsUint64: extendsStdType("uint64"),
|
|
32
|
+
extendsUrl: extendsStdType("url"),
|
|
33
|
+
extendsUtcDateTime: extendsStdType("utcDateTime"),
|
|
34
|
+
isBoolean: isStdType("boolean"),
|
|
35
|
+
isBytes: isStdType("bytes"),
|
|
36
|
+
isDecimal: isStdType("decimal"),
|
|
37
|
+
isDecimal128: isStdType("decimal128"),
|
|
38
|
+
isDuration: isStdType("duration"),
|
|
39
|
+
isFloat: isStdType("float"),
|
|
40
|
+
isFloat32: isStdType("float32"),
|
|
41
|
+
isFloat64: isStdType("float64"),
|
|
42
|
+
isInt8: isStdType("int8"),
|
|
43
|
+
isInt16: isStdType("int16"),
|
|
44
|
+
isInt32: isStdType("int32"),
|
|
45
|
+
isInt64: isStdType("int64"),
|
|
46
|
+
isInteger: isStdType("integer"),
|
|
47
|
+
isNumeric: isStdType("numeric"),
|
|
48
|
+
isOffsetDateTime: isStdType("offsetDateTime"),
|
|
49
|
+
isPlainDate: isStdType("plainDate"),
|
|
50
|
+
isPlainTime: isStdType("plainTime"),
|
|
51
|
+
isSafeint: isStdType("safeint"),
|
|
52
|
+
isString: isStdType("string"),
|
|
53
|
+
isUint8: isStdType("uint8"),
|
|
54
|
+
isUint16: isStdType("uint16"),
|
|
55
|
+
isUint32: isStdType("uint32"),
|
|
56
|
+
isUint64: isStdType("uint64"),
|
|
57
|
+
isUrl: isStdType("url"),
|
|
58
|
+
isUtcDateTime: isStdType("utcDateTime"),
|
|
59
|
+
getStdBase(type) {
|
|
60
|
+
const tspNamespace = this.program.resolveTypeReference("TypeSpec")[0];
|
|
61
|
+
let current = type;
|
|
62
|
+
while (current) {
|
|
63
|
+
if (current.namespace === tspNamespace) {
|
|
64
|
+
return current;
|
|
65
|
+
}
|
|
66
|
+
current = current.baseScalar;
|
|
67
|
+
}
|
|
68
|
+
return null;
|
|
69
|
+
},
|
|
70
|
+
getEncoding(type) {
|
|
71
|
+
return getEncode(this.program, type);
|
|
72
|
+
},
|
|
73
|
+
getFormat(type) {
|
|
74
|
+
return getFormat(this.program, type);
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
function isStdType(typeName) {
|
|
79
|
+
return function (type) {
|
|
80
|
+
return type === this.program.checker.getStdType(typeName);
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function extendsStdType(typeName) {
|
|
84
|
+
return function (type) {
|
|
85
|
+
if (!this.scalar.is(type)) {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
return isIntrinsicType(this.program, type, typeName);
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=scalar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scalar.js","sourceRoot":"","sources":["../../../../../src/experimental/typekit/kits/scalar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAEnE,OAAO,EAAmB,SAAS,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACnF,OAAO,EAAE,SAAS,EAAyB,MAAM,kBAAkB,CAAC;AAwZpE,SAAS,CAAY;IACnB,MAAM,EAAE;QACN,EAAE,CAAC,IAAI;YACL,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC;QAChC,CAAC;QACD,cAAc,EAAE,cAAc,CAAC,SAAS,CAAC;QACzC,YAAY,EAAE,cAAc,CAAC,OAAO,CAAC;QACrC,cAAc,EAAE,cAAc,CAAC,SAAS,CAAC;QACzC,iBAAiB,EAAE,cAAc,CAAC,YAAY,CAAC;QAC/C,eAAe,EAAE,cAAc,CAAC,UAAU,CAAC;QAC3C,YAAY,EAAE,cAAc,CAAC,OAAO,CAAC;QACrC,cAAc,EAAE,cAAc,CAAC,SAAS,CAAC;QACzC,cAAc,EAAE,cAAc,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