@ceramicnetwork/stream-model 1.12.0 → 1.13.0-rc.1
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/lib/codecs.d.ts +124 -0
- package/lib/codecs.d.ts.map +1 -0
- package/lib/codecs.js +56 -0
- package/lib/codecs.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/model.d.ts +2 -47
- package/lib/model.d.ts.map +1 -1
- package/lib/model.js +11 -53
- package/lib/model.js.map +1 -1
- package/package.json +10 -3
package/lib/codecs.d.ts
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { Type, type TypeOf } from 'codeco';
|
|
2
|
+
import type { JSONSchema } from 'json-schema-typed/draft-2020-12';
|
|
3
|
+
export type { JSONSchema } from 'json-schema-typed/draft-2020-12';
|
|
4
|
+
export declare type SchemaType = JSONSchema.Boolean | JSONSchema.Integer | JSONSchema.Number | JSONSchema.String | JSONSchema.Array | JSONSchema.Object;
|
|
5
|
+
export declare function createSchemaType<T extends SchemaType>(type: T['type'], name: string): Type<T>;
|
|
6
|
+
export declare const ObjectSchema: Type<JSONSchema.Object<any>, JSONSchema.Object<any>, unknown>;
|
|
7
|
+
export declare type ObjectSchema = TypeOf<typeof ObjectSchema>;
|
|
8
|
+
export declare const ModelMetadata: import("codeco").ExactCodec<import("codeco").TypeCodec<{
|
|
9
|
+
controller: import("codeco").RefinementCodec<import("codeco").TrivialCodec<string>, string & import("ts-essentials").WithOpaque<"DIDString">>;
|
|
10
|
+
model: Type<import("streamid/lib").StreamID, Uint8Array, Uint8Array>;
|
|
11
|
+
}>>;
|
|
12
|
+
export declare type ModelMetadata = TypeOf<typeof ModelMetadata>;
|
|
13
|
+
export declare const ModelAccountRelation: import("codeco").UnionCodec<[import("codeco").ExactCodec<import("codeco").TypeCodec<{
|
|
14
|
+
type: import("codeco").LiteralCodec<"list">;
|
|
15
|
+
}>>, import("codeco").ExactCodec<import("codeco").TypeCodec<{
|
|
16
|
+
type: import("codeco").LiteralCodec<"single">;
|
|
17
|
+
}>>]>;
|
|
18
|
+
export declare type ModelAccountRelation = TypeOf<typeof ModelAccountRelation>;
|
|
19
|
+
export declare const ModelRelationDefinition: import("codeco").UnionCodec<[import("codeco").ExactCodec<import("codeco").TypeCodec<{
|
|
20
|
+
type: import("codeco").LiteralCodec<"account">;
|
|
21
|
+
}>>, import("codeco").ExactCodec<import("codeco").TypeCodec<{
|
|
22
|
+
type: import("codeco").LiteralCodec<"document">;
|
|
23
|
+
model: import("codeco").RefinementCodec<import("codeco").TrivialCodec<string>, string>;
|
|
24
|
+
}>>]>;
|
|
25
|
+
export declare type ModelRelationDefinition = TypeOf<typeof ModelRelationDefinition>;
|
|
26
|
+
export declare const ModelRelationsDefinition: import("codeco").NonEnumerableRecordCodec<import("codeco").TrivialCodec<string>, import("codeco").UnionCodec<[import("codeco").ExactCodec<import("codeco").TypeCodec<{
|
|
27
|
+
type: import("codeco").LiteralCodec<"account">;
|
|
28
|
+
}>>, import("codeco").ExactCodec<import("codeco").TypeCodec<{
|
|
29
|
+
type: import("codeco").LiteralCodec<"document">;
|
|
30
|
+
model: import("codeco").RefinementCodec<import("codeco").TrivialCodec<string>, string>;
|
|
31
|
+
}>>]>>;
|
|
32
|
+
export declare type ModelRelationsDefinition = TypeOf<typeof ModelRelationsDefinition>;
|
|
33
|
+
export declare const ModelDocumentMetadataViewDefinition: import("codeco").UnionCodec<[import("codeco").ExactCodec<import("codeco").TypeCodec<{
|
|
34
|
+
type: import("codeco").LiteralCodec<"documentAccount">;
|
|
35
|
+
}>>, import("codeco").ExactCodec<import("codeco").TypeCodec<{
|
|
36
|
+
type: import("codeco").LiteralCodec<"documentVersion">;
|
|
37
|
+
}>>]>;
|
|
38
|
+
export declare type ModelDocumentMetadataViewDefinition = TypeOf<typeof ModelDocumentMetadataViewDefinition>;
|
|
39
|
+
export declare const ModelRelationViewDefinition: import("codeco").UnionCodec<[import("codeco").ExactCodec<import("codeco").TypeCodec<{
|
|
40
|
+
type: import("codeco").LiteralCodec<"relationDocument">;
|
|
41
|
+
model: import("codeco").RefinementCodec<import("codeco").TrivialCodec<string>, string>;
|
|
42
|
+
property: import("codeco").TrivialCodec<string>;
|
|
43
|
+
}>>, import("codeco").ExactCodec<import("codeco").TypeCodec<{
|
|
44
|
+
type: import("codeco").LiteralCodec<"relationFrom">;
|
|
45
|
+
model: import("codeco").RefinementCodec<import("codeco").TrivialCodec<string>, string>;
|
|
46
|
+
property: import("codeco").TrivialCodec<string>;
|
|
47
|
+
}>>, import("codeco").ExactCodec<import("codeco").TypeCodec<{
|
|
48
|
+
type: import("codeco").LiteralCodec<"relationCountFrom">;
|
|
49
|
+
model: import("codeco").RefinementCodec<import("codeco").TrivialCodec<string>, string>;
|
|
50
|
+
property: import("codeco").TrivialCodec<string>;
|
|
51
|
+
}>>]>;
|
|
52
|
+
export declare type ModelRelationViewDefinition = TypeOf<typeof ModelRelationViewDefinition>;
|
|
53
|
+
export declare const ModelViewDefinition: import("codeco").UnionCodec<[import("codeco").UnionCodec<[import("codeco").ExactCodec<import("codeco").TypeCodec<{
|
|
54
|
+
type: import("codeco").LiteralCodec<"documentAccount">;
|
|
55
|
+
}>>, import("codeco").ExactCodec<import("codeco").TypeCodec<{
|
|
56
|
+
type: import("codeco").LiteralCodec<"documentVersion">;
|
|
57
|
+
}>>]>, import("codeco").UnionCodec<[import("codeco").ExactCodec<import("codeco").TypeCodec<{
|
|
58
|
+
type: import("codeco").LiteralCodec<"relationDocument">;
|
|
59
|
+
model: import("codeco").RefinementCodec<import("codeco").TrivialCodec<string>, string>;
|
|
60
|
+
property: import("codeco").TrivialCodec<string>;
|
|
61
|
+
}>>, import("codeco").ExactCodec<import("codeco").TypeCodec<{
|
|
62
|
+
type: import("codeco").LiteralCodec<"relationFrom">;
|
|
63
|
+
model: import("codeco").RefinementCodec<import("codeco").TrivialCodec<string>, string>;
|
|
64
|
+
property: import("codeco").TrivialCodec<string>;
|
|
65
|
+
}>>, import("codeco").ExactCodec<import("codeco").TypeCodec<{
|
|
66
|
+
type: import("codeco").LiteralCodec<"relationCountFrom">;
|
|
67
|
+
model: import("codeco").RefinementCodec<import("codeco").TrivialCodec<string>, string>;
|
|
68
|
+
property: import("codeco").TrivialCodec<string>;
|
|
69
|
+
}>>]>]>;
|
|
70
|
+
export declare type ModelViewDefinition = TypeOf<typeof ModelViewDefinition>;
|
|
71
|
+
export declare const ModelViewsDefinition: import("codeco").NonEnumerableRecordCodec<import("codeco").TrivialCodec<string>, import("codeco").UnionCodec<[import("codeco").UnionCodec<[import("codeco").ExactCodec<import("codeco").TypeCodec<{
|
|
72
|
+
type: import("codeco").LiteralCodec<"documentAccount">;
|
|
73
|
+
}>>, import("codeco").ExactCodec<import("codeco").TypeCodec<{
|
|
74
|
+
type: import("codeco").LiteralCodec<"documentVersion">;
|
|
75
|
+
}>>]>, import("codeco").UnionCodec<[import("codeco").ExactCodec<import("codeco").TypeCodec<{
|
|
76
|
+
type: import("codeco").LiteralCodec<"relationDocument">;
|
|
77
|
+
model: import("codeco").RefinementCodec<import("codeco").TrivialCodec<string>, string>;
|
|
78
|
+
property: import("codeco").TrivialCodec<string>;
|
|
79
|
+
}>>, import("codeco").ExactCodec<import("codeco").TypeCodec<{
|
|
80
|
+
type: import("codeco").LiteralCodec<"relationFrom">;
|
|
81
|
+
model: import("codeco").RefinementCodec<import("codeco").TrivialCodec<string>, string>;
|
|
82
|
+
property: import("codeco").TrivialCodec<string>;
|
|
83
|
+
}>>, import("codeco").ExactCodec<import("codeco").TypeCodec<{
|
|
84
|
+
type: import("codeco").LiteralCodec<"relationCountFrom">;
|
|
85
|
+
model: import("codeco").RefinementCodec<import("codeco").TrivialCodec<string>, string>;
|
|
86
|
+
property: import("codeco").TrivialCodec<string>;
|
|
87
|
+
}>>]>]>>;
|
|
88
|
+
export declare type ModelViewsDefinition = TypeOf<typeof ModelViewsDefinition>;
|
|
89
|
+
export declare const ModelDefinition: import("codeco").SparseCodec<{
|
|
90
|
+
version: import("codeco").TrivialCodec<string>;
|
|
91
|
+
name: import("codeco").TrivialCodec<string>;
|
|
92
|
+
description: import("codeco").OptionalCodec<import("codeco").TrivialCodec<string>>;
|
|
93
|
+
schema: Type<JSONSchema.Object<any>, JSONSchema.Object<any>, unknown>;
|
|
94
|
+
accountRelation: import("codeco").UnionCodec<[import("codeco").ExactCodec<import("codeco").TypeCodec<{
|
|
95
|
+
type: import("codeco").LiteralCodec<"list">;
|
|
96
|
+
}>>, import("codeco").ExactCodec<import("codeco").TypeCodec<{
|
|
97
|
+
type: import("codeco").LiteralCodec<"single">;
|
|
98
|
+
}>>]>;
|
|
99
|
+
relations: import("codeco").OptionalCodec<import("codeco").NonEnumerableRecordCodec<import("codeco").TrivialCodec<string>, import("codeco").UnionCodec<[import("codeco").ExactCodec<import("codeco").TypeCodec<{
|
|
100
|
+
type: import("codeco").LiteralCodec<"account">;
|
|
101
|
+
}>>, import("codeco").ExactCodec<import("codeco").TypeCodec<{
|
|
102
|
+
type: import("codeco").LiteralCodec<"document">;
|
|
103
|
+
model: import("codeco").RefinementCodec<import("codeco").TrivialCodec<string>, string>;
|
|
104
|
+
}>>]>>>;
|
|
105
|
+
views: import("codeco").OptionalCodec<import("codeco").NonEnumerableRecordCodec<import("codeco").TrivialCodec<string>, import("codeco").UnionCodec<[import("codeco").UnionCodec<[import("codeco").ExactCodec<import("codeco").TypeCodec<{
|
|
106
|
+
type: import("codeco").LiteralCodec<"documentAccount">;
|
|
107
|
+
}>>, import("codeco").ExactCodec<import("codeco").TypeCodec<{
|
|
108
|
+
type: import("codeco").LiteralCodec<"documentVersion">;
|
|
109
|
+
}>>]>, import("codeco").UnionCodec<[import("codeco").ExactCodec<import("codeco").TypeCodec<{
|
|
110
|
+
type: import("codeco").LiteralCodec<"relationDocument">;
|
|
111
|
+
model: import("codeco").RefinementCodec<import("codeco").TrivialCodec<string>, string>;
|
|
112
|
+
property: import("codeco").TrivialCodec<string>;
|
|
113
|
+
}>>, import("codeco").ExactCodec<import("codeco").TypeCodec<{
|
|
114
|
+
type: import("codeco").LiteralCodec<"relationFrom">;
|
|
115
|
+
model: import("codeco").RefinementCodec<import("codeco").TrivialCodec<string>, string>;
|
|
116
|
+
property: import("codeco").TrivialCodec<string>;
|
|
117
|
+
}>>, import("codeco").ExactCodec<import("codeco").TypeCodec<{
|
|
118
|
+
type: import("codeco").LiteralCodec<"relationCountFrom">;
|
|
119
|
+
model: import("codeco").RefinementCodec<import("codeco").TrivialCodec<string>, string>;
|
|
120
|
+
property: import("codeco").TrivialCodec<string>;
|
|
121
|
+
}>>]>]>>>;
|
|
122
|
+
}>;
|
|
123
|
+
export declare type ModelDefinition = TypeOf<typeof ModelDefinition>;
|
|
124
|
+
//# sourceMappingURL=codecs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codecs.d.ts","sourceRoot":"","sources":["../src/codecs.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,IAAI,EACJ,KAAK,MAAM,EASZ,MAAM,QAAQ,CAAA;AACf,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAA;AAWjE,YAAY,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAA;AAEjE,oBAAY,UAAU,GAClB,UAAU,CAAC,OAAO,GAClB,UAAU,CAAC,OAAO,GAClB,UAAU,CAAC,MAAM,GACjB,UAAU,CAAC,MAAM,GACjB,UAAU,CAAC,KAAK,GAChB,UAAU,CAAC,MAAM,CAAA;AAErB,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAuB7F;AAED,eAAO,MAAM,YAAY,+DAAgE,CAAA;AACzF,oBAAY,YAAY,GAAG,MAAM,CAAC,OAAO,YAAY,CAAC,CAAA;AAKtD,eAAO,MAAM,aAAa;;;GAczB,CAAA;AACD,oBAAY,aAAa,GAAG,MAAM,CAAC,OAAO,aAAa,CAAC,CAAA;AAQxD,eAAO,MAAM,oBAAoB;;;;KAGhC,CAAA;AACD,oBAAY,oBAAoB,GAAG,MAAM,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAUtE,eAAO,MAAM,uBAAuB;;;;;KAMnC,CAAA;AACD,oBAAY,uBAAuB,GAAG,MAAM,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAO5E,eAAO,MAAM,wBAAwB;;;;;MAIpC,CAAA;AACD,oBAAY,wBAAwB,GAAG,MAAM,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAE9E,eAAO,MAAM,mCAAmC;;;;KAG/C,CAAA;AACD,oBAAY,mCAAmC,GAAG,MAAM,CAAC,OAAO,mCAAmC,CAAC,CAAA;AAEpG,eAAO,MAAM,2BAA2B;;;;;;;;;;;;KAOvC,CAAA;AACD,oBAAY,2BAA2B,GAAG,MAAM,CAAC,OAAO,2BAA2B,CAAC,CAAA;AAepF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;OAG/B,CAAA;AACD,oBAAY,mBAAmB,GAAG,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAOpE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;QAA6D,CAAA;AAC9F,oBAAY,oBAAoB,GAAG,MAAM,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAKtE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAW3B,CAAA;AACD,oBAAY,eAAe,GAAG,MAAM,CAAC,OAAO,eAAe,CAAC,CAAA"}
|
package/lib/codecs.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { didString, streamIdAsBytes, streamIdString } from '@ceramicnetwork/codecs';
|
|
2
|
+
import Ajv from 'ajv/dist/2020.js';
|
|
3
|
+
import addFormats from 'ajv-formats';
|
|
4
|
+
import { Type, identity, literal, optional, record, sparse, strict, string, union, } from 'codeco';
|
|
5
|
+
const ajv = new Ajv({
|
|
6
|
+
strict: true,
|
|
7
|
+
allErrors: true,
|
|
8
|
+
allowMatchingProperties: false,
|
|
9
|
+
ownProperties: false,
|
|
10
|
+
unevaluated: false,
|
|
11
|
+
});
|
|
12
|
+
addFormats(ajv);
|
|
13
|
+
export function createSchemaType(type, name) {
|
|
14
|
+
function isSchemaType(input) {
|
|
15
|
+
return typeof input === 'object' && input != null && input.type === type;
|
|
16
|
+
}
|
|
17
|
+
return new Type(name, isSchemaType, (input, context) => {
|
|
18
|
+
if (!isSchemaType(input)) {
|
|
19
|
+
return context.failure(`Input is not a JSON schema of type: ${type}`);
|
|
20
|
+
}
|
|
21
|
+
const isValid = ajv.validateSchema(input);
|
|
22
|
+
ajv.removeSchema(input);
|
|
23
|
+
return isValid
|
|
24
|
+
? context.success(input)
|
|
25
|
+
: context.failure(`Validation Error: ${ajv.errorsText()}`);
|
|
26
|
+
}, identity);
|
|
27
|
+
}
|
|
28
|
+
export const ObjectSchema = createSchemaType('object', 'ObjectSchema');
|
|
29
|
+
export const ModelMetadata = strict({
|
|
30
|
+
controller: didString,
|
|
31
|
+
model: streamIdAsBytes,
|
|
32
|
+
}, 'ModelMetadata');
|
|
33
|
+
export const ModelAccountRelation = union([strict({ type: literal('list') }), strict({ type: literal('single') })], 'ModelAccountRelation');
|
|
34
|
+
export const ModelRelationDefinition = union([
|
|
35
|
+
strict({ type: literal('account') }),
|
|
36
|
+
strict({ type: literal('document'), model: streamIdString }),
|
|
37
|
+
], 'ModelRelationDefinition');
|
|
38
|
+
export const ModelRelationsDefinition = record(string, ModelRelationDefinition, 'ModelRelationsDefinition');
|
|
39
|
+
export const ModelDocumentMetadataViewDefinition = union([strict({ type: literal('documentAccount') }), strict({ type: literal('documentVersion') })], 'ModelDocumentMetadataViewDefinition');
|
|
40
|
+
export const ModelRelationViewDefinition = union([
|
|
41
|
+
strict({ type: literal('relationDocument'), model: streamIdString, property: string }),
|
|
42
|
+
strict({ type: literal('relationFrom'), model: streamIdString, property: string }),
|
|
43
|
+
strict({ type: literal('relationCountFrom'), model: streamIdString, property: string }),
|
|
44
|
+
], 'ModelRelationViewDefinition');
|
|
45
|
+
export const ModelViewDefinition = union([ModelDocumentMetadataViewDefinition, ModelRelationViewDefinition], 'ModelViewDefinition');
|
|
46
|
+
export const ModelViewsDefinition = record(string, ModelViewDefinition, 'ModelViewDefinition');
|
|
47
|
+
export const ModelDefinition = sparse({
|
|
48
|
+
version: string,
|
|
49
|
+
name: string,
|
|
50
|
+
description: optional(string),
|
|
51
|
+
schema: ObjectSchema,
|
|
52
|
+
accountRelation: ModelAccountRelation,
|
|
53
|
+
relations: optional(ModelRelationsDefinition),
|
|
54
|
+
views: optional(ModelViewsDefinition),
|
|
55
|
+
}, 'ModelDefinition');
|
|
56
|
+
//# sourceMappingURL=codecs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codecs.js","sourceRoot":"","sources":["../src/codecs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AACnF,OAAO,GAAG,MAAM,kBAAkB,CAAA;AAClC,OAAO,UAAU,MAAM,aAAa,CAAA;AACpC,OAAO,EACL,IAAI,EAEJ,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,MAAM,EACN,MAAM,EACN,MAAM,EACN,MAAM,EACN,KAAK,GACN,MAAM,QAAQ,CAAA;AAGf,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC;IAClB,MAAM,EAAE,IAAI;IACZ,SAAS,EAAE,IAAI;IACf,uBAAuB,EAAE,KAAK;IAC9B,aAAa,EAAE,KAAK;IACpB,WAAW,EAAE,KAAK;CACnB,CAAC,CAAA;AACF,UAAU,CAAC,GAAG,CAAC,CAAA;AAYf,MAAM,UAAU,gBAAgB,CAAuB,IAAe,EAAE,IAAY;IAClF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WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC;IAC7B,MAAM,EAAE,YAAY;IACpB,eAAe,EAAE,oBAAoB;IACrC,SAAS,EAAE,QAAQ,CAAC,wBAAwB,CAAC;IAC7C,KAAK,EAAE,QAAQ,CAAC,oBAAoB,CAAC;CACtC,EACD,iBAAiB,CAClB,CAAA"}
|
package/lib/index.d.ts
CHANGED
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA"}
|
package/lib/index.js
CHANGED
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA"}
|
package/lib/model.d.ts
CHANGED
|
@@ -1,56 +1,11 @@
|
|
|
1
1
|
import { LoadOpts, Stream, CeramicApi } from '@ceramicnetwork/common';
|
|
2
2
|
import { CommitID, StreamID } from '@ceramicnetwork/streamid';
|
|
3
|
-
import type
|
|
3
|
+
import { ModelDefinition, type ModelMetadata } from './codecs.js';
|
|
4
4
|
export declare const MODEL_VERSION_REGEXP: RegExp;
|
|
5
5
|
export declare function parseModelVersion(version: string): [number, number];
|
|
6
6
|
export interface ModelMetadataArgs {
|
|
7
7
|
controller: string;
|
|
8
8
|
}
|
|
9
|
-
export interface ModelMetadata {
|
|
10
|
-
controller: string;
|
|
11
|
-
model: StreamID;
|
|
12
|
-
}
|
|
13
|
-
export declare type ModelAccountRelation = {
|
|
14
|
-
type: 'list';
|
|
15
|
-
} | {
|
|
16
|
-
type: 'single';
|
|
17
|
-
};
|
|
18
|
-
export declare type ModelRelationDefinition = {
|
|
19
|
-
type: 'account';
|
|
20
|
-
} | {
|
|
21
|
-
type: 'document';
|
|
22
|
-
model: string;
|
|
23
|
-
};
|
|
24
|
-
export declare type ModelRelationsDefinition = Record<string, ModelRelationDefinition>;
|
|
25
|
-
export declare type ModelDocumentMetadataViewDefinition = {
|
|
26
|
-
type: 'documentAccount';
|
|
27
|
-
} | {
|
|
28
|
-
type: 'documentVersion';
|
|
29
|
-
};
|
|
30
|
-
export declare type ModelRelationViewDefinition = {
|
|
31
|
-
type: 'relationDocument';
|
|
32
|
-
model: string;
|
|
33
|
-
property: string;
|
|
34
|
-
} | {
|
|
35
|
-
type: 'relationFrom';
|
|
36
|
-
model: string;
|
|
37
|
-
property: string;
|
|
38
|
-
} | {
|
|
39
|
-
type: 'relationCountFrom';
|
|
40
|
-
model: string;
|
|
41
|
-
property: string;
|
|
42
|
-
};
|
|
43
|
-
export declare type ModelViewDefinition = ModelDocumentMetadataViewDefinition | ModelRelationViewDefinition;
|
|
44
|
-
export declare type ModelViewsDefinition = Record<string, ModelViewDefinition>;
|
|
45
|
-
export interface ModelDefinition {
|
|
46
|
-
version: string;
|
|
47
|
-
name: string;
|
|
48
|
-
description?: string;
|
|
49
|
-
schema: JSONSchema.Object;
|
|
50
|
-
accountRelation: ModelAccountRelation;
|
|
51
|
-
relations?: ModelRelationsDefinition;
|
|
52
|
-
views?: ModelViewsDefinition;
|
|
53
|
-
}
|
|
54
9
|
export declare type ValidVersionSatisfies = 'major' | 'minor';
|
|
55
10
|
export declare class Model extends Stream {
|
|
56
11
|
static STREAM_TYPE_NAME: string;
|
|
@@ -61,7 +16,7 @@ export declare class Model extends Stream {
|
|
|
61
16
|
get content(): ModelDefinition;
|
|
62
17
|
get metadata(): ModelMetadata;
|
|
63
18
|
static create(ceramic: CeramicApi, content: ModelDefinition, metadata?: ModelMetadataArgs): Promise<Model>;
|
|
64
|
-
static assertComplete(content: ModelDefinition,
|
|
19
|
+
static assertComplete(content: ModelDefinition, _streamId?: StreamID | CommitID | string): void;
|
|
65
20
|
static assertVersionValid(content: ModelDefinition, satisfies?: ValidVersionSatisfies): void;
|
|
66
21
|
static assertRelationsValid(content: ModelDefinition): void;
|
|
67
22
|
static load(ceramic: CeramicApi, streamId: StreamID | CommitID | string, opts?: LoadOpts): Promise<Model>;
|
package/lib/model.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EACR,MAAM,EAMN,UAAU,EAIX,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAa,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EACR,MAAM,EAMN,UAAU,EAIX,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAa,MAAM,0BAA0B,CAAA;AAQxE,OAAO,EAAE,eAAe,EAAE,KAAK,aAAa,EAA4B,MAAM,aAAa,CAAA;AAE3F,eAAO,MAAM,oBAAoB,QAAqB,CAAA;AAEtD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAMnE;AAKD,MAAM,WAAW,iBAAiB;IAIhC,UAAU,EAAE,MAAM,CAAA;CACnB;AA2BD,oBAAY,qBAAqB,GAAG,OAAO,GAAG,OAAO,CAAA;AAKrD,qBACa,KAAM,SAAQ,MAAM;IAC/B,MAAM,CAAC,gBAAgB,SAAU;IACjC,MAAM,CAAC,cAAc,SAAI;IAKzB,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAM3B;IAEJ,MAAM,CAAC,QAAQ,CAAC,OAAO,SAAQ;IAE/B,OAAO,CAAC,WAAW,CAAQ;IAE3B,IAAI,OAAO,IAAI,eAAe,CAE7B;IAED,IAAI,QAAQ,IAAI,aAAa,CAK5B;WAQY,MAAM,CACjB,OAAO,EAAE,UAAU,EACnB,OAAO,EAAE,eAAe,EACxB,QAAQ,CAAC,EAAE,iBAAiB,GAC3B,OAAO,CAAC,KAAK,CAAC;IAmBjB,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,eAAe,EAAE,SAAS,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,IAAI;IAS/F,MAAM,CAAC,kBAAkB,CACvB,OAAO,EAAE,eAAe,EACxB,SAAS,GAAE,qBAA+B,GACzC,IAAI;IAkBP,MAAM,CAAC,oBAAoB,CAAC,OAAO,EAAE,eAAe;WAYvC,IAAI,CACf,OAAO,EAAE,UAAU,EACnB,QAAQ,EAAE,QAAQ,GAAG,QAAQ,GAAG,MAAM,EACtC,IAAI,GAAE,QAAa,GAClB,OAAO,CAAC,KAAK,CAAC;mBAsBI,YAAY;mBAYZ,eAAe;IAgCpC,YAAY;IAKZ,IAAI,UAAU,IAAI,OAAO,CAExB;mBAQoB,WAAW;CAOjC"}
|
package/lib/model.js
CHANGED
|
@@ -11,6 +11,9 @@ import { CID } from 'multiformats/cid';
|
|
|
11
11
|
import { create } from 'multiformats/hashes/digest';
|
|
12
12
|
import { code, encode } from '@ipld/dag-cbor';
|
|
13
13
|
import { identity } from 'multiformats/hashes/identity';
|
|
14
|
+
import { asDIDString } from '@ceramicnetwork/codecs';
|
|
15
|
+
import { decode } from 'codeco';
|
|
16
|
+
import { ModelDefinition, ModelRelationsDefinition } from './codecs.js';
|
|
14
17
|
export const MODEL_VERSION_REGEXP = /^[0-9]+\.[0-9]+$/;
|
|
15
18
|
export function parseModelVersion(version) {
|
|
16
19
|
if (!MODEL_VERSION_REGEXP.test(version)) {
|
|
@@ -43,12 +46,14 @@ let Model = Model_1 = class Model extends Stream {
|
|
|
43
46
|
return super.content;
|
|
44
47
|
}
|
|
45
48
|
get metadata() {
|
|
46
|
-
return {
|
|
49
|
+
return {
|
|
50
|
+
controller: asDIDString(this.state$.value.metadata.controllers[0]),
|
|
51
|
+
model: Model_1.MODEL,
|
|
52
|
+
};
|
|
47
53
|
}
|
|
48
54
|
static async create(ceramic, content, metadata) {
|
|
49
55
|
Model_1.assertComplete(content);
|
|
50
56
|
Model_1.assertVersionValid(content, 'minor');
|
|
51
|
-
Model_1.assertRelationsValid(content);
|
|
52
57
|
const opts = {
|
|
53
58
|
publish: true,
|
|
54
59
|
anchor: true,
|
|
@@ -58,39 +63,8 @@ let Model = Model_1 = class Model extends Stream {
|
|
|
58
63
|
const model = await ceramic.createStreamFromGenesis(Model_1.STREAM_TYPE_ID, commit, opts);
|
|
59
64
|
return model;
|
|
60
65
|
}
|
|
61
|
-
static assertComplete(content,
|
|
62
|
-
|
|
63
|
-
if (streamId) {
|
|
64
|
-
throw new Error(`Model with StreamID ${streamId.toString()} is missing a 'name' field`);
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
throw new Error(`Model is missing a 'name' field`);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
if (!content.version) {
|
|
71
|
-
if (streamId) {
|
|
72
|
-
throw new Error(`Model ${content.name} (${streamId.toString()}) is missing a 'version' field`);
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
throw new Error(`Model ${content.name} is missing a 'version' field`);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
if (!content.schema) {
|
|
79
|
-
if (streamId) {
|
|
80
|
-
throw new Error(`Model ${content.name} (${streamId.toString()}) is missing a 'schema' field`);
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
throw new Error(`Model ${content.name} is missing a 'schema' field`);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
if (!content.accountRelation) {
|
|
87
|
-
if (streamId) {
|
|
88
|
-
throw new Error(`Model ${content.name} (${streamId.toString()}) is missing a 'accountRelation' field`);
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
throw new Error(`Model ${content.name} is missing a 'accountRelation' field`);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
66
|
+
static assertComplete(content, _streamId) {
|
|
67
|
+
decode(ModelDefinition, content);
|
|
94
68
|
}
|
|
95
69
|
static assertVersionValid(content, satisfies = 'minor') {
|
|
96
70
|
const [expectedMajor, expectedMinor] = parseModelVersion(Model_1.VERSION);
|
|
@@ -101,24 +75,8 @@ let Model = Model_1 = class Model extends Stream {
|
|
|
101
75
|
}
|
|
102
76
|
}
|
|
103
77
|
static assertRelationsValid(content) {
|
|
104
|
-
if (
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
for (const [fieldName, relationDefinition] of Object.entries(content.relations)) {
|
|
108
|
-
switch (relationDefinition.type) {
|
|
109
|
-
case 'account':
|
|
110
|
-
continue;
|
|
111
|
-
case 'document':
|
|
112
|
-
try {
|
|
113
|
-
StreamID.fromString(relationDefinition.model);
|
|
114
|
-
}
|
|
115
|
-
catch (err) {
|
|
116
|
-
throw new Error(`Relation on field ${fieldName} has invalid model: ${err.toString()}`);
|
|
117
|
-
}
|
|
118
|
-
continue;
|
|
119
|
-
default:
|
|
120
|
-
throw new Error(`Relation on field ${fieldName} has unexpected type ${relationDefinition.type}`);
|
|
121
|
-
}
|
|
78
|
+
if (content.relations != null) {
|
|
79
|
+
decode(ModelRelationsDefinition, content.relations);
|
|
122
80
|
}
|
|
123
81
|
}
|
|
124
82
|
static async load(ceramic, streamId, opts = {}) {
|
package/lib/model.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAGL,MAAM,EAEN,YAAY,EACZ,WAAW,GAOZ,MAAM,wBAAwB,CAAA;AAC/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",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ceramic",
|
|
@@ -37,14 +37,21 @@
|
|
|
37
37
|
"clean": "npx rimraf ./lib"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@ceramicnetwork/
|
|
40
|
+
"@ceramicnetwork/codecs": "^1.6.0-rc.0",
|
|
41
|
+
"@ceramicnetwork/common": "^2.31.0-rc.1",
|
|
41
42
|
"@ceramicnetwork/streamid": "^2.17.0",
|
|
42
43
|
"@ipld/dag-cbor": "^7.0.0",
|
|
43
44
|
"@stablelib/random": "^1.0.1",
|
|
45
|
+
"ajv": "^8.8.2",
|
|
46
|
+
"ajv-formats": "^2.1.1",
|
|
47
|
+
"codeco": "^1.1.0",
|
|
44
48
|
"fast-json-patch": "^3.1.0",
|
|
45
49
|
"json-schema-typed": "^8.0.1",
|
|
46
50
|
"multiformats": "^11.0.1",
|
|
47
51
|
"uint8arrays": "^4.0.3"
|
|
48
52
|
},
|
|
49
|
-
"
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"json-schema-typed": "^8.0.1"
|
|
55
|
+
},
|
|
56
|
+
"gitHead": "9d172d34252e33502c96ee4b669d56a43d643d9f"
|
|
50
57
|
}
|