@junobuild/functions 0.0.12 → 0.0.13
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 +994 -213
- package/chunk-6G6FWQ45.js +2 -0
- package/chunk-6G6FWQ45.js.map +7 -0
- package/global.d.ts +11 -6
- package/hooks/assertions.d.ts +7149 -0
- package/hooks/hooks.d.ts +10529 -0
- package/hooks/schemas/collections.d.ts +8 -5
- package/hooks/schemas/context.d.ts +13 -21
- package/hooks/schemas/db/context.d.ts +2119 -247
- package/hooks/schemas/db/payload.d.ts +96 -52
- package/hooks/schemas/storage/context.d.ts +2010 -0
- package/hooks/schemas/storage/payload.d.ts +248 -0
- package/ic-cdk/schemas/call.d.ts +23 -16
- package/ic-cdk.js +1 -1
- package/ic-cdk.js.map +2 -2
- package/index.d.ts +5 -2
- package/index.js +1 -1
- package/index.js.map +4 -4
- package/package.json +1 -1
- package/schemas/db.d.ts +98 -15
- package/schemas/satellite.d.ts +9 -0
- package/schemas/storage.d.ts +307 -0
- package/sdk/db.sdk.d.ts +11 -1
- package/sdk/schemas/db.d.ts +66 -61
- package/sdk.js +1 -1
- package/sdk.js.map +3 -3
- package/src/global.d.ts +11 -6
- package/chunk-LVVTFR6B.js +0 -2
- package/chunk-LVVTFR6B.js.map +0 -7
- package/hooks/db/assertions.d.ts +0 -2127
- package/hooks/db/hooks.d.ts +0 -2577
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a,b as p,c}from"./chunk-CCKUQNB5.js";import*as e from"zod";var r=e.bigint(),t=e.bigint(),n=p,h=c,d=e.string(),f=e.string(),i=e.string().max(1024);import*as o from"zod";var s=a,m=o.object({owner:n,data:s,description:i.optional(),created_at:r,updated_at:r,version:t.optional()}).strict(),l=m.optional(),w=o.object({data:s,description:i.optional(),version:t.optional()}).strict(),R=o.object({version:t.optional()}).strict();export{r as a,t as b,n as c,h as d,d as e,f,i as g,s as h,m as i,l as j,w as k,R as l};
|
|
2
|
+
//# sourceMappingURL=chunk-6G6FWQ45.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["src/schemas/satellite.ts", "src/schemas/db.ts"],
|
|
4
|
+
"sourcesContent": ["import * as z from 'zod';\nimport {PrincipalSchema, RawPrincipalSchema} from './candid';\n\n/**\n * @see Timestamp\n */\nexport const TimestampSchema = z.bigint();\n\n/**\n * Represents a timestamp in nanoseconds since the Unix epoch.\n *\n * Used for tracking when events occur, such as document creation and updates.\n */\nexport type Timestamp = z.infer<typeof TimestampSchema>;\n\n/**\n * @see Version\n */\nexport const VersionSchema = z.bigint();\n\n/**\n * Represents a version number for tracking changes.\n *\n * This is typically incremented with each update to ensure consistency.\n */\nexport type Version = z.infer<typeof VersionSchema>;\n\n/**\n * @see RawUserId\n */\nexport const RawUserIdSchema = RawPrincipalSchema;\n\n/**\n * Represents a raw user identifier.\n *\n * This is a principal associated with a user.\n */\nexport type RawUserId = z.infer<typeof RawUserIdSchema>;\n\n/**\n * @see UserId\n */\nexport const UserIdSchema = PrincipalSchema;\n\n/**\n * Represents a user identifier.\n *\n * This is a principal associated with a user.\n */\nexport type UserId = z.infer<typeof UserIdSchema>;\n\n/**\n * @see Collection\n */\nexport const CollectionSchema = z.string();\n\n/**\n * A collection name where data are stored.\n */\nexport type Collection = z.infer<typeof CollectionSchema>;\n\n/**\n * @see Key\n */\nexport const KeySchema = z.string();\n\n/**\n * A unique key identifier within a collection.\n */\nexport type Key = z.infer<typeof KeySchema>;\n\n/**\n * @see Description\n */\nexport const DescriptionSchema = z.string().max(1024);\n\n/**\n * Represents a description with a maximum length of 1024 characters.\n * Used for document and asset fields which can be useful for search purpose.\n */\nexport type Description = z.infer<typeof DescriptionSchema>;\n", "import * as z from 'zod';\nimport {Uint8ArraySchema} from './candid';\nimport {\n Description,\n DescriptionSchema,\n type RawUserId,\n RawUserIdSchema,\n type Timestamp,\n TimestampSchema,\n type Version,\n VersionSchema\n} from './satellite';\n\n/**\n * @see RawData\n */\nexport const RawDataSchema = Uint8ArraySchema;\n\n/**\n * Represents raw binary data.\n *\n * This is used to store structured data in a document.\n */\nexport type RawData = z.infer<typeof Uint8ArraySchema>;\n\n/**\n * @see Doc\n */\nexport const DocSchema = z\n .object({\n owner: RawUserIdSchema,\n data: RawDataSchema,\n description: DescriptionSchema.optional(),\n created_at: TimestampSchema,\n updated_at: TimestampSchema,\n version: VersionSchema.optional()\n })\n .strict();\n\n/**\n * Represents a document stored in a collection.\n */\nexport interface Doc {\n /**\n * The user who owns this document.\n */\n owner: RawUserId;\n\n /**\n * The raw data of the document.\n */\n data: RawData;\n\n /**\n * An optional description of the document.\n */\n description?: Description;\n\n /**\n * The timestamp when the document was first created.\n */\n created_at: Timestamp;\n\n /**\n * The timestamp when the document was last updated.\n */\n updated_at: Timestamp;\n\n /**\n * The version number of the document, used for consistency checks.\n * If not provided, it's assumed to be the first version.\n */\n version?: Version;\n}\n\n/**\n * @see OptionDoc\n */\nexport const OptionDocSchema = DocSchema.optional();\n\n/**\n * A shorthand for a document that might or not be defined.\n */\nexport type OptionDoc = Doc | undefined;\n\n/**\n * @see SetDoc\n */\nexport const SetDocSchema = z\n .object({\n data: RawDataSchema,\n description: DescriptionSchema.optional(),\n version: VersionSchema.optional()\n })\n .strict();\n\n/**\n * Represents the proposed version of a document to be created or updated.\n * This can be validated before allowing the operation.\n */\nexport interface SetDoc {\n /**\n * The raw data of the document.\n */\n data: RawData;\n\n /**\n * An optional description of the document.\n */\n description?: Description;\n\n /**\n * The expected version number to ensure consistency.\n */\n version?: Version;\n}\n\n/**\n * @see DelDoc\n */\nexport const DelDocSchema = z\n .object({\n version: VersionSchema.optional()\n })\n .strict();\n\n/**\n * Represents the proposed version of a document to be deleted.\n * This can be validated before allowing the operation.\n */\nexport interface DelDoc {\n /**\n * The expected version number to ensure consistency.\n */\n version?: Version;\n}\n"],
|
|
5
|
+
"mappings": "4CAAA,UAAYA,MAAO,MAMZ,IAAMC,EAAoB,SAAO,EAY3BC,EAAkB,SAAO,EAYzBC,EAAkBC,EAYlBC,EAAeC,EAYfC,EAAqB,SAAO,EAU5BC,EAAc,SAAO,EAUrBC,EAAsB,SAAO,EAAE,IAAI,IAAI,EC1EpD,UAAYC,MAAO,MAgBZ,IAAMC,EAAgBC,EAYhBC,EACV,SAAO,CACN,MAAOC,EACP,KAAMH,EACN,YAAaI,EAAkB,SAAS,EACxC,WAAYC,EACZ,WAAYA,EACZ,QAASC,EAAc,SAAS,CAClC,CAAC,EACA,OAAO,EAyCGC,EAAkBL,EAAU,SAAS,EAUrCM,EACV,SAAO,CACN,KAAMR,EACN,YAAaI,EAAkB,SAAS,EACxC,QAASE,EAAc,SAAS,CAClC,CAAC,EACA,OAAO,EA0BGG,EACV,SAAO,CACN,QAASH,EAAc,SAAS,CAClC,CAAC,EACA,OAAO",
|
|
6
|
+
"names": ["z", "TimestampSchema", "VersionSchema", "RawUserIdSchema", "RawPrincipalSchema", "UserIdSchema", "PrincipalSchema", "CollectionSchema", "KeySchema", "DescriptionSchema", "z", "RawDataSchema", "Uint8ArraySchema", "DocSchema", "RawUserIdSchema", "DescriptionSchema", "TimestampSchema", "VersionSchema", "OptionDocSchema", "SetDocSchema", "DelDocSchema"]
|
|
7
|
+
}
|
package/global.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {RawData} from './schemas/db';
|
|
2
|
-
import type {RawPrincipal, RawUserId} from './schemas/satellite';
|
|
3
|
-
import type {SetDoc} from './sdk/schemas/db';
|
|
1
|
+
import type {DelDoc, RawData, SetDoc} from './schemas/db';
|
|
2
|
+
import type {Collection, Key, RawPrincipal, RawUserId} from './schemas/satellite';
|
|
4
3
|
|
|
5
4
|
declare global {
|
|
6
5
|
function __juno_satellite_datastore_raw_data_to_text(data: RawData): string;
|
|
@@ -8,9 +7,15 @@ declare global {
|
|
|
8
7
|
|
|
9
8
|
function __juno_satellite_datastore_set_doc_store(
|
|
10
9
|
caller: RawUserId,
|
|
11
|
-
collection:
|
|
12
|
-
key:
|
|
13
|
-
value:
|
|
10
|
+
collection: Collection,
|
|
11
|
+
key: Key,
|
|
12
|
+
value: SetDoc
|
|
13
|
+
): void;
|
|
14
|
+
function __juno_satellite_datastore_delete_doc_store(
|
|
15
|
+
caller: RawUserId,
|
|
16
|
+
collection: Collection,
|
|
17
|
+
key: Key,
|
|
18
|
+
value: DelDoc
|
|
14
19
|
): void;
|
|
15
20
|
|
|
16
21
|
function __ic_cdk_id(): RawPrincipal;
|