@ember-data/legacy-compat 5.5.0-alpha.2 → 5.5.0-alpha.21

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 (71) hide show
  1. package/LICENSE.md +19 -7
  2. package/README.md +10 -2
  3. package/addon-main.cjs +5 -0
  4. package/{addon/fetch-manager-0744e8e9.js → dist/-private-Dlia0pw1.js} +252 -125
  5. package/dist/-private-Dlia0pw1.js.map +1 -0
  6. package/dist/-private.js +1 -0
  7. package/dist/builders.js +323 -0
  8. package/dist/builders.js.map +1 -0
  9. package/dist/index.js +1011 -0
  10. package/dist/index.js.map +1 -0
  11. package/dist/utils.js +246 -0
  12. package/dist/utils.js.map +1 -0
  13. package/logos/NCC-1701-a-blue.svg +4 -0
  14. package/logos/NCC-1701-a-gold.svg +4 -0
  15. package/logos/NCC-1701-a-gold_100.svg +1 -0
  16. package/logos/NCC-1701-a-gold_base-64.txt +1 -0
  17. package/logos/NCC-1701-a.svg +4 -0
  18. package/logos/README.md +4 -0
  19. package/logos/docs-badge.svg +2 -0
  20. package/logos/github-header.svg +444 -0
  21. package/logos/social1.png +0 -0
  22. package/logos/social2.png +0 -0
  23. package/logos/warp-drive-logo-dark.svg +4 -0
  24. package/logos/warp-drive-logo-gold.svg +4 -0
  25. package/package.json +58 -49
  26. package/unstable-preview-types/-private.d.ts +17 -0
  27. package/unstable-preview-types/-private.d.ts.map +1 -0
  28. package/unstable-preview-types/builders/find-all.d.ts +41 -0
  29. package/unstable-preview-types/builders/find-all.d.ts.map +1 -0
  30. package/unstable-preview-types/builders/find-record.d.ts +62 -0
  31. package/unstable-preview-types/builders/find-record.d.ts.map +1 -0
  32. package/unstable-preview-types/builders/query.d.ts +72 -0
  33. package/unstable-preview-types/builders/query.d.ts.map +1 -0
  34. package/unstable-preview-types/builders/save-record.d.ts +40 -0
  35. package/unstable-preview-types/builders/save-record.d.ts.map +1 -0
  36. package/unstable-preview-types/builders/utils.d.ts +6 -0
  37. package/unstable-preview-types/builders/utils.d.ts.map +1 -0
  38. package/unstable-preview-types/builders.d.ts +18 -0
  39. package/unstable-preview-types/builders.d.ts.map +1 -0
  40. package/unstable-preview-types/index.d.ts +162 -0
  41. package/unstable-preview-types/index.d.ts.map +1 -0
  42. package/unstable-preview-types/legacy-network-handler/fetch-manager.d.ts +49 -0
  43. package/unstable-preview-types/legacy-network-handler/fetch-manager.d.ts.map +1 -0
  44. package/unstable-preview-types/legacy-network-handler/identifier-has-id.d.ts +5 -0
  45. package/unstable-preview-types/legacy-network-handler/identifier-has-id.d.ts.map +1 -0
  46. package/unstable-preview-types/legacy-network-handler/legacy-data-fetch.d.ts +14 -0
  47. package/unstable-preview-types/legacy-network-handler/legacy-data-fetch.d.ts.map +1 -0
  48. package/unstable-preview-types/legacy-network-handler/legacy-data-utils.d.ts +8 -0
  49. package/unstable-preview-types/legacy-network-handler/legacy-data-utils.d.ts.map +1 -0
  50. package/unstable-preview-types/legacy-network-handler/legacy-network-handler.d.ts +5 -0
  51. package/unstable-preview-types/legacy-network-handler/legacy-network-handler.d.ts.map +1 -0
  52. package/unstable-preview-types/legacy-network-handler/minimum-adapter-interface.d.ts +549 -0
  53. package/unstable-preview-types/legacy-network-handler/minimum-adapter-interface.d.ts.map +1 -0
  54. package/unstable-preview-types/legacy-network-handler/minimum-serializer-interface.d.ts +235 -0
  55. package/unstable-preview-types/legacy-network-handler/minimum-serializer-interface.d.ts.map +1 -0
  56. package/unstable-preview-types/legacy-network-handler/serializer-response.d.ts +9 -0
  57. package/unstable-preview-types/legacy-network-handler/serializer-response.d.ts.map +1 -0
  58. package/unstable-preview-types/legacy-network-handler/snapshot-record-array.d.ts +96 -0
  59. package/unstable-preview-types/legacy-network-handler/snapshot-record-array.d.ts.map +1 -0
  60. package/unstable-preview-types/legacy-network-handler/snapshot.d.ts +248 -0
  61. package/unstable-preview-types/legacy-network-handler/snapshot.d.ts.map +1 -0
  62. package/unstable-preview-types/utils.d.ts +161 -0
  63. package/unstable-preview-types/utils.d.ts.map +1 -0
  64. package/addon/-private.js +0 -1
  65. package/addon/fetch-manager-0744e8e9.js.map +0 -1
  66. package/addon/index.js +0 -617
  67. package/addon/index.js.map +0 -1
  68. package/addon-main.js +0 -93
  69. /package/{addon → dist}/-private.js.map +0 -0
  70. /package/{ember-data-logo-dark.svg → logos/ember-data-logo-dark.svg} +0 -0
  71. /package/{ember-data-logo-light.svg → logos/ember-data-logo-light.svg} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAI3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAEnE,OAAO,EAAE,YAAY,EAAgB,MAAM,YAAY,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,oDAAoD,CAAC;AAClH,OAAO,KAAK,EACV,0BAA0B,EAC1B,iBAAiB,EAClB,MAAM,uDAAuD,CAAC;AAE/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,iDAAiD,CAAC;AAEvF,YAAY,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,iBAAiB,EAAE,cAAc,EAAE,CAAC;AAEvG;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,aAAa,EAAE,YAAY,CAAC;IAC5B,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,GAAG,uBAAuB,CAAC;IACpE,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,GAAG,uBAAuB,GAAG,SAAS,CAAC;IAErG,aAAa,CAAC,CAAC,SAAS,MAAM,EAAE,SAAS,EAAE,CAAC,EAAE,aAAa,CAAC,EAAE,OAAO,GAAG,0BAA0B,GAAG,IAAI,CAAC;IAE1G,SAAS,CAAC,SAAS,EAAE,M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AI,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAQlG;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,KAAK,QAgBlC"}
@@ -0,0 +1,49 @@
1
+ declare module '@ember-data/legacy-compat/legacy-network-handler/fetch-manager' {
2
+ import { createDeferred } from '@ember-data/request';
3
+ import type Store from '@ember-data/store';
4
+ import type { Request, RequestStateService } from '@ember-data/store/-private';
5
+ import type { FindRecordOptions } from '@ember-data/store/types';
6
+ import type { StableExistingRecordIdentifier, StableRecordIdentifier } from '@warp-drive/core-types/identifier';
7
+ import type { TypeFromInstance } from '@warp-drive/core-types/record';
8
+ import type { ImmutableRequestInfo } from '@warp-drive/core-types/request';
9
+ import type { SingleResourceDocument } from '@warp-drive/core-types/spec/json-api-raw';
10
+ import { Snapshot } from '@ember-data/legacy-compat/legacy-network-handler/snapshot';
11
+ type Deferred<T> = ReturnType<typeof createDeferred<T>>;
12
+ export const SaveOp: "___(unique) Symbol(SaveOp)";
13
+ export type FetchMutationOptions = FindRecordOptions & {
14
+ [SaveOp]: 'createRecord' | 'deleteRecord' | 'updateRecord';
15
+ };
16
+ interface PendingFetchItem {
17
+ identifier: StableExistingRecordIdentifier;
18
+ queryRequest: Request;
19
+ resolver: Deferred<any>;
20
+ options: FindRecordOptions;
21
+ trace?: unknown;
22
+ promise: Promise<StableExistingRecordIdentifier>;
23
+ }
24
+ export class FetchManager {
25
+ isDestroyed: boolean;
26
+ requestCache: RequestStateService;
27
+ _pendingFetch: Map<string, Map<StableExistingRecordIdentifier, PendingFetchItem[]>>;
28
+ _store: Store;
29
+ constructor(store: Store);
30
+ createSnapshot<T>(identifier: StableRecordIdentifier<TypeFromInstance<T>>, options?: FindRecordOptions): Snapshot<T>;
31
+ createSnapshot(identifier: StableRecordIdentifier, options?: FindRecordOptions): Snapshot;
32
+ /**
33
+ This method is called by `record.save`, and gets passed a
34
+ resolver for the promise that `record.save` returns.
35
+
36
+ It schedules saving to happen at the end of the run loop.
37
+
38
+ @internal
39
+ */
40
+ scheduleSave(identifier: StableRecordIdentifier, options: FetchMutationOptions): Promise<null | SingleResourceDocument>;
41
+ scheduleFetch(identifier: StableExistingRecordIdentifier, options: FindRecordOptions, request: ImmutableRequestInfo): Promise<StableExistingRecordIdentifier>;
42
+ getPendingFetch(identifier: StableExistingRecordIdentifier, options: FindRecordOptions): Promise<StableExistingRecordIdentifier<string>> | undefined;
43
+ flushAllPendingFetches(): void;
44
+ fetchDataIfNeededForIdentifier(identifier: StableExistingRecordIdentifier, options: FindRecordOptions | undefined, request: ImmutableRequestInfo): Promise<StableExistingRecordIdentifier>;
45
+ destroy(): void;
46
+ }
47
+ export {};
48
+ }
49
+ //# sourceMappingURL=fetch-manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch-manager.d.ts","sourceRoot":"","sources":["../../src/legacy-network-handler/fetch-manager.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAC3C,OAAO,KAAK,EAGV,OAAO,EACP,mBAAmB,EAEpB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAE,iBAAiB,EAAe,MAAM,yBAAyB,CAAC;AAI9E,OAAO,KAAK,EAAE,8BAA8B,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAChH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,KAAK,EAA8B,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAQnH,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,KAAK,QAAQ,CAAC,CAAC,IAAI,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;AAMxD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BAAsB;IAUtB,8BAA8B,CAC5B,UAAU,EAAE,8BAA8B,EAC1C,OAAO,EAAE,iBAAiB,YAAK,EAC/B,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,8BAA8B,CAAC;IAyB1C,OAAO;CAGR"}
@@ -0,0 +1,5 @@
1
+ declare module '@ember-data/legacy-compat/legacy-network-handler/identifier-has-id' {
2
+ import type { StableExistingRecordIdentifier } from '@warp-drive/core-types/identifier';
3
+ export function assertIdentifierHasId(identifier: unknown): asserts identifier is StableExistingRecordIdentifier;
4
+ }
5
+ //# sourceMappingURL=identifier-has-id.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identifier-has-id.d.ts","sourceRoot":"","sources":["../../src/legacy-network-handler/identifier-has-id.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,mCAAmC,CAAC;AAExF,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,OAAO,GAAG,OAAO,CAAC,UAAU,IAAI,8BAA8B,CAK/G"}
@@ -0,0 +1,14 @@
1
+ declare module '@ember-data/legacy-compat/legacy-network-handler/legacy-data-fetch' {
2
+ import type Store from '@ember-data/store';
3
+ import type { BaseFinderOptions } from '@ember-data/store/types';
4
+ import type { StableRecordIdentifier } from '@warp-drive/core-types';
5
+ import type { LegacyRelationshipField as RelationshipSchema } from '@warp-drive/core-types/schema/fields';
6
+ import type { MinimumAdapterInterface } from '@ember-data/legacy-compat/legacy-network-handler/minimum-adapter-interface';
7
+ export function _findHasMany(adapter: MinimumAdapterInterface, store: Store, identifier: StableRecordIdentifier, link: string | null | {
8
+ href: string;
9
+ }, relationship: RelationshipSchema, options: BaseFinderOptions): Promise<import("@warp-drive/core-types/identifier").StableExistingRecordIdentifier<string> | import("@warp-drive/core-types/identifier").StableExistingRecordIdentifier<string>[] | null>;
10
+ export function _findBelongsTo(store: Store, identifier: StableRecordIdentifier, link: string | null | {
11
+ href: string;
12
+ }, relationship: RelationshipSchema, options: BaseFinderOptions): Promise<import("@warp-drive/core-types/identifier").StableExistingRecordIdentifier<string> | import("@warp-drive/core-types/identifier").StableExistingRecordIdentifier<string>[] | null>;
13
+ }
14
+ //# sourceMappingURL=legacy-data-fetch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"legacy-data-fetch.d.ts","sourceRoot":"","sources":["../../src/legacy-network-handler/legacy-data-fetch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAC3C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAGjE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,KAAK,EAAE,uBAAuB,IAAI,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAK1G,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAG3E,wBAAgB,YAAY,CAC1B,OAAO,EAAE,uBAAuB,EAChC,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,sBAAsB,EAClC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,EACtC,YAAY,EAAE,kBAAkB,EAChC,OAAO,EAAE,iBAAiB,6LA0C3B;AAED,wBAAgB,cAAc,CAC5B,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,sBAAsB,EAClC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,EACtC,YAAY,EAAE,kBAAkB,EAChC,OAAO,EAAE,iBAAiB,6LA0C3B"}
@@ -0,0 +1,8 @@
1
+ declare module '@ember-data/legacy-compat/legacy-network-handler/legacy-data-utils' {
2
+ import type { AdapterPayload } from '@ember-data/legacy-compat/legacy-network-handler/minimum-adapter-interface';
3
+ type IteratorCB<T> = ((o: T, index: number) => T) | ((o: T) => T);
4
+ export function iterateData<T>(data: T[] | T, fn: IteratorCB<T>): T | T[];
5
+ export function payloadIsNotBlank<T>(adapterPayload: T | AdapterPayload): adapterPayload is AdapterPayload;
6
+ export {};
7
+ }
8
+ //# sourceMappingURL=legacy-data-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"legacy-data-utils.d.ts","sourceRoot":"","sources":["../../src/legacy-network-handler/legacy-data-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAElE,KAAK,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;AAElE,wBAAgB,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC,WAM9D;AAED,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,GAAG,cAAc,GAAG,cAAc,IAAI,cAAc,CAMzG"}
@@ -0,0 +1,5 @@
1
+ declare module '@ember-data/legacy-compat/legacy-network-handler/legacy-network-handler' {
2
+ import type { Handler } from '@ember-data/request';
3
+ export const LegacyNetworkHandler: Handler;
4
+ }
5
+ //# sourceMappingURL=legacy-network-handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"legacy-network-handler.d.ts","sourceRoot":"","sources":["../../src/legacy-network-handler/legacy-network-handler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAU,OAAO,EAAkC,MAAM,qBAAqB,CAAC;AAiD3F,eAAO,MAAM,oBAAoB,EAAE,OAoClC,CAAC"}