@warp-drive/core-types 4.13.0-alpha.5 → 4.13.0-alpha.6

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/dist/-private.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { macroCondition, getGlobalConfig } from '@embroider/macros';
2
2
  const name = "@warp-drive/core-types";
3
- const version = "4.13.0-alpha.5";
3
+ const version = "4.13.0-alpha.6";
4
4
 
5
5
  // in testing mode, we utilize globals to ensure only one copy exists of
6
6
  // these maps, due to bugs in ember-auto-import
@@ -1 +1 @@
1
- {"version":3,"file":"-private.js","sources":["../src/-private.ts"],"sourcesContent":["// in testing mode, we utilize globals to ensure only one copy exists of\n// these maps, due to bugs in ember-auto-import\nimport { DEBUG, TESTING } from '@warp-drive/build-config/env';\n\nimport { name, version } from '../package.json';\n\ntype UniversalTransientKey =\n // @ember-data/request\n 'REQ_ID';\n\ntype UniversalKey =\n | `(transient) ${UniversalTransientKey}`\n // @ember-data/request\n | 'RequestMap'\n | 'PromiseCache'\n | 'RequestCache'\n // @warp-drive/core-types/request\n | 'SkipCache'\n | 'EnableHydration';\n\ntype TransientKey =\n // @ember-data/tracking\n | 'TRANSACTION'\n // @ember-data/graph\n | 'transactionRef'\n // @ember-data/store\n | 'configuredGenerationMethod'\n | 'configuredUpdateMethod'\n | 'configuredForgetMethod'\n | 'configuredResetMethod'\n | 'configuredKeyInfoMethod';\n\ntype GlobalKey =\n | `(transient) ${TransientKey}`\n // @ember-data/adapter\n | 'AdapterError'\n | 'InvalidError'\n | 'TimeoutError'\n | 'AbortError'\n | 'UnauthorizedError'\n | 'ForbiddenError'\n | 'NotFoundError'\n | 'ConflictError'\n | 'ServerError'\n // @ember-data/tracking\n | 'Signals'\n // @ember-data/store LegacySupport\n | 'AvailableShims'\n // @ember-data/store RecordArrayManager\n | 'FAKE_ARR'\n // @ember-data/store IdentifierArray\n | '#signal'\n | '#source'\n | '#update'\n | '#notify'\n | 'IS_COLLECTION'\n // @ember-data/store RequestCache\n | 'Touching'\n | 'RequestPromise'\n // @ember-data/legacy-compat FetchManager\n | 'SaveOp'\n // @ember-data/model\n | 'LEGACY_SUPPORT'\n | 'LegacySupport'\n // @ember-data/graph\n | 'Graphs'\n // @ember-data/request\n | 'IS_FROZEN'\n | 'IS_CACHE_HANDLER'\n // @ember-data/request-utils\n | 'CONFIG'\n // @ember-data/store IdentityCache\n | 'DEBUG_MAP'\n | 'IDENTIFIERS'\n | 'DOCUMENTS'\n // @ember-data/store InstanceCache\n | 'CacheForIdentifierCache'\n | 'RecordCache'\n | 'StoreMap'\n // @warp-drive/core-types/symbols\n | 'Store'\n | '$type'\n | 'TransformName'\n | 'RequestSignature'\n // @warp-drive/core-types/request\n | 'IS_FUTURE'\n | 'DOC'\n // @warp-drive/schema-record\n | 'ManagedArrayMap'\n | 'ManagedObjectMap'\n | 'Support'\n | 'SOURCE'\n | 'MUTATE'\n | 'ARRAY_SIGNAL'\n | 'OBJECT_SIGNAL'\n | 'NOTIFY'\n | 'Destroy'\n | 'Identifier'\n | 'Editable'\n | 'EmbeddedPath'\n | 'EmbeddedType'\n | 'Parent'\n | 'Checkout'\n | 'Legacy';\n\ntype ModuleScopedCaches = Record<GlobalKey, unknown>;\n\nconst GlobalRef = globalThis as unknown as Record<\n string,\n {\n __warpDrive_ModuleScopedCaches?: ModuleScopedCaches;\n __warpDrive_hasOtherCopy?: boolean;\n __version: string;\n }\n> & {\n __warpDrive_universalCache: Record<UniversalKey, unknown>;\n};\nconst UniversalCache = (GlobalRef.__warpDrive_universalCache =\n GlobalRef.__warpDrive_universalCache ?? ({} as Record<UniversalKey, unknown>));\n\n// in order to support mirror packages, we ensure that each\n// unique package name has its own global cache\nGlobalRef[name] = GlobalRef[name] ?? { __version: version };\nconst GlobalSink = GlobalRef[name];\n\nif (DEBUG) {\n if (GlobalSink.__version !== version) {\n throw new Error('Multiple versions of WarpDrive detected, the application will malfunction.');\n }\n}\n\nconst ModuleScopedCaches = GlobalSink.__warpDrive_ModuleScopedCaches ?? ({} as ModuleScopedCaches);\nif (TESTING) {\n if (!GlobalSink.__warpDrive_ModuleScopedCaches) {\n GlobalSink.__warpDrive_ModuleScopedCaches = ModuleScopedCaches;\n } else {\n // eslint-disable-next-line no-console\n console.warn(`\nMultiple copies of EmberData have been detected. This may be due to a bug in ember-auto-import\n in which test assets get their own copy of some v2-addons. This can cause the application to\n malfunction as each copy will maintain its own separate state.`);\n }\n} else {\n if (GlobalSink.__warpDrive_hasOtherCopy) {\n throw new Error('Multiple copies of EmberData detected, the application will malfunction.');\n }\n GlobalSink.__warpDrive_hasOtherCopy = true;\n}\n\ntype UniqueSymbol<T extends string> = `___(unique) Symbol(${T})`;\ntype UniqueSymbolOr<T, K extends string> = T extends symbol ? UniqueSymbol<K> : T;\n\nexport function getOrSetGlobal<T, K extends GlobalKey>(key: K, value: T): UniqueSymbolOr<T, K> {\n if (TESTING) {\n const existing = ModuleScopedCaches[key];\n if (existing === undefined) {\n return (ModuleScopedCaches[key] = value) as UniqueSymbolOr<T, K>;\n } else {\n return existing as UniqueSymbolOr<T, K>;\n }\n } else {\n return value as UniqueSymbolOr<T, K>;\n }\n}\n\nexport function peekTransient<T>(key: TransientKey): T | null {\n const globalKey: `(transient) ${TransientKey}` = `(transient) ${key}`;\n return (ModuleScopedCaches[globalKey] as T) ?? null;\n}\n\nexport function setTransient<T>(key: TransientKey, value: T): T {\n const globalKey: `(transient) ${TransientKey}` = `(transient) ${key}`;\n return (ModuleScopedCaches[globalKey] = value);\n}\n\nexport function getOrSetUniversal<T, K extends UniversalKey>(key: K, value: T): UniqueSymbolOr<T, K> {\n if (TESTING) {\n const existing = UniversalCache[key];\n if (existing === undefined) {\n return (UniversalCache[key] = value) as UniqueSymbolOr<T, K>;\n } else {\n return existing as UniqueSymbolOr<T, K>;\n }\n } else {\n return value as UniqueSymbolOr<T, K>;\n }\n}\n\nexport function peekUniversalTransient<T>(key: UniversalTransientKey): T | null {\n const globalKey: `(transient) ${UniversalTransientKey}` = `(transient) ${key}`;\n return (UniversalCache[globalKey] as T) ?? null;\n}\n\nexport function setUniversalTransient<T>(key: UniversalTransientKey, value: T): T {\n const globalKey: `(transient) ${UniversalTransientKey}` = `(transient) ${key}`;\n return (UniversalCache[globalKey] = value);\n}\n"],"names":["GlobalRef","globalThis","UniversalCache","__warpDrive_universalCache","name","__version","version","GlobalSink","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","Error","ModuleScopedCaches","__warpDrive_ModuleScopedCaches","TESTING","console","warn","__warpDrive_hasOtherCopy","getOrSetGlobal","key","value","existing","undefined","peekTransient","globalKey","setTransient","getOrSetUniversal","peekUniversalTransient","setUniversalTransient"],"mappings":";;;;;AAAA;AACA;;AA0GA,MAAMA,SAAS,GAAGC,UASjB;AACD,MAAMC,cAAc,GAAIF,SAAS,CAACG,0BAA0B,GAC1DH,SAAS,CAACG,0BAA0B,IAAK,EAAqC;;AAEhF;AACA;AACAH,SAAS,CAACI,IAAI,CAAC,GAAGJ,SAAS,CAACI,IAAI,CAAC,IAAI;AAAEC,EAAAA,SAAS,EAAEC;AAAQ,CAAC;AAC3D,MAAMC,UAAU,GAAGP,SAAS,CAACI,IAAI,CAAC;AAElC,IAAAI,cAAA,CAAAC,eAAA,EAAA,CAAAC,SAAA,CAAAC,GAAA,CAAAC,KAAA,CAAW,EAAA;AACT,EAAA,IAAIL,UAAU,CAACF,SAAS,KAAKC,OAAO,EAAE;AACpC,IAAA,MAAM,IAAIO,KAAK,CAAC,4EAA4E,CAAC;AAC/F;AACF;AAEA,MAAMC,kBAAkB,GAAGP,UAAU,CAACQ,8BAA8B,IAAK,EAAyB;AAClG,IAAAP,cAAA,CAAAC,eAAA,EAAA,CAAAC,SAAA,CAAAC,GAAA,CAAAK,OAAA,CAAa,EAAA;AACX,EAAA,IAAI,CAACT,UAAU,CAACQ,8BAA8B,EAAE;IAC9CR,UAAU,CAACQ,8BAA8B,GAAGD,kBAAkB;AAChE,GAAC,MAAM;AACL;IACAG,OAAO,CAACC,IAAI,CAAC;AACjB;AACA;AACA,gEAAA,CAAiE,CAAC;AAChE;AACF,CAAC,MAAM;EACL,IAAIX,UAAU,CAACY,wBAAwB,EAAE;AACvC,IAAA,MAAM,IAAIN,KAAK,CAAC,0EAA0E,CAAC;AAC7F;EACAN,UAAU,CAACY,wBAAwB,GAAG,IAAI;AAC5C;AAKO,SAASC,cAAcA,CAAyBC,GAAM,EAAEC,KAAQ,EAAwB;EAC7F,IAAAd,cAAA,CAAAC,eAAA,EAAA,CAAAC,SAAA,CAAAC,GAAA,CAAAK,OAAA,CAAa,EAAA;AACX,IAAA,MAAMO,QAAQ,GAAGT,kBAAkB,CAACO,GAAG,CAAC;IACxC,IAAIE,QAAQ,KAAKC,SAAS,EAAE;AAC1B,MAAA,OAAQV,kBAAkB,CAACO,GAAG,CAAC,GAAGC,KAAK;AACzC,KAAC,MAAM;AACL,MAAA,OAAOC,QAAQ;AACjB;AACF,GAAC,MAAM;AACL,IAAA,OAAOD,KAAK;AACd;AACF;AAEO,SAASG,aAAaA,CAAIJ,GAAiB,EAAY;AAC5D,EAAA,MAAMK,SAAwC,GAAG,CAAeL,YAAAA,EAAAA,GAAG,CAAE,CAAA;AACrE,EAAA,OAAQP,kBAAkB,CAACY,SAAS,CAAC,IAAU,IAAI;AACrD;AAEO,SAASC,YAAYA,CAAIN,GAAiB,EAAEC,KAAQ,EAAK;AAC9D,EAAA,MAAMI,SAAwC,GAAG,CAAeL,YAAAA,EAAAA,GAAG,CAAE,CAAA;AACrE,EAAA,OAAQP,kBAAkB,CAACY,SAAS,CAAC,GAAGJ,KAAK;AAC/C;AAEO,SAASM,iBAAiBA,CAA4BP,GAAM,EAAEC,KAAQ,EAAwB;EACnG,IAAAd,cAAA,CAAAC,eAAA,EAAA,CAAAC,SAAA,CAAAC,GAAA,CAAAK,OAAA,CAAa,EAAA;AACX,IAAA,MAAMO,QAAQ,GAAGrB,cAAc,CAACmB,GAAG,CAAC;IACpC,IAAIE,QAAQ,KAAKC,SAAS,EAAE;AAC1B,MAAA,OAAQtB,cAAc,CAACmB,GAAG,CAAC,GAAGC,KAAK;AACrC,KAAC,MAAM;AACL,MAAA,OAAOC,QAAQ;AACjB;AACF,GAAC,MAAM;AACL,IAAA,OAAOD,KAAK;AACd;AACF;AAEO,SAASO,sBAAsBA,CAAIR,GAA0B,EAAY;AAC9E,EAAA,MAAMK,SAAiD,GAAG,CAAeL,YAAAA,EAAAA,GAAG,CAAE,CAAA;AAC9E,EAAA,OAAQnB,cAAc,CAACwB,SAAS,CAAC,IAAU,IAAI;AACjD;AAEO,SAASI,qBAAqBA,CAAIT,GAA0B,EAAEC,KAAQ,EAAK;AAChF,EAAA,MAAMI,SAAiD,GAAG,CAAeL,YAAAA,EAAAA,GAAG,CAAE,CAAA;AAC9E,EAAA,OAAQnB,cAAc,CAACwB,SAAS,CAAC,GAAGJ,KAAK;AAC3C;;;;"}
1
+ {"version":3,"file":"-private.js","sources":["../src/-private.ts"],"sourcesContent":["// in testing mode, we utilize globals to ensure only one copy exists of\n// these maps, due to bugs in ember-auto-import\nimport { DEBUG, TESTING } from '@warp-drive/build-config/env';\n\nimport { name, version } from '../package.json';\n\ntype UniversalTransientKey =\n // @ember-data/request\n 'REQ_ID';\n\ntype UniversalKey =\n | `(transient) ${UniversalTransientKey}`\n // @ember-data/request\n | 'RequestMap'\n | 'PromiseCache'\n | 'RequestCache'\n // @warp-drive/core-types/request\n | 'SkipCache'\n | 'EnableHydration'\n // @warp-drive/core-types/runtime\n | 'WarpDriveRuntimeConfig';\n\ntype TransientKey =\n // @ember-data/tracking\n | 'TRANSACTION'\n // @ember-data/graph\n | 'transactionRef'\n // @ember-data/store\n | 'configuredGenerationMethod'\n | 'configuredUpdateMethod'\n | 'configuredForgetMethod'\n | 'configuredResetMethod'\n | 'configuredKeyInfoMethod';\n\ntype GlobalKey =\n | `(transient) ${TransientKey}`\n // @ember-data/adapter\n | 'AdapterError'\n | 'InvalidError'\n | 'TimeoutError'\n | 'AbortError'\n | 'UnauthorizedError'\n | 'ForbiddenError'\n | 'NotFoundError'\n | 'ConflictError'\n | 'ServerError'\n // @ember-data/tracking\n | 'Signals'\n // @ember-data/store LegacySupport\n | 'AvailableShims'\n // @ember-data/store RecordArrayManager\n | 'FAKE_ARR'\n // @ember-data/store IdentifierArray\n | '#signal'\n | '#source'\n | '#update'\n | '#notify'\n | 'IS_COLLECTION'\n // @ember-data/store RequestCache\n | 'Touching'\n | 'RequestPromise'\n // @ember-data/legacy-compat FetchManager\n | 'SaveOp'\n // @ember-data/model\n | 'LEGACY_SUPPORT'\n | 'LegacySupport'\n // @ember-data/graph\n | 'Graphs'\n // @ember-data/request\n | 'IS_FROZEN'\n | 'IS_CACHE_HANDLER'\n // @ember-data/request-utils\n | 'CONFIG'\n // @ember-data/store IdentityCache\n | 'DEBUG_MAP'\n | 'IDENTIFIERS'\n | 'DOCUMENTS'\n // @ember-data/store InstanceCache\n | 'CacheForIdentifierCache'\n | 'RecordCache'\n | 'StoreMap'\n // @warp-drive/core-types/symbols\n | 'Store'\n | '$type'\n | 'TransformName'\n | 'RequestSignature'\n // @warp-drive/core-types/request\n | 'IS_FUTURE'\n | 'DOC'\n // @warp-drive/schema-record\n | 'ManagedArrayMap'\n | 'ManagedObjectMap'\n | 'Support'\n | 'SOURCE'\n | 'MUTATE'\n | 'ARRAY_SIGNAL'\n | 'OBJECT_SIGNAL'\n | 'NOTIFY'\n | 'Destroy'\n | 'Identifier'\n | 'Editable'\n | 'EmbeddedPath'\n | 'EmbeddedType'\n | 'Parent'\n | 'Checkout'\n | 'Legacy';\n\ntype ModuleScopedCaches = Record<GlobalKey, unknown>;\n\nconst GlobalRef = globalThis as unknown as Record<\n string,\n {\n __warpDrive_ModuleScopedCaches?: ModuleScopedCaches;\n __warpDrive_hasOtherCopy?: boolean;\n __version: string;\n }\n> & {\n __warpDrive_universalCache: Record<UniversalKey, unknown>;\n};\nconst UniversalCache = (GlobalRef.__warpDrive_universalCache =\n GlobalRef.__warpDrive_universalCache ?? ({} as Record<UniversalKey, unknown>));\n\n// in order to support mirror packages, we ensure that each\n// unique package name has its own global cache\nGlobalRef[name] = GlobalRef[name] ?? { __version: version };\nconst GlobalSink = GlobalRef[name];\n\nif (DEBUG) {\n if (GlobalSink.__version !== version) {\n throw new Error('Multiple versions of WarpDrive detected, the application will malfunction.');\n }\n}\n\nconst ModuleScopedCaches = GlobalSink.__warpDrive_ModuleScopedCaches ?? ({} as ModuleScopedCaches);\nif (TESTING) {\n if (!GlobalSink.__warpDrive_ModuleScopedCaches) {\n GlobalSink.__warpDrive_ModuleScopedCaches = ModuleScopedCaches;\n } else {\n // eslint-disable-next-line no-console\n console.warn(`\nMultiple copies of EmberData have been detected. This may be due to a bug in ember-auto-import\n in which test assets get their own copy of some v2-addons. This can cause the application to\n malfunction as each copy will maintain its own separate state.`);\n }\n} else {\n if (GlobalSink.__warpDrive_hasOtherCopy) {\n throw new Error('Multiple copies of EmberData detected, the application will malfunction.');\n }\n GlobalSink.__warpDrive_hasOtherCopy = true;\n}\n\ntype UniqueSymbol<T extends string> = `___(unique) Symbol(${T})`;\ntype UniqueSymbolOr<T, K extends string> = T extends symbol ? UniqueSymbol<K> : T;\n\nexport function getOrSetGlobal<T, K extends GlobalKey>(key: K, value: T): UniqueSymbolOr<T, K> {\n if (TESTING) {\n const existing = ModuleScopedCaches[key];\n if (existing === undefined) {\n return (ModuleScopedCaches[key] = value) as UniqueSymbolOr<T, K>;\n } else {\n return existing as UniqueSymbolOr<T, K>;\n }\n } else {\n return value as UniqueSymbolOr<T, K>;\n }\n}\n\nexport function peekTransient<T>(key: TransientKey): T | null {\n const globalKey: `(transient) ${TransientKey}` = `(transient) ${key}`;\n return (ModuleScopedCaches[globalKey] as T) ?? null;\n}\n\nexport function setTransient<T>(key: TransientKey, value: T): T {\n const globalKey: `(transient) ${TransientKey}` = `(transient) ${key}`;\n return (ModuleScopedCaches[globalKey] = value);\n}\n\nexport function getOrSetUniversal<T, K extends UniversalKey>(key: K, value: T): UniqueSymbolOr<T, K> {\n if (TESTING) {\n const existing = UniversalCache[key];\n if (existing === undefined) {\n return (UniversalCache[key] = value) as UniqueSymbolOr<T, K>;\n } else {\n return existing as UniqueSymbolOr<T, K>;\n }\n } else {\n return value as UniqueSymbolOr<T, K>;\n }\n}\n\nexport function peekUniversalTransient<T>(key: UniversalTransientKey): T | null {\n const globalKey: `(transient) ${UniversalTransientKey}` = `(transient) ${key}`;\n return (UniversalCache[globalKey] as T) ?? null;\n}\n\nexport function setUniversalTransient<T>(key: UniversalTransientKey, value: T): T {\n const globalKey: `(transient) ${UniversalTransientKey}` = `(transient) ${key}`;\n return (UniversalCache[globalKey] = value);\n}\n"],"names":["GlobalRef","globalThis","UniversalCache","__warpDrive_universalCache","name","__version","version","GlobalSink","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","Error","ModuleScopedCaches","__warpDrive_ModuleScopedCaches","TESTING","console","warn","__warpDrive_hasOtherCopy","getOrSetGlobal","key","value","existing","undefined","peekTransient","globalKey","setTransient","getOrSetUniversal","peekUniversalTransient","setUniversalTransient"],"mappings":"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"}
@@ -7,12 +7,12 @@ import { macroCondition, getGlobalConfig } from '@embroider/macros';
7
7
  const DEBUG_CLIENT_ORIGINATED = Symbol('record-originated-on-client');
8
8
  const DEBUG_IDENTIFIER_BUCKET = Symbol('identifier-bucket');
9
9
  const DEBUG_STALE_CACHE_OWNER = Symbol('warpDriveStaleCache');
10
- function ProdSymbol(str) {
11
- return macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? Symbol(str) : str;
10
+ function ProdSymbol(str, debugStr) {
11
+ return macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? Symbol(debugStr) : str;
12
12
  }
13
13
 
14
14
  // also present in production
15
- const CACHE_OWNER = ProdSymbol('__$co');
15
+ const CACHE_OWNER = ProdSymbol('__$co', 'CACHE_OWNER');
16
16
 
17
17
  /**
18
18
  * An Identifier specific to a record which may or may not
@@ -1 +1 @@
1
- {"version":3,"file":"identifier.js","sources":["../src/identifier.ts"],"sourcesContent":["/**\n @module @ember-data/store\n*/\n\nimport { DEBUG } from '@warp-drive/build-config/env';\n\n// provided for additional debuggability\nexport const DEBUG_CLIENT_ORIGINATED: unique symbol = Symbol('record-originated-on-client');\nexport const DEBUG_IDENTIFIER_BUCKET: unique symbol = Symbol('identifier-bucket');\nexport const DEBUG_STALE_CACHE_OWNER: unique symbol = Symbol('warpDriveStaleCache');\n\nfunction ProdSymbol<T extends string>(str: T): T {\n return DEBUG ? (Symbol(str) as unknown as T) : str;\n}\n\n// also present in production\nexport const CACHE_OWNER: '__$co' = ProdSymbol('__$co');\n\nexport type IdentifierBucket = 'record' | 'document';\n\nexport interface Identifier {\n lid: string;\n clientId?: string;\n}\n\nexport interface ExistingRecordIdentifier<T extends string = string> extends Identifier {\n id: string;\n type: T;\n}\n\nexport interface NewRecordIdentifier<T extends string = string> extends Identifier {\n id: string | null;\n type: T;\n}\n\nexport type StableDocumentIdentifier = {\n lid: string;\n};\n\n/**\n * An Identifier specific to a record which may or may not\n * be present in the cache.\n *\n * The absence of an `id` DOES NOT indicate that this\n * Identifier is for a new client-created record as it\n * may also indicate that it was generated for a secondary\n * index and the primary `id` index is not yet known.\n *\n * @internal\n */\nexport type RecordIdentifier<T extends string = string> = ExistingRecordIdentifier<T> | NewRecordIdentifier<T>;\n\n/**\n * Used when an Identifier is known to be the stable version\n *\n * @internal\n */\nexport interface StableIdentifier extends Identifier {\n [DEBUG_IDENTIFIER_BUCKET]?: string;\n}\n\n/**\n * Used when a StableRecordIdentifier was not created locally as part\n * of a call to store.createRecord\n *\n * Distinguishing between this Identifier and one for a client created\n * record that was created with an ID is generally speaking not possible\n * at runtime, so anything with an ID typically narrows to this.\n *\n * @internal\n */\nexport interface StableExistingRecordIdentifier<T extends string = string> extends StableIdentifier {\n id: string;\n type: T;\n [DEBUG_CLIENT_ORIGINATED]?: boolean;\n [CACHE_OWNER]: number | undefined;\n [DEBUG_STALE_CACHE_OWNER]?: number | undefined;\n}\n\n/**\n * Used when a StableRecordIdentifier was created locally\n * (by a call to store.createRecord).\n *\n * It is possible in rare circumstances to have a StableRecordIdentifier\n * that is not for a new record but does not have an ID. This would\n * happen if a user intentionally created one for use with a secondary-index\n * prior to the record having been fully loaded.\n *\n * @internal\n */\nexport interface StableNewRecordIdentifier<T extends string = string> extends StableIdentifier {\n id: string | null;\n type: T;\n [DEBUG_CLIENT_ORIGINATED]?: boolean;\n [CACHE_OWNER]: number | undefined;\n [DEBUG_STALE_CACHE_OWNER]?: number | undefined;\n}\n\n/**\n * A referentially stable object with a unique string (lid) that can be used\n * as a reference to data in the cache.\n *\n * Every record instance has a unique identifier, and identifiers may refer\n * to data that has never been loaded (for instance, in an async relationship).\n *\n * @class StableRecordIdentifier\n * @public\n */\n\n/**\n * A string representing a unique identity.\n *\n * @property {string} lid\n * @public\n */\n/**\n * the primary resource `type` or `modelName` this identity belongs to.\n *\n * @property {string} type\n * @public\n */\n/**\n * the primary id for the record this identity belongs to. `null`\n * if not yet assigned an id.\n *\n * @property {string | null} id\n * @public\n */\nexport type StableRecordIdentifier<T extends string = string> =\n | StableExistingRecordIdentifier<T>\n | StableNewRecordIdentifier<T>;\n"],"names":["DEBUG_CLIENT_ORIGINATED","Symbol","DEBUG_IDENTIFIER_BUCKET","DEBUG_STALE_CACHE_OWNER","ProdSymbol","str","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","CACHE_OWNER"],"mappings":";;AAAA;AACA;AACA;AAIA;MACaA,uBAAsC,GAAGC,MAAM,CAAC,6BAA6B;MAC7EC,uBAAsC,GAAGD,MAAM,CAAC,mBAAmB;MACnEE,uBAAsC,GAAGF,MAAM,CAAC,qBAAqB;AAElF,SAASG,UAAUA,CAAmBC,GAAM,EAAK;AAC/C,EAAA,OAAOC,cAAA,CAAAC,eAAA,EAAA,CAAAC,SAAA,CAAAC,GAAA,CAAAC,KAAA,IAAST,MAAM,CAACI,GAAG,CAAC,GAAoBA,GAAG;AACpD;;AAEA;MACaM,WAAoB,GAAGP,UAAU,CAAC,OAAO;;AAuBtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;"}
1
+ {"version":3,"file":"identifier.js","sources":["../src/identifier.ts"],"sourcesContent":["/**\n @module @ember-data/store\n*/\n\nimport { DEBUG } from '@warp-drive/build-config/env';\n\n// provided for additional debuggability\nexport const DEBUG_CLIENT_ORIGINATED: unique symbol = Symbol('record-originated-on-client');\nexport const DEBUG_IDENTIFIER_BUCKET: unique symbol = Symbol('identifier-bucket');\nexport const DEBUG_STALE_CACHE_OWNER: unique symbol = Symbol('warpDriveStaleCache');\n\nfunction ProdSymbol<T extends string>(str: T, debugStr: string): T {\n return DEBUG ? (Symbol(debugStr) as unknown as T) : str;\n}\n\n// also present in production\nexport const CACHE_OWNER: '__$co' = ProdSymbol('__$co', 'CACHE_OWNER');\n\nexport type IdentifierBucket = 'record' | 'document';\n\nexport interface Identifier {\n lid: string;\n clientId?: string;\n}\n\nexport interface ExistingRecordIdentifier<T extends string = string> extends Identifier {\n id: string;\n type: T;\n}\n\nexport interface NewRecordIdentifier<T extends string = string> extends Identifier {\n id: string | null;\n type: T;\n}\n\nexport type StableDocumentIdentifier = {\n lid: string;\n};\n\n/**\n * An Identifier specific to a record which may or may not\n * be present in the cache.\n *\n * The absence of an `id` DOES NOT indicate that this\n * Identifier is for a new client-created record as it\n * may also indicate that it was generated for a secondary\n * index and the primary `id` index is not yet known.\n *\n * @internal\n */\nexport type RecordIdentifier<T extends string = string> = ExistingRecordIdentifier<T> | NewRecordIdentifier<T>;\n\n/**\n * Used when an Identifier is known to be the stable version\n *\n * @internal\n */\nexport interface StableIdentifier extends Identifier {\n [DEBUG_IDENTIFIER_BUCKET]?: string;\n}\n\n/**\n * Used when a StableRecordIdentifier was not created locally as part\n * of a call to store.createRecord\n *\n * Distinguishing between this Identifier and one for a client created\n * record that was created with an ID is generally speaking not possible\n * at runtime, so anything with an ID typically narrows to this.\n *\n * @internal\n */\nexport interface StableExistingRecordIdentifier<T extends string = string> extends StableIdentifier {\n id: string;\n type: T;\n [DEBUG_CLIENT_ORIGINATED]?: boolean;\n [CACHE_OWNER]: number | undefined;\n [DEBUG_STALE_CACHE_OWNER]?: number | undefined;\n}\n\n/**\n * Used when a StableRecordIdentifier was created locally\n * (by a call to store.createRecord).\n *\n * It is possible in rare circumstances to have a StableRecordIdentifier\n * that is not for a new record but does not have an ID. This would\n * happen if a user intentionally created one for use with a secondary-index\n * prior to the record having been fully loaded.\n *\n * @internal\n */\nexport interface StableNewRecordIdentifier<T extends string = string> extends StableIdentifier {\n id: string | null;\n type: T;\n [DEBUG_CLIENT_ORIGINATED]?: boolean;\n [CACHE_OWNER]: number | undefined;\n [DEBUG_STALE_CACHE_OWNER]?: number | undefined;\n}\n\n/**\n * A referentially stable object with a unique string (lid) that can be used\n * as a reference to data in the cache.\n *\n * Every record instance has a unique identifier, and identifiers may refer\n * to data that has never been loaded (for instance, in an async relationship).\n *\n * @class StableRecordIdentifier\n * @public\n */\n\n/**\n * A string representing a unique identity.\n *\n * @property {string} lid\n * @public\n */\n/**\n * the primary resource `type` or `modelName` this identity belongs to.\n *\n * @property {string} type\n * @public\n */\n/**\n * the primary id for the record this identity belongs to. `null`\n * if not yet assigned an id.\n *\n * @property {string | null} id\n * @public\n */\nexport type StableRecordIdentifier<T extends string = string> =\n | StableExistingRecordIdentifier<T>\n | StableNewRecordIdentifier<T>;\n"],"names":["DEBUG_CLIENT_ORIGINATED","Symbol","DEBUG_IDENTIFIER_BUCKET","DEBUG_STALE_CACHE_OWNER","ProdSymbol","str","debugStr","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","CACHE_OWNER"],"mappings":";;AAAA;AACA;AACA;AAIA;MACaA,uBAAsC,GAAGC,MAAM,CAAC,6BAA6B;MAC7EC,uBAAsC,GAAGD,MAAM,CAAC,mBAAmB;MACnEE,uBAAsC,GAAGF,MAAM,CAAC,qBAAqB;AAElF,SAASG,UAAUA,CAAmBC,GAAM,EAAEC,QAAgB,EAAK;AACjE,EAAA,OAAOC,cAAA,CAAAC,eAAA,EAAA,CAAAC,SAAA,CAAAC,GAAA,CAAAC,KAAA,IAASV,MAAM,CAACK,QAAQ,CAAC,GAAoBD,GAAG;AACzD;;AAEA;AACO,MAAMO,WAAoB,GAAGR,UAAU,CAAC,OAAO,EAAE,aAAa;;AAuBrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;"}
@@ -0,0 +1,25 @@
1
+ import { getOrSetUniversal } from "./-private.js";
2
+ const RuntimeConfig = getOrSetUniversal('WarpDriveRuntimeConfig', {
3
+ debug: {}
4
+ });
5
+ const settings = globalThis.sessionStorage?.getItem('WarpDriveRuntimeConfig');
6
+ if (settings) {
7
+ Object.assign(RuntimeConfig, JSON.parse(settings));
8
+ }
9
+ function getRuntimeConfig() {
10
+ return RuntimeConfig;
11
+ }
12
+
13
+ /**
14
+ * Upserts the specified logging configuration into the runtime
15
+ * config.
16
+ *
17
+ * globalThis.setWarpDriveLogging({ LOG_PAYLOADS: true } });
18
+ *
19
+ * @typedoc
20
+ */
21
+ function setLogging(config) {
22
+ Object.assign(RuntimeConfig.debug, config);
23
+ globalThis.sessionStorage?.setItem('WarpDriveRuntimeConfig', JSON.stringify(RuntimeConfig));
24
+ }
25
+ export { getRuntimeConfig, setLogging };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.js","sources":["../src/runtime.ts"],"sourcesContent":["import type { LOG_CONFIG } from '@warp-drive/build-config/-private/utils/logging';\n\nimport { getOrSetUniversal } from './-private';\n\nconst RuntimeConfig: { debug: Partial<LOG_CONFIG> } = getOrSetUniversal('WarpDriveRuntimeConfig', {\n debug: {},\n});\n\nconst settings = globalThis.sessionStorage?.getItem('WarpDriveRuntimeConfig');\nif (settings) {\n Object.assign(RuntimeConfig, JSON.parse(settings));\n}\n\nexport function getRuntimeConfig(): typeof RuntimeConfig {\n return RuntimeConfig;\n}\n\n/**\n * Upserts the specified logging configuration into the runtime\n * config.\n *\n * globalThis.setWarpDriveLogging({ LOG_PAYLOADS: true } });\n *\n * @typedoc\n */\nexport function setLogging(config: Partial<LOG_CONFIG>): void {\n Object.assign(RuntimeConfig.debug, config);\n globalThis.sessionStorage?.setItem('WarpDriveRuntimeConfig', JSON.stringify(RuntimeConfig));\n}\n"],"names":["RuntimeConfig","getOrSetUniversal","debug","settings","globalThis","sessionStorage","getItem","Object","assign","JSON","parse","getRuntimeConfig","setLogging","config","setItem","stringify"],"mappings":";;AAIA,MAAMA,aAA6C,GAAGC,iBAAiB,CAAC,wBAAwB,EAAE;AAChGC,EAAAA,KAAK,EAAE;AACT,CAAC,CAAC;AAEF,MAAMC,QAAQ,GAAGC,UAAU,CAACC,cAAc,EAAEC,OAAO,CAAC,wBAAwB,CAAC;AAC7E,IAAIH,QAAQ,EAAE;EACZI,MAAM,CAACC,MAAM,CAACR,aAAa,EAAES,IAAI,CAACC,KAAK,CAACP,QAAQ,CAAC,CAAC;AACpD;AAEO,SAASQ,gBAAgBA,GAAyB;AACvD,EAAA,OAAOX,aAAa;AACtB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASY,UAAUA,CAACC,MAA2B,EAAQ;EAC5DN,MAAM,CAACC,MAAM,CAACR,aAAa,CAACE,KAAK,EAAEW,MAAM,CAAC;AAC1CT,EAAAA,UAAU,CAACC,cAAc,EAAES,OAAO,CAAC,wBAAwB,EAAEL,IAAI,CAACM,SAAS,CAACf,aAAa,CAAC,CAAC;AAC7F;;;;"}
@@ -0,0 +1,463 @@
1
+ /**
2
+ * @module @warp-drive/core-types
3
+ */
4
+
5
+ /**
6
+ * A generic "field" that can be used to define
7
+ * primitive value fields.
8
+ *
9
+ * Replaces "attribute" for primitive value fields.
10
+ * Can also be used to eject from deep-tracking of
11
+ * objects or arrays.
12
+ *
13
+ * A major difference between "field" and "attribute"
14
+ * is that "type" points to a legacy transform on
15
+ * "attribute" that a serializer *might* use, while
16
+ * "type" points to a new-style transform on "field"
17
+ * that a record implmentation *must* use.
18
+ *
19
+ * @typedoc
20
+ */
21
+
22
+ /**
23
+ * A field that can be used to alias one key to another
24
+ * key present in the cache version of the resource.
25
+ *
26
+ * Unlike DerivedField, an AliasField may write to its
27
+ * source when a record is in an editable mode.
28
+ *
29
+ * AliasFields may utilize a transform, specified by type,
30
+ * to pre/post process the field.
31
+ *
32
+ * An AliasField may also specify a `kind` via options.
33
+ * `kind` may be any other valid field kind other than
34
+ *
35
+ * - `@hash`
36
+ * - `@id`
37
+ * - `@local`
38
+ * - `derived`
39
+ *
40
+ * This allows an AliasField to rename any field in the cache.
41
+ *
42
+ * Alias fields are generally intended to be used to support migrating
43
+ * between different schemas, though there are times where they are useful
44
+ * as a form of advanced derivation when used with a transform. For instance,
45
+ * an AliasField could be used to expose both a string and a Date version of the
46
+ * same field, with both being capable of being written to.
47
+ *
48
+ * @typedoc
49
+ */
50
+
51
+ /**
52
+ * A field that can be used to alias one key to another
53
+ * key present in the cache version of the resource.
54
+ *
55
+ * Unlike DerivedField, an AliasField may write to its
56
+ * source when a record is in an editable mode.
57
+ *
58
+ * AliasFields may utilize a transform, specified by type,
59
+ * to pre/post process the field.
60
+ *
61
+ * An AliasField may also specify a `kind` via options.
62
+ * `kind` may be any other valid field kind other than
63
+ *
64
+ * - `@hash`
65
+ * - `@id`
66
+ * - `@local`
67
+ * - `derived`
68
+ *
69
+ * This allows an AliasField to rename any field in the cache.
70
+ *
71
+ * Alias fields are generally intended to be used to support migrating
72
+ * between different schemas, though there are times where they are useful
73
+ * as a form of advanced derivation when used with a transform. For instance,
74
+ * an AliasField could be used to expose both a string and a Date version of the
75
+ * same field, with both being capable of being written to.
76
+ *
77
+ * @typedoc
78
+ */
79
+
80
+ /**
81
+ * A field that can be used to alias one key to another
82
+ * key present in the cache version of the resource.
83
+ *
84
+ * Unlike DerivedField, an AliasField may write to its
85
+ * source when a record is in an editable mode.
86
+ *
87
+ * AliasFields may utilize a transform, specified by type,
88
+ * to pre/post process the field.
89
+ *
90
+ * An AliasField may also specify a `kind` via options.
91
+ * `kind` may be any other valid field kind other than
92
+ *
93
+ * - `@hash`
94
+ * - `@id`
95
+ * - `@local`
96
+ * - `derived`
97
+ *
98
+ * This allows an AliasField to rename any field in the cache.
99
+ *
100
+ * Alias fields are generally intended to be used to support migrating
101
+ * between different schemas, though there are times where they are useful
102
+ * as a form of advanced derivation when used with a transform. For instance,
103
+ * an AliasField could be used to expose both a string and a Date version of the
104
+ * same field, with both being capable of being written to.
105
+ *
106
+ * @typedoc
107
+ */
108
+
109
+ /**
110
+ * Represents a field whose value is the primary
111
+ * key of the resource.
112
+ *
113
+ * This allows any field to serve as the primary
114
+ * key while still being able to drive identity
115
+ * needs within the system.
116
+ *
117
+ * This is useful for resources that use for instance
118
+ * 'uuid', 'urn' or 'entityUrn' or 'primaryKey' as their
119
+ * primary key field instead of 'id'.
120
+ *
121
+ * @typedoc
122
+ */
123
+
124
+ /**
125
+ * Represents a specialized field whose computed value
126
+ * will be used as the primary key of a schema-object
127
+ * for serializability and comparison purposes.
128
+ *
129
+ * This field functions similarly to derived fields in that
130
+ * it is non-settable, derived state but differs in that
131
+ * it is only able to compute off of cache state and is given
132
+ * no access to a record instance.
133
+ *
134
+ * This means that if a hashing function wants to compute its value
135
+ * taking into account transformations and derivations it must
136
+ * perform those itself.
137
+ *
138
+ * A schema-array can declare its "key" value to be `@hash` if
139
+ * a schema-object has such a field.
140
+ *
141
+ * Only one hash field is permittable per schema-object, and
142
+ * it should be placed in the `ResourceSchema`'s `@id` field
143
+ * in place of an `IdentityField`.
144
+ *
145
+ * @typedoc
146
+ */
147
+
148
+ /**
149
+ * Represents a field whose value is a local
150
+ * value that is not stored in the cache, nor
151
+ * is it sent to the server.
152
+ *
153
+ * Local fields can be written to, and their
154
+ * value is both memoized and reactive (though
155
+ * not deep-tracked).
156
+ *
157
+ * Because their state is not derived from the cache
158
+ * data or the server, they represent a divorced
159
+ * uncanonical source of state.
160
+ *
161
+ * For this reason Local fields should be used sparingly.
162
+ *
163
+ * Currently, while we document this feature here,
164
+ * only allow our own SchemaRecord should utilize them
165
+ * and the feature should be considered private.
166
+ *
167
+ * Example use cases that drove the creation of local
168
+ * fields are states like `isDestroying` and `isDestroyed`
169
+ * which are specific to a record instance but not
170
+ * stored in the cache. We wanted to be able to drive
171
+ * these fields from schema the same as all other fields.
172
+ *
173
+ * Don't make us regret this decision.
174
+ *
175
+ * @typedoc
176
+ */
177
+
178
+ /**
179
+ * Represents a field whose value is an object
180
+ * with keys pointing to values that are primitive
181
+ * values.
182
+ *
183
+ * If values of the keys are not primitives, or
184
+ * if the key/value pairs have well-defined shape,
185
+ * use 'schema-object' instead.
186
+ *
187
+ * @typedoc
188
+ */
189
+
190
+ /**
191
+ * Represents a field whose value is an object
192
+ * with a well-defined structure described by
193
+ * a non-resource schema.
194
+ *
195
+ * If the object's structure is not well-defined,
196
+ * use 'object' instead.
197
+ *
198
+ * @typedoc
199
+ */
200
+
201
+ /**
202
+ * Represents a field whose value is an array
203
+ * of primitive values.
204
+ *
205
+ * If the array's elements are not primitive
206
+ * values, use 'schema-array' instead.
207
+ *
208
+ * @typedoc
209
+ */
210
+
211
+ /**
212
+ * Represents a field whose value is an array
213
+ * of objects with a well-defined structure
214
+ * described by a non-resource schema.
215
+ *
216
+ * If the array's elements are not well-defined,
217
+ * use 'array' instead.
218
+ *
219
+ * @typedoc
220
+ */
221
+
222
+ /**
223
+ * Represents a field whose value is derived
224
+ * from other fields in the schema.
225
+ *
226
+ * The value is read-only, and is not stored
227
+ * in the cache, nor is it sent to the server.
228
+ *
229
+ * Usage of derived fields should be minimized
230
+ * to scenarios where the derivation is known
231
+ * to be safe. For instance, derivations that
232
+ * required fields that are not always loaded
233
+ * or that require access to related resources
234
+ * that may not be loaded should be avoided.
235
+ *
236
+ * @typedoc
237
+ */
238
+
239
+ /**
240
+ * Represents a field that is a reference to
241
+ * another resource.
242
+ *
243
+ * SUPPORT FOR THIS FEATURE IS NOT YET IMPLEMENTED
244
+ * BY SchemaRecord
245
+ *
246
+ * @typedoc
247
+ */
248
+
249
+ /**
250
+ * Represents a field that is a reference to
251
+ * a collection of other resources, potentially
252
+ * paginate.
253
+ *
254
+ * SUPPORT FOR THIS FEATURE IS NOT YET IMPLEMENTED
255
+ * BY SchemaRecord
256
+ *
257
+ * @typedoc
258
+ */
259
+
260
+ /**
261
+ * > [!CAUTION]
262
+ * > This Field is LEGACY
263
+ * > It cannot be used with PolarisMode
264
+ *
265
+ * A generic "field" that can be used to define
266
+ * primitive value fields.
267
+ *
268
+ * If the field points to an object or array,
269
+ * it will not be deep-tracked.
270
+ *
271
+ * Transforms when defined are legacy transforms
272
+ * that a serializer *might* use, but their usage
273
+ * is not guaranteed.
274
+ *
275
+ * @typedoc
276
+ */
277
+
278
+ /**
279
+ * > [!CAUTION]
280
+ * > This Field is LEGACY
281
+ *
282
+ * Represents a field that is a reference to
283
+ * another resource.
284
+ *
285
+ * This is the legacy version of the `ResourceField`.
286
+ *
287
+ * @typedoc
288
+ */
289
+
290
+ /**
291
+ * > [!CAUTION]
292
+ * > This Field is LEGACY
293
+ *
294
+ * Represents a field that is a reference to
295
+ * another resource.
296
+ *
297
+ * This is the legacy version of the `ResourceField`.
298
+ *
299
+ * @typedoc
300
+ */
301
+
302
+ /**
303
+ * > [!CAUTION]
304
+ * > This Field is LEGACY
305
+ *
306
+ * Represents a field that is a reference to
307
+ * a collection of other resources.
308
+ *
309
+ * This is the legacy version of the `CollectionField`.
310
+ *
311
+ * @typedoc
312
+ */
313
+
314
+ /**
315
+ * > [!CAUTION]
316
+ * > This Field is LEGACY
317
+ *
318
+ * Represents a field that is a reference to
319
+ * a collection of other resources.
320
+ *
321
+ * This is the legacy version of the `CollectionField`.
322
+ *
323
+ * @typedoc
324
+ */
325
+
326
+ /**
327
+ * A union of all possible LegacyMode field schemas.
328
+ *
329
+ * @typedoc
330
+ */
331
+
332
+ /**
333
+ * A union of all possible PolarisMode field schemas.
334
+ *
335
+ * @typedoc
336
+ */
337
+
338
+ /**
339
+ * A union of all possible LegacyMode and PolarisMode
340
+ * field schemas.
341
+ *
342
+ * You likely will want to use PolarisModeFieldSchema,
343
+ * LegacyModeFieldSchema, or ObjectFieldSchema instead
344
+ * as appropriate as they are more specific and will
345
+ * provide better guidance around what is valid.
346
+ *
347
+ * @typedoc
348
+ */
349
+
350
+ /**
351
+ * A union of all possible field schemas that can be
352
+ * used in an ObjectSchema.
353
+ *
354
+ * @typedoc
355
+ */
356
+
357
+ /**
358
+ * Represents a schema for a primary resource in PolarisMode.
359
+ *
360
+ * Primary resources are objects with a unique identity of their
361
+ * own which may allow them to appear in relationships, or in multiple
362
+ * response documents.
363
+ *
364
+ * @typedoc
365
+ */
366
+
367
+ /**
368
+ * Represents a schema for a primary resource in LegacyMode
369
+ *
370
+ * Primary resources are objects with a unique identity of their
371
+ * own which may allow them to appear in relationships, or in multiple
372
+ * response documents.
373
+ *
374
+ * @typedoc
375
+ */
376
+
377
+ /**
378
+ * A type which represents a valid JSON schema
379
+ * definition for either a PolarisMode or a
380
+ * LegacyMode resource.
381
+ *
382
+ * Note, this is separate from the type returned
383
+ * by the SchemaService which provides fields as a Map
384
+ * instead of as an Array.
385
+ *
386
+ * @typedoc
387
+ */
388
+
389
+ /**
390
+ * Represents a schema for an object that is not
391
+ * a primary resource (has no unique identity of its own).
392
+ *
393
+ * ObjectSchemas may not currently contain relationships.
394
+ *
395
+ * @typedoc
396
+ */
397
+
398
+ /**
399
+ * A no-op type utility that enables type-checking resource schema
400
+ * definitions.
401
+ *
402
+ * Will return the passed in schema.
403
+ *
404
+ * This will not validate relationship inverses or related types,
405
+ * as doing so would require a full schema graph to be passed in
406
+ * and no cycles in the graph to be present.
407
+ *
408
+ * @method resourceSchema
409
+ * @static
410
+ * @for @warp-drive/core-types
411
+ * @param {ResourceSchema} schema
412
+ * @returns {ResourceSchema} the passed in schema
413
+ * @public
414
+ */
415
+ function resourceSchema(schema) {
416
+ return schema;
417
+ }
418
+
419
+ /**
420
+ * A no-op type utility that enables type-checking object schema
421
+ * definitions.
422
+ *
423
+ * Will return the passed in schema.
424
+ *
425
+ * @method objectSchema
426
+ * @static
427
+ * @for @warp-drive/core-types
428
+ * @param {ObjectSchema} schema
429
+ * @returns {ObjectSchema} the passed in schema
430
+ * @public
431
+ */
432
+ function objectSchema(schema) {
433
+ return schema;
434
+ }
435
+
436
+ /**
437
+ * A type utility to narrow a schema to a ResourceSchema
438
+ *
439
+ * @method isResourceSchema
440
+ * @static
441
+ * @for @warp-drive/core-types
442
+ * @param schema
443
+ * @returns {boolean}
444
+ * @public
445
+ */
446
+ function isResourceSchema(schema) {
447
+ return schema?.identity?.kind === '@id';
448
+ }
449
+
450
+ /**
451
+ * A type utility to narrow a schema to LegacyResourceSchema
452
+ *
453
+ * @method isLegacyResourceSchema
454
+ * @static
455
+ * @for @warp-drive/core-types
456
+ * @param schema
457
+ * @returns {boolean}
458
+ * @public
459
+ */
460
+ function isLegacyResourceSchema(schema) {
461
+ return isResourceSchema(schema) && schema.legacy === true;
462
+ }
463
+ export { isLegacyResourceSchema, isResourceSchema, objectSchema, resourceSchema };