@warp-drive/core-types 5.6.0-beta.0 → 5.6.0-beta.2

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 (96) hide show
  1. package/addon-main.cjs +1 -1
  2. package/dist/-private.js +1 -79
  3. package/dist/cache/aliases.js +1 -0
  4. package/dist/cache/change.js +1 -0
  5. package/dist/cache/mutations.js +1 -0
  6. package/dist/cache/operations.js +1 -0
  7. package/dist/cache/relationship.js +1 -0
  8. package/dist/cache.js +1 -0
  9. package/dist/graph.js +1 -0
  10. package/dist/identifier.js +1 -92
  11. package/dist/index.js +1 -0
  12. package/dist/json/raw.js +1 -0
  13. package/dist/params.js +1 -0
  14. package/dist/record.js +1 -74
  15. package/dist/request.js +1 -34
  16. package/dist/runtime.js +1 -35
  17. package/dist/schema/concepts.js +1 -0
  18. package/dist/schema/fields.js +1 -520
  19. package/dist/spec/document.js +1 -0
  20. package/dist/spec/error.js +1 -0
  21. package/dist/spec/json-api-raw.js +1 -0
  22. package/dist/symbols.js +1 -92
  23. package/dist/utils.js +1 -0
  24. package/package.json +4 -7
  25. package/unstable-preview-types/-private.d.ts +3 -15
  26. package/unstable-preview-types/cache/aliases.d.ts +3 -3
  27. package/unstable-preview-types/cache/change.d.ts +3 -8
  28. package/unstable-preview-types/cache/mutations.d.ts +3 -40
  29. package/unstable-preview-types/cache/operations.d.ts +3 -73
  30. package/unstable-preview-types/cache/relationship.d.ts +3 -15
  31. package/unstable-preview-types/cache.d.ts +3 -530
  32. package/unstable-preview-types/graph.d.ts +3 -57
  33. package/unstable-preview-types/identifier.d.ts +3 -113
  34. package/unstable-preview-types/index.d.ts +14 -23
  35. package/unstable-preview-types/json/raw.d.ts +3 -8
  36. package/unstable-preview-types/params.d.ts +3 -11
  37. package/unstable-preview-types/record.d.ts +3 -104
  38. package/unstable-preview-types/request.d.ts +3 -338
  39. package/unstable-preview-types/runtime.d.ts +3 -17
  40. package/unstable-preview-types/schema/concepts.d.ts +3 -18
  41. package/unstable-preview-types/schema/fields.d.ts +3 -1886
  42. package/unstable-preview-types/spec/document.d.ts +3 -32
  43. package/unstable-preview-types/spec/error.d.ts +3 -20
  44. package/unstable-preview-types/spec/json-api-raw.d.ts +3 -143
  45. package/unstable-preview-types/symbols.d.ts +3 -84
  46. package/unstable-preview-types/utils.d.ts +3 -6
  47. package/dist/-private.js.map +0 -1
  48. package/dist/cache/aliases.js.map +0 -1
  49. package/dist/cache/change.js.map +0 -1
  50. package/dist/cache/mutations.js.map +0 -1
  51. package/dist/cache/operations.js.map +0 -1
  52. package/dist/cache/relationship.js.map +0 -1
  53. package/dist/cache.js.map +0 -1
  54. package/dist/graph.js.map +0 -1
  55. package/dist/identifier.js.map +0 -1
  56. package/dist/index.js.map +0 -1
  57. package/dist/json/raw.js.map +0 -1
  58. package/dist/params.js.map +0 -1
  59. package/dist/record.js.map +0 -1
  60. package/dist/request.js.map +0 -1
  61. package/dist/runtime.js.map +0 -1
  62. package/dist/schema/concepts.js.map +0 -1
  63. package/dist/schema/fields.js.map +0 -1
  64. package/dist/schema/fields.type-test.js +0 -0
  65. package/dist/schema/fields.type-test.js.map +0 -1
  66. package/dist/spec/document.js.map +0 -1
  67. package/dist/spec/error.js.map +0 -1
  68. package/dist/spec/json-api-raw.js.map +0 -1
  69. package/dist/symbols.js.map +0 -1
  70. package/dist/utils.js.map +0 -1
  71. package/unstable-preview-types/-private.d.ts.map +0 -1
  72. package/unstable-preview-types/cache/aliases.d.ts.map +0 -1
  73. package/unstable-preview-types/cache/change.d.ts.map +0 -1
  74. package/unstable-preview-types/cache/mutations.d.ts.map +0 -1
  75. package/unstable-preview-types/cache/operations.d.ts.map +0 -1
  76. package/unstable-preview-types/cache/relationship.d.ts.map +0 -1
  77. package/unstable-preview-types/cache.d.ts.map +0 -1
  78. package/unstable-preview-types/graph.d.ts.map +0 -1
  79. package/unstable-preview-types/identifier.d.ts.map +0 -1
  80. package/unstable-preview-types/index.d.ts.map +0 -1
  81. package/unstable-preview-types/json/raw.d.ts.map +0 -1
  82. package/unstable-preview-types/params.d.ts.map +0 -1
  83. package/unstable-preview-types/record.d.ts.map +0 -1
  84. package/unstable-preview-types/record.type-test.d.ts +0 -4
  85. package/unstable-preview-types/record.type-test.d.ts.map +0 -1
  86. package/unstable-preview-types/request.d.ts.map +0 -1
  87. package/unstable-preview-types/runtime.d.ts.map +0 -1
  88. package/unstable-preview-types/schema/concepts.d.ts.map +0 -1
  89. package/unstable-preview-types/schema/fields.d.ts.map +0 -1
  90. package/unstable-preview-types/schema/fields.type-test.d.ts +0 -4
  91. package/unstable-preview-types/schema/fields.type-test.d.ts.map +0 -1
  92. package/unstable-preview-types/spec/document.d.ts.map +0 -1
  93. package/unstable-preview-types/spec/error.d.ts.map +0 -1
  94. package/unstable-preview-types/spec/json-api-raw.d.ts.map +0 -1
  95. package/unstable-preview-types/symbols.d.ts.map +0 -1
  96. package/unstable-preview-types/utils.d.ts.map +0 -1
package/addon-main.cjs CHANGED
@@ -1,4 +1,4 @@
1
1
  'use strict';
2
2
 
3
- const { addonShim } = require('@warp-drive/build-config/addon-shim.cjs');
3
+ const { addonShim } = require('@warp-drive/core/addon-shim.cjs');
4
4
  module.exports = addonShim(__dirname);
package/dist/-private.js CHANGED
@@ -1,79 +1 @@
1
- import { macroCondition, getGlobalConfig } from '@embroider/macros';
2
- const name = "@warp-drive/core-types";
3
- const version = "5.6.0-beta.0";
4
-
5
- // in testing mode, we utilize globals to ensure only one copy exists of
6
- // these maps, due to bugs in ember-auto-import
7
-
8
- const GlobalRef = globalThis;
9
- const UniversalCache = GlobalRef.__warpDrive_universalCache = GlobalRef.__warpDrive_universalCache ?? {};
10
-
11
- // in order to support mirror packages, we ensure that each
12
- // unique package name has its own global cache
13
- GlobalRef[name] = GlobalRef[name] ?? {
14
- __version: version
15
- };
16
- const GlobalSink = GlobalRef[name];
17
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
18
- if (GlobalSink.__version !== version) {
19
- throw new Error('Multiple versions of WarpDrive detected, the application will malfunction.');
20
- }
21
- }
22
- const ModuleScopedCaches = GlobalSink.__warpDrive_ModuleScopedCaches ?? {};
23
- if (macroCondition(getGlobalConfig().WarpDrive.env.TESTING)) {
24
- if (!GlobalSink.__warpDrive_ModuleScopedCaches) {
25
- GlobalSink.__warpDrive_ModuleScopedCaches = ModuleScopedCaches;
26
- } else {
27
- // eslint-disable-next-line no-console
28
- console.warn(`
29
- Multiple copies of EmberData have been detected. This may be due to a bug in ember-auto-import
30
- in which test assets get their own copy of some v2-addons. This can cause the application to
31
- malfunction as each copy will maintain its own separate state.`);
32
- }
33
- } else {
34
- if (GlobalSink.__warpDrive_hasOtherCopy) {
35
- throw new Error('Multiple copies of EmberData detected, the application will malfunction.');
36
- }
37
- GlobalSink.__warpDrive_hasOtherCopy = true;
38
- }
39
- function getOrSetGlobal(key, value) {
40
- if (macroCondition(getGlobalConfig().WarpDrive.env.TESTING)) {
41
- const existing = ModuleScopedCaches[key];
42
- if (existing === undefined) {
43
- return ModuleScopedCaches[key] = value;
44
- } else {
45
- return existing;
46
- }
47
- } else {
48
- return value;
49
- }
50
- }
51
- function peekTransient(key) {
52
- const globalKey = `(transient) ${key}`;
53
- return ModuleScopedCaches[globalKey] ?? null;
54
- }
55
- function setTransient(key, value) {
56
- const globalKey = `(transient) ${key}`;
57
- return ModuleScopedCaches[globalKey] = value;
58
- }
59
- function getOrSetUniversal(key, value) {
60
- if (macroCondition(getGlobalConfig().WarpDrive.env.TESTING)) {
61
- const existing = UniversalCache[key];
62
- if (existing === undefined) {
63
- return UniversalCache[key] = value;
64
- } else {
65
- return existing;
66
- }
67
- } else {
68
- return value;
69
- }
70
- }
71
- function peekUniversalTransient(key) {
72
- const globalKey = `(transient) ${key}`;
73
- return UniversalCache[globalKey] ?? null;
74
- }
75
- function setUniversalTransient(key, value) {
76
- const globalKey = `(transient) ${key}`;
77
- return UniversalCache[globalKey] = value;
78
- }
79
- export { getOrSetGlobal, getOrSetUniversal, peekTransient, peekUniversalTransient, setTransient, setUniversalTransient };
1
+ export * from '@warp-drive/core/types/-private';
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
1
+
package/dist/cache.js CHANGED
@@ -0,0 +1 @@
1
+
package/dist/graph.js CHANGED
@@ -0,0 +1 @@
1
+
@@ -1,92 +1 @@
1
- import { macroCondition, getGlobalConfig } from '@embroider/macros';
2
-
3
- /**
4
- @module @ember-data/store
5
- */
6
- // provided for additional debuggability
7
- const DEBUG_CLIENT_ORIGINATED = Symbol('record-originated-on-client');
8
- const DEBUG_IDENTIFIER_BUCKET = Symbol('identifier-bucket');
9
- const DEBUG_STALE_CACHE_OWNER = Symbol('warpDriveStaleCache');
10
- function ProdSymbol(str, debugStr) {
11
- return macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? Symbol(debugStr) : str;
12
- }
13
-
14
- // also present in production
15
- const CACHE_OWNER = ProdSymbol('__$co', 'CACHE_OWNER');
16
-
17
- /**
18
- * An Identifier specific to a record which may or may not
19
- * be present in the cache.
20
- *
21
- * The absence of an `id` DOES NOT indicate that this
22
- * Identifier is for a new client-created record as it
23
- * may also indicate that it was generated for a secondary
24
- * index and the primary `id` index is not yet known.
25
- *
26
- * @internal
27
- */
28
-
29
- /**
30
- * Used when an Identifier is known to be the stable version
31
- *
32
- * @internal
33
- */
34
-
35
- /**
36
- * Used when a StableRecordIdentifier was not created locally as part
37
- * of a call to store.createRecord
38
- *
39
- * Distinguishing between this Identifier and one for a client created
40
- * record that was created with an ID is generally speaking not possible
41
- * at runtime, so anything with an ID typically narrows to this.
42
- *
43
- * @internal
44
- */
45
-
46
- /**
47
- * Used when a StableRecordIdentifier was created locally
48
- * (by a call to store.createRecord).
49
- *
50
- * It is possible in rare circumstances to have a StableRecordIdentifier
51
- * that is not for a new record but does not have an ID. This would
52
- * happen if a user intentionally created one for use with a secondary-index
53
- * prior to the record having been fully loaded.
54
- *
55
- * @internal
56
- */
57
-
58
- /**
59
- * A referentially stable object with a unique string (lid) that can be used
60
- * as a reference to data in the cache.
61
- *
62
- * Every record instance has a unique identifier, and identifiers may refer
63
- * to data that has never been loaded (for instance, in an async relationship).
64
- *
65
- * @class StableRecordIdentifier
66
- * @public
67
- */
68
-
69
- /**
70
- * A string representing a unique identity.
71
- *
72
- * @property lid
73
- * @type {String}
74
- * @public
75
- */
76
- /**
77
- * the primary resource `type` or `modelName` this identity belongs to.
78
- *
79
- * @property type
80
- * @type {String}
81
- * @public
82
- */
83
- /**
84
- * the primary id for the record this identity belongs to. `null`
85
- * if not yet assigned an id.
86
- *
87
- * @property id
88
- * @type {String | null}
89
- * @public
90
- */
91
-
92
- export { CACHE_OWNER, DEBUG_CLIENT_ORIGINATED, DEBUG_IDENTIFIER_BUCKET, DEBUG_STALE_CACHE_OWNER };
1
+ export * from '@warp-drive/core/types/identifier';
package/dist/index.js CHANGED
@@ -0,0 +1 @@
1
+
package/dist/json/raw.js CHANGED
@@ -0,0 +1 @@
1
+
package/dist/params.js CHANGED
@@ -0,0 +1 @@
1
+
package/dist/record.js CHANGED
@@ -1,74 +1 @@
1
- /*
2
- * @module @warp-drive/core-types
3
- */
4
-
5
- /**
6
- * Records may be anything, They don't even
7
- * have to be objects.
8
- *
9
- * Whatever they are, if they have a Type
10
- * property, that property will be used by EmberData
11
- * and WarpDrive to provide better type safety and
12
- * intellisense.
13
- *
14
- * @class TypedRecordInstance
15
- * @typedoc
16
- */
17
-
18
- /**
19
- * A type utility that extracts the Type if available,
20
- * otherwise it returns never.
21
- *
22
- * @typedoc
23
- */
24
-
25
- /**
26
- * A type utility that extracts the Type if available,
27
- * otherwise it returns string
28
- *
29
- * @typedoc
30
- */
31
-
32
- /**
33
- * A Utility that extracts either resource types or resource paths from a TypedRecordInstance.
34
- *
35
- * Its limitations are mostly around its intentional non-recursiveness. It presumes that APIs which
36
- * implement includes will not allow cyclical include paths, and will collapse includes by type.
37
- *
38
- * This follows closer to the JSON:API fields spec than to the includes spec in nature, but in
39
- * practice it is so impracticle for an API to allow z-algo include paths that this is probably
40
- * reasonable.
41
- *
42
- * We may need to revisit this in the future, opting to either make this restriction optional or
43
- * to allow for other strategies.
44
- *
45
- * There's a 90% chance this particular implementation belongs being in the JSON:API package instead
46
- * of core-types, but it's here for now.
47
- *
48
- * @typedoc
49
- */
50
-
51
- /**
52
- * A utility that provides the union of all ResourceName for all potential
53
- * includes for the given TypedRecordInstance.
54
- *
55
- * @typedoc
56
- */
57
-
58
- // ToPaths<ExpandIgnore<T, true>, false>;
59
-
60
- /**
61
- * A utility that provides the union type of all valid include paths for the given
62
- * TypedRecordInstance.
63
- *
64
- * Cyclical paths are filtered out.
65
- *
66
- * @typedoc
67
- */
68
-
69
- function createIncludeValidator() {
70
- return function validateIncludes(includes) {
71
- return includes;
72
- };
73
- }
74
- export { createIncludeValidator };
1
+ export * from '@warp-drive/core/types/record';
package/dist/request.js CHANGED
@@ -1,34 +1 @@
1
- import { getOrSetUniversal, getOrSetGlobal } from "./-private.js";
2
- const SkipCache = getOrSetUniversal('SkipCache', Symbol.for('wd:skip-cache'));
3
- const EnableHydration = getOrSetUniversal('EnableHydration', Symbol.for('wd:enable-hydration'));
4
- const IS_FUTURE = getOrSetGlobal('IS_FUTURE', Symbol('IS_FUTURE'));
5
- const STRUCTURED = getOrSetGlobal('DOC', Symbol('DOC'));
6
-
7
- /**
8
- * Use these options to adjust CacheHandler behavior for a request.
9
- *
10
- * @typedoc
11
- */
12
-
13
- /**
14
- * JavaScript's native Request class.
15
- *
16
- * EmberData provides our own typings due to incompleteness in the native typings.
17
- *
18
- * @typedoc
19
- */
20
-
21
- /**
22
- * Extends JavaScript's native {@link Request} object with additional
23
- * properties specific to the RequestManager's capabilities.
24
- *
25
- * @typedoc
26
- */
27
-
28
- /**
29
- * Immutable version of {@link RequestInfo}. This is what is passed to handlers.
30
- *
31
- * @typedoc
32
- */
33
-
34
- export { EnableHydration, IS_FUTURE, STRUCTURED, SkipCache };
1
+ export * from '@warp-drive/core/types/request';
package/dist/runtime.js CHANGED
@@ -1,35 +1 @@
1
- import { getOrSetUniversal } from "./-private.js";
2
- const RuntimeConfig = getOrSetUniversal('WarpDriveRuntimeConfig', {
3
- debug: {}
4
- });
5
- function trySessionStorage() {
6
- // This works even when sessionStorage is not available.
7
- // See https://github.com/emberjs/data/issues/9784
8
- try {
9
- return globalThis.sessionStorage;
10
- } catch {
11
- return undefined;
12
- }
13
- }
14
- const storage = trySessionStorage();
15
- const settings = storage?.getItem('WarpDriveRuntimeConfig');
16
- if (settings) {
17
- Object.assign(RuntimeConfig, JSON.parse(settings));
18
- }
19
- function getRuntimeConfig() {
20
- return RuntimeConfig;
21
- }
22
-
23
- /**
24
- * Upserts the specified logging configuration into the runtime
25
- * config.
26
- *
27
- * globalThis.setWarpDriveLogging({ LOG_CACHE: true } });
28
- *
29
- * @typedoc
30
- */
31
- function setLogging(config) {
32
- Object.assign(RuntimeConfig.debug, config);
33
- storage?.setItem('WarpDriveRuntimeConfig', JSON.stringify(RuntimeConfig));
34
- }
35
- export { getRuntimeConfig, setLogging };
1
+ export * from '@warp-drive/core/types/runtime';
@@ -0,0 +1 @@
1
+