@warp-drive/core 5.6.0-alpha.5 → 5.6.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.
- package/README.md +8 -7
- package/cjs-dist/addon-shim.cjs +1 -0
- package/cjs-dist/cjs-set-config.cjs +1 -0
- package/declarations/build-config/babel-macros.d.ts +1 -0
- package/declarations/build-config/canary-features.d.ts +1 -0
- package/declarations/build-config/debugging.d.ts +1 -0
- package/declarations/build-config/deprecations.d.ts +1 -0
- package/declarations/build-config/env.d.ts +1 -0
- package/declarations/build-config/macros.d.ts +1 -0
- package/declarations/build-config.d.ts +1 -0
- package/declarations/configure.d.ts +7 -0
- package/declarations/graph/-private/-diff.d.ts +32 -0
- package/declarations/graph/-private/-edge-definition.d.ts +148 -0
- package/declarations/graph/-private/-state.d.ts +96 -0
- package/declarations/graph/-private/-utils.d.ts +31 -0
- package/declarations/graph/-private/coerce-id.d.ts +10 -0
- package/declarations/graph/-private/debug/assert-polymorphic-type.d.ts +18 -0
- package/declarations/graph/-private/edges/collection.d.ts +39 -0
- package/declarations/graph/-private/edges/implicit.d.ts +43 -0
- package/declarations/graph/-private/edges/resource.d.ts +24 -0
- package/declarations/graph/-private/graph.d.ts +90 -0
- package/declarations/graph/-private/normalize-link.d.ts +8 -0
- package/declarations/graph/-private/operations/add-to-related-records.d.ts +4 -0
- package/declarations/graph/-private/operations/merge-identifier.d.ts +3 -0
- package/declarations/graph/-private/operations/remove-from-related-records.d.ts +4 -0
- package/declarations/graph/-private/operations/replace-related-record.d.ts +3 -0
- package/declarations/graph/-private/operations/replace-related-records.d.ts +62 -0
- package/declarations/graph/-private/operations/update-relationship.d.ts +13 -0
- package/declarations/graph/-private.d.ts +13 -0
- package/declarations/index.d.ts +14 -3
- package/declarations/reactive/-private/document.d.ts +146 -0
- package/declarations/reactive/-private/fields/compute.d.ts +43 -0
- package/declarations/reactive/-private/fields/extension.d.ts +8 -0
- package/declarations/reactive/-private/fields/managed-array.d.ts +22 -0
- package/declarations/reactive/-private/fields/managed-object.d.ts +21 -0
- package/declarations/reactive/-private/fields/many-array-manager.d.ts +19 -0
- package/declarations/reactive/-private/hooks.d.ts +5 -0
- package/declarations/reactive/-private/record.d.ts +64 -0
- package/declarations/reactive/-private/schema.d.ts +271 -0
- package/declarations/reactive/-private/symbols.d.ts +36 -0
- package/declarations/reactive/-private.d.ts +1 -0
- package/declarations/reactive.d.ts +4 -0
- package/declarations/request/-private/context.d.ts +34 -35
- package/declarations/request/-private/debug.d.ts +2 -3
- package/declarations/request/-private/fetch.d.ts +24 -36
- package/declarations/request/-private/future.d.ts +3 -4
- package/declarations/request/-private/manager.d.ts +159 -132
- package/declarations/request/-private/promise-cache.d.ts +21 -13
- package/declarations/request/-private/types.d.ts +124 -123
- package/declarations/request/-private/utils.d.ts +8 -9
- package/declarations/request.d.ts +5 -433
- package/declarations/store/-private/cache-handler/handler.d.ts +62 -0
- package/declarations/store/-private/cache-handler/types.d.ts +98 -0
- package/declarations/store/-private/cache-handler/utils.d.ts +32 -0
- package/declarations/store/-private/caches/cache-utils.d.ts +12 -0
- package/declarations/store/-private/caches/identifier-cache.d.ts +304 -0
- package/declarations/store/-private/caches/instance-cache.d.ts +65 -0
- package/declarations/store/-private/caches/resource-utils.d.ts +9 -0
- package/declarations/store/-private/debug/utils.d.ts +6 -0
- package/declarations/store/-private/default-cache-policy.d.ts +384 -0
- package/declarations/store/-private/legacy-model-support/record-reference.d.ts +159 -0
- package/declarations/store/-private/legacy-model-support/shim-model-class.d.ts +17 -0
- package/declarations/store/-private/managers/cache-capabilities-manager.d.ts +25 -0
- package/declarations/store/-private/managers/cache-manager.d.ts +443 -0
- package/declarations/store/-private/managers/notification-manager.d.ts +98 -0
- package/declarations/store/-private/managers/record-array-manager.d.ts +97 -0
- package/declarations/store/-private/network/request-cache.d.ts +107 -0
- package/declarations/store/-private/new-core-tmp/promise-state.d.ts +263 -0
- package/declarations/store/-private/new-core-tmp/reactivity/configure.d.ts +176 -0
- package/declarations/store/-private/new-core-tmp/reactivity/internal.d.ts +169 -0
- package/declarations/store/-private/new-core-tmp/reactivity/signal.d.ts +35 -0
- package/declarations/store/-private/new-core-tmp/request-state.d.ts +277 -0
- package/declarations/store/-private/new-core-tmp/request-subscription.d.ts +261 -0
- package/declarations/store/-private/record-arrays/identifier-array.d.ts +147 -0
- package/declarations/store/-private/record-arrays/many-array.d.ts +197 -0
- package/declarations/store/-private/record-arrays/native-proxy-type-fix.d.ts +126 -0
- package/declarations/store/-private/store-service.d.ts +1605 -0
- package/declarations/store/-private/utils/coerce-id.d.ts +10 -0
- package/declarations/store/-private/utils/construct-resource.d.ts +6 -0
- package/declarations/store/-private/utils/is-non-empty-string.d.ts +1 -0
- package/declarations/store/-private/utils/normalize-model-name.d.ts +1 -0
- package/declarations/store/-private/utils/uuid-polyfill.d.ts +1 -0
- package/declarations/store/-private.d.ts +31 -0
- package/declarations/store/-types/q/cache-capabilities-manager.d.ts +99 -0
- package/declarations/store/-types/q/ds-model.d.ts +21 -0
- package/declarations/store/-types/q/identifier.d.ts +20 -0
- package/declarations/store/-types/q/record-instance.d.ts +23 -0
- package/declarations/store/-types/q/schema-service.d.ts +354 -0
- package/declarations/store/-types/q/store.d.ts +32 -0
- package/declarations/store.d.ts +1 -0
- package/declarations/types/-private.d.ts +16 -8
- package/declarations/types/cache/aliases.d.ts +11 -1
- package/declarations/types/cache/change.d.ts +4 -5
- package/declarations/types/cache/mutations.d.ts +51 -28
- package/declarations/types/cache/operations.d.ts +60 -47
- package/declarations/types/cache/relationship.d.ts +11 -9
- package/declarations/types/cache.d.ts +495 -484
- package/declarations/types/graph.d.ts +31 -40
- package/declarations/types/identifier.d.ts +83 -82
- package/declarations/types/json/raw.d.ts +1 -2
- package/declarations/types/params.d.ts +4 -5
- package/declarations/types/record.d.ts +117 -76
- package/declarations/types/request.d.ts +289 -266
- package/declarations/types/runtime.d.ts +8 -9
- package/declarations/types/schema/concepts.d.ts +19 -13
- package/declarations/types/schema/fields.d.ts +1712 -1741
- package/declarations/types/schema/fields.type-test.d.ts +0 -1
- package/declarations/types/spec/document.d.ts +28 -22
- package/declarations/types/spec/error.d.ts +16 -17
- package/declarations/types/spec/json-api-raw.d.ts +102 -102
- package/declarations/types/symbols.d.ts +74 -75
- package/declarations/types/utils.d.ts +5 -5
- package/declarations/types.d.ts +10 -7
- package/declarations/utils/string.d.ts +48 -0
- package/dist/build-config/babel-macros.js +1 -0
- package/dist/build-config/canary-features.js +1 -0
- package/dist/build-config/debugging.js +1 -0
- package/dist/build-config/deprecations.js +1 -0
- package/dist/build-config/env.js +1 -0
- package/dist/build-config/macros.js +1 -0
- package/dist/build-config.js +1 -0
- package/dist/configure-B48bFHOl.js +181 -0
- package/dist/configure.js +1 -0
- package/dist/{context-DE5sFezZ.js → context-COmAnXUQ.js} +2 -2
- package/dist/graph/-private.js +3372 -0
- package/dist/handler-C2T-IyJK.js +339 -0
- package/dist/index.js +37 -104
- package/dist/reactive/-private.js +1 -0
- package/dist/reactive.js +1988 -0
- package/dist/request-state-CjLph1LP.js +8139 -0
- package/dist/request.js +1 -1
- package/dist/store/-private.js +3 -0
- package/dist/store.js +545 -0
- package/dist/symbols-SIstXMLI.js +44 -0
- package/dist/types/-private.js +3 -3
- package/dist/types/record.js +1 -1
- package/dist/types/request.js +2 -2
- package/dist/types/runtime.js +1 -1
- package/dist/types/schema/fields.js +8 -41
- package/dist/types/symbols.js +3 -3
- package/dist/utils/string.js +92 -0
- package/logos/NCC-1701-a-blue.svg +4 -0
- package/logos/NCC-1701-a-gold.svg +4 -0
- package/logos/NCC-1701-a-gold_100.svg +1 -0
- package/logos/NCC-1701-a-gold_base-64.txt +1 -0
- package/logos/NCC-1701-a.svg +4 -0
- package/logos/README.md +4 -0
- package/logos/docs-badge.svg +2 -0
- package/logos/ember-data-logo-dark.svg +12 -0
- package/logos/ember-data-logo-light.svg +12 -0
- package/logos/github-header.svg +444 -0
- package/logos/social1.png +0 -0
- package/logos/social2.png +0 -0
- package/logos/warp-drive-logo-dark.svg +4 -0
- package/logos/warp-drive-logo-gold.svg +4 -0
- package/package.json +11 -8
- package/declarations/index.d.ts.map +0 -1
- package/declarations/request/-private/context.d.ts.map +0 -1
- package/declarations/request/-private/debug.d.ts.map +0 -1
- package/declarations/request/-private/fetch.d.ts.map +0 -1
- package/declarations/request/-private/future.d.ts.map +0 -1
- package/declarations/request/-private/manager.d.ts.map +0 -1
- package/declarations/request/-private/promise-cache.d.ts.map +0 -1
- package/declarations/request/-private/types.d.ts.map +0 -1
- package/declarations/request/-private/utils.d.ts.map +0 -1
- package/declarations/request.d.ts.map +0 -1
- package/declarations/types/-private.d.ts.map +0 -1
- package/declarations/types/cache/aliases.d.ts.map +0 -1
- package/declarations/types/cache/change.d.ts.map +0 -1
- package/declarations/types/cache/mutations.d.ts.map +0 -1
- package/declarations/types/cache/operations.d.ts.map +0 -1
- package/declarations/types/cache/relationship.d.ts.map +0 -1
- package/declarations/types/cache.d.ts.map +0 -1
- package/declarations/types/graph.d.ts.map +0 -1
- package/declarations/types/identifier.d.ts.map +0 -1
- package/declarations/types/json/raw.d.ts.map +0 -1
- package/declarations/types/params.d.ts.map +0 -1
- package/declarations/types/record.d.ts.map +0 -1
- package/declarations/types/record.type-test.d.ts +0 -2
- package/declarations/types/record.type-test.d.ts.map +0 -1
- package/declarations/types/request.d.ts.map +0 -1
- package/declarations/types/request.type-test.d.ts +0 -2
- package/declarations/types/request.type-test.d.ts.map +0 -1
- package/declarations/types/runtime.d.ts.map +0 -1
- package/declarations/types/schema/concepts.d.ts.map +0 -1
- package/declarations/types/schema/fields.d.ts.map +0 -1
- package/declarations/types/schema/fields.type-test.d.ts.map +0 -1
- package/declarations/types/spec/document.d.ts.map +0 -1
- package/declarations/types/spec/error.d.ts.map +0 -1
- package/declarations/types/spec/json-api-raw.d.ts.map +0 -1
- package/declarations/types/symbols.d.ts.map +0 -1
- package/declarations/types/utils.d.ts.map +0 -1
- package/declarations/types.d.ts.map +0 -1
- package/dist/context-DE5sFezZ.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/request.js.map +0 -1
- package/dist/types/-private.js.map +0 -1
- package/dist/types/cache/aliases.js.map +0 -1
- package/dist/types/cache/change.js.map +0 -1
- package/dist/types/cache/mutations.js.map +0 -1
- package/dist/types/cache/operations.js.map +0 -1
- package/dist/types/cache/relationship.js.map +0 -1
- package/dist/types/cache.js.map +0 -1
- package/dist/types/graph.js.map +0 -1
- package/dist/types/identifier.js.map +0 -1
- package/dist/types/json/raw.js.map +0 -1
- package/dist/types/params.js.map +0 -1
- package/dist/types/record.js.map +0 -1
- package/dist/types/request.js.map +0 -1
- package/dist/types/runtime.js.map +0 -1
- package/dist/types/schema/concepts.js.map +0 -1
- package/dist/types/schema/fields.js.map +0 -1
- package/dist/types/schema/fields.type-test.js.map +0 -1
- package/dist/types/spec/document.js.map +0 -1
- package/dist/types/spec/error.js.map +0 -1
- package/dist/types/spec/json-api-raw.js.map +0 -1
- package/dist/types/symbols.js.map +0 -1
- package/dist/types/utils.js.map +0 -1
- package/dist/types.js.map +0 -1
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import type { Store } from "../../store/-private.js";
|
|
2
|
+
import type { SchemaService as SchemaServiceInterface } from "../../types.js";
|
|
3
|
+
import type { StableRecordIdentifier } from "../../types/identifier.js";
|
|
4
|
+
import type { ObjectValue, Value } from "../../types/json/raw.js";
|
|
5
|
+
import type { Derivation, HashFn } from "../../types/schema/concepts.js";
|
|
6
|
+
import { type ArrayField, type DerivedField, type FieldSchema, type GenericField, type HashField, type LegacyAttributeField, type LegacyBelongsToField, type LegacyHasManyField, type LegacyRelationshipField, type ObjectField, type ObjectSchema, type PolarisResourceSchema, type ResourceSchema } from "../../types/schema/fields.js";
|
|
7
|
+
import { Type } from "../../types/symbols.js";
|
|
8
|
+
import type { WithPartial } from "../../types/utils.js";
|
|
9
|
+
import type { ReactiveResource } from "./record.js";
|
|
10
|
+
/**
|
|
11
|
+
* Extensions allow providing non-schema driven behaviors to
|
|
12
|
+
* reactive resources and arrays.
|
|
13
|
+
*/
|
|
14
|
+
export interface CAUTION_MEGA_DANGER_ZONE_Extension {
|
|
15
|
+
/**
|
|
16
|
+
* Whether this extension extends the behaviors of objects
|
|
17
|
+
* or of arrays.
|
|
18
|
+
*/
|
|
19
|
+
kind: "object" | "array";
|
|
20
|
+
/**
|
|
21
|
+
* The name of the extension, to be used when specifying
|
|
22
|
+
* either `objectExtensions` or `arrayExtensions`
|
|
23
|
+
*/
|
|
24
|
+
name: string;
|
|
25
|
+
/**
|
|
26
|
+
* An object with iterable keys whose values are the getters
|
|
27
|
+
* or methods to expose on the object or array.
|
|
28
|
+
*
|
|
29
|
+
* or
|
|
30
|
+
*
|
|
31
|
+
* A constructable such as a Function or Class whose prototype
|
|
32
|
+
* will be iterated with getOwnPropertyNames.
|
|
33
|
+
*/
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
35
|
+
features: Record<string | symbol, unknown> | Function;
|
|
36
|
+
}
|
|
37
|
+
export type ExtensionDef = {
|
|
38
|
+
kind: "method";
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
40
|
+
fn: Function;
|
|
41
|
+
} | {
|
|
42
|
+
kind: "readonly-value";
|
|
43
|
+
value: unknown;
|
|
44
|
+
} | {
|
|
45
|
+
kind: "mutable-value";
|
|
46
|
+
value: unknown;
|
|
47
|
+
} | {
|
|
48
|
+
kind: "readonly-field";
|
|
49
|
+
get: () => unknown;
|
|
50
|
+
} | {
|
|
51
|
+
kind: "mutable-field";
|
|
52
|
+
get: () => unknown;
|
|
53
|
+
set: (value: unknown) => void;
|
|
54
|
+
} | {
|
|
55
|
+
kind: "writeonly-field";
|
|
56
|
+
set: (value: unknown) => void;
|
|
57
|
+
};
|
|
58
|
+
export interface ProcessedExtension {
|
|
59
|
+
kind: "object" | "array";
|
|
60
|
+
name: string;
|
|
61
|
+
features: Map<string | symbol, ExtensionDef>;
|
|
62
|
+
}
|
|
63
|
+
export interface ExtensibleField {
|
|
64
|
+
kind: "schema-object" | "schema-array" | "array" | "object" | "hasMany";
|
|
65
|
+
options?: {
|
|
66
|
+
objectExtensions?: string[];
|
|
67
|
+
arrayExtensions?: string[];
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Utility for constructing a ResourceSchema with the recommended
|
|
72
|
+
* fields for the PolarisMode experience.
|
|
73
|
+
*
|
|
74
|
+
* Using this requires registering the PolarisMode derivations
|
|
75
|
+
*
|
|
76
|
+
* ```ts
|
|
77
|
+
* import { registerDerivations } from '@warp-drive/schema-record';
|
|
78
|
+
*
|
|
79
|
+
* registerDerivations(schema);
|
|
80
|
+
* ```
|
|
81
|
+
*
|
|
82
|
+
* @public
|
|
83
|
+
* @param schema
|
|
84
|
+
* @return {PolarisResourceSchema}
|
|
85
|
+
*/
|
|
86
|
+
export declare function withDefaults(schema: WithPartial<PolarisResourceSchema, "identity">): ResourceSchema;
|
|
87
|
+
interface FromIdentityDerivation {
|
|
88
|
+
(record: ReactiveResource, options: {
|
|
89
|
+
key: "lid";
|
|
90
|
+
} | {
|
|
91
|
+
key: "type";
|
|
92
|
+
}, key: string): string;
|
|
93
|
+
(record: ReactiveResource, options: {
|
|
94
|
+
key: "id";
|
|
95
|
+
}, key: string): string | null;
|
|
96
|
+
(record: ReactiveResource, options: {
|
|
97
|
+
key: "^";
|
|
98
|
+
}, key: string): StableRecordIdentifier;
|
|
99
|
+
(record: ReactiveResource, options: null, key: string): asserts options;
|
|
100
|
+
(record: ReactiveResource, options: {
|
|
101
|
+
key: "id" | "lid" | "type" | "^";
|
|
102
|
+
} | null, key: string): StableRecordIdentifier | string | null;
|
|
103
|
+
[Type]: "@identity";
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* A derivation that computes its value from the
|
|
107
|
+
* record's identity.
|
|
108
|
+
*
|
|
109
|
+
* It can be used via a derived field definition like:
|
|
110
|
+
*
|
|
111
|
+
* ```ts
|
|
112
|
+
* {
|
|
113
|
+
* kind: 'derived',
|
|
114
|
+
* name: 'id',
|
|
115
|
+
* type: '@identity',
|
|
116
|
+
* options: { key: 'id' }
|
|
117
|
+
* }
|
|
118
|
+
* ```
|
|
119
|
+
*
|
|
120
|
+
* Valid keys are `'id'`, `'lid'`, `'type'`, and `'^'`.
|
|
121
|
+
*
|
|
122
|
+
* `^` returns the entire identifier object.
|
|
123
|
+
*
|
|
124
|
+
* @public
|
|
125
|
+
*/
|
|
126
|
+
export declare const fromIdentity: FromIdentityDerivation;
|
|
127
|
+
/**
|
|
128
|
+
* Registers the default derivations for records that want
|
|
129
|
+
* to use the PolarisMode defaults provided by
|
|
130
|
+
*
|
|
131
|
+
* ```ts
|
|
132
|
+
* import { withDefaults } from '@warp-drive/schema-record';
|
|
133
|
+
* ```
|
|
134
|
+
*
|
|
135
|
+
* @public
|
|
136
|
+
* @param {SchemaService} schema
|
|
137
|
+
*/
|
|
138
|
+
export declare function registerDerivations(schema: SchemaServiceInterface): void;
|
|
139
|
+
interface InternalSchema {
|
|
140
|
+
original: ResourceSchema | ObjectSchema;
|
|
141
|
+
traits: Set<string>;
|
|
142
|
+
fields: Map<string, FieldSchema>;
|
|
143
|
+
attributes: Record<string, LegacyAttributeField>;
|
|
144
|
+
relationships: Record<string, LegacyRelationshipField>;
|
|
145
|
+
}
|
|
146
|
+
export type Transformation<
|
|
147
|
+
T extends Value = Value,
|
|
148
|
+
PT = unknown
|
|
149
|
+
> = {
|
|
150
|
+
serialize(value: PT, options: Record<string, unknown> | null, record: ReactiveResource): T;
|
|
151
|
+
hydrate(value: T | undefined, options: Record<string, unknown> | null, record: ReactiveResource): PT;
|
|
152
|
+
defaultValue?(options: Record<string, unknown> | null, identifier: StableRecordIdentifier): T;
|
|
153
|
+
[Type]: string;
|
|
154
|
+
};
|
|
155
|
+
interface KindFns {
|
|
156
|
+
belongsTo: {
|
|
157
|
+
get: (store: Store, record: object, resourceKey: StableRecordIdentifier, field: LegacyBelongsToField) => unknown;
|
|
158
|
+
set: (store: Store, record: object, cacheKey: StableRecordIdentifier, field: LegacyBelongsToField, value: unknown) => void;
|
|
159
|
+
};
|
|
160
|
+
hasMany: {
|
|
161
|
+
get: (store: Store, record: object, resourceKey: StableRecordIdentifier, field: LegacyHasManyField) => unknown;
|
|
162
|
+
set: (store: Store, record: object, cacheKey: StableRecordIdentifier, field: LegacyHasManyField, value: unknown) => void;
|
|
163
|
+
notify: (store: Store, record: object, cacheKey: StableRecordIdentifier, field: LegacyHasManyField) => boolean;
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
export interface SchemaService {
|
|
167
|
+
doesTypeExist(type: string): boolean;
|
|
168
|
+
attributesDefinitionFor(identifier: {
|
|
169
|
+
type: string;
|
|
170
|
+
}): InternalSchema["attributes"];
|
|
171
|
+
relationshipsDefinitionFor(identifier: {
|
|
172
|
+
type: string;
|
|
173
|
+
}): InternalSchema["relationships"];
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* A SchemaService designed to work with dynamically registered schemas.
|
|
177
|
+
*
|
|
178
|
+
* @class SchemaService
|
|
179
|
+
* @public
|
|
180
|
+
*/
|
|
181
|
+
export declare class SchemaService implements SchemaServiceInterface {
|
|
182
|
+
/** @internal */
|
|
183
|
+
_schemas: Map<string, InternalSchema>;
|
|
184
|
+
/** @internal */
|
|
185
|
+
_transforms: Map<string, Transformation>;
|
|
186
|
+
/** @internal */
|
|
187
|
+
_hashFns: Map<string, HashFn>;
|
|
188
|
+
/** @internal */
|
|
189
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
190
|
+
_derivations: Map<string, Derivation<any, any, any>>;
|
|
191
|
+
/** @internal */
|
|
192
|
+
_traits: Set<string>;
|
|
193
|
+
/** @internal */
|
|
194
|
+
_modes: Map<string, KindFns>;
|
|
195
|
+
/** @internal */
|
|
196
|
+
_extensions: {
|
|
197
|
+
object: Map<string, ProcessedExtension>;
|
|
198
|
+
array: Map<string, ProcessedExtension>;
|
|
199
|
+
};
|
|
200
|
+
_cachedFieldExtensionsByField: {
|
|
201
|
+
object: Map<object, ProcessedExtension["features"] | null>;
|
|
202
|
+
array: Map<object, ProcessedExtension["features"] | null>;
|
|
203
|
+
};
|
|
204
|
+
constructor();
|
|
205
|
+
resourceTypes(): Readonly<string[]>;
|
|
206
|
+
hasTrait(type: string): boolean;
|
|
207
|
+
resourceHasTrait(resource: StableRecordIdentifier | {
|
|
208
|
+
type: string;
|
|
209
|
+
}, trait: string): boolean;
|
|
210
|
+
transformation(field: GenericField | ObjectField | ArrayField | {
|
|
211
|
+
type: string;
|
|
212
|
+
}): Transformation;
|
|
213
|
+
derivation(field: DerivedField | {
|
|
214
|
+
type: string;
|
|
215
|
+
}): Derivation;
|
|
216
|
+
hashFn(field: HashField | {
|
|
217
|
+
type: string;
|
|
218
|
+
}): HashFn;
|
|
219
|
+
resource(resource: StableRecordIdentifier | {
|
|
220
|
+
type: string;
|
|
221
|
+
}): ResourceSchema | ObjectSchema;
|
|
222
|
+
registerResources(schemas: Array<ResourceSchema | ObjectSchema>): void;
|
|
223
|
+
registerResource(schema: ResourceSchema | ObjectSchema): void;
|
|
224
|
+
registerTransformation<
|
|
225
|
+
T extends Value = string,
|
|
226
|
+
PT = unknown
|
|
227
|
+
>(transformation: Transformation<T, PT>): void;
|
|
228
|
+
registerDerivation<
|
|
229
|
+
R,
|
|
230
|
+
T,
|
|
231
|
+
FM extends ObjectValue | null
|
|
232
|
+
>(derivation: Derivation<R, T, FM>): void;
|
|
233
|
+
CAUTION_MEGA_DANGER_ZONE_registerExtension(extension: CAUTION_MEGA_DANGER_ZONE_Extension): void;
|
|
234
|
+
CAUTION_MEGA_DANGER_ZONE_resourceExtensions(resource: StableRecordIdentifier | {
|
|
235
|
+
type: string;
|
|
236
|
+
}): null | ProcessedExtension["features"];
|
|
237
|
+
CAUTION_MEGA_DANGER_ZONE_objectExtensions(field: ExtensibleField): null | ProcessedExtension["features"];
|
|
238
|
+
CAUTION_MEGA_DANGER_ZONE_arrayExtensions(field: ExtensibleField): null | ProcessedExtension["features"];
|
|
239
|
+
/**
|
|
240
|
+
* This is an internal method used to register behaviors for legacy mode.
|
|
241
|
+
* It is not intended for public use.
|
|
242
|
+
*
|
|
243
|
+
* We do think a generalized `kind` registration system would be useful,
|
|
244
|
+
* but we have not yet designed it.
|
|
245
|
+
*
|
|
246
|
+
* See https://github.com/emberjs/data/issues/9534
|
|
247
|
+
*
|
|
248
|
+
* @internal
|
|
249
|
+
*/
|
|
250
|
+
_registerMode(mode: string, kinds: KindFns): void;
|
|
251
|
+
/**
|
|
252
|
+
* This is an internal method used to enable legacy behaviors for legacy mode.
|
|
253
|
+
* It is not intended for public use.
|
|
254
|
+
*
|
|
255
|
+
* We do think a generalized `kind` registration system would be useful,
|
|
256
|
+
* but we have not yet designed it.
|
|
257
|
+
*
|
|
258
|
+
* See https://github.com/emberjs/data/issues/9534
|
|
259
|
+
*
|
|
260
|
+
* @internal
|
|
261
|
+
*/
|
|
262
|
+
_kind<T extends keyof KindFns>(mode: string, kind: T): KindFns[T];
|
|
263
|
+
registerHashFn<T extends object>(hashFn: HashFn<T>): void;
|
|
264
|
+
fields({ type }: {
|
|
265
|
+
type: string;
|
|
266
|
+
}): InternalSchema["fields"];
|
|
267
|
+
hasResource(resource: {
|
|
268
|
+
type: string;
|
|
269
|
+
}): boolean;
|
|
270
|
+
}
|
|
271
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Great, got your attention with that warning didn't we?
|
|
2
|
+
// Good. Here's the deal: typescript treats symbols as unique types.
|
|
3
|
+
// If by accident a module creating a symbol is processed more than
|
|
4
|
+
// once, the symbol will be different in each processing. This will
|
|
5
|
+
// cause a type error.
|
|
6
|
+
// It could also cause a runtime error if the symbol is used innapropriately.
|
|
7
|
+
// However, this case is extremely hard to hit and would require other things
|
|
8
|
+
// to go wrong first.
|
|
9
|
+
//
|
|
10
|
+
// So, why do the warning? And why do we lie about the types of the symbols?
|
|
11
|
+
//
|
|
12
|
+
// Because we intentionally create multiple copies of them within the types
|
|
13
|
+
// at build time. This is because we rollup our d.ts files in order to give
|
|
14
|
+
// our consumers a better experience.
|
|
15
|
+
//
|
|
16
|
+
// However, no tool today supports rolling up d.ts files with multiple entry
|
|
17
|
+
// points correctly. The tool we use currently (vite-plugin-dts) uses @microsoft/api-extractor
|
|
18
|
+
// which creates a fully unique stand-alone types file per-entry-point. Thus
|
|
19
|
+
// every entry point that uses one of these symbols somewhere will have accidentally
|
|
20
|
+
// created a new symbol type.
|
|
21
|
+
//
|
|
22
|
+
// This cast allows us to rollup these types using this tool while not encountering
|
|
23
|
+
// the unique symbol type issue.
|
|
24
|
+
//
|
|
25
|
+
// Note that none of these symbols are part of the public API, these are used for
|
|
26
|
+
// debugging DX and as a safe way to provide an intimate contract on public objects.
|
|
27
|
+
export declare const SOURCE: "___(unique) Symbol(SOURCE)";
|
|
28
|
+
export declare const MUTATE: "___(unique) Symbol(MUTATE)";
|
|
29
|
+
export declare const Destroy: "___(unique) Symbol(Destroy)";
|
|
30
|
+
export declare const Identifier: "___(unique) Symbol(Identifier)";
|
|
31
|
+
export declare const Editable: "___(unique) Symbol(Editable)";
|
|
32
|
+
export declare const Parent: "___(unique) Symbol(Parent)";
|
|
33
|
+
export declare const Checkout: "___(unique) Symbol(Checkout)";
|
|
34
|
+
export declare const Legacy: "___(unique) Symbol(Legacy)";
|
|
35
|
+
export declare const EmbeddedPath: "___(unique) Symbol(EmbeddedPath)";
|
|
36
|
+
export declare const EmbeddedField: "___(unique) Symbol(EmbeddedField)";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Editable, Legacy } from "./-private/symbols.js";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { instantiateRecord, teardownRecord } from "./reactive/-private/hooks.js";
|
|
2
|
+
export { type CAUTION_MEGA_DANGER_ZONE_Extension, type ProcessedExtension, type ExtensionDef, type Transformation, SchemaService, withDefaults, fromIdentity, registerDerivations } from "./reactive/-private/schema.js";
|
|
3
|
+
export { type ReactiveResource } from "./reactive/-private/record.js";
|
|
4
|
+
export { Checkout } from "./reactive/-private/symbols.js";
|
|
@@ -1,42 +1,41 @@
|
|
|
1
|
-
import type { StableDocumentIdentifier } from
|
|
2
|
-
import type { ImmutableHeaders, ImmutableRequestInfo, RequestInfo, ResponseInfo } from
|
|
3
|
-
import type { DeferredStream, GodContext } from
|
|
1
|
+
import type { StableDocumentIdentifier } from "../../types/identifier.js";
|
|
2
|
+
import type { ImmutableHeaders, ImmutableRequestInfo, RequestInfo, ResponseInfo } from "../../types/request.js";
|
|
3
|
+
import type { DeferredStream, GodContext } from "./types.js";
|
|
4
4
|
export declare function upgradeHeaders(headers: Headers | ImmutableHeaders): ImmutableHeaders;
|
|
5
5
|
export declare function cloneResponseProperties(response: Response): ResponseInfo;
|
|
6
6
|
export declare class ContextOwner {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
7
|
+
hasSetStream: boolean;
|
|
8
|
+
hasSetResponse: boolean;
|
|
9
|
+
hasSubscribers: boolean;
|
|
10
|
+
stream: DeferredStream;
|
|
11
|
+
response: ResponseInfo | null;
|
|
12
|
+
request: ImmutableRequestInfo;
|
|
13
|
+
enhancedRequest: ImmutableRequestInfo;
|
|
14
|
+
nextCalled: number;
|
|
15
|
+
god: GodContext;
|
|
16
|
+
controller: AbortController;
|
|
17
|
+
requestId: number;
|
|
18
|
+
isRoot: boolean;
|
|
19
|
+
constructor(request: RequestInfo, god: GodContext, isRoot?: boolean);
|
|
20
|
+
get hasRequestedStream(): boolean;
|
|
21
|
+
getResponse(): ResponseInfo | null;
|
|
22
|
+
getStream(): Promise<ReadableStream | null>;
|
|
23
|
+
abort(reason: DOMException): void;
|
|
24
|
+
setStream(stream: ReadableStream | Promise<ReadableStream | null> | null): void;
|
|
25
|
+
resolveStream(): void;
|
|
26
|
+
setResponse(response: ResponseInfo | Response | null): void;
|
|
27
27
|
}
|
|
28
28
|
export declare class Context {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
29
|
+
#private;
|
|
30
|
+
request: ImmutableRequestInfo;
|
|
31
|
+
id: number;
|
|
32
|
+
private _isCacheHandler;
|
|
33
|
+
private _finalized;
|
|
34
|
+
constructor(owner: ContextOwner, isCacheHandler: boolean);
|
|
35
|
+
setStream(stream: ReadableStream | Promise<ReadableStream | null>): void;
|
|
36
|
+
setResponse(response: ResponseInfo | Response | null): void;
|
|
37
|
+
setIdentifier(identifier: StableDocumentIdentifier): void;
|
|
38
|
+
get hasRequestedStream(): boolean;
|
|
39
|
+
_finalize(): void;
|
|
40
40
|
}
|
|
41
41
|
export type HandlerRequestContext = Context;
|
|
42
|
-
//# sourceMappingURL=context.d.ts.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { RequestInfo } from
|
|
2
|
-
import { Context } from
|
|
1
|
+
import type { RequestInfo } from "../../types/request.js";
|
|
2
|
+
import { Context } from "./context.js";
|
|
3
3
|
export declare function deepFreeze<T = unknown>(value: T): T;
|
|
4
4
|
export declare function assertValidRequest(request: RequestInfo | Context, isTopLevel: boolean): asserts request is RequestInfo;
|
|
5
|
-
//# sourceMappingURL=debug.d.ts.map
|
|
@@ -1,43 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
* A basic Fetch Handler which converts a request into a
|
|
3
|
-
* `fetch` call presuming the response to be `json`.
|
|
4
|
-
*
|
|
5
|
-
* ```ts
|
|
6
|
-
* import Fetch from '@ember-data/request/fetch';
|
|
7
|
-
*
|
|
8
|
-
* manager.use([Fetch]);
|
|
9
|
-
* ```
|
|
10
|
-
*
|
|
11
|
-
* @module
|
|
12
|
-
*/
|
|
13
|
-
import { type Context } from './context';
|
|
1
|
+
import { type Context } from "./context.js";
|
|
14
2
|
interface FastbootRequest extends Request {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
interface FastBoot {
|
|
19
|
-
require(moduleName: string): unknown;
|
|
20
|
-
isFastBoot: boolean;
|
|
21
|
-
request: FastbootRequest;
|
|
3
|
+
protocol: string;
|
|
4
|
+
host: string;
|
|
22
5
|
}
|
|
23
|
-
|
|
24
|
-
|
|
6
|
+
export interface FastBoot {
|
|
7
|
+
require(moduleName: string): unknown;
|
|
8
|
+
isFastBoot: boolean;
|
|
9
|
+
request: FastbootRequest;
|
|
25
10
|
}
|
|
26
11
|
/**
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { Fetch } from '@warp-drive/core';
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* A basic Fetch Handler which converts a request into a
|
|
17
|
+
* `fetch` call presuming the response to be `json`.
|
|
18
|
+
*
|
|
19
|
+
* ```ts
|
|
20
|
+
* import { RequestManager, Fetch } from '@warp-drive/core';
|
|
21
|
+
*
|
|
22
|
+
* const manager = new RequestManager()
|
|
23
|
+
* .use([Fetch]);
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
39
28
|
declare const Fetch: {
|
|
40
|
-
|
|
29
|
+
request<T>(context: Context): Promise<T>;
|
|
41
30
|
};
|
|
42
31
|
export { Fetch };
|
|
43
|
-
//# sourceMappingURL=fetch.d.ts.map
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { type StructuredDocument } from
|
|
2
|
-
import type { ContextOwner } from
|
|
3
|
-
import type { Deferred, DeferredFuture, Future } from
|
|
1
|
+
import { type StructuredDocument } from "../../types/request.js";
|
|
2
|
+
import type { ContextOwner } from "./context.js";
|
|
3
|
+
import type { Deferred, DeferredFuture, Future } from "./types.js";
|
|
4
4
|
export declare function isFuture<T>(maybe: unknown): maybe is Future<T>;
|
|
5
5
|
export declare function createDeferred<T>(): Deferred<T>;
|
|
6
6
|
export declare function upgradePromise<T>(promise: Promise<StructuredDocument<T>>, future: Future<T>): Future<T>;
|
|
7
7
|
export declare function createFuture<T>(owner: ContextOwner): DeferredFuture<T>;
|
|
8
|
-
//# sourceMappingURL=future.d.ts.map
|