@aws-amplify/data-schema 0.13.18 → 0.14.0
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.
|
@@ -43,7 +43,7 @@ type IdentifierFields<T extends ModelTypeParamShape> = keyof IdentifierMap<T> &
|
|
|
43
43
|
type IdentifierType<T extends ModelTypeParamShape, Fields extends string = IdentifierFields<T>> = Array<Fields>;
|
|
44
44
|
export type ModelType<T extends ModelTypeParamShape, K extends keyof ModelType<T> = never> = Omit<{
|
|
45
45
|
identifier<ID extends IdentifierType<T> = []>(identifier: ID): ModelType<SetTypeSubArg<T, 'identifier', ID>, K | 'identifier'>;
|
|
46
|
-
secondaryIndexes<const
|
|
46
|
+
secondaryIndexes<const SecondaryIndexPKPool extends string = SecondaryIndexFields<ExtractType<T>>, const Indexes extends readonly ModelIndexType<string, string, unknown, readonly [], any>[] = readonly [], const IndexesIR extends readonly any[] = SecondaryIndexToIR<Indexes, ExtractType<T>>>(callback: (index: <PK extends SecondaryIndexPKPool>(pk: PK) => ModelIndexType<SecondaryIndexPKPool, PK, ReadonlyArray<Exclude<SecondaryIndexPKPool, PK>>>) => Indexes): ModelType<SetTypeSubArg<T, 'secondaryIndexes', IndexesIR>, K | 'secondaryIndexes'>;
|
|
47
47
|
authorization<AuthRuleType extends Authorization<any, any, any>>(rules: AuthRuleType[]): ModelType<SetTypeSubArg<T, 'authorization', AuthRuleType[]>, K | 'authorization'>;
|
|
48
48
|
}, K> & Brand<typeof brandName>;
|
|
49
49
|
/**
|
package/lib-esm/src/ModelType.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.model = exports.isSchemaModelType = void 0;
|
|
4
4
|
const util_1 = require("./util");
|
|
5
|
+
const ModelIndex_1 = require("./ModelIndex");
|
|
5
6
|
const brandName = 'modelType';
|
|
6
7
|
function _model(fields) {
|
|
7
8
|
const data = {
|
|
@@ -15,8 +16,8 @@ function _model(fields) {
|
|
|
15
16
|
data.identifier = identifier;
|
|
16
17
|
return this;
|
|
17
18
|
},
|
|
18
|
-
secondaryIndexes(
|
|
19
|
-
data.secondaryIndexes =
|
|
19
|
+
secondaryIndexes(callback) {
|
|
20
|
+
data.secondaryIndexes = callback(ModelIndex_1.modelIndex);
|
|
20
21
|
return this;
|
|
21
22
|
},
|
|
22
23
|
authorization(rules) {
|
package/lib-esm/src/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { schema } from './ModelSchema';
|
|
2
2
|
import { model } from './ModelType';
|
|
3
|
-
import { modelIndex } from './ModelIndex';
|
|
4
3
|
import { id, string, integer, float, boolean, date, time, datetime, timestamp, email, json, phone, url, ipAddress } from './ModelField';
|
|
5
4
|
import { ref } from './RefType';
|
|
6
5
|
import { hasOne, hasMany, belongsTo, manyToMany } from './ModelRelationalField';
|
|
@@ -9,4 +8,4 @@ import { customType } from './CustomType';
|
|
|
9
8
|
import { enumType } from './EnumType';
|
|
10
9
|
import { query, mutation, subscription } from './CustomOperation';
|
|
11
10
|
import { handler } from './Handler';
|
|
12
|
-
export { schema, model,
|
|
11
|
+
export { schema, 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, };
|
package/lib-esm/src/index.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
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.
|
|
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.schema = void 0;
|
|
4
4
|
const ModelSchema_1 = require("./ModelSchema");
|
|
5
5
|
Object.defineProperty(exports, "schema", { enumerable: true, get: function () { return ModelSchema_1.schema; } });
|
|
6
6
|
const ModelType_1 = require("./ModelType");
|
|
7
7
|
Object.defineProperty(exports, "model", { enumerable: true, get: function () { return ModelType_1.model; } });
|
|
8
|
-
const ModelIndex_1 = require("./ModelIndex");
|
|
9
|
-
Object.defineProperty(exports, "index", { enumerable: true, get: function () { return ModelIndex_1.modelIndex; } });
|
|
10
8
|
const ModelField_1 = require("./ModelField");
|
|
11
9
|
Object.defineProperty(exports, "id", { enumerable: true, get: function () { return ModelField_1.id; } });
|
|
12
10
|
Object.defineProperty(exports, "string", { enumerable: true, get: function () { return ModelField_1.string; } });
|