@aws-amplify/data-schema 0.0.0-20240412222732
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/LICENSE +175 -0
- package/NOTICE +1 -0
- package/internals/package.json +6 -0
- package/lib-esm/index.d.ts +5 -0
- package/lib-esm/index.d.ts.map +1 -0
- package/lib-esm/index.js +28 -0
- package/lib-esm/src/Authorization.d.ts +287 -0
- package/lib-esm/src/Authorization.d.ts.map +1 -0
- package/lib-esm/src/Authorization.js +332 -0
- package/lib-esm/src/ClientSchema.d.ts +54 -0
- package/lib-esm/src/ClientSchema.d.ts.map +1 -0
- package/lib-esm/src/ClientSchema.js +2 -0
- package/lib-esm/src/CombineSchema.d.ts +19 -0
- package/lib-esm/src/CombineSchema.d.ts.map +1 -0
- package/lib-esm/src/CombineSchema.js +40 -0
- package/lib-esm/src/CustomOperation.d.ts +98 -0
- package/lib-esm/src/CustomOperation.d.ts.map +1 -0
- package/lib-esm/src/CustomOperation.js +67 -0
- package/lib-esm/src/CustomType.d.ts +36 -0
- package/lib-esm/src/CustomType.d.ts.map +1 -0
- package/lib-esm/src/CustomType.js +14 -0
- package/lib-esm/src/EnumType.d.ts +16 -0
- package/lib-esm/src/EnumType.d.ts.map +1 -0
- package/lib-esm/src/EnumType.js +17 -0
- package/lib-esm/src/Handler.d.ts +58 -0
- package/lib-esm/src/Handler.d.ts.map +1 -0
- package/lib-esm/src/Handler.js +48 -0
- package/lib-esm/src/MappedTypes/CustomOperations.d.ts +127 -0
- package/lib-esm/src/MappedTypes/CustomOperations.d.ts.map +1 -0
- package/lib-esm/src/MappedTypes/CustomOperations.js +2 -0
- package/lib-esm/src/MappedTypes/ExtractNonModelTypes.d.ts +74 -0
- package/lib-esm/src/MappedTypes/ExtractNonModelTypes.d.ts.map +1 -0
- package/lib-esm/src/MappedTypes/ExtractNonModelTypes.js +2 -0
- package/lib-esm/src/MappedTypes/ForeignKeys.d.ts +84 -0
- package/lib-esm/src/MappedTypes/ForeignKeys.d.ts.map +1 -0
- package/lib-esm/src/MappedTypes/ForeignKeys.js +2 -0
- package/lib-esm/src/MappedTypes/ImplicitFieldInjector.d.ts +38 -0
- package/lib-esm/src/MappedTypes/ImplicitFieldInjector.d.ts.map +1 -0
- package/lib-esm/src/MappedTypes/ImplicitFieldInjector.js +2 -0
- package/lib-esm/src/MappedTypes/MapSecondaryIndexes.d.ts +61 -0
- package/lib-esm/src/MappedTypes/MapSecondaryIndexes.d.ts.map +1 -0
- package/lib-esm/src/MappedTypes/MapSecondaryIndexes.js +2 -0
- package/lib-esm/src/MappedTypes/ModelMetadata.d.ts +26 -0
- package/lib-esm/src/MappedTypes/ModelMetadata.d.ts.map +1 -0
- package/lib-esm/src/MappedTypes/ModelMetadata.js +2 -0
- package/lib-esm/src/MappedTypes/ResolveFieldProperties.d.ts +70 -0
- package/lib-esm/src/MappedTypes/ResolveFieldProperties.d.ts.map +1 -0
- package/lib-esm/src/MappedTypes/ResolveFieldProperties.js +2 -0
- package/lib-esm/src/MappedTypes/ResolveSchema.d.ts +65 -0
- package/lib-esm/src/MappedTypes/ResolveSchema.d.ts.map +1 -0
- package/lib-esm/src/MappedTypes/ResolveSchema.js +2 -0
- package/lib-esm/src/ModelField.d.ts +162 -0
- package/lib-esm/src/ModelField.d.ts.map +1 -0
- package/lib-esm/src/ModelField.js +209 -0
- package/lib-esm/src/ModelIndex.d.ts +19 -0
- package/lib-esm/src/ModelIndex.d.ts.map +1 -0
- package/lib-esm/src/ModelIndex.js +33 -0
- package/lib-esm/src/ModelRelationalField.d.ts +119 -0
- package/lib-esm/src/ModelRelationalField.d.ts.map +1 -0
- package/lib-esm/src/ModelRelationalField.js +120 -0
- package/lib-esm/src/ModelSchema.d.ts +107 -0
- package/lib-esm/src/ModelSchema.d.ts.map +1 -0
- package/lib-esm/src/ModelSchema.js +162 -0
- package/lib-esm/src/ModelType.d.ts +85 -0
- package/lib-esm/src/ModelType.d.ts.map +1 -0
- package/lib-esm/src/ModelType.js +64 -0
- package/lib-esm/src/RefType.d.ts +59 -0
- package/lib-esm/src/RefType.d.ts.map +1 -0
- package/lib-esm/src/RefType.js +47 -0
- package/lib-esm/src/SchemaProcessor.d.ts +11 -0
- package/lib-esm/src/SchemaProcessor.d.ts.map +1 -0
- package/lib-esm/src/SchemaProcessor.js +1106 -0
- package/lib-esm/src/index.d.ts +13 -0
- package/lib-esm/src/index.d.ts.map +1 -0
- package/lib-esm/src/index.js +43 -0
- package/lib-esm/src/internals/index.d.ts +2 -0
- package/lib-esm/src/internals/index.d.ts.map +1 -0
- package/lib-esm/src/internals/index.js +5 -0
- package/lib-esm/src/util/Brand.d.ts +36 -0
- package/lib-esm/src/util/Brand.d.ts.map +1 -0
- package/lib-esm/src/util/Brand.js +32 -0
- package/lib-esm/src/util/IndexLimit.d.ts +8 -0
- package/lib-esm/src/util/IndexLimit.d.ts.map +1 -0
- package/lib-esm/src/util/IndexLimit.js +2 -0
- package/lib-esm/src/util/SpreadTuple.d.ts +7 -0
- package/lib-esm/src/util/SpreadTuple.d.ts.map +1 -0
- package/lib-esm/src/util/SpreadTuple.js +2 -0
- package/lib-esm/src/util/index.d.ts +4 -0
- package/lib-esm/src/util/index.d.ts.map +1 -0
- package/lib-esm/src/util/index.js +6 -0
- package/lib-esm/tsconfig.tsbuildinfo +1 -0
- package/package.json +62 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { schema } from './ModelSchema';
|
|
2
|
+
import { combine } from './CombineSchema';
|
|
3
|
+
import { model } from './ModelType';
|
|
4
|
+
import { id, string, integer, float, boolean, date, time, datetime, timestamp, email, json, phone, url, ipAddress } from './ModelField';
|
|
5
|
+
import { ref } from './RefType';
|
|
6
|
+
import { hasOne, hasMany, belongsTo, manyToMany } from './ModelRelationalField';
|
|
7
|
+
import { allow } from './Authorization';
|
|
8
|
+
import { customType } from './CustomType';
|
|
9
|
+
import { enumType } from './EnumType';
|
|
10
|
+
import { query, mutation, subscription } from './CustomOperation';
|
|
11
|
+
import { handler } from './Handler';
|
|
12
|
+
export { schema, combine, model, ref, customType, enumType as enum, query, mutation, subscription, hasOne, hasMany, belongsTo, manyToMany, allow, id, string, integer, float, boolean, date, time, datetime, timestamp, email, json, phone, url, ipAddress, handler, };
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EACL,EAAE,EACF,MAAM,EACN,OAAO,EACP,KAAK,EACL,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,KAAK,EACL,IAAI,EACJ,KAAK,EACL,GAAG,EACH,SAAS,EACV,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,OAAO,EACL,MAAM,EACN,OAAO,EACP,KAAK,EACL,GAAG,EACH,UAAU,EACV,QAAQ,IAAI,IAAI,EAChB,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,MAAM,EACN,OAAO,EACP,SAAS,EACT,UAAU,EACV,KAAK,EACL,EAAE,EACF,MAAM,EACN,OAAO,EACP,KAAK,EACL,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,KAAK,EACL,IAAI,EACJ,KAAK,EACL,GAAG,EACH,SAAS,EACT,OAAO,GACR,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handler = exports.ipAddress = exports.url = exports.phone = exports.json = exports.email = exports.timestamp = exports.datetime = exports.time = exports.date = exports.boolean = exports.float = exports.integer = exports.string = exports.id = exports.allow = exports.manyToMany = exports.belongsTo = exports.hasMany = exports.hasOne = exports.subscription = exports.mutation = exports.query = exports.enum = exports.customType = exports.ref = exports.model = exports.combine = exports.schema = void 0;
|
|
4
|
+
const ModelSchema_1 = require("./ModelSchema");
|
|
5
|
+
Object.defineProperty(exports, "schema", { enumerable: true, get: function () { return ModelSchema_1.schema; } });
|
|
6
|
+
const CombineSchema_1 = require("./CombineSchema");
|
|
7
|
+
Object.defineProperty(exports, "combine", { enumerable: true, get: function () { return CombineSchema_1.combine; } });
|
|
8
|
+
const ModelType_1 = require("./ModelType");
|
|
9
|
+
Object.defineProperty(exports, "model", { enumerable: true, get: function () { return ModelType_1.model; } });
|
|
10
|
+
const ModelField_1 = require("./ModelField");
|
|
11
|
+
Object.defineProperty(exports, "id", { enumerable: true, get: function () { return ModelField_1.id; } });
|
|
12
|
+
Object.defineProperty(exports, "string", { enumerable: true, get: function () { return ModelField_1.string; } });
|
|
13
|
+
Object.defineProperty(exports, "integer", { enumerable: true, get: function () { return ModelField_1.integer; } });
|
|
14
|
+
Object.defineProperty(exports, "float", { enumerable: true, get: function () { return ModelField_1.float; } });
|
|
15
|
+
Object.defineProperty(exports, "boolean", { enumerable: true, get: function () { return ModelField_1.boolean; } });
|
|
16
|
+
Object.defineProperty(exports, "date", { enumerable: true, get: function () { return ModelField_1.date; } });
|
|
17
|
+
Object.defineProperty(exports, "time", { enumerable: true, get: function () { return ModelField_1.time; } });
|
|
18
|
+
Object.defineProperty(exports, "datetime", { enumerable: true, get: function () { return ModelField_1.datetime; } });
|
|
19
|
+
Object.defineProperty(exports, "timestamp", { enumerable: true, get: function () { return ModelField_1.timestamp; } });
|
|
20
|
+
Object.defineProperty(exports, "email", { enumerable: true, get: function () { return ModelField_1.email; } });
|
|
21
|
+
Object.defineProperty(exports, "json", { enumerable: true, get: function () { return ModelField_1.json; } });
|
|
22
|
+
Object.defineProperty(exports, "phone", { enumerable: true, get: function () { return ModelField_1.phone; } });
|
|
23
|
+
Object.defineProperty(exports, "url", { enumerable: true, get: function () { return ModelField_1.url; } });
|
|
24
|
+
Object.defineProperty(exports, "ipAddress", { enumerable: true, get: function () { return ModelField_1.ipAddress; } });
|
|
25
|
+
const RefType_1 = require("./RefType");
|
|
26
|
+
Object.defineProperty(exports, "ref", { enumerable: true, get: function () { return RefType_1.ref; } });
|
|
27
|
+
const ModelRelationalField_1 = require("./ModelRelationalField");
|
|
28
|
+
Object.defineProperty(exports, "hasOne", { enumerable: true, get: function () { return ModelRelationalField_1.hasOne; } });
|
|
29
|
+
Object.defineProperty(exports, "hasMany", { enumerable: true, get: function () { return ModelRelationalField_1.hasMany; } });
|
|
30
|
+
Object.defineProperty(exports, "belongsTo", { enumerable: true, get: function () { return ModelRelationalField_1.belongsTo; } });
|
|
31
|
+
Object.defineProperty(exports, "manyToMany", { enumerable: true, get: function () { return ModelRelationalField_1.manyToMany; } });
|
|
32
|
+
const Authorization_1 = require("./Authorization");
|
|
33
|
+
Object.defineProperty(exports, "allow", { enumerable: true, get: function () { return Authorization_1.allow; } });
|
|
34
|
+
const CustomType_1 = require("./CustomType");
|
|
35
|
+
Object.defineProperty(exports, "customType", { enumerable: true, get: function () { return CustomType_1.customType; } });
|
|
36
|
+
const EnumType_1 = require("./EnumType");
|
|
37
|
+
Object.defineProperty(exports, "enum", { enumerable: true, get: function () { return EnumType_1.enumType; } });
|
|
38
|
+
const CustomOperation_1 = require("./CustomOperation");
|
|
39
|
+
Object.defineProperty(exports, "query", { enumerable: true, get: function () { return CustomOperation_1.query; } });
|
|
40
|
+
Object.defineProperty(exports, "mutation", { enumerable: true, get: function () { return CustomOperation_1.mutation; } });
|
|
41
|
+
Object.defineProperty(exports, "subscription", { enumerable: true, get: function () { return CustomOperation_1.subscription; } });
|
|
42
|
+
const Handler_1 = require("./Handler");
|
|
43
|
+
Object.defineProperty(exports, "handler", { enumerable: true, get: function () { return Handler_1.handler; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/internals/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.configure = void 0;
|
|
4
|
+
var ModelSchema_1 = require("../ModelSchema");
|
|
5
|
+
Object.defineProperty(exports, "configure", { enumerable: true, get: function () { return ModelSchema_1.configure; } });
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
declare const brandSymbol: unique symbol;
|
|
2
|
+
/**
|
|
3
|
+
* @typeParam BrandStr - String type to brand this object with
|
|
4
|
+
* @returns A branded empty object type
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* Brand<'example'> => {[brandSymbol]: 'example'}
|
|
8
|
+
*
|
|
9
|
+
* Which I might use like this:
|
|
10
|
+
* type MyType = {content: string} & Brand<'example'>
|
|
11
|
+
*/
|
|
12
|
+
export type Brand<BrandStr extends string> = {
|
|
13
|
+
[brandSymbol]: BrandStr;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Create an object of a specific type Brand
|
|
17
|
+
* string branded type.
|
|
18
|
+
*
|
|
19
|
+
* @param brand: The string to Brand onto a simple object
|
|
20
|
+
* @returns A branded empty object
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* brand('example') => {[brandSymbol]: 'example'}
|
|
24
|
+
*
|
|
25
|
+
* Which I might use like this:
|
|
26
|
+
* const myType = {content: "default content", ...brand<'example'>}
|
|
27
|
+
*/
|
|
28
|
+
export declare function brand<BrandStr extends string>(brand: BrandStr): Brand<BrandStr>;
|
|
29
|
+
/**
|
|
30
|
+
*
|
|
31
|
+
* @param branded: Branded object
|
|
32
|
+
* @returns The string brand value
|
|
33
|
+
*/
|
|
34
|
+
export declare function getBrand(branded: Brand<string>): string;
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=Brand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Brand.d.ts","sourceRoot":"","sources":["../../../src/util/Brand.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,WAAW,eAAkB,CAAC;AAEpC;;;;;;;;;GASG;AACH,MAAM,MAAM,KAAK,CAAC,QAAQ,SAAS,MAAM,IAAI;IAC3C,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC;CACzB,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,wBAAgB,KAAK,CAAC,QAAQ,SAAS,MAAM,EAC3C,KAAK,EAAE,QAAQ,GACd,KAAK,CAAC,QAAQ,CAAC,CAIjB;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,UAE9C"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getBrand = exports.brand = void 0;
|
|
4
|
+
const brandSymbol = Symbol('brand');
|
|
5
|
+
/**
|
|
6
|
+
* Create an object of a specific type Brand
|
|
7
|
+
* string branded type.
|
|
8
|
+
*
|
|
9
|
+
* @param brand: The string to Brand onto a simple object
|
|
10
|
+
* @returns A branded empty object
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* brand('example') => {[brandSymbol]: 'example'}
|
|
14
|
+
*
|
|
15
|
+
* Which I might use like this:
|
|
16
|
+
* const myType = {content: "default content", ...brand<'example'>}
|
|
17
|
+
*/
|
|
18
|
+
function brand(brand) {
|
|
19
|
+
return {
|
|
20
|
+
[brandSymbol]: brand,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
exports.brand = brand;
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @param branded: Branded object
|
|
27
|
+
* @returns The string brand value
|
|
28
|
+
*/
|
|
29
|
+
function getBrand(branded) {
|
|
30
|
+
return branded[brandSymbol];
|
|
31
|
+
}
|
|
32
|
+
exports.getBrand = getBrand;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a type literal of numbers as index strings
|
|
3
|
+
* The resulting literal will include 0 up to (N - 1)
|
|
4
|
+
*
|
|
5
|
+
* @typeParam N - The number of literal values to include
|
|
6
|
+
*/
|
|
7
|
+
export type IndexLimitUnion<N extends number, Result extends Array<unknown> = []> = Result['length'] extends N ? Result : IndexLimitUnion<N, [...Result, `${Result['length']}`]>;
|
|
8
|
+
//# sourceMappingURL=IndexLimit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IndexLimit.d.ts","sourceRoot":"","sources":["../../../src/util/IndexLimit.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,eAAe,CACzB,CAAC,SAAS,MAAM,EAChB,MAAM,SAAS,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,IAChC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,GAC1B,MAAM,GACN,eAAe,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transform into the type intersection of all items in a given tuple
|
|
3
|
+
*
|
|
4
|
+
* @typeParam T - The tuple of types to spread into a type intersection
|
|
5
|
+
*/
|
|
6
|
+
export type SpreadTuple<T extends readonly any[]> = T extends [infer F] ? F : T extends [infer F, ...infer R] ? F & SpreadTuple<R> : never;
|
|
7
|
+
//# sourceMappingURL=SpreadTuple.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SpreadTuple.d.ts","sourceRoot":"","sources":["../../../src/util/SpreadTuple.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,SAAS,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,GACnE,CAAC,GACD,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,GAAG,MAAM,CAAC,CAAC,GAC7B,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,GAClB,KAAK,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/util/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getBrand = exports.brand = void 0;
|
|
4
|
+
var Brand_1 = require("./Brand");
|
|
5
|
+
Object.defineProperty(exports, "brand", { enumerable: true, get: function () { return Brand_1.brand; } });
|
|
6
|
+
Object.defineProperty(exports, "getBrand", { enumerable: true, get: function () { return Brand_1.getBrand; } });
|