@ember-data/model 5.4.0-alpha.64 → 5.4.0-alpha.70
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/addon-main.cjs +5 -0
- package/blueprints/model/index.js +18 -5
- package/blueprints/model-test/index.js +16 -10
- package/blueprints/model-test/qunit-files/__root__/__path__/__test__.js +4 -5
- package/{addon → dist}/-private.js +2 -2
- package/{addon/has-many-BuTJfT5a.js → dist/has-many-CR10J-rp.js} +49 -26
- package/dist/has-many-CR10J-rp.js.map +1 -0
- package/dist/hooks-BNw6VdLr.js +75 -0
- package/dist/hooks-BNw6VdLr.js.map +1 -0
- package/dist/hooks.js +2 -0
- package/{addon → dist}/hooks.js.map +1 -1
- package/dist/index.js +4 -0
- package/{addon → dist}/index.js.map +1 -1
- package/dist/migration-support.js +211 -0
- package/dist/migration-support.js.map +1 -0
- package/{addon/model-DJ9C4aZ-.js → dist/model-CsbDNxap.js} +821 -250
- package/dist/model-CsbDNxap.js.map +1 -0
- package/dist/schema-provider-C5vR7TBr.js +256 -0
- package/dist/schema-provider-C5vR7TBr.js.map +1 -0
- package/package.json +39 -59
- package/unstable-preview-types/-private/attr.d.ts.map +1 -1
- package/unstable-preview-types/-private/belongs-to.d.ts.map +1 -1
- package/unstable-preview-types/-private/debug/assert-polymorphic-type.d.ts +2 -2
- package/unstable-preview-types/-private/debug/assert-polymorphic-type.d.ts.map +1 -1
- package/unstable-preview-types/-private/errors.d.ts +2 -5
- package/unstable-preview-types/-private/errors.d.ts.map +1 -1
- package/unstable-preview-types/-private/has-many.d.ts.map +1 -1
- package/unstable-preview-types/-private/hooks.d.ts.map +1 -1
- package/unstable-preview-types/-private/legacy-relationships-support.d.ts +16 -20
- package/unstable-preview-types/-private/legacy-relationships-support.d.ts.map +1 -1
- package/unstable-preview-types/-private/many-array.d.ts +11 -13
- package/unstable-preview-types/-private/many-array.d.ts.map +1 -1
- package/unstable-preview-types/-private/model-methods.d.ts +6 -5
- package/unstable-preview-types/-private/model-methods.d.ts.map +1 -1
- package/unstable-preview-types/-private/model.d.ts +38 -35
- package/unstable-preview-types/-private/model.d.ts.map +1 -1
- package/unstable-preview-types/-private/notify-changes.d.ts +1 -1
- package/unstable-preview-types/-private/notify-changes.d.ts.map +1 -1
- package/unstable-preview-types/-private/promise-belongs-to.d.ts +1 -2
- package/unstable-preview-types/-private/promise-belongs-to.d.ts.map +1 -1
- package/unstable-preview-types/-private/promise-many-array.d.ts +4 -4
- package/unstable-preview-types/-private/promise-many-array.d.ts.map +1 -1
- package/unstable-preview-types/-private/record-state.d.ts +3 -4
- package/unstable-preview-types/-private/record-state.d.ts.map +1 -1
- package/unstable-preview-types/-private/references/belongs-to.d.ts +4 -4
- package/unstable-preview-types/-private/references/belongs-to.d.ts.map +1 -1
- package/unstable-preview-types/-private/references/has-many.d.ts +7 -7
- package/unstable-preview-types/-private/references/has-many.d.ts.map +1 -1
- package/unstable-preview-types/-private/schema-provider.d.ts +46 -15
- package/unstable-preview-types/-private/schema-provider.d.ts.map +1 -1
- package/unstable-preview-types/-private/type-utils.d.ts +64 -0
- package/unstable-preview-types/-private/type-utils.d.ts.map +1 -0
- package/unstable-preview-types/-private.d.ts +4 -3
- package/unstable-preview-types/-private.d.ts.map +1 -1
- package/unstable-preview-types/index.d.ts +20 -20
- package/unstable-preview-types/index.d.ts.map +1 -1
- package/unstable-preview-types/migration-support.d.ts +45 -6
- package/unstable-preview-types/migration-support.d.ts.map +1 -1
- package/addon/has-many-BuTJfT5a.js.map +0 -1
- package/addon/hooks-BMoEt0SI.js +0 -176
- package/addon/hooks-BMoEt0SI.js.map +0 -1
- package/addon/hooks.js +0 -1
- package/addon/index.js +0 -3
- package/addon/migration-support.js +0 -118
- package/addon/migration-support.js.map +0 -1
- package/addon/model-DJ9C4aZ-.js.map +0 -1
- package/addon/util-CSYkrwfb.js +0 -35
- package/addon/util-CSYkrwfb.js.map +0 -1
- package/addon-main.js +0 -94
- package/unstable-preview-types/-private/promise-proxy-base.d.ts +0 -35
- /package/{addon → dist}/-private.js.map +0 -0
package/addon/util-CSYkrwfb.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { deprecate } from '@ember/debug';
|
|
2
|
-
import { dasherize } from '@ember/string';
|
|
3
|
-
import { macroCondition, getOwnConfig } from '@embroider/macros';
|
|
4
|
-
function isElementDescriptor(args) {
|
|
5
|
-
const [maybeTarget, maybeKey, maybeDesc] = args;
|
|
6
|
-
return (
|
|
7
|
-
// Ensure we have the right number of args
|
|
8
|
-
args.length === 3 && (
|
|
9
|
-
// Make sure the target is a class or object (prototype)
|
|
10
|
-
typeof maybeTarget === 'function' || typeof maybeTarget === 'object' && maybeTarget !== null) &&
|
|
11
|
-
// Make sure the key is a string
|
|
12
|
-
typeof maybeKey === 'string' && (
|
|
13
|
-
// Make sure the descriptor is the right shape
|
|
14
|
-
typeof maybeDesc === 'object' && maybeDesc !== null && 'enumerable' in maybeDesc && 'configurable' in maybeDesc ||
|
|
15
|
-
// TS compatibility
|
|
16
|
-
maybeDesc === undefined)
|
|
17
|
-
);
|
|
18
|
-
}
|
|
19
|
-
function normalizeModelName(type) {
|
|
20
|
-
if (macroCondition(getOwnConfig().deprecations.DEPRECATE_NON_STRICT_TYPES)) {
|
|
21
|
-
const result = dasherize(type);
|
|
22
|
-
deprecate(`The resource type '${type}' is not normalized. Update your application code to use '${result}' instead of '${type}'.`, result === type, {
|
|
23
|
-
id: 'ember-data:deprecate-non-strict-types',
|
|
24
|
-
until: '6.0',
|
|
25
|
-
for: 'ember-data',
|
|
26
|
-
since: {
|
|
27
|
-
available: '5.3',
|
|
28
|
-
enabled: '5.3'
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
return result;
|
|
32
|
-
}
|
|
33
|
-
return type;
|
|
34
|
-
}
|
|
35
|
-
export { isElementDescriptor as i, normalizeModelName as n };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"util-CSYkrwfb.js","sources":["../src/-private/util.ts"],"sourcesContent":["import { deprecate } from '@ember/debug';\nimport { dasherize } from '@ember/string';\n\nimport { DEPRECATE_NON_STRICT_TYPES } from '@warp-drive/build-config/deprecations';\n\nexport type DecoratorPropertyDescriptor = (PropertyDescriptor & { initializer?: () => unknown }) | undefined;\n\nexport function isElementDescriptor(args: unknown[]): args is [object, string, DecoratorPropertyDescriptor] {\n const [maybeTarget, maybeKey, maybeDesc] = args;\n\n return (\n // Ensure we have the right number of args\n args.length === 3 &&\n // Make sure the target is a class or object (prototype)\n (typeof maybeTarget === 'function' || (typeof maybeTarget === 'object' && maybeTarget !== null)) &&\n // Make sure the key is a string\n typeof maybeKey === 'string' &&\n // Make sure the descriptor is the right shape\n ((typeof maybeDesc === 'object' &&\n maybeDesc !== null &&\n 'enumerable' in maybeDesc &&\n 'configurable' in maybeDesc) ||\n // TS compatibility\n maybeDesc === undefined)\n );\n}\n\nexport type DataDecorator = (\n target: object,\n key: string,\n desc?: DecoratorPropertyDescriptor\n) => DecoratorPropertyDescriptor;\nexport type DataDecoratorFactory = (...args: unknown[]) => DataDecorator;\n\nexport function computedMacroWithOptionalParams(fn: DataDecorator | DataDecoratorFactory) {\n return (...maybeDesc: unknown[]) =>\n isElementDescriptor(maybeDesc)\n ? (fn as DataDecoratorFactory)()(...maybeDesc)\n : fn(...(maybeDesc as [object, string, DecoratorPropertyDescriptor?]));\n}\n\nexport function normalizeModelName(type: string): string {\n if (DEPRECATE_NON_STRICT_TYPES) {\n const result = dasherize(type);\n\n deprecate(\n `The resource type '${type}' is not normalized. Update your application code to use '${result}' instead of '${type}'.`,\n result === type,\n {\n id: 'ember-data:deprecate-non-strict-types',\n until: '6.0',\n for: 'ember-data',\n since: {\n available: '5.3',\n enabled: '5.3',\n },\n }\n );\n\n return result;\n }\n\n return type;\n}\n"],"names":["isElementDescriptor","args","maybeTarget","maybeKey","maybeDesc","length","undefined","normalizeModelName","type","macroCondition","getOwnConfig","deprecations","DEPRECATE_NON_STRICT_TYPES","result","dasherize","deprecate","id","until","for","since","available","enabled"],"mappings":";;;;AAOO,SAASA,mBAAmBA,CAACC,IAAe,EAAyD;EAC1G,MAAM,CAACC,WAAW,EAAEC,QAAQ,EAAEC,SAAS,CAAC,GAAGH,IAAI,CAAA;AAE/C,EAAA;AACE;IACAA,IAAI,CAACI,MAAM,KAAK,CAAC;AACjB;AACC,IAAA,OAAOH,WAAW,KAAK,UAAU,IAAK,OAAOA,WAAW,KAAK,QAAQ,IAAIA,WAAW,KAAK,IAAK,CAAC;AAChG;IACA,OAAOC,QAAQ,KAAK,QAAQ;AAC5B;AACE,IAAA,OAAOC,SAAS,KAAK,QAAQ,IAC7BA,SAAS,KAAK,IAAI,IAClB,YAAY,IAAIA,SAAS,IACzB,cAAc,IAAIA,SAAS;AAC3B;AACAA,IAAAA,SAAS,KAAKE,SAAS,CAAA;AAAC,IAAA;AAE9B,CAAA;AAgBO,SAASC,kBAAkBA,CAACC,IAAY,EAAU;AACvD,EAAA,IAAAC,cAAA,CAAAC,YAAA,GAAAC,YAAA,CAAAC,0BAAA,CAAgC,EAAA;AAC9B,IAAA,MAAMC,MAAM,GAAGC,SAAS,CAACN,IAAI,CAAC,CAAA;AAE9BO,IAAAA,SAAS,CACN,CAAA,mBAAA,EAAqBP,IAAK,CAAA,0DAAA,EAA4DK,MAAO,CAAA,cAAA,EAAgBL,IAAK,CAAA,EAAA,CAAG,EACtHK,MAAM,KAAKL,IAAI,EACf;AACEQ,MAAAA,EAAE,EAAE,uCAAuC;AAC3CC,MAAAA,KAAK,EAAE,KAAK;AACZC,MAAAA,GAAG,EAAE,YAAY;AACjBC,MAAAA,KAAK,EAAE;AACLC,QAAAA,SAAS,EAAE,KAAK;AAChBC,QAAAA,OAAO,EAAE,KAAA;AACX,OAAA;AACF,KACF,CAAC,CAAA;AAED,IAAA,OAAOR,MAAM,CAAA;AACf,GAAA;AAEA,EAAA,OAAOL,IAAI,CAAA;AACb;;;;"}
|
package/addon-main.js
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
const requireModule = require('@ember-data/private-build-infra/src/utilities/require-module');
|
|
2
|
-
const getEnv = require('@ember-data/private-build-infra/src/utilities/get-env');
|
|
3
|
-
const detectModule = require('@ember-data/private-build-infra/src/utilities/detect-module');
|
|
4
|
-
|
|
5
|
-
const pkg = require('./package.json');
|
|
6
|
-
|
|
7
|
-
module.exports = {
|
|
8
|
-
name: pkg.name,
|
|
9
|
-
|
|
10
|
-
options: {
|
|
11
|
-
'@embroider/macros': {
|
|
12
|
-
setOwnConfig: {},
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
_emberDataConfig: null,
|
|
17
|
-
configureEmberData() {
|
|
18
|
-
if (this._emberDataConfig) {
|
|
19
|
-
return this._emberDataConfig;
|
|
20
|
-
}
|
|
21
|
-
const app = this._findHost();
|
|
22
|
-
const isProd = /production/.test(process.env.EMBER_ENV);
|
|
23
|
-
const hostOptions = app.options?.emberData || {};
|
|
24
|
-
const debugOptions = Object.assign(
|
|
25
|
-
{
|
|
26
|
-
LOG_PAYLOADS: false,
|
|
27
|
-
LOG_OPERATIONS: false,
|
|
28
|
-
LOG_MUTATIONS: false,
|
|
29
|
-
LOG_NOTIFICATIONS: false,
|
|
30
|
-
LOG_REQUESTS: false,
|
|
31
|
-
LOG_REQUEST_STATUS: false,
|
|
32
|
-
LOG_IDENTIFIERS: false,
|
|
33
|
-
LOG_GRAPH: false,
|
|
34
|
-
LOG_INSTANCE_CACHE: false,
|
|
35
|
-
},
|
|
36
|
-
hostOptions.debug || {}
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
const HAS_DEBUG_PACKAGE = detectModule(require, '@ember-data/debug', __dirname, pkg);
|
|
40
|
-
const HAS_META_PACKAGE = detectModule(require, 'ember-data', __dirname, pkg);
|
|
41
|
-
|
|
42
|
-
const includeDataAdapterInProduction =
|
|
43
|
-
typeof hostOptions.includeDataAdapterInProduction === 'boolean'
|
|
44
|
-
? hostOptions.includeDataAdapterInProduction
|
|
45
|
-
: HAS_META_PACKAGE;
|
|
46
|
-
|
|
47
|
-
const includeDataAdapter = HAS_DEBUG_PACKAGE ? (isProd ? includeDataAdapterInProduction : true) : false;
|
|
48
|
-
const DEPRECATIONS = require('@ember-data/private-build-infra/src/deprecations')(hostOptions.compatWith || null);
|
|
49
|
-
const FEATURES = require('@ember-data/private-build-infra/src/features')(isProd);
|
|
50
|
-
|
|
51
|
-
const ALL_PACKAGES = requireModule('@ember-data/private-build-infra/virtual-packages/packages.js');
|
|
52
|
-
const MACRO_PACKAGE_FLAGS = Object.assign({}, ALL_PACKAGES.default);
|
|
53
|
-
delete MACRO_PACKAGE_FLAGS['HAS_DEBUG_PACKAGE'];
|
|
54
|
-
|
|
55
|
-
Object.keys(MACRO_PACKAGE_FLAGS).forEach((key) => {
|
|
56
|
-
MACRO_PACKAGE_FLAGS[key] = detectModule(require, MACRO_PACKAGE_FLAGS[key], __dirname, pkg);
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
// copy configs forward
|
|
60
|
-
const ownConfig = this.options['@embroider/macros'].setOwnConfig;
|
|
61
|
-
ownConfig.polyfillUUID = hostOptions.polyfillUUID ?? false;
|
|
62
|
-
ownConfig.compatWith = hostOptions.compatWith || null;
|
|
63
|
-
ownConfig.debug = debugOptions;
|
|
64
|
-
ownConfig.deprecations = Object.assign(DEPRECATIONS, ownConfig.deprecations || {}, hostOptions.deprecations || {});
|
|
65
|
-
ownConfig.features = Object.assign({}, FEATURES);
|
|
66
|
-
ownConfig.includeDataAdapter = includeDataAdapter;
|
|
67
|
-
ownConfig.packages = MACRO_PACKAGE_FLAGS;
|
|
68
|
-
ownConfig.env = getEnv(ownConfig);
|
|
69
|
-
|
|
70
|
-
this._emberDataConfig = ownConfig;
|
|
71
|
-
return ownConfig;
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
included() {
|
|
75
|
-
this.configureEmberData();
|
|
76
|
-
return this._super.included.call(this, ...arguments);
|
|
77
|
-
},
|
|
78
|
-
|
|
79
|
-
treeForVendor() {
|
|
80
|
-
return;
|
|
81
|
-
},
|
|
82
|
-
treeForPublic() {
|
|
83
|
-
return;
|
|
84
|
-
},
|
|
85
|
-
treeForStyles() {
|
|
86
|
-
return;
|
|
87
|
-
},
|
|
88
|
-
treeForAddonStyles() {
|
|
89
|
-
return;
|
|
90
|
-
},
|
|
91
|
-
treeForApp() {
|
|
92
|
-
return;
|
|
93
|
-
},
|
|
94
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
declare module '@ember-data/model/-private/promise-proxy-base' {
|
|
2
|
-
import ObjectProxy from '@ember/object/proxy';
|
|
3
|
-
|
|
4
|
-
export interface PromiseObject<T> extends Promise<T> {}
|
|
5
|
-
export class PromiseObject<T> extends ObjectProxy<T> {
|
|
6
|
-
content?: T | null;
|
|
7
|
-
|
|
8
|
-
/*
|
|
9
|
-
* If the proxied promise is rejected this will contain the reason
|
|
10
|
-
* provided.
|
|
11
|
-
*/
|
|
12
|
-
reason: string | Error;
|
|
13
|
-
/*
|
|
14
|
-
* Once the proxied promise has settled this will become `false`.
|
|
15
|
-
*/
|
|
16
|
-
isPending: boolean;
|
|
17
|
-
/*
|
|
18
|
-
* Once the proxied promise has settled this will become `true`.
|
|
19
|
-
*/
|
|
20
|
-
isSettled: boolean;
|
|
21
|
-
/*
|
|
22
|
-
* Will become `true` if the proxied promise is rejected.
|
|
23
|
-
*/
|
|
24
|
-
isRejected: boolean;
|
|
25
|
-
/*
|
|
26
|
-
* Will become `true` if the proxied promise is fulfilled.
|
|
27
|
-
*/
|
|
28
|
-
isFulfilled: boolean;
|
|
29
|
-
/*
|
|
30
|
-
* The promise whose fulfillment value is being proxied by this object.
|
|
31
|
-
*/
|
|
32
|
-
promise: Promise<T>;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
}
|
|
File without changes
|