@api-client/core 0.6.4 → 0.6.7

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 (87) hide show
  1. package/build/browser.d.ts +8 -0
  2. package/build/browser.js +8 -0
  3. package/build/browser.js.map +1 -1
  4. package/build/index.d.ts +8 -0
  5. package/build/index.js +8 -0
  6. package/build/index.js.map +1 -1
  7. package/build/src/Platform.d.ts +12 -0
  8. package/build/src/Platform.js +13 -0
  9. package/build/src/Platform.js.map +1 -0
  10. package/build/src/authorization/OAuth2Authorization.d.ts +1 -1
  11. package/build/src/authorization/OidcAuthorization.d.ts +1 -0
  12. package/build/src/authorization/OidcAuthorization.js +3 -0
  13. package/build/src/authorization/OidcAuthorization.js.map +1 -1
  14. package/build/src/authorization/Utils.js +1 -1
  15. package/build/src/authorization/Utils.js.map +1 -1
  16. package/build/src/authorization/lib/SecurityProcessor.d.ts +33 -0
  17. package/build/src/authorization/lib/SecurityProcessor.js +118 -0
  18. package/build/src/authorization/lib/SecurityProcessor.js.map +1 -0
  19. package/build/src/authorization/lib/Utils.d.ts +41 -0
  20. package/build/src/authorization/lib/Utils.js +85 -0
  21. package/build/src/authorization/lib/Utils.js.map +1 -0
  22. package/build/src/lib/transformers/PayloadSerializer.d.ts +0 -3
  23. package/build/src/lib/transformers/PayloadSerializer.js +1 -3
  24. package/build/src/lib/transformers/PayloadSerializer.js.map +1 -1
  25. package/build/src/models/SerializablePayload.js +2 -1
  26. package/build/src/models/SerializablePayload.js.map +1 -1
  27. package/build/src/models/data/DataAssociation.d.ts +76 -0
  28. package/build/src/models/data/DataAssociation.js +151 -0
  29. package/build/src/models/data/DataAssociation.js.map +1 -0
  30. package/build/src/models/data/DataAssociationSchema.d.ts +32 -0
  31. package/build/src/models/data/DataAssociationSchema.js +2 -0
  32. package/build/src/models/data/DataAssociationSchema.js.map +1 -0
  33. package/build/src/models/data/DataEntity.d.ts +195 -0
  34. package/build/src/models/data/DataEntity.js +415 -0
  35. package/build/src/models/data/DataEntity.js.map +1 -0
  36. package/build/src/models/data/DataModel.d.ts +74 -0
  37. package/build/src/models/data/DataModel.js +173 -0
  38. package/build/src/models/data/DataModel.js.map +1 -0
  39. package/build/src/models/data/DataNamespace.d.ts +174 -0
  40. package/build/src/models/data/DataNamespace.js +424 -0
  41. package/build/src/models/data/DataNamespace.js.map +1 -0
  42. package/build/src/models/data/DataProperty.d.ts +159 -0
  43. package/build/src/models/data/DataProperty.js +216 -0
  44. package/build/src/models/data/DataProperty.js.map +1 -0
  45. package/build/src/models/data/DataPropertySchema.d.ts +125 -0
  46. package/build/src/models/data/DataPropertySchema.js +33 -0
  47. package/build/src/models/data/DataPropertySchema.js.map +1 -0
  48. package/build/src/models/legacy/Normalizer.js +1 -1
  49. package/build/src/models/legacy/Normalizer.js.map +1 -1
  50. package/build/src/models/store/File.d.ts +17 -0
  51. package/build/src/models/store/File.js +53 -1
  52. package/build/src/models/store/File.js.map +1 -1
  53. package/build/src/runtime/store/FilesSdk.d.ts +41 -6
  54. package/build/src/runtime/store/FilesSdk.js +77 -6
  55. package/build/src/runtime/store/FilesSdk.js.map +1 -1
  56. package/build/src/runtime/store/Http.d.ts +1 -0
  57. package/build/src/runtime/store/Http.js.map +1 -1
  58. package/build/src/runtime/store/HttpNode.d.ts +1 -0
  59. package/build/src/runtime/store/HttpNode.js +6 -4
  60. package/build/src/runtime/store/HttpNode.js.map +1 -1
  61. package/build/src/runtime/store/HttpWeb.d.ts +1 -0
  62. package/build/src/runtime/store/HttpWeb.js +4 -0
  63. package/build/src/runtime/store/HttpWeb.js.map +1 -1
  64. package/build/src/runtime/store/SdkBase.d.ts +1 -1
  65. package/package.json +1 -1
  66. package/src/Platform.ts +12 -0
  67. package/src/authorization/OAuth2Authorization.ts +1 -1
  68. package/src/authorization/OidcAuthorization.ts +4 -0
  69. package/src/authorization/Utils.ts +1 -1
  70. package/src/authorization/lib/SecurityProcessor.ts +141 -0
  71. package/src/authorization/lib/Utils.ts +89 -0
  72. package/src/lib/transformers/PayloadSerializer.ts +2 -4
  73. package/src/models/SerializablePayload.ts +2 -1
  74. package/src/models/data/DataAssociation.ts +189 -0
  75. package/src/models/data/DataAssociationSchema.ts +32 -0
  76. package/src/models/data/DataEntity.ts +496 -0
  77. package/src/models/data/DataModel.ts +206 -0
  78. package/src/models/data/DataNamespace.ts +503 -0
  79. package/src/models/data/DataProperty.ts +306 -0
  80. package/src/models/data/DataPropertySchema.ts +156 -0
  81. package/src/models/legacy/Normalizer.ts +1 -1
  82. package/src/models/store/File.ts +55 -1
  83. package/src/runtime/store/FilesSdk.ts +95 -9
  84. package/src/runtime/store/Http.ts +2 -0
  85. package/src/runtime/store/HttpNode.ts +7 -4
  86. package/src/runtime/store/HttpWeb.ts +5 -0
  87. package/src/runtime/store/SdkBase.ts +1 -1
@@ -0,0 +1,159 @@
1
+ import { IThing, Thing } from "../Thing.js";
2
+ import { DataNamespace } from "./DataNamespace.js";
3
+ import { IDataPropertySchema } from "./DataPropertySchema.js";
4
+ export declare type DataPropertyType = 'string' | 'number' | 'nil' | 'boolean' | 'date' | 'datetime' | 'time' | 'bytes' | 'any' | 'file';
5
+ export declare const DataPropertyTypes: DataPropertyType[];
6
+ export declare enum DataPropertyList {
7
+ string = "string",
8
+ number = "number",
9
+ nil = "nil",
10
+ boolean = "boolean",
11
+ date = "date",
12
+ datetime = "datetime",
13
+ time = "time",
14
+ bytes = "bytes",
15
+ any = "any",
16
+ file = "file"
17
+ }
18
+ export declare const Kind = "Core#DataProperty";
19
+ export interface IPropertySchema<T> {
20
+ /**
21
+ * Whether it is a general schema for the property.
22
+ * All other schemas inherit from this one. This allows creating global schema description
23
+ * like examples, default values, minimum value, etc and then use it as a base to generate specific formats.
24
+ *
25
+ * A property may not have a global schema.
26
+ */
27
+ global?: boolean;
28
+ /**
29
+ * The mime type this schema describes.
30
+ * For JSON it is `application/json`, for XML it is `application/xml` (or `text/xml`) adn so on.
31
+ *
32
+ * Note, when this value is missing then it is assumed that the schema is `global`.
33
+ */
34
+ format?: string;
35
+ /**
36
+ * The schema definition.
37
+ */
38
+ value: IDataPropertySchema<T>;
39
+ }
40
+ export interface IDataProperty {
41
+ kind: typeof Kind;
42
+ /**
43
+ * The key of the namespace.
44
+ */
45
+ key: string;
46
+ /**
47
+ * The data property description.
48
+ */
49
+ info: IThing;
50
+ /**
51
+ * Wether the data property is required.
52
+ */
53
+ required?: boolean;
54
+ /**
55
+ * Whether the data property allows multiple items.
56
+ */
57
+ multiple?: boolean;
58
+ /**
59
+ * Whether this property describes a primary key of the entity.
60
+ */
61
+ primary?: boolean;
62
+ /**
63
+ * Whether this property describes an indexed property of the entity.
64
+ */
65
+ index?: boolean;
66
+ /**
67
+ * Optional general purpose tags for the UI.
68
+ */
69
+ tags?: string[];
70
+ /**
71
+ * For future use.
72
+ *
73
+ * The keys of the taxonomy items associated with the property.
74
+ */
75
+ taxonomy?: string[];
76
+ /**
77
+ * The data type for this property.
78
+ * Note, not all schemas support the same type. For example, defining `sint32`
79
+ * works for protocol buffers but does not for JSON. In such case we use default
80
+ * translation `sint32` -> `number`. Another way it to create
81
+ * a derivative entity for specific schema to describe specific schema case.
82
+ */
83
+ type: DataPropertyType;
84
+ /**
85
+ * While the `DataProperty` describes the general shape of the data and can be used to
86
+ * model the structure of the data in the system, a schema describes hwo the data
87
+ * should be serialized into a specific format. This allows adding example values,
88
+ * default values, specifying data format, etc. The assumption here is
89
+ * that with enough specifics provided by the user (a domain specialist)
90
+ * we can automatically generate a schema for the given format.
91
+ */
92
+ schemas?: IPropertySchema<unknown>[];
93
+ }
94
+ export declare class DataProperty {
95
+ protected root: DataNamespace;
96
+ kind: string;
97
+ key: string;
98
+ /**
99
+ * The description of the data namespace.
100
+ */
101
+ info: Thing;
102
+ /**
103
+ * Wether the data property is required.
104
+ */
105
+ required?: boolean;
106
+ /**
107
+ * Whether the data property allows multiple items.
108
+ */
109
+ multiple?: boolean;
110
+ /**
111
+ * Whether this property describes a primary key of the entity.
112
+ */
113
+ primary?: boolean;
114
+ /**
115
+ * Whether this property describes an indexed property of the entity.
116
+ */
117
+ index?: boolean;
118
+ /**
119
+ * Optional general purpose tags for the UI.
120
+ */
121
+ tags: string[];
122
+ /**
123
+ * Reserved for future use.
124
+ *
125
+ * The keys of the taxonomy items associated with the property.
126
+ */
127
+ taxonomy: string[];
128
+ /**
129
+ * The data type for this property.
130
+ * Note, not all schemas support the same type. For example, defining `sint32`
131
+ * works for protocol buffers but does not for JSON. In such case we use default
132
+ * translation `sint32` -> `number`. Another way it to create
133
+ * a derivative entity for specific schema to describe specific schema case.
134
+ */
135
+ type: DataPropertyType;
136
+ /**
137
+ * While the `DataProperty` describes the general shape of the data and can be used to
138
+ * model the structure of the data in the system, a schema describes hwo the data
139
+ * should be serialized into a specific format. This allows adding example values,
140
+ * default values, specifying data format, etc. The assumption here is
141
+ * that with enough specifics provided by the user (a domain specialist)
142
+ * we can automatically generate a schema for the given format.
143
+ */
144
+ schemas: IPropertySchema<unknown>[];
145
+ static get supportedTypes(): DataPropertyType[];
146
+ static fromName(root: DataNamespace, name: string): DataProperty;
147
+ static fromType(root: DataNamespace, type: DataPropertyType): DataProperty;
148
+ /**
149
+ * @param input The data property definition to restore.
150
+ */
151
+ constructor(root: DataNamespace, input?: string | IDataProperty);
152
+ new(init: IDataProperty): void;
153
+ static isDataProperty(input: unknown): boolean;
154
+ toJSON(): IDataProperty;
155
+ /**
156
+ * Removes self from the parent entity and the namespace definition.
157
+ */
158
+ remove(): void;
159
+ }
@@ -0,0 +1,216 @@
1
+ import { Thing } from "../Thing.js";
2
+ import v4 from '../../lib/uuid.js';
3
+ export const DataPropertyTypes = [
4
+ 'string', 'number', 'nil', 'boolean', 'date', 'datetime', 'time', 'bytes', 'any', 'file'
5
+ ];
6
+ export var DataPropertyList;
7
+ (function (DataPropertyList) {
8
+ DataPropertyList["string"] = "string";
9
+ DataPropertyList["number"] = "number";
10
+ DataPropertyList["nil"] = "nil";
11
+ DataPropertyList["boolean"] = "boolean";
12
+ DataPropertyList["date"] = "date";
13
+ DataPropertyList["datetime"] = "datetime";
14
+ DataPropertyList["time"] = "time";
15
+ DataPropertyList["bytes"] = "bytes";
16
+ DataPropertyList["any"] = "any";
17
+ DataPropertyList["file"] = "file";
18
+ })(DataPropertyList || (DataPropertyList = {}));
19
+ export const Kind = 'Core#DataProperty';
20
+ export class DataProperty {
21
+ root;
22
+ kind = Kind;
23
+ key = '';
24
+ /**
25
+ * The description of the data namespace.
26
+ */
27
+ info = Thing.fromName('');
28
+ /**
29
+ * Wether the data property is required.
30
+ */
31
+ required;
32
+ /**
33
+ * Whether the data property allows multiple items.
34
+ */
35
+ multiple;
36
+ /**
37
+ * Whether this property describes a primary key of the entity.
38
+ */
39
+ primary;
40
+ /**
41
+ * Whether this property describes an indexed property of the entity.
42
+ */
43
+ index;
44
+ /**
45
+ * Optional general purpose tags for the UI.
46
+ */
47
+ tags = [];
48
+ /**
49
+ * Reserved for future use.
50
+ *
51
+ * The keys of the taxonomy items associated with the property.
52
+ */
53
+ taxonomy = [];
54
+ /**
55
+ * The data type for this property.
56
+ * Note, not all schemas support the same type. For example, defining `sint32`
57
+ * works for protocol buffers but does not for JSON. In such case we use default
58
+ * translation `sint32` -> `number`. Another way it to create
59
+ * a derivative entity for specific schema to describe specific schema case.
60
+ */
61
+ type = 'string';
62
+ /**
63
+ * While the `DataProperty` describes the general shape of the data and can be used to
64
+ * model the structure of the data in the system, a schema describes hwo the data
65
+ * should be serialized into a specific format. This allows adding example values,
66
+ * default values, specifying data format, etc. The assumption here is
67
+ * that with enough specifics provided by the user (a domain specialist)
68
+ * we can automatically generate a schema for the given format.
69
+ */
70
+ schemas = [];
71
+ static get supportedTypes() {
72
+ return [...DataPropertyTypes];
73
+ }
74
+ static fromName(root, name) {
75
+ const property = new DataProperty(root);
76
+ property.info = Thing.fromName(name);
77
+ return property;
78
+ }
79
+ static fromType(root, type) {
80
+ const assoc = new DataProperty(root);
81
+ assoc.type = type;
82
+ return assoc;
83
+ }
84
+ /**
85
+ * @param input The data property definition to restore.
86
+ */
87
+ constructor(root, input) {
88
+ this.root = root;
89
+ let init;
90
+ if (typeof input === 'string') {
91
+ init = JSON.parse(input);
92
+ }
93
+ else if (typeof input === 'object') {
94
+ init = input;
95
+ }
96
+ else {
97
+ init = {
98
+ kind: Kind,
99
+ key: v4(),
100
+ info: Thing.fromName('').toJSON(),
101
+ type: 'string',
102
+ };
103
+ }
104
+ this.new(init);
105
+ }
106
+ new(init) {
107
+ if (!DataProperty.isDataProperty(init)) {
108
+ throw new Error(`Not a data property.`);
109
+ }
110
+ const { info, key = v4(), kind = Kind, multiple, required, type = DataPropertyList.string, index, primary, tags, taxonomy, schemas } = init;
111
+ this.kind = kind;
112
+ this.key = key;
113
+ this.type = type;
114
+ if (info) {
115
+ this.info = new Thing(info);
116
+ }
117
+ else {
118
+ this.info = Thing.fromName('');
119
+ }
120
+ if (typeof multiple === 'boolean') {
121
+ this.multiple = multiple;
122
+ }
123
+ else {
124
+ this.multiple = undefined;
125
+ }
126
+ if (typeof required === 'boolean') {
127
+ this.required = required;
128
+ }
129
+ else {
130
+ this.required = undefined;
131
+ }
132
+ if (typeof index === 'boolean') {
133
+ this.index = index;
134
+ }
135
+ else {
136
+ this.index = undefined;
137
+ }
138
+ if (typeof primary === 'boolean') {
139
+ this.primary = primary;
140
+ }
141
+ else {
142
+ this.primary = undefined;
143
+ }
144
+ if (Array.isArray(tags)) {
145
+ this.tags = [...tags];
146
+ }
147
+ else {
148
+ this.tags = [];
149
+ }
150
+ if (Array.isArray(taxonomy)) {
151
+ this.taxonomy = [...taxonomy];
152
+ }
153
+ else {
154
+ this.taxonomy = [];
155
+ }
156
+ if (Array.isArray(schemas)) {
157
+ this.schemas = schemas.map(i => ({ ...i }));
158
+ }
159
+ else {
160
+ this.schemas = [];
161
+ }
162
+ }
163
+ static isDataProperty(input) {
164
+ const typed = input;
165
+ if (!input || typed.kind !== Kind) {
166
+ return false;
167
+ }
168
+ return true;
169
+ }
170
+ toJSON() {
171
+ const result = {
172
+ kind: Kind,
173
+ info: this.info.toJSON(),
174
+ key: this.key,
175
+ type: this.type || DataPropertyList.string,
176
+ };
177
+ if (typeof this.index === 'boolean') {
178
+ result.index = this.index;
179
+ }
180
+ if (typeof this.primary === 'boolean') {
181
+ result.primary = this.primary;
182
+ }
183
+ if (typeof this.multiple === 'boolean') {
184
+ result.multiple = this.multiple;
185
+ }
186
+ if (typeof this.required === 'boolean') {
187
+ result.required = this.required;
188
+ }
189
+ if (Array.isArray(this.tags) && this.tags.length) {
190
+ result.tags = [...this.tags];
191
+ }
192
+ if (Array.isArray(this.taxonomy) && this.taxonomy.length) {
193
+ result.taxonomy = [...this.taxonomy];
194
+ }
195
+ if (Array.isArray(this.schemas) && this.schemas.length) {
196
+ result.schemas = this.schemas.map(i => ({ ...i }));
197
+ }
198
+ return result;
199
+ }
200
+ /**
201
+ * Removes self from the parent entity and the namespace definition.
202
+ */
203
+ remove() {
204
+ const { root } = this;
205
+ const entity = root.definitions.entities.find(i => i.properties.some(j => j === this));
206
+ if (entity) {
207
+ const assocIndex = entity.properties.findIndex(i => i === this);
208
+ entity.properties.splice(assocIndex, 1);
209
+ }
210
+ const defIndex = this.root.definitions.properties.findIndex(i => i.key === this.key);
211
+ if (defIndex >= 0) {
212
+ this.root.definitions.properties.splice(defIndex, 1);
213
+ }
214
+ }
215
+ }
216
+ //# sourceMappingURL=DataProperty.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataProperty.js","sourceRoot":"","sources":["../../../../src/models/data/DataProperty.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAMnC,MAAM,CAAC,MAAM,iBAAiB,GAAuB;IACnD,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MA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| 'uint64' | 'sint32' | 'sint64' | 'fixed32' | 'fixed64' | 'sfixed32' | 'sfixed64';
2
+ export declare const NumberFormats: NumberFormat[];
3
+ export declare enum NumberFormatList {
4
+ integer = "integer",
5
+ float = "float",
6
+ int32 = "int32",
7
+ int64 = "int64",
8
+ uint32 = "uint32",
9
+ uint64 = "uint64",
10
+ sint32 = "sint32",
11
+ sint64 = "sint64",
12
+ fixed32 = "fixed32",
13
+ fixed64 = "fixed64",
14
+ sfixed32 = "sfixed32",
15
+ sfixed64 = "sfixed64",
16
+ double = "double"
17
+ }
18
+ export declare type DateFormat = 'rfc3339' | 'rfc2616';
19
+ export declare const DateFormats: DateFormat[];
20
+ export declare enum DateFormatList {
21
+ /**
22
+ * The "date-time" notation of RFC3339
23
+ */
24
+ rfc3339 = "rfc3339",
25
+ /**
26
+ * The format defined in RFC2616.
27
+ */
28
+ rfc2616 = "rfc2616"
29
+ }
30
+ /**
31
+ * The difference between the DataProperty and this is that the `DataProperty` describes the general shape of
32
+ * the data and `IDataPropertySchema` describes how this property is translated into a specific format
33
+ * (like JSON, Protocol Buffer, XML, etc)
34
+ */
35
+ export interface IDataPropertySchema<T> {
36
+ /**
37
+ * The default value for the property.
38
+ */
39
+ default?: T;
40
+ /**
41
+ * Enum values for the property.
42
+ */
43
+ enum?: T[];
44
+ /**
45
+ * The example value for the property.
46
+ */
47
+ examples?: T[];
48
+ /**
49
+ * The format of a `number` or `datetime` type.
50
+ */
51
+ format?: NumberFormat | DateFormat;
52
+ /**
53
+ * Minimum length of the string or a file. Value MUST be equal to or greater than 0.
54
+ */
55
+ minLength?: number;
56
+ /**
57
+ * The minimum length of the string or a file. Value MUST be equal to or greater than 0.
58
+ */
59
+ maxLength?: number;
60
+ /**
61
+ * Regular expression that this string MUST match.
62
+ */
63
+ pattern?: string;
64
+ /**
65
+ * The minimum value.
66
+ */
67
+ minimum?: number;
68
+ /**
69
+ * The maximum value.
70
+ */
71
+ maximum?: number;
72
+ /**
73
+ * A numeric instance is valid against "multipleOf" if the result of dividing the instance by this
74
+ * value is an integer.
75
+ */
76
+ multipleOf?: number;
77
+ /**
78
+ * A list of valid content-type strings for the file. The file type `*\/*` is a valid value.
79
+ */
80
+ fileTypes?: string[];
81
+ /**
82
+ * Describes XML specific serialization.
83
+ */
84
+ xml?: {
85
+ /**
86
+ * Whether is property should be represented as an attribute of the parent entity.
87
+ *
88
+ * ```
89
+ * <Person name="John Doe"></Person>
90
+ * ```
91
+ */
92
+ attribute?: boolean;
93
+ /**
94
+ * The name of the attribute or a wrapped property to use when serializing the property.
95
+ *
96
+ * ```
97
+ * <Person fullName="John Doe"></Person>
98
+ * ```
99
+ */
100
+ name?: string;
101
+ /**
102
+ * When the property is an array (has the `multiple` set to true)
103
+ * then it tells that the list of values should be wrapped with a parent
104
+ * element:
105
+ *
106
+ * ```
107
+ * <Person>
108
+ * <Person fullName="John Doe"></Person>
109
+ * </Person>
110
+ * ```
111
+ *
112
+ * Use this with the combination with `name` to describe the name of the wrapped
113
+ * element
114
+ *
115
+ * ```
116
+ * <people>
117
+ * <Person fullName="John Doe"></Person>
118
+ * </people>
119
+ * ```
120
+ *
121
+ * Note, this is mutually exclusive with `attribute`.
122
+ */
123
+ wrapped?: boolean;
124
+ };
125
+ }
@@ -0,0 +1,33 @@
1
+ export const NumberFormats = [
2
+ 'integer', 'float', 'long', 'double', 'int32', 'int64', 'uint32', 'uint64', 'sint32', 'sint64', 'fixed32', 'fixed64',
3
+ 'sfixed32', 'sfixed64'
4
+ ];
5
+ export var NumberFormatList;
6
+ (function (NumberFormatList) {
7
+ NumberFormatList["integer"] = "integer";
8
+ NumberFormatList["float"] = "float";
9
+ NumberFormatList["int32"] = "int32";
10
+ NumberFormatList["int64"] = "int64";
11
+ NumberFormatList["uint32"] = "uint32";
12
+ NumberFormatList["uint64"] = "uint64";
13
+ NumberFormatList["sint32"] = "sint32";
14
+ NumberFormatList["sint64"] = "sint64";
15
+ NumberFormatList["fixed32"] = "fixed32";
16
+ NumberFormatList["fixed64"] = "fixed64";
17
+ NumberFormatList["sfixed32"] = "sfixed32";
18
+ NumberFormatList["sfixed64"] = "sfixed64";
19
+ NumberFormatList["double"] = "double";
20
+ })(NumberFormatList || (NumberFormatList = {}));
21
+ export const DateFormats = ['rfc3339', 'rfc2616'];
22
+ export var DateFormatList;
23
+ (function (DateFormatList) {
24
+ /**
25
+ * The "date-time" notation of RFC3339
26
+ */
27
+ DateFormatList["rfc3339"] = "rfc3339";
28
+ /**
29
+ * The format defined in RFC2616.
30
+ */
31
+ DateFormatList["rfc2616"] = "rfc2616";
32
+ })(DateFormatList || (DateFormatList = {}));
33
+ //# sourceMappingURL=DataPropertySchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataPropertySchema.js","sourceRoot":"","sources":["../../../../src/models/data/DataPropertySchema.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,aAAa,GAAmB;IAC3C,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS;IACpH,UAAU,EAAE,UAAU;CACvB,CAAC;AAEF,MAAM,CAAN,IAAY,gBAcX;AAdD,WAAY,gBAAgB;IAC1B,uCAAmB,CAAA;IACnB,mCAAe,CAAA;IACf,mCAAe,CAAA;IACf,mCAAe,CAAA;IACf,qCAAiB,CAAA;IACjB,qCAAiB,CAAA;IACjB,qCAAiB,CAAA;IACjB,qCAAiB,CAAA;IACjB,uCAAmB,CAAA;IACnB,uCAAmB,CAAA;IACnB,yCAAqB,CAAA;IACrB,yCAAqB,CAAA;IACrB,qCAAiB,CAAA;AACnB,CAAC,EAdW,gBAAgB,KAAhB,gBAAgB,QAc3B;AAGD,MAAM,CAAC,MAAM,WAAW,GAAiB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;AAChE,MAAM,CAAN,IAAY,cASX;AATD,WAAY,cAAc;IACxB;;OAEG;IACH,qCAAmB,CAAA;IACnB;;OAEG;IACH,qCAAmB,CAAA;AACrB,CAAC,EATW,cAAc,KAAd,cAAc,QASzB"}
@@ -1,5 +1,5 @@
1
1
  import { Kind as AuthKind } from '../RequestAuthorization.js';
2
- import { hasBuffer } from '../../lib/transformers/PayloadSerializer.js';
2
+ import { hasBuffer } from '../../Platform.js';
3
3
  export class Normalizer {
4
4
  static normalizeRequest(request) {
5
5
  if (!request) {
@@ -1 +1 @@
1
- {"version":3,"file":"Normalizer.js","sourceRoot":"","sources":["../../../../src/models/legacy/Normalizer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAyB,IAAI,IAAI,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAC;AAExE,MAAM,OAAO,UAAU;IACrB,MAAM,CAAC,gBAAgB,CAAC,OAAgB;QACtC,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,SAAS,CAAC;SAClB;QACD,MAAM,KAAK,GAAG,EAAE,GAAG,OAAiB,EAAS,CAAC;QAC9C,IAAI,KAAK,CAAC,aAAa,EAAE;YACvB,MAAM,KAAK,GAAG,KAAwB,CAAC;YACvC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;gBACnB,KAAK,CAAC,QAAQ,GAAG,EAAE,CAAC;aACrB;YACD,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC;YAC5D,OAAO,KAAK,CAAC,aAAa,CAAC;SAC5B;QACD,MAAM,QAAQ,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;QAC7C,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YACjC,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,QAAQ,CAAC,OAAO,CAAC,GAAG,CA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C,OAAO,IAAI,CAAC;SACb;QACD,IAAI,IAAI,YAAY,WAAW,EAAE;YAC/B,OAAO,IAAI,CAAC;SACb;QACD,MAAM,KAAK,GAAG,IAAgC,CAAC;QAC/C,IAAI,KAAK,CAAC,IAAI,KAAK,aAAa,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,SAAS,CAAC,EAAE;YAC3E,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAC9C,OAAO,MAAM,CAAC;SACf;QACD,IAAI,SAAS,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE;YACxC,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;SAChC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF"}
@@ -204,6 +204,23 @@ export declare class StoredFile {
204
204
  * @param user The user key to compare.
205
205
  */
206
206
  static updateByMeMeta(file: IFile, user: string): void;
207
+ /**
208
+ * Static method to set the `lastModified` property on a file without creating an instance of a file meta.
209
+ * Useful when the meta kind is unknown.
210
+ *
211
+ * @param file The file to update. Note, this method mutates the file.
212
+ * @param user The user that modifies the file.
213
+ * @returns The same file.
214
+ */
215
+ static setLastModified(file: IFile, user: IUser): IFile;
216
+ /**
217
+ * Similar to the instance method `setDeleted()` but without creating an instance of the file when the type is unknown.
218
+ *
219
+ * @param file The file to change. Note, this operation mutates the file.
220
+ * @param user The deleting user
221
+ * @returns The same file reference.
222
+ */
223
+ static setDeleted(file: IFile, user: IUser): IFile;
207
224
  }
208
225
  export declare class File extends StoredFile {
209
226
  [permissionsSymbol]: ReadonlyArray<IPermission>;
@@ -207,7 +207,7 @@ export class StoredFile {
207
207
  throw new Error(`The user is required.`);
208
208
  }
209
209
  if (user.kind !== UserKind) {
210
- throw new Error(`Invalid value for the user when setting "lastModified".`);
210
+ throw new Error(`Invalid value for the user when setting "deletedInfo".`);
211
211
  }
212
212
  this[deletedSymbol] = true;
213
213
  this[deletedInfoSymbol] = {
@@ -281,6 +281,58 @@ export class StoredFile {
281
281
  file.lastModified.byMe = file.lastModified.user === user;
282
282
  }
283
283
  }
284
+ /**
285
+ * Static method to set the `lastModified` property on a file without creating an instance of a file meta.
286
+ * Useful when the meta kind is unknown.
287
+ *
288
+ * @param file The file to update. Note, this method mutates the file.
289
+ * @param user The user that modifies the file.
290
+ * @returns The same file.
291
+ */
292
+ static setLastModified(file, user) {
293
+ if (!file) {
294
+ throw new Error(`The file is required.`);
295
+ }
296
+ if (!user) {
297
+ throw new Error(`The user is required.`);
298
+ }
299
+ if (user.kind !== UserKind) {
300
+ throw new Error(`Invalid value for the user when setting "lastModified".`);
301
+ }
302
+ file.lastModified = {
303
+ byMe: false,
304
+ time: Date.now(),
305
+ user: user.key,
306
+ name: user.name,
307
+ };
308
+ return file;
309
+ }
310
+ /**
311
+ * Similar to the instance method `setDeleted()` but without creating an instance of the file when the type is unknown.
312
+ *
313
+ * @param file The file to change. Note, this operation mutates the file.
314
+ * @param user The deleting user
315
+ * @returns The same file reference.
316
+ */
317
+ static setDeleted(file, user) {
318
+ if (!file) {
319
+ throw new Error(`The file is required.`);
320
+ }
321
+ if (!user) {
322
+ throw new Error(`The user is required.`);
323
+ }
324
+ if (user.kind !== UserKind) {
325
+ throw new Error(`Invalid value for the user when setting "deletedInfo".`);
326
+ }
327
+ file.deleted = true;
328
+ file.deletedInfo = {
329
+ byMe: false,
330
+ time: Date.now(),
331
+ user: user.key,
332
+ name: user.name,
333
+ };
334
+ return file;
335
+ }
284
336
  }
285
337
  export class File extends StoredFile {
286
338
  [permissionsSymbol] = [];