@warp-drive/legacy 5.8.0-beta.0 → 5.8.0-beta.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.
Files changed (214) hide show
  1. package/README.md +16 -26
  2. package/declarations/adapter/error.d.ts +7 -7
  3. package/declarations/adapter/json-api.d.ts +6 -8
  4. package/declarations/adapter/rest.d.ts +26 -112
  5. package/declarations/adapter.d.ts +6 -8
  6. package/declarations/compat/-private.d.ts +1 -1
  7. package/declarations/compat/builders/find-all.d.ts +6 -6
  8. package/declarations/compat/builders/find-record.d.ts +8 -8
  9. package/declarations/compat/builders/query.d.ts +12 -12
  10. package/declarations/compat/extensions.d.ts +1 -1
  11. package/declarations/compat/legacy-network-handler/minimum-adapter-interface.d.ts +7 -9
  12. package/declarations/compat/legacy-network-handler/minimum-serializer-interface.d.ts +20 -30
  13. package/declarations/compat/utils.d.ts +17 -17
  14. package/declarations/compat.d.ts +35 -11
  15. package/declarations/index.d.ts +70 -0
  16. package/declarations/model/-private/attr.d.ts +5 -6
  17. package/declarations/model/-private/belongs-to.d.ts +4 -5
  18. package/declarations/model/-private/has-many.d.ts +4 -5
  19. package/declarations/model/-private/hooks.d.ts +1 -1
  20. package/declarations/model/-private/legacy-relationships-support.d.ts +2 -2
  21. package/declarations/model/-private/model.d.ts +18 -59
  22. package/declarations/model/-private/promise-many-array.d.ts +0 -18
  23. package/declarations/model/-private/record-state.d.ts +1 -1
  24. package/declarations/model/-private/references/belongs-to.d.ts +19 -29
  25. package/declarations/model/-private/references/has-many.d.ts +14 -16
  26. package/declarations/model/migration-support.d.ts +46 -21
  27. package/declarations/model-fragments/extensions/fragment-array.d.ts +16 -0
  28. package/declarations/model-fragments/extensions/fragment.d.ts +15 -0
  29. package/declarations/model-fragments/hooks/model-for.d.ts +20 -0
  30. package/declarations/model-fragments/index.d.ts +5 -0
  31. package/declarations/model-fragments/instance-initializers/fragment-extensions.d.ts +9 -0
  32. package/declarations/model-fragments/utilities/with-array-defaults.d.ts +15 -0
  33. package/declarations/model-fragments/utilities/with-fragment-array-defaults.d.ts +20 -0
  34. package/declarations/model-fragments/utilities/with-fragment-defaults.d.ts +19 -0
  35. package/declarations/model-fragments/utilities/with-legacy.d.ts +3 -0
  36. package/declarations/model-fragments.d.ts +9 -0
  37. package/declarations/model.d.ts +2 -2
  38. package/declarations/serializer/-private/embedded-records-mixin.d.ts +1 -6
  39. package/declarations/serializer/-private/transforms/boolean.d.ts +2 -2
  40. package/declarations/serializer/-private/transforms/date.d.ts +2 -2
  41. package/declarations/serializer/-private/transforms/number.d.ts +1 -1
  42. package/declarations/serializer/-private/transforms/string.d.ts +1 -1
  43. package/declarations/serializer/json-api.d.ts +11 -12
  44. package/declarations/serializer/json.d.ts +9 -11
  45. package/declarations/serializer/rest.d.ts +4 -6
  46. package/declarations/serializer.d.ts +9 -12
  47. package/dist/{-private-8UmnAf9J.js → -private-BG3bMiKp.js} +3 -2
  48. package/dist/adapter/-private.js +1 -1
  49. package/dist/adapter/error.js +14 -15
  50. package/dist/adapter/json-api.js +4 -1
  51. package/dist/adapter/rest.js +38 -125
  52. package/dist/adapter.js +6 -8
  53. package/dist/compat/-private.js +1 -1
  54. package/dist/compat/builders.js +26 -26
  55. package/dist/compat/utils.js +17 -18
  56. package/dist/compat.js +61 -43
  57. package/dist/{errors-8kD2mSe_.js → errors-Cz5KrzBk.js} +115 -122
  58. package/dist/hooks-D6diaM34.js +74 -0
  59. package/dist/index.js +195 -0
  60. package/dist/{json-Et4mt_LM.js → json-ChdEfB0X.js} +18 -35
  61. package/dist/model/-private.js +1 -1
  62. package/dist/model/migration-support.js +59 -27
  63. package/dist/model-for-CqXsIKws.js +221 -0
  64. package/dist/model-fragments.js +76 -0
  65. package/dist/model.js +18 -90
  66. package/dist/{schema-provider-DQu4Rjco.js → schema-provider-DJCV_6AF.js} +50 -95
  67. package/dist/{serialize-into-hash-CS0MIv4F.js → serialize-into-hash-DPZYoF-i.js} +1 -1
  68. package/dist/serializer/json-api.js +18 -45
  69. package/dist/serializer/json.js +1 -1
  70. package/dist/serializer/rest.js +14 -21
  71. package/dist/serializer/transform.js +15 -6
  72. package/dist/serializer.js +9 -13
  73. package/dist/store.js +5 -1
  74. package/dist/unpkg/dev/-private-DtjBbEgy.js +1206 -0
  75. package/dist/unpkg/dev/adapter/-private.js +1 -0
  76. package/dist/unpkg/dev/adapter/error.js +335 -0
  77. package/dist/unpkg/dev/adapter/json-api.js +271 -0
  78. package/dist/unpkg/dev/adapter/rest.js +1171 -0
  79. package/dist/unpkg/dev/adapter.js +1252 -0
  80. package/dist/unpkg/dev/compat/-private.js +1 -0
  81. package/dist/unpkg/dev/compat/builders.js +275 -0
  82. package/dist/unpkg/dev/compat/extensions.js +242 -0
  83. package/dist/unpkg/dev/compat/utils.js +223 -0
  84. package/dist/unpkg/dev/compat.js +1147 -0
  85. package/dist/unpkg/dev/errors-DmGGJr3T.js +2562 -0
  86. package/dist/unpkg/dev/hooks-CkYiE6Ud.js +73 -0
  87. package/dist/unpkg/dev/index.js +197 -0
  88. package/dist/unpkg/dev/json-Cu1LNgmQ.js +1256 -0
  89. package/dist/unpkg/dev/model/-private.js +1 -0
  90. package/dist/unpkg/dev/model/migration-support.js +553 -0
  91. package/dist/unpkg/dev/model-for-CqXsIKws.js +221 -0
  92. package/dist/unpkg/dev/model-fragments.js +76 -0
  93. package/dist/unpkg/dev/model.js +678 -0
  94. package/dist/unpkg/dev/runtime-BPCpkOf1-BKOwiRJp.js +65 -0
  95. package/dist/unpkg/dev/schema-provider-DDVYxmUV.js +2186 -0
  96. package/dist/unpkg/dev/serialize-into-hash-B2xDbuo5.js +259 -0
  97. package/dist/unpkg/dev/serializer/json-api.js +649 -0
  98. package/dist/unpkg/dev/serializer/json.js +4 -0
  99. package/dist/unpkg/dev/serializer/rest.js +1242 -0
  100. package/dist/unpkg/dev/serializer/transform.js +278 -0
  101. package/dist/unpkg/dev/serializer.js +248 -0
  102. package/dist/unpkg/dev/store.js +637 -0
  103. package/dist/unpkg/dev/util-DvanW33H.js +20 -0
  104. package/dist/unpkg/dev/utils-BhvS1iTS.js +8 -0
  105. package/dist/unpkg/dev-deprecated/-private-DtjBbEgy.js +1206 -0
  106. package/dist/unpkg/dev-deprecated/adapter/-private.js +1 -0
  107. package/dist/unpkg/dev-deprecated/adapter/error.js +335 -0
  108. package/dist/unpkg/dev-deprecated/adapter/json-api.js +271 -0
  109. package/dist/unpkg/dev-deprecated/adapter/rest.js +1171 -0
  110. package/dist/unpkg/dev-deprecated/adapter.js +1252 -0
  111. package/dist/unpkg/dev-deprecated/compat/-private.js +1 -0
  112. package/dist/unpkg/dev-deprecated/compat/builders.js +275 -0
  113. package/dist/unpkg/dev-deprecated/compat/extensions.js +242 -0
  114. package/dist/unpkg/dev-deprecated/compat/utils.js +223 -0
  115. package/dist/unpkg/dev-deprecated/compat.js +1147 -0
  116. package/dist/unpkg/dev-deprecated/errors-Spt6ubMd.js +2565 -0
  117. package/dist/unpkg/dev-deprecated/hooks-DOXegvhL.js +73 -0
  118. package/dist/unpkg/dev-deprecated/index.js +196 -0
  119. package/dist/unpkg/dev-deprecated/json-Cu1LNgmQ.js +1256 -0
  120. package/dist/unpkg/dev-deprecated/model/-private.js +1 -0
  121. package/dist/unpkg/dev-deprecated/model/migration-support.js +570 -0
  122. package/dist/unpkg/dev-deprecated/model-for-CqXsIKws.js +221 -0
  123. package/dist/unpkg/dev-deprecated/model-fragments.js +76 -0
  124. package/dist/unpkg/dev-deprecated/model.js +682 -0
  125. package/dist/unpkg/dev-deprecated/runtime-BPCpkOf1-BKOwiRJp.js +65 -0
  126. package/dist/unpkg/dev-deprecated/schema-provider-BP6_8N-V.js +2211 -0
  127. package/dist/unpkg/dev-deprecated/serialize-into-hash-B2xDbuo5.js +259 -0
  128. package/dist/unpkg/dev-deprecated/serializer/json-api.js +649 -0
  129. package/dist/unpkg/dev-deprecated/serializer/json.js +4 -0
  130. package/dist/unpkg/dev-deprecated/serializer/rest.js +1242 -0
  131. package/dist/unpkg/dev-deprecated/serializer/transform.js +278 -0
  132. package/dist/unpkg/dev-deprecated/serializer.js +248 -0
  133. package/dist/unpkg/dev-deprecated/store.js +637 -0
  134. package/dist/unpkg/dev-deprecated/util-CWr5WQOT.js +24 -0
  135. package/dist/unpkg/dev-deprecated/utils-C9PJehtL.js +12 -0
  136. package/dist/unpkg/prod/-private-BdyZaGEh.js +971 -0
  137. package/dist/unpkg/prod/adapter/-private.js +1 -0
  138. package/dist/unpkg/prod/adapter/error.js +330 -0
  139. package/dist/unpkg/prod/adapter/json-api.js +266 -0
  140. package/dist/unpkg/prod/adapter/rest.js +1134 -0
  141. package/dist/unpkg/prod/adapter.js +1219 -0
  142. package/dist/unpkg/prod/compat/-private.js +1 -0
  143. package/dist/unpkg/prod/compat/builders.js +210 -0
  144. package/dist/unpkg/prod/compat/extensions.js +232 -0
  145. package/dist/unpkg/prod/compat/utils.js +218 -0
  146. package/dist/unpkg/prod/compat.js +727 -0
  147. package/dist/unpkg/prod/errors-BGVFCBmi.js +2314 -0
  148. package/dist/unpkg/prod/hooks-BztVA_x0.js +41 -0
  149. package/dist/unpkg/prod/index.js +151 -0
  150. package/dist/unpkg/prod/json-BWrZ5546.js +1243 -0
  151. package/dist/unpkg/prod/model/-private.js +1 -0
  152. package/dist/unpkg/prod/model/migration-support.js +546 -0
  153. package/dist/unpkg/prod/model-for-CqXsIKws.js +221 -0
  154. package/dist/unpkg/prod/model-fragments.js +76 -0
  155. package/dist/unpkg/prod/model.js +593 -0
  156. package/dist/unpkg/prod/runtime-BPCpkOf1-BKOwiRJp.js +65 -0
  157. package/dist/unpkg/prod/schema-provider-DJtD_8jZ.js +1861 -0
  158. package/dist/unpkg/prod/serialize-into-hash-DGlzQteF.js +215 -0
  159. package/dist/unpkg/prod/serializer/json-api.js +592 -0
  160. package/dist/unpkg/prod/serializer/json.js +4 -0
  161. package/dist/unpkg/prod/serializer/rest.js +1210 -0
  162. package/dist/unpkg/prod/serializer/transform.js +278 -0
  163. package/dist/unpkg/prod/serializer.js +248 -0
  164. package/dist/unpkg/prod/store.js +505 -0
  165. package/dist/unpkg/prod/util-DvanW33H.js +20 -0
  166. package/dist/unpkg/prod/utils-BhvS1iTS.js +8 -0
  167. package/dist/unpkg/prod-deprecated/-private-BdyZaGEh.js +971 -0
  168. package/dist/unpkg/prod-deprecated/adapter/-private.js +1 -0
  169. package/dist/unpkg/prod-deprecated/adapter/error.js +330 -0
  170. package/dist/unpkg/prod-deprecated/adapter/json-api.js +266 -0
  171. package/dist/unpkg/prod-deprecated/adapter/rest.js +1134 -0
  172. package/dist/unpkg/prod-deprecated/adapter.js +1219 -0
  173. package/dist/unpkg/prod-deprecated/compat/-private.js +1 -0
  174. package/dist/unpkg/prod-deprecated/compat/builders.js +210 -0
  175. package/dist/unpkg/prod-deprecated/compat/extensions.js +232 -0
  176. package/dist/unpkg/prod-deprecated/compat/utils.js +218 -0
  177. package/dist/unpkg/prod-deprecated/compat.js +727 -0
  178. package/dist/unpkg/prod-deprecated/errors-CdDaK81x.js +2317 -0
  179. package/dist/unpkg/prod-deprecated/hooks-yId87yyG.js +41 -0
  180. package/dist/unpkg/prod-deprecated/index.js +150 -0
  181. package/dist/unpkg/prod-deprecated/json-BWrZ5546.js +1243 -0
  182. package/dist/unpkg/prod-deprecated/model/-private.js +1 -0
  183. package/dist/unpkg/prod-deprecated/model/migration-support.js +563 -0
  184. package/dist/unpkg/prod-deprecated/model-for-CqXsIKws.js +221 -0
  185. package/dist/unpkg/prod-deprecated/model-fragments.js +76 -0
  186. package/dist/unpkg/prod-deprecated/model.js +596 -0
  187. package/dist/unpkg/prod-deprecated/runtime-BPCpkOf1-BKOwiRJp.js +65 -0
  188. package/dist/unpkg/prod-deprecated/schema-provider-CjX55uSY.js +1904 -0
  189. package/dist/unpkg/prod-deprecated/serialize-into-hash-DGlzQteF.js +215 -0
  190. package/dist/unpkg/prod-deprecated/serializer/json-api.js +592 -0
  191. package/dist/unpkg/prod-deprecated/serializer/json.js +4 -0
  192. package/dist/unpkg/prod-deprecated/serializer/rest.js +1210 -0
  193. package/dist/unpkg/prod-deprecated/serializer/transform.js +278 -0
  194. package/dist/unpkg/prod-deprecated/serializer.js +248 -0
  195. package/dist/unpkg/prod-deprecated/store.js +505 -0
  196. package/dist/unpkg/prod-deprecated/util-B6cn-i93.js +23 -0
  197. package/dist/unpkg/prod-deprecated/utils-BUWwQwCh.js +11 -0
  198. package/logos/README.md +2 -2
  199. package/logos/logo-yellow-slab.svg +1 -0
  200. package/logos/word-mark-black.svg +1 -0
  201. package/logos/word-mark-white.svg +1 -0
  202. package/package.json +15 -7
  203. package/logos/NCC-1701-a-blue.svg +0 -4
  204. package/logos/NCC-1701-a-gold.svg +0 -4
  205. package/logos/NCC-1701-a-gold_100.svg +0 -1
  206. package/logos/NCC-1701-a-gold_base-64.txt +0 -1
  207. package/logos/NCC-1701-a.svg +0 -4
  208. package/logos/docs-badge.svg +0 -2
  209. package/logos/ember-data-logo-dark.svg +0 -12
  210. package/logos/ember-data-logo-light.svg +0 -12
  211. package/logos/social1.png +0 -0
  212. package/logos/social2.png +0 -0
  213. package/logos/warp-drive-logo-dark.svg +0 -4
  214. package/logos/warp-drive-logo-gold.svg +0 -4
@@ -7,7 +7,7 @@ import type { ResourceKey } from "@warp-drive/core/types/identifier";
7
7
  import type { ObjectValue } from "@warp-drive/core/types/json/raw";
8
8
  import type { TypedRecordInstance, TypeFromInstance } from "@warp-drive/core/types/record";
9
9
  import type { Derivation, HashFn, Transformation } from "@warp-drive/core/types/schema/concepts";
10
- import type { ArrayField, DerivedField, FieldSchema, GenericField, HashField, LegacyResourceSchema, ObjectField, ObjectSchema, ResourceSchema } from "@warp-drive/core/types/schema/fields";
10
+ import type { ArrayField, CacheableFieldSchema, DerivedField, FieldSchema, GenericField, HashField, IdentityField, LegacyResourceSchema, ObjectField, ObjectSchema, ResourceSchema } from "@warp-drive/core/types/schema/fields";
11
11
  import type { WithPartial } from "@warp-drive/core/types/utils";
12
12
  import type { Snapshot } from "../compat/-private.js";
13
13
  import type { MinimalLegacyRecord } from "./-private/model-methods.js";
@@ -56,14 +56,14 @@ interface LegacyModeRecord<T extends TypedRecordInstance> {
56
56
  }
57
57
  /**
58
58
  * A Type utility that enables quickly adding type information for the fields
59
- * defined by `import { withDefaults } from '@ember-data/model/migration-support'`.
59
+ * defined by `import { withDefaults } from '@warp-drive/legacy/model/migration-support'`.
60
60
  *
61
61
  * Example:
62
62
  *
63
63
  * ```ts
64
- * import { withDefaults, WithLegacy } from '@ember-data/model/migration-support';
65
- * import { Type } from '@warp-drive/core-types/symbols';
66
- * import type { HasMany } from '@ember-data/model';
64
+ * import { withDefaults, WithLegacy } from '@warp-drive/legacy/model/migration-support';
65
+ * import { Type } from '@warp-drive/core/types/symbols';
66
+ * import type { HasMany } from '@@warp-drive/legacy/model';
67
67
  *
68
68
  * export const UserSchema = withDefaults({
69
69
  * type: 'user',
@@ -99,14 +99,14 @@ export type WithLegacy<T extends TypedRecordInstance> = T & LegacyModeRecord<T>;
99
99
  /**
100
100
  * A function which adds the necessary fields to a schema and marks it as
101
101
  * being in LegacyMode. This is used to support the legacy features of
102
- * @ember-data/model while migrating to WarpDrive.
102
+ * @warp-drive/legacy/model while migrating to WarpDrive.
103
103
  *
104
104
  * Example:
105
105
  *
106
106
  * ```ts
107
- * import { withDefaults, WithLegacy } from '@ember-data/model/migration-support';
108
- * import { Type } from '@warp-drive/core-types/symbols';
109
- * import type { HasMany } from '@ember-data/model';
107
+ * import { withDefaults, WithLegacy } from '@warp-drive/legacy/model/migration-support';
108
+ * import { Type } from '@warp-drive/core/types/symbols';
109
+ * import type { HasMany } from '@warp-drive/legacy/model';
110
110
  *
111
111
  * export const UserSchema = withDefaults({
112
112
  * type: 'user',
@@ -141,26 +141,42 @@ export type WithLegacy<T extends TypedRecordInstance> = T & LegacyModeRecord<T>;
141
141
  * it requires with the schema service.
142
142
  *
143
143
  * ```ts
144
- * import { registerDerivations } from '@ember-data/model/migration-support';
144
+ * import { registerDerivations } from '@warp-drive/legacy/model/migration-support';
145
145
  *
146
146
  * registerDerivations(schema);
147
147
  * ```
148
148
  *
149
- * @param {LegacyResourceSchema} schema The schema to add legacy support to.
150
- * @return {LegacyResourceSchema} The schema with legacy support added.
149
+ * @param schema The schema to add legacy support to.
150
+ * @return The schema with legacy support added.
151
151
  * @public
152
152
  */
153
153
  export declare function withDefaults(schema: WithPartial<LegacyResourceSchema, "legacy" | "identity">): LegacyResourceSchema;
154
- export declare function withRestoredDeprecatedModelRequestBehaviors(schema: WithPartial<LegacyResourceSchema, "legacy" | "identity">): LegacyResourceSchema;
155
154
  /**
156
- * A function which registers the necessary derivations to support
157
- * the LegacyMode features of @ember-data/model while migrating to WarpDrive.
155
+ * Adds the necessasary fields to the schema for supporting
156
+ * the deprecated request methods on LegacyMode schemas.
158
157
  *
159
- * This must be called in order to use the fields added by:
158
+ * Use this instead of `withDefaults` to add the fields
159
+ * and behaviors necessary to support Model-Like capabilities.
160
160
  *
161
161
  * ```ts
162
- * import { withDefaults } from '@ember-data/model/migration-support';
162
+ * import { withRestoredDeprecatedModelRequestBehaviors } from '@warp-drive/legacy/model/migration-support';
163
+ *
164
+ * export const UserSchema = withRestoredDeprecatedModelRequestBehaviors({
165
+ * type: 'user',
166
+ * fields: [
167
+ * { name: 'firstName', kind: 'attribute' },
168
+ * { name: 'lastName', kind: 'attribute' },
169
+ * ]
170
+ * });
163
171
  * ```
172
+ */
173
+ export declare function withRestoredDeprecatedModelRequestBehaviors(schema: WithPartial<LegacyResourceSchema, "legacy" | "identity">): LegacyResourceSchema;
174
+ /**
175
+ * A function which registers the necessary derivations to support
176
+ * the LegacyMode features of @warp-drive/legacy/model while migrating to WarpDrive.
177
+ *
178
+ * This must be called in order to use the fields added by {@link withDefaults} or
179
+ * {@link withRestoredDeprecatedModelRequestBehaviors}.
164
180
  *
165
181
  * @param schema The schema service to register the derivations with.
166
182
  * @public
@@ -180,8 +196,8 @@ export declare function registerDerivations(schema: SchemaService): void;
180
196
  * provide their own schema information to the application.
181
197
  *
182
198
  * ```ts
183
- * import { DelegatingSchemaService } from '@ember-data/model/migration-support';
184
- * import { SchemaService } from '@warp-drive/schema-record';
199
+ * import { DelegatingSchemaService } from '@warp-drive/legacy/model/migration-support';
200
+ * import { SchemaService } from '@warp-drive/core/reactive';
185
201
  *
186
202
  * class AppStore extends Store {
187
203
  * createSchemaService() {
@@ -207,8 +223,6 @@ export interface DelegatingSchemaService {
207
223
  doesTypeExist?(type: string): boolean;
208
224
  }
209
225
  export declare class DelegatingSchemaService implements SchemaService {
210
- _preferred: SchemaService;
211
- _secondary: SchemaService;
212
226
  constructor(store: Store, schema: SchemaService);
213
227
  isDelegated(resource: ResourceKey | {
214
228
  type: string;
@@ -224,6 +238,9 @@ export declare class DelegatingSchemaService implements SchemaService {
224
238
  fields(resource: ResourceKey | {
225
239
  type: string;
226
240
  }): Map<string, FieldSchema>;
241
+ cacheFields?(resource: {
242
+ type: string;
243
+ }): Map<string, Exclude<CacheableFieldSchema, IdentityField>>;
227
244
  transformation(field: GenericField | ObjectField | ArrayField | {
228
245
  type: string;
229
246
  }): Transformation;
@@ -245,6 +262,10 @@ export declare class DelegatingSchemaService implements SchemaService {
245
262
  FM extends ObjectValue | null
246
263
  >(derivation: Derivation<R, T, FM>): void;
247
264
  registerHashFn(hashFn: HashFn): void;
265
+ CAUTION_MEGA_DANGER_ZONE_hasExtension(ext: {
266
+ kind: "object" | "array";
267
+ name: string;
268
+ }): boolean;
248
269
  CAUTION_MEGA_DANGER_ZONE_registerExtension(extension: CAUTION_MEGA_DANGER_ZONE_Extension): void;
249
270
  CAUTION_MEGA_DANGER_ZONE_resourceExtensions(resource: ResourceKey | {
250
271
  type: string;
@@ -252,4 +273,8 @@ export declare class DelegatingSchemaService implements SchemaService {
252
273
  CAUTION_MEGA_DANGER_ZONE_objectExtensions(field: ExtensibleField, resolvedType: string | null): null | ProcessedExtension["features"];
253
274
  CAUTION_MEGA_DANGER_ZONE_arrayExtensions(field: ExtensibleField): null | ProcessedExtension["features"];
254
275
  }
276
+ export interface PrivateDelegatingSchemaService extends DelegatingSchemaService {
277
+ _preferred: SchemaService;
278
+ _secondary: SchemaService;
279
+ }
255
280
  export {};
@@ -0,0 +1,16 @@
1
+ import type { Fragment } from "./fragment.js";
2
+ export declare class FragmentArray<T extends Fragment> {
3
+ isDestroying: boolean;
4
+ isDestroyed: boolean;
5
+ get hasDirtyAttributes(): boolean;
6
+ addFragment(fragment?: T): Fragment[] | undefined;
7
+ createFragment(fragment?: T): Fragment | undefined;
8
+ removeFragment(fragment?: T): void;
9
+ rollbackAttributes(): void;
10
+ }
11
+ export declare const FragmentArrayExtension: {
12
+ kind: "array";
13
+ name: "fragment-array";
14
+ features: typeof FragmentArray;
15
+ };
16
+ export default FragmentArrayExtension;
@@ -0,0 +1,15 @@
1
+ import type { PrivateReactiveResource } from "@warp-drive/core/reactive/-private";
2
+ export declare class Fragment {
3
+ isDestroying: boolean;
4
+ isDestroyed: boolean;
5
+ get hasDirtyAttributes(): boolean;
6
+ get isFragment(): boolean;
7
+ get $type(): string | null | undefined;
8
+ rollbackAttributes(this: PrivateReactiveResource): void;
9
+ }
10
+ export declare const FragmentExtension: {
11
+ kind: "object";
12
+ name: "fragment";
13
+ features: typeof Fragment;
14
+ };
15
+ export default FragmentExtension;
@@ -0,0 +1,20 @@
1
+ import type { Store } from "@warp-drive/core";
2
+ import type { ModelSchema } from "@warp-drive/core/types";
3
+ import type { TypedRecordInstance, TypeFromInstance } from "@warp-drive/core/types/record";
4
+ import type { LegacyAttributeField, LegacyRelationshipField } from "@warp-drive/core/types/schema/fields";
5
+ type KeyOrString<T> = keyof T & string extends never ? string : keyof T & string;
6
+ export declare function getShimClass<T>(store: Store, modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string): ShimModelClass<T>;
7
+ export declare class ShimModelClass<T = unknown> implements ModelSchema<T> {
8
+ __store: Store;
9
+ modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string;
10
+ constructor(store: Store, modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string);
11
+ get fields(): Map<KeyOrString<T>, "attribute" | "belongsTo" | "hasMany">;
12
+ get attributes(): Map<KeyOrString<T>, LegacyAttributeField>;
13
+ get relationshipsByName(): Map<KeyOrString<T>, LegacyRelationshipField>;
14
+ eachAttribute<K extends KeyOrString<T>>(callback: (key: K, attribute: LegacyAttributeField) => void, binding?: T): void;
15
+ eachRelationship<K extends KeyOrString<T>>(callback: (key: K, relationship: LegacyRelationshipField) => void, binding?: T): void;
16
+ eachTransformedAttribute<K extends KeyOrString<T>>(callback: (key: K, type: string | null) => void, binding?: T): void;
17
+ }
18
+ export declare function fragmentsModelFor<T extends TypedRecordInstance>(this: Store, modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string): ShimModelClass<T>;
19
+ export declare const modelFor: typeof fragmentsModelFor;
20
+ export {};
@@ -0,0 +1,5 @@
1
+ import type { WithArrayLike, WithEmberObject } from "../compat/extensions.js";
2
+ import type { Fragment } from "./extensions/fragment.js";
3
+ import type { FragmentArray } from "./extensions/fragment-array.js";
4
+ export type WithFragment<T> = T & WithEmberObject<T> & Fragment;
5
+ export type WithFragmentArray<T extends Fragment> = T & WithArrayLike<T> & FragmentArray<T>;
@@ -0,0 +1,9 @@
1
+ import type ApplicationInstance from "@ember/application/instance";
2
+ import type { SchemaService } from "@warp-drive/core/types";
3
+ export declare function registerFragmentExtensions(schema: SchemaService): void;
4
+ export declare function initialize(application: ApplicationInstance): void;
5
+ declare const _default: {
6
+ name: string;
7
+ initialize: (application: ApplicationInstance) => void;
8
+ };
9
+ export default _default;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Used as a helper to setup the relevant parts of an array
3
+ * schema and add extensions etc.
4
+ *
5
+ * @param arrayName The name of the array
6
+ * @returns The schema for an array
7
+ */
8
+ export declare function withArrayDefaults<ArrayName extends string>(arrayName: ArrayName): {
9
+ kind: "array";
10
+ name: ArrayName;
11
+ type: `array:${string}`;
12
+ options: {
13
+ arrayExtensions: string[];
14
+ };
15
+ };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Used as a helper to setup the relevant parts of a fragment-array
3
+ * schema and add extensions etc.
4
+ *
5
+ * @param fragmentArrayType The type of the fragment-array
6
+ * @param fragmentArrayName The name of the fragment-array
7
+ * @returns The schema for a fragment-array
8
+ */
9
+ export declare function withFragmentArrayDefaults<
10
+ FragmentArrayType extends string,
11
+ FragmentArrayName extends string
12
+ >(fragmentArrayType: FragmentArrayType, fragmentArrayName?: FragmentArrayName): {
13
+ kind: "schema-array";
14
+ type: `fragment:${string}`;
15
+ name: string;
16
+ options: {
17
+ arrayExtensions: string[];
18
+ defaultValue: boolean;
19
+ };
20
+ };
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Used as a helper to setup the relevant parts of a fragment schema
3
+ * and add extensions etc.
4
+ *
5
+ * @param fragmentType The type of the fragment
6
+ * @param fragmentName The optional name of the fragment. If not provided, it will default to the fragmentType.
7
+ * @returns The schema for a fragment
8
+ */
9
+ export declare function withFragmentDefaults<
10
+ FragmentType extends string,
11
+ FragmentName extends string
12
+ >(fragmentType: FragmentType, fragmentName?: FragmentName): {
13
+ kind: "schema-object";
14
+ type: `fragment:${FragmentType}`;
15
+ name: FragmentType | FragmentName;
16
+ options: {
17
+ objectExtensions: string[];
18
+ };
19
+ };
@@ -0,0 +1,3 @@
1
+ import type { LegacyResourceSchema, ResourceSchema } from "@warp-drive/core/types/schema/fields";
2
+ import type { WithPartial } from "@warp-drive/core/types/utils";
3
+ export declare function withLegacy(schema: WithPartial<LegacyResourceSchema, "legacy" | "identity">): ResourceSchema;
@@ -0,0 +1,9 @@
1
+ export { withArrayDefaults } from "./model-fragments/utilities/with-array-defaults.js";
2
+ export { withFragmentDefaults } from "./model-fragments/utilities/with-fragment-defaults.js";
3
+ export { withFragmentArrayDefaults } from "./model-fragments/utilities/with-fragment-array-defaults.js";
4
+ export { withLegacy } from "./model-fragments/utilities/with-legacy.js";
5
+ export { registerFragmentExtensions } from "./model-fragments/instance-initializers/fragment-extensions.js";
6
+ export { modelFor } from "./model-fragments/hooks/model-for.js";
7
+ export { FragmentArray, FragmentArrayExtension } from "./model-fragments/extensions/fragment-array.js";
8
+ export { Fragment, FragmentExtension } from "./model-fragments/extensions/fragment.js";
9
+ export type { WithFragment, WithFragmentArray } from "./model-fragments/index.js";
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * This package provides a Presentation Model for resource data in an WarpDrive Cache.
3
3
  *
4
- * Models are defined as classes extending from `import Model from '@ember-data/model';` and the
4
+ * Models are defined as classes extending from `import Model from '@warp-drive/legacy/model';` and the
5
5
  * attributes and relationships on these classes are parsed at runtime to supply static "schema"
6
6
  * to WarpDrive's SchemaService.
7
7
  *
@@ -17,7 +17,7 @@ the resource data for a given `type` and `id`.
17
17
  ### Defining a Model
18
18
 
19
19
  ```js [app/models/person.js]
20
- import Model, { attr, belongsTo, hasMany } from '@ember-data/model';
20
+ import Model, { attr, belongsTo, hasMany } from '@warp-drive/legacy/model';
21
21
 
22
22
  export default class PersonModel extends Model {
23
23
  @attr name;
@@ -14,7 +14,7 @@ Note also that this mixin does not work with JSONAPISerializer because the JSON:
14
14
  Below is an example of a per-type serializer (`post` type).
15
15
 
16
16
  ```js [app/serializers/post.js]
17
- import RESTSerializer, { EmbeddedRecordsMixin } from '@ember-data/serializer/rest';
17
+ import RESTSerializer, { EmbeddedRecordsMixin } from '@warp-drive/legacy/serializer/rest';
18
18
 
19
19
  export default class PostSerializer extends RESTSerializer.extend(EmbeddedRecordsMixin) {
20
20
  attrs = {
@@ -85,11 +85,6 @@ instances must have an `id` property to be used with Ember Data.
85
85
  are. Please read the docs for the methods this mixin provides, in case you need
86
86
  to modify it to fit your specific needs.**
87
87
 
88
- For example, review the docs for each method of this mixin:
89
- * [normalize](/ember-data/release/classes/EmbeddedRecordsMixin/methods/normalize?anchor=normalize)
90
- * [serializeBelongsTo](/ember-data/release/classes/EmbeddedRecordsMixin/methods/serializeBelongsTo?anchor=serializeBelongsTo)
91
- * [serializeHasMany](/ember-data/release/classes/EmbeddedRecordsMixin/methods/serializeHasMany?anchor=serializeHasMany)
92
-
93
88
  @class EmbeddedRecordsMixin
94
89
  @public
95
90
  */
@@ -5,8 +5,8 @@ export interface BooleanTransform {
5
5
  /**
6
6
  The `BooleanTransform` class is used to serialize and deserialize
7
7
  boolean attributes on Ember Data record objects. This transform is
8
- used when `boolean` is passed as the type parameter to the
9
- [attr](/ember-data/release/functions/@ember-data%2Fmodel/attr) function.
8
+ used when `'boolean'` is passed as the type parameter to the
9
+ {@link attr}function.
10
10
 
11
11
  Usage
12
12
 
@@ -5,8 +5,8 @@ export interface DateTransform {
5
5
  /**
6
6
  The `DateTransform` class is used to serialize and deserialize
7
7
  date attributes on Ember Data record objects. This transform is used
8
- when `date` is passed as the type parameter to the
9
- [attr](/ember-data/release/functions/@ember-data%2Fmodel/attr) function. It uses the [`ISO 8601`](https://en.wikipedia.org/wiki/ISO_8601)
8
+ when `'date'` is passed as the type parameter to the
9
+ {@link attr} function. It uses the [`ISO 8601`](https://en.wikipedia.org/wiki/ISO_8601)
10
10
  standard.
11
11
 
12
12
  ```js [app/models/score.js]
@@ -6,7 +6,7 @@ export interface NumberTransform {
6
6
  The `NumberTransform` class is used to serialize and deserialize
7
7
  numeric attributes on Ember Data record objects. This transform is
8
8
  used when `number` is passed as the type parameter to the
9
- [attr](/ember-data/release/functions/@ember-data%2Fmodel/attr) function.
9
+ {@link attr} function.
10
10
 
11
11
  Usage
12
12
 
@@ -6,7 +6,7 @@ export interface StringTransform {
6
6
  The `StringTransform` class is used to serialize and deserialize
7
7
  string attributes on Ember Data record objects. This transform is
8
8
  used when `string` is passed as the type parameter to the
9
- [attr](/ember-data/release/functions/@ember-data%2Fmodel/attr) function.
9
+ {@link attr} function.
10
10
 
11
11
  Usage
12
12
 
@@ -1,24 +1,23 @@
1
1
  /**
2
- * <blockquote style="margin: 1em; padding: .1em 1em .1em 1em; border-left: solid 1em #E34C32; background: #e0e0e0;">
3
- <p>
2
+ * :::danger
4
3
  ⚠️ <strong>This is LEGACY documentation</strong> for a feature that is no longer encouraged to be used.
5
4
  If starting a new app or thinking of implementing a new adapter, consider writing a
6
- <a href="/ember-data/release/classes/%3CInterface%3E%20Handler">Handler</a> instead to be used with the <a href="https://github.com/emberjs/data/tree/main/packages/request#readme">RequestManager</a>
7
- </p>
8
- </blockquote>
5
+ {@link Handler} instead to be used with the {@link RequestManager}
6
+ :::
9
7
 
10
- In EmberData a Serializer is used to serialize and deserialize
8
+ In WarpDrive a Serializer is used to serialize and deserialize
11
9
  records when they are transferred in and out of an external source.
12
10
  This process involves normalizing property names, transforming
13
11
  attribute values and serializing relationships.
14
12
 
15
- `JSONAPISerializer` supports the http://jsonapi.org/ spec and is the
16
- serializer recommended by Ember Data.
13
+ `JSONAPISerializer` supports the http://jsonapi.org/ spec, though
14
+ even compliant {json:api} servers may find writing an application
15
+ specific serializer better suited to their needs and more performant.
17
16
 
18
17
  This serializer normalizes a JSON API payload that looks like:
19
18
 
20
19
  ```js [app/models/player.js]
21
- import Model, { attr, belongsTo } from '@ember-data/model';
20
+ import Model, { attr, belongsTo } from '@warp-drive/legacy/model';
22
21
 
23
22
  export default class Player extends Model {
24
23
  @attr('string') name;
@@ -29,7 +28,7 @@ export default class Player extends Model {
29
28
  ```
30
29
 
31
30
  ```js [app/models/club.js]
32
- import Model, { attr, hasMany } from '@ember-data/model';
31
+ import Model, { attr, hasMany } from '@warp-drive/legacy/model';
33
32
 
34
33
  export default class Club extends Model {
35
34
  @attr('string') name;
@@ -82,7 +81,7 @@ export default class Club extends Model {
82
81
  }
83
82
  ```
84
83
 
85
- to the format that the Ember Data store expects.
84
+ to the format that the JSONAPICache expects.
86
85
 
87
86
  ### Customizing meta
88
87
 
@@ -94,7 +93,7 @@ below shows how this could be done using `normalizeArrayResponse` and
94
93
  `extractRelationship`.
95
94
 
96
95
  ```js [app/serializers/application.js]
97
- import JSONAPISerializer from '@ember-data/serializer/json-api';
96
+ import JSONAPISerializer from '@warp-drive/legacy/serializer/json-api';
98
97
 
99
98
  export default class ApplicationSerializer extends JSONAPISerializer {
100
99
  normalizeArrayResponse(store, primaryModelClass, payload, id, requestType) {
@@ -1,18 +1,16 @@
1
1
  /**
2
- * <blockquote style="margin: 1em; padding: .1em 1em .1em 1em; border-left: solid 1em #E34C32; background: #e0e0e0;">
3
- <p>
4
- ⚠️ <strong>This is LEGACY documentation</strong> for a feature that is no longer encouraged to be used.
2
+ * :::danger
3
+ ⚠️ **This is LEGACY documentation** for a feature that is no longer encouraged to be used.
5
4
  If starting a new app or thinking of implementing a new adapter, consider writing a
6
- <a href="/ember-data/release/classes/%3CInterface%3E%20Handler">Handler</a> instead to be used with the <a href="https://github.com/emberjs/data/tree/main/packages/request#readme">RequestManager</a>
7
- </p>
8
- </blockquote>
5
+ {@link Handler} instead to be used with the {@link RequestManager}
6
+ :::
9
7
 
10
- In EmberData a Serializer is used to serialize and deserialize
8
+ In WarpDrive a Serializer is used to serialize and deserialize
11
9
  records when they are transferred in and out of an external source.
12
10
  This process involves normalizing property names, transforming
13
11
  attribute values and serializing relationships.
14
12
 
15
- By default, EmberData uses and recommends the `JSONAPISerializer`.
13
+ By default, WarpDrive uses and recommends the `JSONAPISerializer`.
16
14
 
17
15
  `JSONSerializer` is useful for simpler or legacy backends that may
18
16
  not support the http://jsonapi.org/ spec.
@@ -20,7 +18,7 @@ not support the http://jsonapi.org/ spec.
20
18
  For example, given the following `User` model and JSON payload:
21
19
 
22
20
  ```js [app/models/user.js]
23
- import Model, { attr, belongsTo, hasMany } from '@ember-data/model';
21
+ import Model, { attr, belongsTo, hasMany } from '@warp-drive/legacy/model';
24
22
 
25
23
  export default class UserModel extends Model {
26
24
  @hasMany('user') friends;
@@ -41,8 +39,8 @@ house: '/houses/lefkada'
41
39
  }
42
40
  ```
43
41
 
44
- `JSONSerializer` will normalize the JSON payload to the JSON API format that the
45
- Ember Data store expects.
42
+ `JSONSerializer` will normalize the JSON payload to the {json:api} format that the
43
+ JSONAPICache uses to cache data in the Store.
46
44
 
47
45
  You can customize how JSONSerializer processes its payload by passing options in
48
46
  the `attrs` hash or by subclassing the `JSONSerializer` and overriding hooks:
@@ -1,11 +1,9 @@
1
1
  /**
2
- * <blockquote style="margin: 1em; padding: .1em 1em .1em 1em; border-left: solid 1em #E34C32; background: #e0e0e0;">
3
- <p>
4
- ⚠️ <strong>This is LEGACY documentation</strong> for a feature that is no longer encouraged to be used.
2
+ * :::danger
3
+ ⚠️ **This is LEGACY documentation** for a feature that is no longer encouraged to be used.
5
4
  If starting a new app or thinking of implementing a new adapter, consider writing a
6
- <a href="/ember-data/release/classes/%3CInterface%3E%20Handler">Handler</a> instead to be used with the <a href="https://github.com/emberjs/data/tree/main/packages/request#readme">RequestManager</a>
7
- </p>
8
- </blockquote>
5
+ {@link Handler} instead to be used with the {@link RequestManager}
6
+ :::
9
7
 
10
8
  Normally, applications will use the `RESTSerializer` by implementing
11
9
  the `normalize` method.
@@ -1,13 +1,11 @@
1
1
  /**
2
2
  ## Overview
3
3
 
4
- <blockquote style="margin: 1em; padding: .1em 1em .1em 1em; border-left: solid 1em #E34C32; background: #e0e0e0;">
5
- <p>
6
- ⚠️ <strong>This is LEGACY documentation</strong> for a feature that is no longer encouraged to be used.
4
+ :::danger
5
+ ⚠️ **This is LEGACY documentation** for a feature that is no longer encouraged to be used.
7
6
  If starting a new app or thinking of implementing a new serializer, consider writing a
8
- <a href="/ember-data/release/classes/%3CInterface%3E%20Handler">Handler</a> instead to be used with the <a href="https://github.com/emberjs/data/tree/main/packages/request#readme">RequestManager</a>
9
- </p>
10
- </blockquote>
7
+ {@link Handler} instead to be used with the {@link RequestManager}
8
+ :::
11
9
 
12
10
  In order to properly manage and present your data, WarpDrive
13
11
  needs to understand the structure of data it receives.
@@ -16,14 +14,14 @@ needs to understand the structure of data it receives.
16
14
  the format WarpDrive understands.
17
15
 
18
16
  Data received from an API response is **normalized** into
19
- [JSON:API](https://jsonapi.org/) (the format used internally
17
+ [{json:api}](https://jsonapi.org/) (the format used internally
20
18
  by WarpDrive), while data sent to an API is **serialized**
21
19
  into the format the API expects.
22
20
 
23
21
  ### Implementing a Serializer
24
22
 
25
23
  There are only two required serializer methods, one for
26
- normalizing data from the server API format into JSON:API, and
24
+ normalizing data from the server API format into {json:api}, and
27
25
  another for serializing records via `Snapshots` into the expected
28
26
  server API format.
29
27
 
@@ -69,7 +67,7 @@ store.serializerFor('author');
69
67
  // app/serializers/application.js
70
68
  ```
71
69
 
72
- Most requests in @warp-drive/legacy are made with respect to a particular `type` (or `modelName`)
70
+ Most requests in `@warp-drive/legacy` are made with respect to a particular `type` (or `modelName`)
73
71
  (e.g., "get me the full collection of **books**" or "get me the **employee** whose id is 37"). We
74
72
  refer to this as the **primary** resource `type`.
75
73
 
@@ -93,7 +91,7 @@ Any serializer in `app/serializers/` can be looked up by `name` using `store.ser
93
91
  ### Default Serializers
94
92
 
95
93
  For applications whose APIs are *very close to* or *exactly* the **REST** format or **JSON:API**
96
- format the `@ember-data/serializer` package contains implementations these applications can
94
+ format the `@warp-drive/legacy/serializer` package contains implementations these applications can
97
95
  extend. It also contains a simple `JSONSerializer` for serializing to/from very basic JSON objects.
98
96
 
99
97
  Many applications will find writing their own serializer to be more performant and less
@@ -124,8 +122,7 @@ And you can optionally override the following methods:
124
122
 
125
123
  * `normalize()`
126
124
 
127
- For an example implementation, see
128
- [JSONSerializer](JSONSerializer), the included JSON serializer.
125
+ For an example implementation, see the included {@link JSONSerializer}.
129
126
 
130
127
  @class Serializer
131
128
  @public
@@ -1,7 +1,8 @@
1
1
  import { Context } from '@warp-drive/core/reactive/-private';
2
2
  import { warn } from '@ember/debug';
3
3
  import { createDeferred } from '@warp-drive/core/request';
4
- import { assertPrivateStore, waitFor, coerceId } from '@warp-drive/core/store/-private';
4
+ import { waitFor } from '@warp-drive/core/signals/-leaked';
5
+ import { assertPrivateStore, coerceId } from '@warp-drive/core/store/-private';
5
6
  import { getOrSetGlobal } from '@warp-drive/core/types/-private';
6
7
  import { macroCondition, getGlobalConfig } from '@embroider/macros';
7
8
 
@@ -1202,7 +1203,7 @@ function _flushPendingSave(store, pending) {
1202
1203
 
1203
1204
  /**
1204
1205
  * Utilities - often temporary - for maintaining backwards compatibility with
1205
- * older parts of EmberData.
1206
+ * older parts of WarpDrive.
1206
1207
  *
1207
1208
  @module
1208
1209
  */
@@ -1 +1 @@
1
- export { d as determineBodyPromise, g as fetch, p as parseResponseHeaders, b as serializeIntoHash, s as serializeQueryParams, a as setupFastboot } from "../serialize-into-hash-CS0MIv4F.js";
1
+ export { d as determineBodyPromise, g as fetch, p as parseResponseHeaders, b as serializeIntoHash, s as serializeQueryParams, a as setupFastboot } from "../serialize-into-hash-DPZYoF-i.js";